123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- if(!dojo._hasResource["dojox.widget.Wizard"]){
- dojo._hasResource["dojox.widget.Wizard"] = true;
- dojo.provide("dojox.widget.Wizard");
- dojo.require("dijit.layout.StackContainer");
- dojo.require("dijit.layout.ContentPane");
- dojo.require("dijit.form.Button");
- dojo.require("dojo.i18n");
- dojo.requireLocalization("dijit", "common", null, "ROOT,ar,az,bg,ca,cs,da,de,el,es,fi,fr,he,hr,hu,it,ja,kk,ko,nb,nl,pl,pt,pt-pt,ro,ru,sk,sl,sv,th,tr,zh,zh-tw");
- dojo.requireLocalization("dojox.widget", "Wizard", null, "ROOT,ar,az,bg,ca,cs,da,de,el,es,fi,fr,he,hr,hu,it,ja,kk,ko,nb,nl,pl,pt,pt-pt,ro,ru,sk,sl,sv,th,tr,zh,zh-tw");
- dojo.declare("dojox.widget.Wizard", [dijit.layout.StackContainer, dijit._Templated], {
-
-
-
-
-
- widgetsInTemplate: true,
- templateString: dojo.cache("dojox.widget", "Wizard/Wizard.html", "<div class=\"dojoxWizard\" dojoAttachPoint=\"wizardNode\">\n <div class=\"dojoxWizardContainer\" dojoAttachPoint=\"containerNode\"></div>\n <div class=\"dojoxWizardButtons\" dojoAttachPoint=\"wizardNav\">\n <button dojoType=\"dijit.form.Button\" type=\"button\" dojoAttachPoint=\"previousButton\">${previousButtonLabel}</button>\n <button dojoType=\"dijit.form.Button\" type=\"button\" dojoAttachPoint=\"nextButton\">${nextButtonLabel}</button>\n <button dojoType=\"dijit.form.Button\" type=\"button\" dojoAttachPoint=\"doneButton\" style=\"display:none\">${doneButtonLabel}</button>\n <button dojoType=\"dijit.form.Button\" type=\"button\" dojoAttachPoint=\"cancelButton\">${cancelButtonLabel}</button>\n </div>\n</div>\n"),
-
-
-
- nextButtonLabel: "",
-
-
- previousButtonLabel: "",
-
-
- cancelButtonLabel: "",
-
-
- doneButtonLabel: "",
-
-
-
- cancelFunction: null,
-
-
-
- hideDisabled: false,
- postMixInProperties: function(){
- this.inherited(arguments);
- var labels = dojo.mixin({cancel: dojo.i18n.getLocalization("dijit", "common", this.lang).buttonCancel},
- dojo.i18n.getLocalization("dojox.widget", "Wizard", this.lang));
- var prop;
- for(prop in labels){
- if(!this[prop + "ButtonLabel"]){
- this[prop + "ButtonLabel"] = labels[prop];
- }
- }
- },
- startup: function(){
- if(this._started){
-
- return;
- }
- this.inherited(arguments);
-
- this.connect(this.nextButton, "onClick", "_forward");
- this.connect(this.previousButton, "onClick", "back");
- if(this.cancelFunction){
- if(dojo.isString(this.cancelFunction)){
- this.cancelFunction = dojo.getObject(this.cancelFunction);
- }
- this.connect(this.cancelButton, "onClick", this.cancelFunction);
- }else{
- this.cancelButton.domNode.style.display = "none";
- }
- this.connect(this.doneButton, "onClick", "done");
- this._subscription = dojo.subscribe(this.id + "-selectChild", dojo.hitch(this,"_checkButtons"));
- this._started = true;
-
- },
-
- resize: function(){
- this.inherited(arguments);
- this._checkButtons();
- },
- _checkButtons: function(){
-
- var sw = this.selectedChildWidget;
-
- var lastStep = sw.isLastChild;
- this.nextButton.set("disabled", lastStep);
- this._setButtonClass(this.nextButton);
- if(sw.doneFunction){
-
- this.doneButton.domNode.style.display = "";
- if(lastStep){
- this.nextButton.domNode.style.display = "none";
- }
- }else{
-
- this.doneButton.domNode.style.display = "none";
- }
- this.previousButton.set("disabled", !this.selectedChildWidget.canGoBack);
- this._setButtonClass(this.previousButton);
- },
- _setButtonClass: function(button){
- button.domNode.style.display = (this.hideDisabled && button.disabled) ? "none" : "";
- },
- _forward: function(){
-
- if(this.selectedChildWidget._checkPass()){
- this.forward();
- }
- },
-
- done: function(){
-
- this.selectedChildWidget.done();
- },
-
- destroy: function(){
- dojo.unsubscribe(this._subscription);
- this.inherited(arguments);
- }
-
- });
- dojo.declare("dojox.widget.WizardPane", dijit.layout.ContentPane, {
-
-
-
-
-
-
-
-
-
- canGoBack: true,
-
-
-
-
-
- passFunction: null,
-
-
-
- doneFunction: null,
- startup: function(){
- this.inherited(arguments);
- if(this.isFirstChild){ this.canGoBack = false; }
- if(dojo.isString(this.passFunction)){
- this.passFunction = dojo.getObject(this.passFunction);
- }
- if(dojo.isString(this.doneFunction) && this.doneFunction){
- this.doneFunction = dojo.getObject(this.doneFunction);
- }
- },
- _onShow: function(){
- if(this.isFirstChild){ this.canGoBack = false; }
- this.inherited(arguments);
- },
- _checkPass: function(){
-
-
-
-
-
-
-
- var r = true;
- if(this.passFunction && dojo.isFunction(this.passFunction)){
- var failMessage = this.passFunction();
- switch(typeof failMessage){
- case "boolean":
- r = failMessage;
- break;
- case "string":
- alert(failMessage);
- r = false;
- break;
- }
- }
- return r;
- },
- done: function(){
- if(this.doneFunction && dojo.isFunction(this.doneFunction)){ this.doneFunction(); }
- }
- });
- }
|