Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/externals/javelin/lib/Workflow.js
| Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | newFromForm : function(form, data, keep_enabled) { | ||||
| } | } | ||||
| var workflow = new JX.Workflow(form.getAttribute('action'), {}); | var workflow = new JX.Workflow(form.getAttribute('action'), {}); | ||||
| workflow._form = form; | workflow._form = form; | ||||
| workflow.setDataWithListOfPairs(pairs); | workflow.setDataWithListOfPairs(pairs); | ||||
| workflow.setMethod(form.getAttribute('method')); | workflow.setMethod(form.getAttribute('method')); | ||||
| workflow.listen('finally', function() { | |||||
| // Re-enable form elements | var onfinally = JX.bind(workflow, function() { | ||||
| if (!this._keepControlsDisabled) { | |||||
| for (var ii = 0; ii < inputs.length; ii++) { | for (var ii = 0; ii < inputs.length; ii++) { | ||||
| inputs[ii] && (inputs[ii].disabled = false); | inputs[ii] && (inputs[ii].disabled = false); | ||||
| } | } | ||||
| } | |||||
| }); | }); | ||||
| workflow.listen('finally', onfinally); | |||||
| return workflow; | return workflow; | ||||
| }, | }, | ||||
| newFromLink : function(link) { | newFromLink : function(link) { | ||||
| var workflow = new JX.Workflow(link.href); | var workflow = new JX.Workflow(link.href); | ||||
| return workflow; | return workflow; | ||||
| }, | }, | ||||
| _push : function(workflow) { | _push : function(workflow) { | ||||
| ▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | JX.install('Workflow', { | ||||
| members : { | members : { | ||||
| _root : null, | _root : null, | ||||
| _pushed : false, | _pushed : false, | ||||
| _data : null, | _data : null, | ||||
| _form: null, | _form: null, | ||||
| _paused: 0, | _paused: 0, | ||||
| _nextCallback: null, | _nextCallback: null, | ||||
| _keepControlsDisabled: false, | |||||
| getSourceForm: function() { | getSourceForm: function() { | ||||
| return this._form; | return this._form; | ||||
| }, | }, | ||||
| pause: function() { | pause: function() { | ||||
| this._paused++; | this._paused++; | ||||
| return this; | return this; | ||||
| Show All 25 Lines | _onload : function(r) { | ||||
| if (r && (typeof r.redirect != 'undefined')) { | if (r && (typeof r.redirect != 'undefined')) { | ||||
| // Before we redirect to file downloads, we close the dialog. These | // Before we redirect to file downloads, we close the dialog. These | ||||
| // redirects aren't real navigation events so we end up stuck in the | // redirects aren't real navigation events so we end up stuck in the | ||||
| // dialog otherwise. | // dialog otherwise. | ||||
| if (r.close) { | if (r.close) { | ||||
| this._pop(); | this._pop(); | ||||
| } | } | ||||
| // If we're redirecting, don't re-enable for controls. | |||||
| this._keepControlsDisabled = true; | |||||
| JX.$U(r.redirect).go(); | JX.$U(r.redirect).go(); | ||||
| } else if (r && r.dialog) { | } else if (r && r.dialog) { | ||||
| this._push(); | this._push(); | ||||
| this._root = JX.$N( | this._root = JX.$N( | ||||
| 'div', | 'div', | ||||
| {className: 'jx-client-dialog'}, | {className: 'jx-client-dialog'}, | ||||
| JX.$H(r.dialog)); | JX.$H(r.dialog)); | ||||
| JX.DOM.listen( | JX.DOM.listen( | ||||
| ▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines | |||||