Commit 32ca5e01 authored by Boxiang Sun's avatar Boxiang Sun

erp5_officejs_support_request_ui: New implementation.

parent 37a57752
#wrap1 iframe {
height: 100%;
}
#wrap2 iframe {
height: 100%;
}
#generate-rss {
padding: 8pt;
margin-top: 30pt;
margin-right: 12pt;
background-color: #FF6600;
color: #FFFFFF;
border-radius: 0.325em;
border-width: 1px;
border-style: solid;
min-width: 8em;
line-height: 1.5;
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Style" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<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_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<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>_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>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_erp5_page_homepage.css</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_supportrequest_homepage_css</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Style</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget SupportRequest Homepage CSS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<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>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</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>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1503496717.49</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.39463.33273.62822</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</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>1503504237.1</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>1503496597.54</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -17,8 +17,8 @@
<!-- custom script -->
<script src="gadget_erp5_page_homepage.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="gadget_erp5_pt_form_view_discussable.css">
<link rel="stylesheet" type="text/css" href="gadget_erp5_page_homepage.css">
</head>
<body>
<h1 style="font-size:2em;font-weight:bold;text-align:center">Customer Support Dashboard</h1>
......@@ -30,18 +30,18 @@
<div class='left' style="height:50%; width:80%">
<div id="wrap1" style="height:300px;"></div>
</div>
<div class='right' style="height:50%; width:80%">
<div id="wrap2" style="height:300px;"></div>
</div>
</div>
<div class='bottom'>
<a id="generate-rss">
Generate RSS
</a>
</div>
<div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="test"></div>
......
......@@ -66,9 +66,7 @@
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/erp5_officejs_support_request_ui_test_person_002</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -236,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.39192.36126.39662</string> </value>
<value> <string>961.39461.64521.8755</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1503481031.13</float>
<float>1503502469.82</float>
<string>UTC</string>
</tuple>
</state>
......
/*global document, window, Option, rJS, RSVP, Chart, loopEventListener*/
/*global document, window, Option, rJS, RSVP, Chart, loopEventListener, console*/
/*jslint nomen: true, indent: 2, maxerr: 150 */
(function (window, rJS, RSVP, loopEventListener) {
"use strict";
......@@ -26,25 +26,26 @@
.allowPublicAcquisition("updateHeader", function () {
return;
})
.declareMethod('getSearchCriteria', function(name, seriesName) {
.declareMethod('getSearchCriteria', function (name, seriesName) {
console.log("In getSearchCriteria");
var search_criteria;
console.log(name, seriesName);
if (seriesName != 'Support Request') {
var cur_mid_night = new Date();
if (seriesName !== 'Support Request') {
var cur_mid_night = new Date(), begin_date, end_date,
days_2 = new Date(), days_7 = new Date(), days_30 = new Date();
cur_mid_night.setHours(0, 0, 0, 0);
cur_mid_night.setDate(cur_mid_night.getDate() + 1);
var days_2 = new Date(), days_7 = new Date(), days_30 = new Date();
days_2.setDate(cur_mid_night.getDate() - 2);
days_7.setDate(cur_mid_night.getDate() - 7);
days_30.setDate(cur_mid_night.getDate() - 30);
days_2.setHours(0, 0, 0, 0);
days_7.setHours(0, 0, 0, 0);
days_30.setHours(0, 0, 0, 0);
var begin_date, end_date;
if (name === 'Less than 2 days') {
begin_date = days_2;
cur_mid_night.setDate(cur_mid_night.getDate() + 1);
end_date = cur_mid_night;
} else if (name === '2-7 days') {
begin_date = days_7;
......@@ -61,9 +62,8 @@
console.log(name);
console.log(end_date);
console.log(end_date.toISOString());
search_criteria = '( translated_simulation_state_title: "' + seriesName + '" AND modification_date: >= ' + begin_date.toISOString().slice(0,10) + ' AND modification_date: <= ' + end_date.toISOString().slice(0,10) + ' )';
}
else {
search_criteria = '( translated_simulation_state_title: "' + seriesName + '" AND modification_date: >= ' + begin_date.toISOString().slice(0, 10) + ' AND modification_date: < ' + end_date.toISOString().slice(0, 10) + ' )';
} else {
search_criteria = '( translated_simulation_state_title: "' + name + '")';
}
console.log("Search criteria: ", search_criteria);
......@@ -76,7 +76,7 @@
return gadget.getSearchCriteria(params[0][0], params[0][1])
.push(function (search_criteria) {
gadget.changeState({extended_search: search_criteria});
});
});
// method code
})
/////////////////////////////////////////////////////////////////
......@@ -88,16 +88,16 @@
return gadget.changeState({
render: true
})
.push(function () {
return gadget.updateHeader({
page_title: 'Support Requests Home Page'
});
})
.push(function () {
return gadget.changeState({
field_listbox_begin_from: options.field_listbox_begin_from
.push(function () {
return gadget.updateHeader({
page_title: 'Support Requests Home Page'
});
})
});
.push(function () {
return gadget.changeState({
field_listbox_begin_from: options.field_listbox_begin_from
});
});
})
.declareJob("renderGraph", function () {
var gadget = this,
......@@ -230,45 +230,44 @@
title: "Support Request activites"
}
}
}
);
});
});
})
.onStateChange(function (modification_dict) {
var gadget = this,
queue = new RSVP.Queue();
if (modification_dict.hasOwnProperty("extended_search")) {
// render the erp5 listbox
queue
.push(function () {
return gadget.getDeclaredGadget("test")
})
.push(function (result_list) {
var erp5_form = result_list,
tmp;
.push(function () {
return gadget.getDeclaredGadget("test");
})
.push(function (result_list) {
var erp5_form = result_list,
tmp;
tmp = JSON.parse(erp5_form.state.erp5_form);
tmp.extended_search = modification_dict.extended_search;
return erp5_form.changeState({erp5_form: JSON.stringify(tmp)});
});
tmp = JSON.parse(erp5_form.state.erp5_form);
tmp.extended_search = modification_dict.extended_search;
return erp5_form.changeState({erp5_form: JSON.stringify(tmp)});
});
}
if (modification_dict.hasOwnProperty("field_listbox_begin_from")) {
// render the erp5 listbox
queue
.push(function () {
return gadget.getDeclaredGadget("test")
})
.push(function (result_list) {
var erp5_form = result_list,
tmp;
.push(function () {
return gadget.getDeclaredGadget("test");
})
.push(function (result_list) {
var erp5_form = result_list,
tmp;
tmp = JSON.parse(erp5_form.state.erp5_form);
tmp.field_listbox_begin_from = modification_dict.field_listbox_begin_from;
return erp5_form.changeState({erp5_form: JSON.stringify(tmp)});
});
tmp = JSON.parse(erp5_form.state.erp5_form);
tmp.field_listbox_begin_from = modification_dict.field_listbox_begin_from;
return erp5_form.changeState({erp5_form: JSON.stringify(tmp)});
});
}
if (modification_dict.hasOwnProperty("render")) {
queue
......@@ -285,11 +284,11 @@
view_list = erp5_document._links.action_object_view || [],
test_href;
//last_href;
if (view_list.constructor !== Array) {
view_list = [view_list];
}
for (i = 0; i < view_list.length; i += 1) {
/*
if (view_list[i].name === 'view_last_support_request') {
......@@ -300,7 +299,7 @@
test_href = view_list[i].href;
}
}
if (test_href === undefined) {
throw new Error('Cant find the list document view');
}
......@@ -316,7 +315,7 @@
jio_key: "support_request_module",
view: test_href
}),
gadget.renderGraph(), //Launched as service, not blocking
gadget.renderGraph() //Launched as service, not blocking
]);
});
}
......@@ -325,8 +324,7 @@
console.log(error);
});
return queue;
//})
//})
})
.declareService(function () {
var gadget = this;
......@@ -337,20 +335,19 @@
return gadget.getSetting("hateoas_url")
.push(function (hateoas_url) {
return gadget.jio_getAttachment(
'support_request_module',
hateoas_url + 'support_request_module'
+ "/SupportRequestModule_getRSSWithToken"
)
.push(function (result) {
rss_button.href = result.restricted_access_url;
rss_button.innerHTML = "RSS Link";
rss_button.target = "_blank";
})
})
'support_request_module',
hateoas_url + 'support_request_module'
+ "/SupportRequestModule_getRSSLinkAsJson"
)
.push(function (result) {
rss_button.href = result.restricted_access_url;
rss_button.innerHTML = "RSS Link";
rss_button.target = "_blank";
});
});
}
click_event.returnValue = true;
}
// Listen to form submit
return loopEventListener(
gadget.element.querySelector("#generate-rss"),
......@@ -386,8 +383,7 @@
}
}, false, false)
.onEvent('submit', function () {
var curElement = document.activeElement;
var gadget = this;
var curElement = document.activeElement, gadget = this;
if (curElement.name === 'restore') {
console.log("Restore button cliked!");
} else if (curElement.name === 'create') {
......
......@@ -66,9 +66,7 @@
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/erp5_officejs_support_request_ui_test_person_002</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -238,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.39351.42999.18875</string> </value>
<value> <string>961.39594.58186.7577</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1503490171.57</float>
<float>1503504898.37</float>
<string>UTC</string>
</tuple>
</state>
......
hr#post_item {
border-color: #0E81C2;
}
#wrap1 iframe {
height: 100%;
}
#wrap2 iframe {
height: 100%;
}
#generate-rss {
padding: 8pt;
margin-top: 30pt;
margin-right: 12pt;
background-color: #FF6600;
color: #FFFFFF;
border-radius: 0.325em;
border-width: 1px;
border-style: solid;
min-width: 8em;
line-height: 1.5;
}
\ No newline at end of file
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.38112.35462.38963</string> </value>
<value> <string>961.39462.18361.64392</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1503418576.4</float>
<float>1503496700.14</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequest_getNexediJSLink</string> </value>
<value> <string>SupportRequestModule_getRSSLinkAsJson</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -438,16 +438,7 @@
<item>
<key> <string>sort_columns</string> </key>
<value>
<list>
<tuple>
<string>post_start_date_hidden</string>
<string>Comment Date</string>
</tuple>
<tuple>
<string>post_start_date</string>
<string>Comment Date</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
......
......@@ -116,7 +116,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.SupportRequest_getNexediJSLink()</string> </value>
<value> <string>python: cell.SupportRequest_getSupportRequestLink()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_getRSSWithToken</string> </value>
<value> <string>SupportRequest_getSupportRequestLink</string> </value>
</item>
</dictionary>
</pickle>
......
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