Commit 0e3893cd authored by Hamza Chahed's avatar Hamza Chahed

initial commit of jiodev until updating the jio project

parent b3edff46
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Button Editable</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_button_editable.js" type="text/javascript"></script>
</head>
<body>
<button type="button" class="ui-icon-check ui-btn-icon-notext" value="Execute" style="float: right; border: 1px solid #e7e7e7;border-radius: 5px; padding: 8px; width: 100px">Execute</button>
<button type="button" class="ui-icon-edit ui-btn-icon-notext" value="Edit" style="float: right; border: 1px solid #e7e7e7;border-radius: 5px; padding: 8px; width: 100px" >Edit</button>
</body>
</html>
/*global window, rJS */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
.declareAcquiredMethod('triggerEditable', 'triggerEditable')
.onEvent('click', function (event) {
var identif = event.toElement.value;
if (identif === 'Edit') {
return this.triggerEditable({editable: true});
} else if (identif === 'Execute') {
return this.triggerEditable({editable: false});
}
});
}(window, rJS, RSVP));
\ No newline at end of file
......@@ -131,10 +131,6 @@
return this.getContent(param_list[0]);
})
.allowPublicAcquisition("getFormDefinition", function getFormDefinition() {
return JSON.parse(JSON.stringify( this.state.form_definition ));
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.18983.58402.648</string> </value>
<value> <string>978.11004.43383.62156</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1540898451.07</float>
<float>1567426691.29</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.29292.10042.3754</string> </value>
<value> <string>978.11575.30837.17920</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1556870187.8</float>
<float>1567498338.6</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -90,7 +90,7 @@
cell = row.cell_list[j];
td_element = document.createElement('td');
if (options.show_line_selector || (options.form_id === 'form_dialog' && options.show_select)) {
if (options.show_line_selector) {
if (j === 0) {
// If first cell, show a checkbox to select the line
sub_element = document.createElement('input');
......@@ -279,8 +279,6 @@
container = template({
"row_list": row_list,
"show_anchor": gadget.state.show_anchor,
"show_select": gadget.state.show_select,
"form_id": gadget.state.form_id,
"column_list": column_list,
"show_line_selector": gadget.state.show_line_selector,
"show_select_action": gadget.state.show_select_action,
......@@ -344,7 +342,6 @@
"triggerListboxSelectAction")
.declareAcquiredMethod("triggerListboxClipboardAction",
"triggerListboxClipboardAction")
.declareAcquiredMethod("getFormDefinition", "getFormDefinition")
//////////////////////////////////////////////
// initialize the gadget content
......@@ -409,8 +406,7 @@
return RSVP.all([
gadget.getUrlParameter(field_json.key + '_begin_from'),
gadget.getUrlParameter(field_json.key + '_sort_list:json'),
gadget.getUrlParameter(field_json.key + '_column_list:json'),
gadget.getFormDefinition()
gadget.getUrlParameter(field_json.key + '_column_list:json')
]);
})
.push(function (result_list) {
......@@ -463,8 +459,6 @@
show_anchor: field_json.show_anchor,
show_stat: field_json.show_stat,
show_count: field_json.show_count,
show_select: field_json.show_select,
form_id: result_list[3].pt,
line_icon: field_json.line_icon,
query: field_json.query,
......
......@@ -589,17 +589,10 @@ and handling data send&receive.
.declareJob("forceDownload", function forceDownload(attachment) {
/*jslint regexp: true */
var attachment_data = attachment.target.response,
filename_utf8_quoted = /(?:^|;)\s*filename\*=UTF-8''?([^";]+)/i.exec(
attachment.target.getResponseHeader("Content-Disposition") || ""
),
filename = /(?:^|;)\s*filename\s*=\s*"?([^";]+)/i.exec(
attachment.target.getResponseHeader("Content-Disposition") || ""
),
a_tag = document.createElement("a");
if (filename_utf8_quoted) {
filename = filename_utf8_quoted;
filename[1] = decodeURI(filename[1]);
}
/*jslint regexp: false */
if (attachment.target.responseType !== "blob") {
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>978.9875.57005.56541</string> </value>
<value> <string>976.34271.30288.29832</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1567358955.05</float>
<float>1561044454.34</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15905,7 +15905,7 @@ return new Parser;
var parser = new DOMParser(),
serializer = new XMLSerializer();
function makeXmlRpcRequest(file, from, to) {
function makeXmlRpcRequest(file, from, to, conversion_kw) {
var xml = parser.parseFromString(
'<?xml version="1.0" encoding="UTF-8"?><methodCall>' +
'<methodName>convertFile</methodName><params>' +
......@@ -15918,6 +15918,25 @@ return new Parser;
string_list[0].textContent = file;
string_list[1].textContent = from;
string_list[2].textContent = to;
//
if (conversion_kw){
var param = parser.parseFromString('<param><value><boolean>0</boolean></value></param>','text/xml').firstChild;
xml.firstChild.lastChild.appendChild(param);
var param = parser.parseFromString('<param><value><boolean>0</boolean></value></param>','text/xml').firstChild;
xml.firstChild.lastChild.appendChild(param);
param = parser.parseFromString('<param><struct></struct></param>','text/xml').firstChild;
var struct = param.firstChild;
for (var key in conversion_kw) {
var element_value = document.createElement(conversion_kw[key][1]);
var member = parser.parseFromString('<member><name></name><value></value></member>','text/xml').firstChild;
element_value.textContent = conversion_kw[key][0];
member.getElementsByTagName('name')[0].textContent = key;
member.getElementsByTagName('value')[0].appendChild(element_value);
struct.appendChild(member);
}
xml.firstChild.lastChild.appendChild(param);
}
//
return serializer.serializeToString(xml);
}
......@@ -15926,7 +15945,7 @@ return new Parser;
* from a format to another
* return converted blob.
**/
function convert(url, blob, from, to) {
function convert(url, blob, from, to, conversion_kw) {
return new RSVP.Queue()
.push(function () {
return jIO.util.readBlobAsDataURL(blob);
......@@ -15938,7 +15957,8 @@ return new Parser;
data: makeXmlRpcRequest(
result.target.result.split('base64,')[1],
from,
to
to,
conversion_kw
)
});
})
......@@ -15988,11 +16008,11 @@ return new Parser;
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
CloudoooStorage.prototype.putAttachment = function (id, name, blob) {
CloudoooStorage.prototype.putAttachment = function (id, name, blob, conversion_kw) {
var storage = this;
return storage.get(id)
.push(function (doc) {
return convert(storage._url, blob, doc.from, doc.to);
return convert(storage._url, blob, doc.from, doc.to, conversion_kw);
})
.push(function (converted_blob) {
return storage._sub_storage.putAttachment(id, name, converted_blob);
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.17610.605.30924</string> </value>
<value> <string>978.10764.60200.28910</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1563892822.4</float>
<float>1567412217.18</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