Commit e0eba65e authored by Boxiang Sun's avatar Boxiang Sun

erp5_officejs_support_request_ui: Add some new functions.

- Add two charts in homepage to show the statistc information about Support Request.
- Show recent activities of Support Requests.
- Add fast input dialog to allow user to create new Support Request.
- Allow user to submit comment when creating new Support Request or in Support Request view.
parent bd496547
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>fast_input</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Fast Create Support Request</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SupportRequestModule_viewSupportRequestFastInputDialog</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>officejs_support_request_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>4.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Support Request View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SupportRequestModule_viewForOfficejsSupportRequest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_last_support_request</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View Last Support Request</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SupportRequestModule_viewLastSupportRequestList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -16,13 +16,13 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_officejs_support_request_view</string>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_officejs_support_request_view</string> </value>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
......@@ -50,17 +50,13 @@
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Officejs Support Request View</string> </value>
<value> <string>OfficeJS View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 PT Report View</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_support_request_fast_view_dialog.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_page_form.html"
data-gadget-scope="erp5_form"
data-gadget-sandbox="public"></div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, URI, document, Option */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 79 */
(function (window, rJS) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.allowPublicAcquisition("redirect", function (param_list) {
var gadget = this;
return gadget.redirect({command: 'change', options: {
view: gadget.hateoas_url +
"ERP5Document_getHateoas?mode=traverse&relative_url=" +
encodeURIComponent(param_list[0].options.jio_key) +
"&view=officejs_support_request_view",
page: 'list',
jio_key: param_list[0].options.jio_key
}
});
})
.declareMethod('render', function (options) {
var gadget = this,
view;
gadget.options = options;
return gadget.getUrlParameter('view')
.push(function (result) {
view = result;
return gadget.getDeclaredGadget('erp5_form');
})
.push(function (form) {
gadget.form = form;
return form.render({
view: view,
jio_key: options.jio_key
});
})
.push(function () {
return gadget.getSetting('hateoas_url');
})
.push(function (hateoas_url) {
gadget.hateoas_url = hateoas_url;
});
})
.declareMethod('triggerSubmit', function () {
return this.form.triggerSubmit();
})
.onEvent('change', function (evt) {
if (evt.target.id === "field_your_project") {
var gadget = this;
return gadget.jio_getAttachment(
'support_request_module',
gadget.hateoas_url + 'support_request_module'
+ "/SupportRequest_getSupportTypeList"
+ "?project_id=" + evt.target.value + "&json_flag=True"
).push(function (sp_list) {
var i, j,
sp_select = document.getElementById('field_your_resource');
for (i = sp_select.options.length - 1; i >= 0; i -= 1) {
sp_select.remove(i);
}
for (j = 0; j < sp_list.length; j += 1) {
sp_select.options[j] = new Option(sp_list[j][0], sp_list[j][1]);
}
});
}
}, false, false);
}(window, rJS));
\ No newline at end of file
......@@ -12,13 +12,36 @@
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- libraries needed for graphs -->
<script src="chart.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_homepage.js" type="text/javascript"></script>
</head>
<body>
<h1 style="font-size:2em;font-weight:bold;text-align:center">Customer Support Dashboard</h1>
<form>
<input data-theme="b" data-inline="true" type="submit" data-i18n="[value]Add Support Request" value="Add Support Request" data-icon="check" />
<div style="text-align:center;">
<input data-theme="b" data-inline="true" type="submit" data-i18n="[value]Submit New Support Request" value="Submit New Support Request" data-icon="check" />
</div>
<div class='ui-field-contain'>
<div class='left'>
<div style="width: 100% height: 200%">
<canvas id="bar-chart-grouped" responsive="true"></canvas>
</div>
</div>
<div class='right'>
<div style="width: 50%">
<canvas id="pie-chart" responsive="true"></canvas>
</div>
</div>
</div>
<div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="last"></div>
</form>
</body>
</html>
\ No newline at end of file
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.64744.39586.49937</string> </value>
<value> <string>960.35981.60221.61405</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1493992890.4</float>
<float>1499419560.99</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.10712.35541.7987</string> </value>
<value> <string>960.35777.20882.61627</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1493993924.38</float>
<float>1499343497.75</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -96,7 +96,7 @@
context.getUrlFor({command: 'display', options: {page: "preference"}}),
context.getUrlFor({command: 'display', options: {page: "logout"}}),
context.getUrlFor({command: 'display', options: {page: "search"}}),
context.getUrlFor({command: 'display', options: {jio_key: "support_request_module"}})
context.getUrlFor({command: 'display', options: {jio_key: "support_request_module", page: "list"}})
]);
})
.push(function (result_list) {
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.10653.1373.3140</string> </value>
<value> <string>960.10532.37433.4932</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1493990250.51</float>
<float>1497956198.88</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 PT Form View</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_global.js" type="text/javascript"></script>
<script src="gadget_erp5_pt_form_view_discussable.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="gadget_erp5_pt_form_view_discussable.css">
</head>
<body>
<!-- XXX this is a form replacement -->
<div class="ui-body-c">
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="erp5_form"
data-gadget-sandbox="public">
</div>
<form>
<p style="background-color:#0E81C2;color:white;margin:1em 0;padding:0.5em">Comments:</p>
<ol id="post_list"></ol>
<h3 class="ui-content-title ui-body-c ui-icon ui-icon-custom ui-icon-random">&nbsp;Post a comment</h3>
<div class='editor'></div>
<div id="file_upload_div">
<input value="" name="attachment" id="attachment" type="file" title="Upload">
</div>
<input data-theme="b" data-inline="true" type="submit" data-i18n="[value]Reply" value="Reply" data-icon="check" />
</form>
</div>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, calculatePageTitle, FormData, URI, jIO*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, calculatePageTitle) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod('getImageUrl', function (raw_url) {
var gadget = this;
return gadget.jio_getAttachment(raw_url, "links")
.push(function (links) {
var full_size_url = links._links.view[1].href;
return gadget.getUrlFor({
command: 'display',
options: {
jio_key: "image_module",
view: full_size_url
}
});
});
})
.declareMethod('render', function (options) {
var gadget = this;
gadget.options = options;
return gadget.getSetting('hateoas_url')
.push(function (hateoas_url) {
gadget.hateoas_url = hateoas_url;
})
.push(function () {
var state_dict = {
id: options.jio_key,
view: options.view,
editable: options.editable,
erp5_document: options.erp5_document,
form_definition: options.form_definition,
erp5_form: options.erp5_form || {}
};
return gadget.changeState(state_dict);
});
})
.onStateChange(function () {
var gadget = this;
// render the erp5 form
return this.getDeclaredGadget("erp5_form")
.push(function (erp5_form) {
var form_options = gadget.state.erp5_form,
rendered_form = gadget.state.erp5_document._embedded._view,
rendered_field,
key;
// Remove all empty fields, and mark all others as non editable
for (key in rendered_form) {
if (rendered_form.hasOwnProperty(key) && (key[0] !== "_")) {
rendered_field = rendered_form[key];
if ((rendered_field.type !== "ListBox") && ((!rendered_field.default) || (rendered_field.hidden === 1) || (rendered_field.default.length === 0)
|| (rendered_field.default.length === 1 && (!rendered_field.default[0])))) {
delete rendered_form[key];
} else {
rendered_field.editable = 0;
}
}
}
form_options.erp5_document = gadget.state.erp5_document;
form_options.form_definition = gadget.state.form_definition;
form_options.view = gadget.state.view;
return erp5_form.render(form_options);
})
// render the header
.push(function () {
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {editable: true}}),
gadget.getUrlFor({command: 'change', options: {page: "action"}}),
gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({command: 'change', options: {page: "tab"}}),
gadget.state.erp5_document._links.action_object_report_jio ?
gadget.getUrlFor({command: 'change', options: {page: "export"}}) :
"",
calculatePageTitle(gadget, gadget.state.erp5_document)
]);
})
.push(function (all_result) {
return gadget.updateHeader({
edit_url: all_result[0],
actions_url: all_result[1],
selection_url: all_result[2],
previous_url: all_result[3],
next_url: all_result[4],
tab_url: all_result[5],
export_url: all_result[6],
page_title: all_result[7]
});
})
.push(function () {
return gadget.jio_getAttachment(
'post_module',
gadget.hateoas_url + 'post_module/PostModule_getAscendingRelatedPostListAsJson'
+ "?follow_up=" + gadget.options.jio_key
);
})
.push(function (post_list) {
var i, // XXX abbreviation
queue_list = [];
if (post_list.length) {
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 {
queue_list.push(null);
}
}
}
queue_list.push(post_list);
return RSVP.all(queue_list);
})
.push(function (result_list) {
var s = '', i, comments = gadget.element.querySelector("#post_list"),
post_list = result_list.pop();
if (post_list.length) {
for (i = 0; i < post_list.length; i += 1) {
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) {
post_list[i][3] = result_list[i];
}
if (post_list[i][2]) {
if (post_list[i][3]) {
s += post_list[i][2] + '<strong>Attachment: </strong>' +
'<a href=\"' +
post_list[i][3] + '\">' + post_list[i][4] +
'</a>';
} else {
s += post_list[i][2];
}
} else {
if (post_list[i][3]) {
s += '<strong>Attachment: </strong>' + '<a href=\"' +
post_list[i][3] + '\">' + post_list[i][4] +
'</a>';
}
}
s += '<hr id=post_item>'; // XXX XSS attack!
}
comments.innerHTML = s;
} else {
comments.innerHTML = "<p><em>No comment yet.</em></p><hr id=post_item>";
}
});
})
.declareService(function () {
var gadget = this;
return gadget.declareGadget('officejs_ckeditor_gadget/development/',
{
element: gadget.element.querySelector('.editor'),
sandbox: 'iframe',
scope: 'editor'
});
})
.onEvent('submit', function () {
var gadget = this,
editor_gadget;
return gadget.getDeclaredGadget('editor')
.push(function (text_content_gadget) {
editor_gadget = text_content_gadget;
return text_content_gadget.getContent();
})
.push(function (data) {
var post_content = Object.values(data)[0],
choose_file_html_element = gadget.element.querySelector('#attachment'),
file_blob = choose_file_html_element.files[0],
file_upload_div = gadget.element.querySelector('#file_upload_div');
file_upload_div.innerHTML = file_upload_div.innerHTML;
return [post_content, file_blob];
})
.push(function (result) {
// XXX: Hack, call jIO.util.ajax directly to pass the file blob
// Because the jio_putAttachment will call readBlobAsText, which
// will broke the binary file. Call the jIO.util.ajax directly
// will not touch the blob
var url = gadget.hateoas_url + "post_module/PostModule_createHTMLPost",
data = new FormData();
data.append("follow_up", gadget.options.jio_key);
data.append("predecessor", '');
data.append("data", result[0]);
data.append("file", result[1]);
return jIO.util.ajax({
"type": "POST",
"url": url,
"data": data,
"xhrFields": {
withCredentials: true
}
});
})
.push(function () {
return RSVP.all([
editor_gadget.render({}),
gadget.notifySubmitted("Comment added")
]);
})
.push(function () {
return gadget.redirect({command: 'reload'});
});
});
}(window, rJS, RSVP, calculatePageTitle));
\ No newline at end of file
<!DOCTYPE html>
<html>
<!--
data-i18n=User
data-i18n=Language
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 Page Preferences</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_erp5_page_list.js" type="text/javascript"></script>
</head>
<body>
<form class="preference">
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="erp5_form"
data-gadget-sandbox="public">
</div>
</form>
</body>
</html>
\ No newline at end of file
/*global window, rJS, URI */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, URI) {
"use strict";
function loadFormContent(gadget, result) {
var key;
if (gadget.state.options.form_content) {
for (key in result) {
if (result.hasOwnProperty(key)) {
if (gadget.state.options.form_content[result[key].key]) {
result[key].default = gadget.state.options.form_content[result[key].key];
}
}
}
}
}
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("updateHeader", "updateHeader")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition("updateHeader", function (param_list) {
var param = param_list[0];
delete param.add_url;
delete param.actions_url;
delete param.cut_url;
delete param.jump_url;
delete param.export_url;
return this.updateHeader(param);
})
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i;
if (result.data.rows.length) {
for (i = 0; i < result.data.rows.length; i += 1) {
loadFormContent(gadget, result.data.rows[i].value);
}
}
return result;
});
})
.allowPublicAcquisition('notifySubmit', function () {
return this.triggerSubmit();
})
.declareMethod('triggerSubmit', function () {
return this.getDeclaredGadget('fg')
.push(function (g) {
return g.triggerSubmit();
});
})
.declareMethod("render", function (options) {
var gadget = this,
view;
return gadget.getUrlParameter('view')
.push(function (result) {
view = result;
return gadget.jio_getAttachment(options.jio_key, view || "view")
})
.push(function (result) {
var uri;
if (!result._embedded) {
return gadget.jio_getAttachment(options.jio_key, "links")
.push(function (result2) {
return gadget.redirect({command: 'change', options: {
view: result2._links.view[0].href,
page: "list"
}});
});
}
uri = new URI(result._embedded._view._links.form_definition.href);
return gadget.jio_getAttachment(uri.segment(2), "view")
.push(function (erp5_form) {
var url = "gadget_erp5_pt_" + erp5_form.pt;
// XXX Hardcoded specific behaviour for form_view
if ((options.editable !== undefined) && (erp5_form.pt === "form_view")) {
url += "_editable";
}
url += ".html";
return gadget.changeState({
jio_key: options.jio_key,
options: options,
view: options.view,
url: url,
erp5_document: JSON.stringify(result),
erp5_form: JSON.stringify(erp5_form)
});
});
});
})
.onStateChange(function (modification_dict) {
var queue,
gadget = this,
options = this.state.options,
page_template_gadget,
clean_dom = modification_dict.hasOwnProperty('url');
if (clean_dom) {
queue = gadget.declareGadget(gadget.state.url, {scope: "fg"});
} else {
queue = gadget.getDeclaredGadget("fg");
}
return queue
.push(function (result) {
page_template_gadget = result;
var sub_options = options.fg || {},
erp5_document = JSON.parse(gadget.state.erp5_document),
erp5_form = JSON.parse(gadget.state.erp5_form);
loadFormContent(gadget, erp5_document._embedded._view);
sub_options.erp5_document = erp5_document;
sub_options.form_definition = erp5_form;
sub_options.view = options.view;
sub_options.action_view = options.action_view;
sub_options.jio_key = options.jio_key;
sub_options.editable = options.editable;
return page_template_gadget.render(sub_options);
})
.push(function () {
if (clean_dom) {
return page_template_gadget.getElement()
.push(function (fragment) {
var element = gadget.element;
// Clear first to DOM, append after to reduce flickering/manip
while (element.firstChild) {
element.removeChild(element.firstChild);
}
element.appendChild(fragment);
});
}
})
.push(function () {
var jio_key = gadget.state.options.jio_key;
/*jslint regexp: true*/
if (/^[^\/]+_module\/.+$/.test(jio_key)) {
/*jslint regexp: false*/
return gadget.updatePanel({
erp5_document: JSON.parse(gadget.state.erp5_document),
editable: gadget.state.options.editable
});
}
});
})
.allowPublicAcquisition("displayFormulatorValidationError", function (param_list) {
var erp5_document = JSON.parse(this.state.erp5_document);
erp5_document._embedded._view = param_list[0];
// Force refresh
erp5_document._now = Date.now();
return this.changeState({erp5_document: JSON.stringify(erp5_document)});
});
}(window, rJS, URI));
\ No newline at end of file
......@@ -2,30 +2,36 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
......@@ -34,33 +40,39 @@
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<key> <string>content_md5</string> </key>
<value>
<tuple>
<string>action_type/object_officejs_support_request_view</string>
</tuple>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_list.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
......@@ -69,15 +81,29 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>object_officejs_support_request_view</string> </value>
<value> <string>rjs_gadget_erp5_pt_listpage_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>object_officejs_support_request_view</string> </value>
<value> <string>Gadget ERP5 List JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
......@@ -99,7 +125,7 @@
<value>
<dictionary>
<item>
<key> <string>category_publication_workflow</string> </key>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
......@@ -110,6 +136,12 @@
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -127,7 +159,7 @@
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>embed</string> </value>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
......@@ -153,7 +185,7 @@
</tuple>
<state>
<tuple>
<float>1493131468.89</float>
<float>1497910839.57</float>
<string>UTC</string>
</tuple>
</state>
......@@ -162,7 +194,7 @@
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>embedded</string> </value>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
......@@ -198,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.60387.48102.13858</string> </value>
<value> <string>960.41558.22184.55074</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -216,7 +248,64 @@
</tuple>
<state>
<tuple>
<float>1493128547.05</float>
<float>1499690344.59</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1497909777.39</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -29,6 +29,7 @@
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Manager</string>
</tuple>
</value>
......@@ -38,6 +39,7 @@
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Manager</string>
</tuple>
</value>
......@@ -47,6 +49,7 @@
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Manager</string>
</tuple>
</value>
......@@ -56,6 +59,7 @@
<value>
<tuple>
<string>Assignor</string>
<string>Authenticated</string>
<string>Manager</string>
</tuple>
</value>
......@@ -578,9 +582,7 @@
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
<value> <string>Deleted objects: []</string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
......@@ -588,7 +590,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.63241.32836.58845</string> </value>
<value> <string>959.56722.31338.13107</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -606,7 +608,7 @@
</tuple>
<state>
<tuple>
<float>1493912552.82</float>
<float>1497540038.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,7 +9,18 @@
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple/>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
......@@ -18,6 +29,10 @@
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>42.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_officejs_support_request</string> </value>
......
if 'sort_on' not in kw:
kw['sort_on'] = [('simulation_state', 'descending'), ('delivery.start_date', 'descending')]
else:
if 'simulation_state' not in [x[0] for x in kw['sort_on']]:
kw['sort_on'] = list(kw['sort_on']) + [('simulation_state', 'descending')]
if 'delivery.start_date' not in [x[0] for x in kw['sort_on']]:
kw['sort_on'] = list(kw['sort_on']) + [('delivery.start_date', 'descending')]
return context.searchFolder(**kw)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Folder_searchFolderDefaultSortByStateAndStartDate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if 'sort_on' in kw:
del kw['sort_on']
return context.searchFolder(sort_on=[('modification_date', 'descending')], **kw)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Folder_searchFolderSortByReferenceDescending</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
now = DateTime()
# default_field_your_resource,field_your_title, description, field_your_project, default_field_your_project, form_id, field_your_resource, dialog_id, resource, title, file, project, dialog_method, field_my_description, field_your_file=None
project_list = portal.portal_catalog(portal_type="Project", id=project) # with id keyword, this function will return a sequence data type which contains one element.
project_object = project_list[0].getObject()
support_request = portal.support_request_module.newContent(
portal_type='Support Request',
title=title,
resource="service_module/" + resource,
)
# support_request.Base_getRelatedPostList
# - Reference = automatically generated - already implemented
# - Requester = current user person
# - Start date = now
# - State = submitted
# - Billing Supplier = Project related Billing Supplier
# - Location = Project related Location
# - Supervisor = Project related Supervisor
support_request.edit(
destination_decision_value=logged_in_user_value,
source_decision_value = project_object.getSourceDecisionValue(),
source_section_value = project_object.getSourceSectionValue(),
source_project_value = project_object,
destination_value = project_object.getDestinationValue(),
start_date=now,
)
support_request.submit()
# create an HTML Post
if description or file != 'undefined':
post_module = portal.post_module
post_1 = post_module.newContent(portal_type='HTML Post')
post_1.edit(
start_date=now,
follow_up_value=support_request,
text_content=description,
)
# handle attachments
if getattr(file, 'filename', '') != '':
document_kw = {'batch_mode': True,
'redirect_to_document': False,
'file': file}
document = context.Base_contribute(**document_kw)
# set relation between post and document
post_1.setSuccessorValueList([document])
# depending on security model this should be changed accordingly
document.publish()
post_1.immediateReindexObject()
support_request.immediateReindexObject()
return support_request.Base_redirect('officejs_support_request_view',
keep_items={
'portal_status_message': portal.Base_translateString(
'New ${portal_type} created.',
mapping={
'portal_type': 'Support Request',
},
),
},
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>default_field_your_resource,field_your_title, description, field_your_project, default_field_your_project, form_id, field_your_resource, dialog_id, resource, title, file, project, dialog_method, field_my_description, field_your_file=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_createSupportRequest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_doSelect</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_stop_date</string>
<string>listbox_destination_decision_language</string>
<string>listbox_causality_translated_portal_type</string>
<string>listbox_start_date</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_viewForOfficejsSupportRequest</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleOpportunityModule_viewSaleOpportunityList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_list</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Tickets</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -9,12 +9,15 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>default</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_stop_date</string> </value>
<value> <string>listbox_causality_translated_portal_type</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -50,6 +53,16 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -69,13 +82,21 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_stop_date</string> </value>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......@@ -87,4 +108,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:getattr(cell.getCausalityValue(), \'getTranslatedPortalType\', lambda:None)()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -9,12 +9,15 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>default</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_price_currency</string> </value>
<value> <string>listbox_destination_decision_language</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -50,6 +53,12 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -69,13 +78,21 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_price_currency</string> </value>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......@@ -87,4 +104,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:cell.hasDestinationDecision() and cell.getDestinationDecisionValue().getLanguage()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -9,12 +9,15 @@
<item>
<key> <string>delegated_list</string> </key>
<value>
<list/>
<list>
<string>default</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_destination_project_title</string> </value>
<value> <string>listbox_start_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -50,6 +53,14 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -69,13 +80,23 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_destination_project_title</string> </value>
<value> <string>my_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
......@@ -14,7 +14,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_assessment_form_id</string> </value>
<value> <string>listbox_stop_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -71,11 +71,11 @@
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_assessment_form_id</string> </value>
<value> <string>my_date_time_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_doSelect</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_delivery_stop_date</string>
<string>listbox_destination_decision_language</string>
<string>listbox_causality_translated_portal_type</string>
<string>listbox_delivery_start_date</string>
<string>listbox_post_start_date_hidden</string>
<string>listbox_post_user</string>
<string>listbox_post_start_date</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_viewLastSupportRequestList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleOpportunityModule_viewSaleOpportunityList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Tickets</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,13 +10,13 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_causality_title</string> </value>
<value> <string>listbox_delivery_start_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -52,6 +52,10 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -71,22 +75,22 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_causality_title</string> </value>
<value> <string>my_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Origin</string> </value>
</item>
</dictionary>
</value>
</item>
......
......@@ -14,7 +14,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_price</string> </value>
<value> <string>listbox_delivery_stop_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -71,11 +71,11 @@
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_price</string> </value>
<value> <string>my_date_time_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
portal = context.getPortalObject()
# get the related Support Request, this should not be None
support_request_list = portal.portal_catalog(portal_type="Support Request", id=context.getId()) # with id keyword, this function will return a sequence data type which contains one element.
support_request_object = support_request_list[0].getObject()
# get the all HTML Posts which related to this Support Request
post_list = portal.portal_catalog(portal_type="HTML Post", strict_follow_up_uid=support_request_object.getUid()) # with id keyword, this function will return a sequence data type which contains one element.
post_list = sorted(post_list, key=lambda x:x.getStartDate(), reverse=False)
if post_list:
return post_list[0].Base_getOwnerTitle()
else:
return None
portal = context.getPortalObject()
sale_supply_list = portal.portal_catalog(portal_type="Sale Supply")
if project_id:
project_list = context.getPortalObject().portal_catalog(portal_type="Project", id=project_id)
else:
project_list = context.getPortalObject().portal_catalog(portal_type="Project", validation_state="validated")
project = project_list[0]
service_pairs = []
for sale_supply_obj in sale_supply_list:
sale_supply_lines = sale_supply_obj.contentValues(portal_type='Sale Supply Line')
if sale_supply_obj.getDestinationProjectValue().getTitle() == project.getTitle():
for supply_line in sale_supply_lines:
service_obj = supply_line.getResourceValue()
service_pairs.append((service_obj.getTitle(), service_obj.getId()))
result = [list(item) for item in set(service_pairs)]
if json_flag:
from json import dumps
return dumps(result)
return result
Support Request Module | fast_input
Support Request Module | officejs_support_request_view
Support Request Module | view_last_support_request
Support Request | officejs_support_request_view
\ No newline at end of file
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