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