Jexcel web table app
Integrate Jexcel editor to Web Table app See merge request nexedi/erp5!1207
23.8 KB
<?xml version="1.0"?> | |||
<ZopeData> | |||
<record id="1" aka="AAAAAAAAAAE="> | |||
<pickle> | |||
<global name="File" module="OFS.Image"/> | |||
</pickle> | |||
<pickle> | |||
<dictionary> | |||
<item> | |||
<key> <string>__name__</string> </key> | |||
<value> <string>jexcel.js</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>content_type</string> </key> | |||
<value> <string>application/javascript</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>precondition</string> </key> | |||
<value> <string></string> </value> | |||
</item> | |||
<item> | |||
<key> <string>title</string> </key> | |||
<value> <string></string> </value> | |||
</item> | |||
|
|||
</dictionary> | |||
</pickle> | |||
</record> | |||
</ZopeData> |
/*jslint nomen: true, indent: 2 */ | |||
/*global window, rJS, RSVP*/ | |||
(function (window, rJS) { | |||
"use strict"; | |||
rJS(window) | |||
.declareAcquiredMethod("jio_get", "jio_get") | |||
.declareAcquiredMethod("jio_post", "jio_post") | |||
.declareMethod("preRenderDocument", function (parent_options) { | |||
var gadget = this; | |||
return gadget.jio_get(parent_options.jio_key) | |||
.push(function (parent_document) { | |||
return parent_document; | |||
}); | |||
}) | |||
.declareMethod("handleSubmit", function (content_dict, parent_options) { | |||
//must return a dict with: | |||
//notify: options_dict for notifySubmitted | |||
//redirect: options_dict for redirect | |||
var return_submit_dict = { | |||
notify: { | |||
message: "", | |||
status: "" | |||
}, | |||
redirect: { | |||
command: "display", | |||
options: {} | |||
} | |||
}, | |||
gadget = this, | |||
document = parent_options.doc, | |||
property; | |||
delete content_dict.dialog_method; | |||
for (property in content_dict) { | |||
if (content_dict.hasOwnProperty(property)) { | |||
document[property] = content_dict[property]; | |||
} | |||
} | |||
return gadget.jio_post(document) | |||
.push(function (jio_key) { | |||
return_submit_dict.notify.message = "Document Cloned"; | |||
|
|||
return_submit_dict.notify.status = "success"; | |||
return_submit_dict.redirect.options = { | |||
jio_key: jio_key, | |||
editable: true | |||
}; | |||
return return_submit_dict; | |||
}, function (error) { | |||
if (error instanceof jIO.util.jIOError) { | |||
return_submit_dict.notify.message = "Failure cloning document"; | |||
return_submit_dict.notify.status = "error"; | |||
return return_submit_dict; | |||
} | |||
throw error; | |||
}); | |||
}); | |||
}(window, rJS)); | |||
\ No newline at end of file |