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