Commit 6c6488e7 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs_ooffice] Add conversion properties in onlyoffice apps

parent 9388e6a8
...@@ -22,5 +22,9 @@ ...@@ -22,5 +22,9 @@
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
</form> </form>
<div data-gadget-url="gadget_ojs_cloudooo.html"
data-gadget-scope="ojs_cloudooo"
data-gadget-sandbox="public">
</div>
</body> </body>
</html> </html>
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -223,7 +229,7 @@ ...@@ -223,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +243,7 @@ ...@@ -237,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.1752.42277.50636</string> </value> <value> <string>969.27633.19787.19507</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501252142.23</float> <float>1533640688.31</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
(function (window, rJS, RSVP, jIO, Blob) { (function (window, rJS, RSVP, jIO, Blob) {
"use strict"; "use strict";
var ATT_NAME = "data";
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Acquired methods // Acquired methods
...@@ -10,8 +12,11 @@ ...@@ -10,8 +12,11 @@
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("updateDocument", "updateDocument") .declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment") .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment") .declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting") .declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted') .declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
...@@ -20,16 +25,21 @@ ...@@ -20,16 +25,21 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ var gadget = this;
return gadget.getSetting('file_extension', "")
.push(function (result) {
return gadget.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
mime_type: result,
content_editable: options.doc.content_type === undefined || content_editable: options.doc.content_type === undefined ||
options.doc.content_type.indexOf("application/x-asc") === 0 options.doc.content_type.indexOf("application/x-asc") === 0
}); });
});
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, data; var gadget = this, data, name_list;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -40,6 +50,11 @@ ...@@ -40,6 +50,11 @@
.push(function (content) { .push(function (content) {
data = content.text_content; data = content.text_content;
delete content.text_content; delete content.text_content;
name_list = gadget.state.doc.filename.split('.');
if (name_list.pop() !== gadget.state.mime_type) {
name_list.push(gadget.state.mime_type);
content.filename = name_list.join('.');
}
return gadget.updateDocument(content); return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
...@@ -48,7 +63,16 @@ ...@@ -48,7 +63,16 @@
gadget.state.jio_key, gadget.state.jio_key,
"data", "data",
jIO.util.dataURItoBlob(data) jIO.util.dataURItoBlob(data)
); )
.push(function () {
return gadget.getDeclaredGadget("ojs_cloudooo");
})
.push(function (cloudooo) {
return cloudooo.putAllCloudoooConvertionOperation({
format: gadget.state.mime_type,
jio_key: gadget.state.jio_key
});
});
} }
}) })
.push(function () { .push(function () {
...@@ -61,19 +85,31 @@ ...@@ -61,19 +85,31 @@
}) })
.onStateChange(function () { .onStateChange(function () {
var gadget = this, data; var gadget = this,
data,
editable = gadget.state.content_editable;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.jio_getAttachment(gadget.state.jio_key, "data") if (!editable) {
return gadget.jio_getAttachment(gadget.state.jio_key, "data");
}
return gadget.getDeclaredGadget("ojs_cloudooo")
.push(function (ojs_cloudooo) {
return ojs_cloudooo.getConvertedBlob({
jio_key: gadget.state.jio_key,
format: gadget.state.mime_type,
filename: gadget.state.doc.filename
});
});
})
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status_code === 404) { if (error instanceof jIO.util.jIOError && error.status_code === 404) {
return new Blob(); return new Blob();
} }
throw error; throw error;
});
}) })
.push(function (blob) { .push(function (blob) {
if (gadget.state.content_editable) { if (editable) {
return jIO.util.readBlobAsDataURL(blob); return jIO.util.readBlobAsDataURL(blob);
} }
return jIO.util.readBlobAsText(blob); return jIO.util.readBlobAsText(blob);
...@@ -83,7 +119,6 @@ ...@@ -83,7 +119,6 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -150,7 +185,7 @@ ...@@ -150,7 +185,7 @@
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
"renderjs_extra": '{"editor": "onlyoffice", ' + "renderjs_extra": '{"editor": "onlyoffice",' +
'"maximize": true}', '"maximize": true}',
"url": "gadget_editor.html", "url": "gadget_editor.html",
"sandbox": "public" "sandbox": "public"
...@@ -184,7 +219,11 @@ ...@@ -184,7 +219,11 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}) gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({
command: 'change',
options: {'page': "ojs_download_convert"}
})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
...@@ -193,7 +232,8 @@ ...@@ -193,7 +232,8 @@
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true,
download_url: url_list[3]
}); });
}); });
}); });
......
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -219,7 +225,7 @@ ...@@ -219,7 +225,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +239,7 @@ ...@@ -233,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.54546.48173.5239</string> </value> <value> <string>969.27672.42411.61542</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +257,7 @@ ...@@ -251,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516871823.9</float> <float>1533641806.59</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,5 +22,9 @@ ...@@ -22,5 +22,9 @@
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
</form> </form>
<div data-gadget-url="gadget_ojs_cloudooo.html"
data-gadget-scope="ojs_cloudooo"
data-gadget-sandbox="public">
</div>
</body> </body>
</html> </html>
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -223,7 +229,7 @@ ...@@ -223,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +243,7 @@ ...@@ -237,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.645.13018.3652</string> </value> <value> <string>969.27633.19787.19507</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501252130.3</float> <float>1533639597.7</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
(function (window, rJS, RSVP, jIO, Blob) { (function (window, rJS, RSVP, jIO, Blob) {
"use strict"; "use strict";
var ATT_NAME = "data";
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Acquired methods // Acquired methods
...@@ -10,8 +12,11 @@ ...@@ -10,8 +12,11 @@
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("updateDocument", "updateDocument") .declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment") .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment") .declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting") .declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted') .declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
...@@ -20,16 +25,21 @@ ...@@ -20,16 +25,21 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ var gadget = this;
return gadget.getSetting('file_extension', "")
.push(function (result) {
return gadget.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
mime_type: result,
content_editable: options.doc.content_type === undefined || content_editable: options.doc.content_type === undefined ||
options.doc.content_type.indexOf("application/x-asc") === 0 options.doc.content_type.indexOf("application/x-asc") === 0
}); });
});
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, data; var gadget = this, data, name_list;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -40,6 +50,11 @@ ...@@ -40,6 +50,11 @@
.push(function (content) { .push(function (content) {
data = content.text_content; data = content.text_content;
delete content.text_content; delete content.text_content;
name_list = gadget.state.doc.filename.split('.');
if (name_list.pop() !== gadget.state.mime_type) {
name_list.push(gadget.state.mime_type);
content.filename = name_list.join('.');
}
return gadget.updateDocument(content); return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
...@@ -48,7 +63,16 @@ ...@@ -48,7 +63,16 @@
gadget.state.jio_key, gadget.state.jio_key,
"data", "data",
jIO.util.dataURItoBlob(data) jIO.util.dataURItoBlob(data)
); )
.push(function () {
return gadget.getDeclaredGadget("ojs_cloudooo");
})
.push(function (cloudooo) {
return cloudooo.putAllCloudoooConvertionOperation({
format: gadget.state.mime_type,
jio_key: gadget.state.jio_key
});
});
} }
}) })
.push(function () { .push(function () {
...@@ -61,19 +85,31 @@ ...@@ -61,19 +85,31 @@
}) })
.onStateChange(function () { .onStateChange(function () {
var gadget = this, data; var gadget = this,
data,
editable = gadget.state.content_editable;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.jio_getAttachment(gadget.state.jio_key, "data") if (!editable) {
return gadget.jio_getAttachment(gadget.state.jio_key, "data");
}
return gadget.getDeclaredGadget("ojs_cloudooo")
.push(function (ojs_cloudooo) {
return ojs_cloudooo.getConvertedBlob({
jio_key: gadget.state.jio_key,
format: gadget.state.mime_type,
filename: gadget.state.doc.filename
});
});
})
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status_code === 404) { if (error instanceof jIO.util.jIOError && error.status_code === 404) {
return new Blob(); return new Blob();
} }
throw error; throw error;
});
}) })
.push(function (blob) { .push(function (blob) {
if (gadget.state.content_editable) { if (editable) {
return jIO.util.readBlobAsDataURL(blob); return jIO.util.readBlobAsDataURL(blob);
} }
return jIO.util.readBlobAsText(blob); return jIO.util.readBlobAsText(blob);
...@@ -83,7 +119,6 @@ ...@@ -83,7 +119,6 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -184,7 +219,11 @@ ...@@ -184,7 +219,11 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}) gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({
command: 'change',
options: {'page': "ojs_download_convert"}
})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
...@@ -193,7 +232,8 @@ ...@@ -193,7 +232,8 @@
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true,
download_url: url_list[3]
}); });
}); });
}); });
......
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -219,7 +225,7 @@ ...@@ -219,7 +225,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +239,7 @@ ...@@ -233,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.3116.20089.9676</string> </value> <value> <string>969.27672.59993.54476</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +257,7 @@ ...@@ -251,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516872229.47</float> <float>1533641822.14</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,5 +22,9 @@ ...@@ -22,5 +22,9 @@
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
</form> </form>
<div data-gadget-url="gadget_ojs_cloudooo.html"
data-gadget-scope="ojs_cloudooo"
data-gadget-sandbox="public">
</div>
</body> </body>
</html> </html>
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -223,7 +229,7 @@ ...@@ -223,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +243,7 @@ ...@@ -237,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value> <value> <string>969.27633.19787.19507</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502111936.98</float> <float>1533641076.97</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
(function (window, rJS, RSVP, jIO, Blob) { (function (window, rJS, RSVP, jIO, Blob) {
"use strict"; "use strict";
var ATT_NAME = "data";
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Acquired methods // Acquired methods
...@@ -10,8 +12,11 @@ ...@@ -10,8 +12,11 @@
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("updateDocument", "updateDocument") .declareAcquiredMethod("updateDocument", "updateDocument")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment") .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_put", "jio_put")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment") .declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting") .declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted') .declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
...@@ -20,16 +25,21 @@ ...@@ -20,16 +25,21 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ var gadget = this;
return gadget.getSetting('file_extension', "")
.push(function (result) {
return gadget.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
mime_type: result,
content_editable: options.doc.content_type === undefined || content_editable: options.doc.content_type === undefined ||
options.doc.content_type.indexOf("application/x-asc") === 0 options.doc.content_type.indexOf("application/x-asc") === 0
}); });
});
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, data; var gadget = this, data, name_list;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -40,6 +50,11 @@ ...@@ -40,6 +50,11 @@
.push(function (content) { .push(function (content) {
data = content.text_content; data = content.text_content;
delete content.text_content; delete content.text_content;
name_list = gadget.state.doc.filename.split('.');
if (name_list.pop() !== gadget.state.mime_type) {
name_list.push(gadget.state.mime_type);
content.filename = name_list.join('.');
}
return gadget.updateDocument(content); return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
...@@ -48,7 +63,16 @@ ...@@ -48,7 +63,16 @@
gadget.state.jio_key, gadget.state.jio_key,
"data", "data",
jIO.util.dataURItoBlob(data) jIO.util.dataURItoBlob(data)
); )
.push(function () {
return gadget.getDeclaredGadget("ojs_cloudooo");
})
.push(function (cloudooo) {
return cloudooo.putAllCloudoooConvertionOperation({
format: gadget.state.mime_type,
jio_key: gadget.state.jio_key
});
});
} }
}) })
.push(function () { .push(function () {
...@@ -61,19 +85,31 @@ ...@@ -61,19 +85,31 @@
}) })
.onStateChange(function () { .onStateChange(function () {
var gadget = this, data; var gadget = this,
data,
editable = gadget.state.content_editable;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.jio_getAttachment(gadget.state.jio_key, "data") if (!editable) {
return gadget.jio_getAttachment(gadget.state.jio_key, "data");
}
return gadget.getDeclaredGadget("ojs_cloudooo")
.push(function (ojs_cloudooo) {
return ojs_cloudooo.getConvertedBlob({
jio_key: gadget.state.jio_key,
format: gadget.state.mime_type,
filename: gadget.state.doc.filename
});
});
})
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status_code === 404) { if (error instanceof jIO.util.jIOError && error.status_code === 404) {
return new Blob(); return new Blob();
} }
throw error; throw error;
});
}) })
.push(function (blob) { .push(function (blob) {
if (gadget.state.content_editable) { if (editable) {
return jIO.util.readBlobAsDataURL(blob); return jIO.util.readBlobAsDataURL(blob);
} }
return jIO.util.readBlobAsText(blob); return jIO.util.readBlobAsText(blob);
...@@ -83,7 +119,6 @@ ...@@ -83,7 +119,6 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -184,7 +219,11 @@ ...@@ -184,7 +219,11 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}) gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({
command: 'change',
options: {'page': "ojs_download_convert"}
})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
...@@ -193,7 +232,8 @@ ...@@ -193,7 +232,8 @@
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true,
download_url: url_list[3]
}); });
}); });
}); });
......
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -219,7 +225,7 @@ ...@@ -219,7 +225,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>vincent</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +239,7 @@ ...@@ -233,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.54546.48173.5239</string> </value> <value> <string>969.27671.44198.55722</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +257,7 @@ ...@@ -251,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516871791.58</float> <float>1533641764.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -63,9 +63,7 @@ ...@@ -63,9 +63,7 @@
<item> <item>
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple/>
<string>contributor/person_module/1</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -206,11 +204,30 @@ gadget_editor.html\n ...@@ -206,11 +204,30 @@ gadget_editor.html\n
gadget_editor.js\n gadget_editor.js\n
gadget_button_maximize.html\n gadget_button_maximize.html\n
gadget_button_maximize.js\n gadget_button_maximize.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_field_file.html\n
gadget_erp5_field_file.js\n
gadget_erp5_field_list.html\n
gadget_erp5_field_list.js\n
gadget_html5_select.html\n
gadget_html5_select.js\n
\n \n
#setting\n #setting\n
gadget_officejs_setting.js\n gadget_officejs_setting.js\n
gadget_officejs_setting.html\n gadget_officejs_setting.html\n
\n \n
\n
#cloudooo\n
gadget_ojs_cloudooo.html\n
gadget_ojs_cloudooo.js\n
gadget_cloudooo.html\n
gadget_cloudooo.js\n
gadget_erp5_page_ojs_upload_convert.html\n
gadget_erp5_page_ojs_upload_convert.js\n
gadget_erp5_page_ojs_download_convert.html\n
gadget_erp5_page_ojs_download_convert.js\n
\n
#presentation\n #presentation\n
gadget_ooffice_presentation_router.html\n gadget_ooffice_presentation_router.html\n
gadget_officejs_jio_presentation_view.html\n gadget_officejs_jio_presentation_view.html\n
...@@ -1359,7 +1376,7 @@ NETWORK:\n ...@@ -1359,7 +1376,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -1373,7 +1390,7 @@ NETWORK:\n ...@@ -1373,7 +1390,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.1014.10748.13687</string> </value> <value> <string>969.27633.19787.19507</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -1391,7 +1408,7 @@ NETWORK:\n ...@@ -1391,7 +1408,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1517243462.59</float> <float>1533639880.53</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">tgbv6bt1grf7muu</script> <script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">tgbv6bt1grf7muu</script>
<script data-renderjs-configuration="content_type" type="text/x-renderjs-configuration">application/x-asc-presentation</script> <script data-renderjs-configuration="content_type" type="text/x-renderjs-configuration">application/x-asc-presentation</script>
<script data-renderjs-configuration="file_extension" type="text/x-renderjs-configuration">ppty</script> <script data-renderjs-configuration="file_extension" type="text/x-renderjs-configuration">ppty</script>
<script data-renderjs-configuration="upload_dict" type="text/x-renderjs-configuration">{"pptx": "ppty", "ppty": "ppty"}</script>
<script data-renderjs-configuration="conversion_dict" type="text/x-renderjs-configuration">{"ppty": ["pptx"], "pptx": ["ppty", "pdf"]}</script>
<div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div> <div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -223,7 +229,7 @@ ...@@ -223,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +243,7 @@ ...@@ -237,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.50090.21906.31573</string> </value> <value> <string>969.30625.2304.34508</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523363204.61</float> <float>1533818996.6</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -63,9 +63,7 @@ ...@@ -63,9 +63,7 @@
<item> <item>
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple/>
<string>contributor/person_module/1</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -206,11 +204,29 @@ gadget_editor.html\n ...@@ -206,11 +204,29 @@ gadget_editor.html\n
gadget_editor.js\n gadget_editor.js\n
gadget_button_maximize.html\n gadget_button_maximize.html\n
gadget_button_maximize.js\n gadget_button_maximize.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_field_file.html\n
gadget_erp5_field_file.js\n
gadget_erp5_field_list.html\n
gadget_erp5_field_list.js\n
gadget_html5_select.html\n
gadget_html5_select.js\n
\n \n
#setting\n #setting\n
gadget_officejs_setting.js\n gadget_officejs_setting.js\n
gadget_officejs_setting.html\n gadget_officejs_setting.html\n
\n \n
#cloudooo\n
gadget_ojs_cloudooo.html\n
gadget_ojs_cloudooo.js\n
gadget_cloudooo.html\n
gadget_cloudooo.js\n
gadget_erp5_page_ojs_upload_convert.html\n
gadget_erp5_page_ojs_upload_convert.js\n
gadget_erp5_page_ojs_download_convert.html\n
gadget_erp5_page_ojs_download_convert.js\n
\n
#spreadsheet\n #spreadsheet\n
gadget_ooffice_spreadsheet_router.html\n gadget_ooffice_spreadsheet_router.html\n
gadget_officejs_jio_spreadsheet_view.html\n gadget_officejs_jio_spreadsheet_view.html\n
...@@ -1359,7 +1375,7 @@ NETWORK:\n ...@@ -1359,7 +1375,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -1373,7 +1389,7 @@ NETWORK:\n ...@@ -1373,7 +1389,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.1012.19255.29354</string> </value> <value> <string>969.27633.19787.19507</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -1391,7 +1407,7 @@ NETWORK:\n ...@@ -1391,7 +1407,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1517243409.91</float> <float>1533639878.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">hxq0vjiu9v0r4mu</script> <script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">hxq0vjiu9v0r4mu</script>
<script data-renderjs-configuration="content_type" type="text/x-renderjs-configuration">application/x-asc-spreadsheet</script> <script data-renderjs-configuration="content_type" type="text/x-renderjs-configuration">application/x-asc-spreadsheet</script>
<script data-renderjs-configuration="file_extension" type="text/x-renderjs-configuration">xlsy</script> <script data-renderjs-configuration="file_extension" type="text/x-renderjs-configuration">xlsy</script>
<script data-renderjs-configuration="upload_dict" type="text/x-renderjs-configuration">{"xlsx": "xlsy", "xlsy": "xlsy"}</script>
<script data-renderjs-configuration="conversion_dict" type="text/x-renderjs-configuration">{"xlsy": ["xlsx"], "xlsx": ["xlsy", "pdf"]}</script>
<div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div> <div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -223,7 +229,7 @@ ...@@ -223,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +243,7 @@ ...@@ -237,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.50089.1127.22237</string> </value> <value> <string>969.30624.38120.45568</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523363197.37</float> <float>1533818989.4</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -63,9 +63,7 @@ ...@@ -63,9 +63,7 @@
<item> <item>
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple/>
<string>contributor/person_module/1</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -206,11 +204,29 @@ gadget_editor.html\n ...@@ -206,11 +204,29 @@ gadget_editor.html\n
gadget_editor.js\n gadget_editor.js\n
gadget_button_maximize.html\n gadget_button_maximize.html\n
gadget_button_maximize.js\n gadget_button_maximize.js\n
gadget_erp5_pt_form_dialog.html\n
gadget_erp5_pt_form_dialog.js\n
gadget_erp5_field_file.html\n
gadget_erp5_field_file.js\n
gadget_erp5_field_list.html\n
gadget_erp5_field_list.js\n
gadget_html5_select.html\n
gadget_html5_select.js\n
\n \n
#setting\n #setting\n
gadget_officejs_setting.js\n gadget_officejs_setting.js\n
gadget_officejs_setting.html\n gadget_officejs_setting.html\n
\n \n
#cloudooo\n
gadget_ojs_cloudooo.html\n
gadget_ojs_cloudooo.js\n
gadget_cloudooo.html\n
gadget_cloudooo.js\n
gadget_erp5_page_ojs_upload_convert.html\n
gadget_erp5_page_ojs_upload_convert.js\n
gadget_erp5_page_ojs_download_convert.html\n
gadget_erp5_page_ojs_download_convert.js\n
\n
#text\n #text\n
gadget_ooffice_text_router.html\n gadget_ooffice_text_router.html\n
gadget_officejs_jio_text_view.html\n gadget_officejs_jio_text_view.html\n
...@@ -1359,7 +1375,7 @@ NETWORK:\n ...@@ -1359,7 +1375,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -1373,7 +1389,7 @@ NETWORK:\n ...@@ -1373,7 +1389,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.1007.59634.37529</string> </value> <value> <string>969.27633.19787.19507</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -1391,7 +1407,7 @@ NETWORK:\n ...@@ -1391,7 +1407,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1517243378.3</float> <float>1533639875.22</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">lj7mua2rf67bo20</script> <script data-renderjs-configuration="dropbox_app_key" type="text/x-renderjs-configuration">lj7mua2rf67bo20</script>
<script data-renderjs-configuration="content_type" type="text/x-renderjs-configuration">application/x-asc-text</script> <script data-renderjs-configuration="content_type" type="text/x-renderjs-configuration">application/x-asc-text</script>
<script data-renderjs-configuration="file_extension" type="text/x-renderjs-configuration">docy</script> <script data-renderjs-configuration="file_extension" type="text/x-renderjs-configuration">docy</script>
<script data-renderjs-configuration="upload_dict" type="text/x-renderjs-configuration">{"docx": "docy", "docy": "docy"}</script>
<script data-renderjs-configuration="conversion_dict" type="text/x-renderjs-configuration">{"docy": ["docx"], "docx": ["docy", "pdf"]}</script>
<div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div> <div data-gadget-url="gadget_erp5_router.html" data-gadget-scope="erp5_router"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -60,6 +60,12 @@ ...@@ -60,6 +60,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -223,7 +229,7 @@ ...@@ -223,7 +229,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>P0</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -237,7 +243,7 @@ ...@@ -237,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.44435.28144.21572</string> </value> <value> <string>969.30624.53361.48776</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -255,7 +261,7 @@ ...@@ -255,7 +261,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523363000.96</float> <float>1533818981.66</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment