Commit 2e83d650 authored by Noah Brackenbury's avatar Noah Brackenbury

Merge branch 'master' of https://lab.nexedi.com/nexedi/erp5 into business_bot

parents 8d0de831 2eedf724
...@@ -23,4 +23,9 @@ ...@@ -23,4 +23,9 @@
position: relative; position: relative;
top: 100px; top: 100px;
width: 120px; width: 120px;
}
.gadget-content .ui-field-contain .bottom .first-line-buttons {
margin-top: 0;
margin-bottom: 20px;
} }
\ No newline at end of file
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.56640.36441.6519</string> </value> <value> <string>961.58280.64149.54152</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504536008.68</float> <float>1504625908.37</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -19,9 +19,13 @@ ...@@ -19,9 +19,13 @@
</head> </head>
<body> <body>
<form> <form>
<div style="text-align:center;"> <div class='ui-field-contain'>
<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 class='bottom'>
<input class='first-line-buttons' data-theme="b" data-inline="true" type="submit" data-i18n="[value]Submit New Support Request" value="Submit New Support Request" data-icon="check" />
<a id="generate-rss">Generate RSS</a>
</div>
</div> </div>
<div class='ui-field-contain'> <div class='ui-field-contain'>
<div class='left' style="height:50%; width:100%"> <div class='left' style="height:50%; width:100%">
<div class="ui-icon-spinner ui-btn-icon-notext first-loader graph-spinner"></div> <div class="ui-icon-spinner ui-btn-icon-notext first-loader graph-spinner"></div>
...@@ -33,10 +37,6 @@ ...@@ -33,10 +37,6 @@
<div id="wrap2" style="height:300px;"></div> <div id="wrap2" style="height:300px;"></div>
</div> </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="last"></div> <div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="last"></div>
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.56620.20048.26265</string> </value> <value> <string>961.57886.54821.53077</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504536228.02</float> <float>1504602240.34</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global document, window, Option, rJS, RSVP, loopEventListener*/ /*global document, window, Option, rJS, RSVP, loopEventListener*/
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 150 */
(function (window, rJS, RSVP, loopEventListener) { (function (window, rJS, RSVP, loopEventListener) {
"use strict"; "use strict";
...@@ -26,6 +26,53 @@ ...@@ -26,6 +26,53 @@
.allowPublicAcquisition("updateHeader", function () { .allowPublicAcquisition("updateHeader", function () {
return; return;
}) })
.declareMethod('getSearchCriteria', function (name, seriesName) {
var search_criteria, cur_mid_night = new Date(), days_2 = new Date(),
days_7 = new Date(), days_30 = new Date(), begin_date, end_date;
if (seriesName !== 'Support Request') {
// Situation 1: Search Support Request with date.
cur_mid_night.setHours(0, 0, 0, 0);
cur_mid_night.setDate(cur_mid_night.getDate() + 1);
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);
if (name === '< 2') {
begin_date = days_2;
cur_mid_night.setDate(cur_mid_night.getDate() + 1);
end_date = cur_mid_night;
} else if (name === '2-7') {
begin_date = days_7;
end_date = days_2;
} else if (name === '7-30') {
begin_date = days_30;
end_date = days_7;
} else {
begin_date = new Date(1970, 1, 1);
end_date = days_30;
}
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 {
// Situation 2: Search Support Request without date.
search_criteria = '( translated_simulation_state_title: "' + name + '")';
}
return search_criteria;
})
.allowPublicAcquisition("chartItemClick", function (params) {
var gadget = this;
return gadget.getDeclaredGadget("last")
.push(function () {
return gadget.getSearchCriteria(params[0][0], params[0][1])
.push(function (search_criteria) {
gadget.changeState({extended_search: search_criteria});
});
});
// method code
})
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -78,10 +125,10 @@ ...@@ -78,10 +125,10 @@
var bar_chart = document.getElementById("wrap1"), var bar_chart = document.getElementById("wrap1"),
pie_chart = document.getElementById("wrap2"), pie_chart = document.getElementById("wrap2"),
loader = document.getElementsByClassName("graph-spinner"); loader = document.getElementsByClassName("graph-spinner");
loader[0].style.display = "none"; loader[0].style.display = "none";
loader[1].style.display = "none"; loader[1].style.display = "none";
bar_chart.style.display = "block"; bar_chart.style.display = "block";
pie_chart.style.display = "block"; pie_chart.style.display = "block";
return result; return result;
}) })
.push(function (result_list) { .push(function (result_list) {
...@@ -93,7 +140,7 @@ ...@@ -93,7 +140,7 @@
data: [ data: [
{ {
value_dict: { value_dict: {
0: ["Less than 2 days", "2-7 days", "7-30 days", "More than 30 days"], 0: ["< 2", "2-7", "7-30", "> 30"],
1: [ 1: [
sp_data.le2.validated, sp_data.le2.validated,
sp_data['2to7'].validated, sp_data['2to7'].validated,
...@@ -107,7 +154,7 @@ ...@@ -107,7 +154,7 @@
}, },
{ {
value_dict: { value_dict: {
0: ["Less than 2 days", "2-7 days", "7-30 days", "More than 30 days"], 0: ["< 2", "2-7", "7-30", "> 30"],
1: [ 1: [
sp_data.le2.submitted, sp_data.le2.submitted,
sp_data['2to7'].submitted, sp_data['2to7'].submitted,
...@@ -121,7 +168,7 @@ ...@@ -121,7 +168,7 @@
}, },
{ {
value_dict: { value_dict: {
0: ["Less than 2 days", "2-7 days", "7-30 days", "More than 30 days"], 0: ["< 2", "2-7", "7-30", "> 30"],
1: [ 1: [
sp_data.le2.suspended, sp_data.le2.suspended,
sp_data['2to7'].suspended, sp_data['2to7'].suspended,
...@@ -132,20 +179,6 @@ ...@@ -132,20 +179,6 @@
colors: ['#c23531'], colors: ['#c23531'],
type: "bar", type: "bar",
title: "Suspended" title: "Suspended"
},
{
value_dict: {
0: ["Less than 2 days", "2-7 days", "7-30 days", "More than 30 days"],
1: [
sp_data.le2.invalidated,
sp_data['2to7'].invalidated,
sp_data['7to30'].invalidated,
sp_data.gt30.invalidated
]
},
colors: ['#2f4554'],
type: "bar",
title: "Closed"
} }
], ],
layout: { layout: {
...@@ -193,6 +226,22 @@ ...@@ -193,6 +226,22 @@
.onStateChange(function (modification_dict) { .onStateChange(function (modification_dict) {
var gadget = this, var gadget = this,
queue = new RSVP.Queue(); queue = new RSVP.Queue();
if (modification_dict.hasOwnProperty("extended_search")) {
// render the erp5 form
queue
.push(function () {
return gadget.getDeclaredGadget("last");
})
.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)});
});
}
if (modification_dict.hasOwnProperty("field_listbox_begin_from")) { if (modification_dict.hasOwnProperty("field_listbox_begin_from")) {
// render the erp5 form // render the erp5 form
queue queue
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.56789.36616.11144</string> </value> <value> <string>961.57878.63760.62037</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504536348.57</float> <float>1504601728.55</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<div id="file_upload_div"> <div id="file_upload_div">
<input value="" name="attachment" id="attachment" type="file" title="Upload"> <input value="" name="attachment" id="attachment" type="file" title="Upload">
</div> </div>
<input data-theme="b" data-inline="true" type="submit" data-i18n="[value]Reply" value="Reply" data-icon="check" /> <input data-theme="b" data-inline="true" type="submit" data-i18n="[value]Post Comment" value="Post Comment" data-icon="check" />
</form> </form>
</div> </div>
</body> </body>
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.56636.3721.3345</string> </value> <value> <string>961.56866.43597.46421</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504536429.08</float> <float>1504599826.73</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Reply"]</td> <td>//input[@data-i18n="[value]Post Comment"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Reply"]</td> <td>//input[@data-i18n="[value]Post Comment"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//input[@data-i18n='[value]Reply']</td> <td>//input[@data-i18n='[value]Post Comment']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Reply']</td> <td>//input[@data-i18n='[value]Post Comment']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
......
...@@ -141,7 +141,8 @@ class FormBoxEditor: ...@@ -141,7 +141,8 @@ class FormBoxEditor:
def edit(self, context): def edit(self, context):
if self.context_method_id: if self.context_method_id:
context = getattr(context, self.context_method_id) context = getattr(context, self.context_method_id)()
context.edit(**self.attr_dict) context.edit(**self.attr_dict)
for encapsulated_editor in self.editor_list: for encapsulated_editor in self.editor_list:
encapsulated_editor.edit(context) encapsulated_editor.edit(context)
......
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