Commit ff38c780 authored by Boxiang Sun's avatar Boxiang Sun

erp5_officejs_support_request_ui: Allow user to preview the uploaded PDF file.

Users may upload PDF files when they submit comment under a support request.
This commit allow user to view the PDF file after they upload it.
parent b1554f0a
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.34504.26890.22033</string> </value>
<value> <string>960.51743.34230.33211</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1499267108.76</float>
<float>1500301444.13</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -33,6 +33,20 @@
});
});
})
.declareMethod('getDocumentUrl', function (raw_url) {
var gadget = this;
return gadget.jio_getAttachment(raw_url, "links")
.push(function (links) {
var full_size_url = links._links.view[4].href;
return gadget.getUrlFor({
command: 'display',
options: {
jio_key: "document_module",
view: full_size_url
}
});
});
})
.declareMethod('render', function (options) {
var gadget = this;
gadget.options = options;
......@@ -124,6 +138,8 @@
for (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]));
} else {
queue_list.push(null);
}
......@@ -140,7 +156,7 @@
s += '<li>' +
'By <strong>' + post_list[i][0] + '</strong>' +
' - <time>' + post_list[i][1] + '</time><br/>';
if (post_list[i][3] !== null && post_list[i][3].indexOf("image_module") !== -1) {
if (post_list[i][3] !== null && result_list[i] !== null) {
post_list[i][3] = result_list[i];
}
if (post_list[i][2]) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.34503.40111.10939</string> </value>
<value> <string>960.51741.36262.5120</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1499267199.84</float>
<float>1500301509.14</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