Commit 756d6323 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: use dictionnaries instead of tuple in API

This is more understandable
parent c2bc7e33
......@@ -172,10 +172,10 @@
var queue_list = [];
if (post_list.length) {
for (var i = 0; i < post_list.length; i += 1) {
if (post_list[i][3] !== null && post_list[i][3].indexOf("image_module") !== -1) {
queue_list.push(gadget.getImageUrl(post_list[i][3]));
} else if (post_list[i][3] !== null && post_list[i][3].indexOf("document_module") !== -1) {
queue_list.push(gadget.getDocumentUrl(post_list[i][3]));
if (post_list[i].attachment_link !== null && post_list[i].attachment_link.indexOf("image_module") !== -1) {
queue_list.push(gadget.getImageUrl(post_list[i].attachment_link));
} else if (post_list[i].attachment_link !== null && post_list[i].attachment_link.indexOf("document_module") !== -1) {
queue_list.push(gadget.getDocumentUrl(post_list[i].attachment_link));
} else {
queue_list.push(null);
}
......@@ -190,25 +190,25 @@
if (post_list.length) {
for (i = 0; i < post_list.length; i += 1) {
s += '<li>' +
'By <strong>' + post_list[i][0] + '</strong>' +
' - <time datetime="' + post_list[i][1] + '" title="' + moment(post_list[i][1]).format('LLLL') + '">' + moment(post_list[i][1]).fromNow() + '</time><br/>';
if (post_list[i][3] !== null && result_list[i] !== null) {
post_list[i][3] = result_list[i];
'By <strong>' + post_list[i].user + '</strong>' +
' - <time datetime="' + post_list[i].date + '" title="' + moment(post_list[i].date).format('LLLL') + '">' + moment(post_list[i].date).fromNow() + '</time><br/>';
if (post_list[i].attachment_link !== null && result_list[i] !== null) {
post_list[i].attachment_link = result_list[i];
}
if (post_list[i][2]) {
plain_content = post_list[i][2];
if (post_list[i][3]) {
if (post_list[i].text) {
plain_content = post_list[i].text;
if (post_list[i].attachment_link) {
s += plain_content + '<strong>Attachment: </strong>' +
'<a href=\"' +
post_list[i][3] + '\">' + post_list[i][4] +
post_list[i].attachment_link + '\">' + post_list[i].attachment_name +
'</a>';
} else {
s += plain_content;
}
} else {
if (post_list[i][3]) {
if (post_list[i].attachment_link) {
s += '<strong>Attachment: </strong>' + '<a href=\"' +
post_list[i][3] + '\">' + post_list[i][4] +
post_list[i].attachment_link + '\">' + post_list[i].attachment_name +
'</a>';
}
}
......
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1538972059.78</float>
<float>1539065902.53</float>
<string>GMT+9</string>
</tuple>
</state>
......
......@@ -51,10 +51,10 @@ successor_name = successor_link = None
if successor_list:
successor_link, successor_name = successor_list[0].getRelativeUrl(), successor_list[0].getFilename()
portal.portal_sessions[
'%s.latest_comment' % follow_up_value.getRelativeUrl()]['comment_post_list'] = (
post.Base_getOwnerTitle(),
post.getStartDate().ISO8601(),
post.asStrippedHTML(),
successor_link,
successor_name,
post.getSourceReference(),
'%s.latest_comment' % follow_up_value.getRelativeUrl()]['comment_post_list'] = dict(
user=post.Base_getOwnerTitle(),
date=post.getStartDate().ISO8601(),
text=post.asStrippedHTML(),
attachment_link=successor_link,
attachment_name=successor_name,
message_id=post.getSourceReference(),)
......@@ -21,22 +21,21 @@ for event in event_list:
if attachment is not None:
attachment_link, attachment_name = attachment.getRelativeUrl(), attachment.getFilename()
comment_list.append((
event.getSourceTitle(),
event.getStartDate().ISO8601(),
event.asStrippedHTML(),
attachment_link,
attachment_name,
event.getSourceReference(),
))
comment_list.append((dict(
user=event.getSourceTitle(),
date=event.getStartDate().ISO8601(),
text=event.asStrippedHTML(),
attachment_link=attachment_link,
attachment_name=attachment_name,
message_id=event.getSourceReference(),
)))
just_posted_comment = portal.portal_sessions[
'%s.latest_comment' % context.getRelativeUrl()].pop(
'comment_post_list', None)
if just_posted_comment is not None:
# make sure not to display twice if it was already ingested in the meantime.
if just_posted_comment[-1] not in [comment[-1] for comment in comment_list]:
if just_posted_comment['message_id'] not in [comment['message_id'] for comment in comment_list]:
comment_list.append(just_posted_comment)
return dumps(comment_list)
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