Commit c7bc4b68 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_officejs: Bookmark, remove CRLF endlines on a few files

parent 222f7a25
/*globals window, RSVP, rJS*/ /*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) { (function (window, RSVP, rJS) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
gadget_klass gadget_klass
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
return g.getElement() return g.getElement()
.push(function (element) { .push(function (element) {
g.props.element = element; g.props.element = element;
g.props.deferred = RSVP.defer(); g.props.deferred = RSVP.defer();
}); });
}) })
.declareAcquiredMethod("post", "jio_post") .declareAcquiredMethod("post", "jio_post")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting') .declareAcquiredMethod('getSetting', 'getSetting')
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
gadget.props.options = options; gadget.props.options = options;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getSetting("portal_type"), gadget.getSetting("portal_type"),
gadget.getSetting("document_title"), gadget.getSetting("document_title"),
gadget.getSetting("parent_relative_url") gadget.getSetting("parent_relative_url")
]); ]);
}).push(function (answer_list) { }).push(function (answer_list) {
gadget.props.portal_type = answer_list[0]; gadget.props.portal_type = answer_list[0];
gadget.props.document_title = answer_list[1]; gadget.props.document_title = answer_list[1];
gadget.props.parent_relative_url = answer_list[2]; gadget.props.parent_relative_url = answer_list[2];
return gadget.updateHeader({ return gadget.updateHeader({
title: "New " + gadget.props.document_title title: "New " + gadget.props.document_title
}); });
}) })
.push(function () { .push(function () {
gadget.props.deferred.resolve(); gadget.props.deferred.resolve();
}); });
}) })
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.props.deferred.promise; return gadget.props.deferred.promise;
}) })
.push(function () { .push(function () {
var doc = { var doc = {
// XXX Hardcoded // XXX Hardcoded
parent_relative_url: gadget.props.parent_relative_url, parent_relative_url: gadget.props.parent_relative_url,
portal_type: gadget.props.portal_type portal_type: gadget.props.portal_type
}; };
return gadget.post(doc); return gadget.post(doc);
}) })
.push(function (data) { .push(function (data) {
return gadget.redirect({ return gadget.redirect({
jio_key: data, jio_key: data,
page: "view" page: "view"
}); });
}); });
}); });
}(window, RSVP, rJS)); }(window, RSVP, rJS));
\ No newline at end of file
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>cedric.le.ninivin</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.64652.42771.37444</string> </value> <value> <string>960.50178.45695.2645</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1485780817.22</float> <float>1500208399.34</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, RSVP, rJS*/ /*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) { (function (window, RSVP, rJS) {
"use strict"; "use strict";
rJS(window) rJS(window)
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
return g.getElement() return g.getElement()
.push(function (element) { .push(function (element) {
g.props.element = element; g.props.element = element;
}); });
}) })
.ready(function (g) { .ready(function (g) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
g.translate("validated"), g.translate("validated"),
g.translate("invalidated"), g.translate("invalidated"),
g.translate("Not synced!"), g.translate("Not synced!"),
g.translate("Waiting for approval") g.translate("Waiting for approval")
]); ]);
}) })
.push(function (result_list) { .push(function (result_list) {
g.props.translation_dict = { g.props.translation_dict = {
"validated": result_list[0], "validated": result_list[0],
"invalidated": result_list[1], "invalidated": result_list[1],
"Not synced!": result_list[2], "Not synced!": result_list[2],
"Waiting for approval": result_list[3] "Waiting for approval": result_list[3]
}; };
}); });
}) })
.declareAcquiredMethod("translate", "translate") .declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting') .declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("jio_allDocs", function (param_list) { .allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this; var gadget = this;
return this.jio_allDocs.apply(this, param_list) return this.jio_allDocs.apply(this, param_list)
.push(function (result) { .push(function (result) {
var i, var i,
len; len;
for (i = 0, len = result.data.total_rows; i < len; i += 1) { for (i = 0, len = result.data.total_rows; i < len; i += 1) {
// XXX jIO does not create UUID with module inside // XXX jIO does not create UUID with module inside
if (result.data.rows[i].id.indexOf("module") === -1) { if (result.data.rows[i].id.indexOf("module") === -1) {
result.data.rows[i].value.state = result.data.rows[i].value.state =
gadget.props.translation_dict["Not synced!"]; gadget.props.translation_dict["Not synced!"];
} else { } else {
result.data.rows[i].value.state = result.data.rows[i].value.state =
gadget.props.translation_dict[ gadget.props.translation_dict[
result.data.rows[i].value.local_state || result.data.rows[i].value.local_state ||
"Waiting for approval" "Waiting for approval"
]; ];
} }
} }
return result; return result;
}); });
}) })
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
gadget.getSetting("portal_type"), gadget.getSetting("portal_type"),
gadget.getSetting("document_title_plural") gadget.getSetting("document_title_plural")
]); ]);
}) })
.push(function (answer_list) { .push(function (answer_list) {
gadget.props.portal_type = answer_list[0]; gadget.props.portal_type = answer_list[0];
gadget.props.bookmark_title_plural = answer_list[1]; gadget.props.bookmark_title_plural = answer_list[1];
return gadget.getUrlFor({page: "add_bookmark"}); return gadget.getUrlFor({page: "add_bookmark"});
}) })
.push(function (url) { .push(function (url) {
return gadget.updateHeader({ return gadget.updateHeader({
title: gadget.props.bookmark_title_plural, title: gadget.props.bookmark_title_plural,
add_url: url add_url: url
}); });
}) })
.push(function () { .push(function () {
return gadget.getDeclaredGadget("listbox"); return gadget.getDeclaredGadget("listbox");
}) })
.push(function (listbox) { .push(function (listbox) {
return listbox.render({ return listbox.render({
search_page: 'bookmark_list', search_page: 'bookmark_list',
search: options.search, search: options.search,
column_list: [{ column_list: [{
select: 'title', select: 'title',
title: 'Title' title: 'Title'
}, { }, {
select: 'url_string', select: 'url_string',
title: 'URL' title: 'URL'
}, { }, {
select: 'description', select: 'description',
title: 'Description' title: 'Description'
}], }],
query: { query: {
query: 'portal_type:("' + gadget.props.portal_type + '")', query: 'portal_type:("' + gadget.props.portal_type + '")',
select_list: ['title', 'url_string', 'description'], select_list: ['title', 'url_string', 'description'],
limit: [0, 30], limit: [0, 30],
sort_on: [["modification_date", "descending"]] sort_on: [["modification_date", "descending"]]
} }
}); });
}); });
}); });
}(window, RSVP, rJS)); }(window, RSVP, rJS));
\ No newline at end of file
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>cedric.le.ninivin</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.64652.30281.58163</string> </value> <value> <string>960.50478.26108.37085</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1485780674.63</float> <float>1500225770.04</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