Commit 534d0f8f authored by Romain Courteaud's avatar Romain Courteaud

[erp5_officejs_afs_directory] wip from sven

parent 933968f0
/*
-------------------------------------------------------------------------
----------------------------- Dygraph -----------------------------------
-------------------------------------------------------------------------
*/
body .dygraph-legend {
left: 15%;
top: 5%;
}
body .dygraph-legend > span {
display: block;
}
/*
-------------------------------------------------------------------------
----------------------------- Masonry -----------------------------------
-------------------------------------------------------------------------
*/
.ui-masonry-container {
margin-top: -5em;
margin-top: -5em;
}
.ui-masonry-container > ul {
margin: 1.5em 0;
......@@ -156,15 +169,15 @@
position: relative;
}
.custom-software-profile-image-wrapper img {
max-height: 100%;
max-width: 100%;
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
padding: .25em;
-moz-box-sizing: border-box;
......@@ -173,7 +186,7 @@
}
@media (max-width: 40em) {
.custom-software-profile-image-wrapper {
margin: 0 auto;
margin: 0 auto;
}
}
......@@ -292,15 +305,15 @@
padding-top: 80vh;
}
.ui-banner-section img {
/* max-height: 100%; */
max-width: 100%;
/* max-height: 100%; */
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
z-index: -1;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.6));
......@@ -366,6 +379,13 @@ div[data-gadget-scope='header'] .ui-header {
.document_table table tbody tr th:not(:first-child) {
text-align: right;
}
/* break lines... hacky */
.financial_listbox .document_table tbody tr td:not(:first-of-type) a {
display: table-caption;
text-align: left;
padding: 0;
margin: 0;
}
/* align header and background colors */
div[data-gadget-scope='header'] .ui-header .ui-controlgroup-controls button, div[data-gadget-scope='header'] .ui-header .ui-controlgroup-controls a,
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.5598.40843.32341</string> </value>
<value> <string>978.16964.29769.38041</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1543942098.55</float>
<float>1567784050.59</float>
<string>UTC</string>
</tuple>
</state>
......
<!Doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Graph</title>
<link rel="stylesheet" href="dygraph.css" />
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="dygraph.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_afs_dygraph.js" type="text/javascript"></script>
</head>
<body>
<div class="dygraph-multibar dygraph-fullsize-chart chart"></div>
</body>
</html>
\ No newline at end of file
/*globals window, RSVP, rJS, Dygraph, Date, Object*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS, Dygraph, Date, Object) {
"use strict";
// Darken a color
function darkenColor(colorStr) {
// Defined in dygraph-utils.js
var color = Dygraph.toRGB_(colorStr);
color.r = Math.floor((255 + color.r) / 2);
color.g = Math.floor((255 + color.g) / 2);
color.b = Math.floor((255 + color.b) / 2);
return 'rgb(' + color.r + ',' + color.g + ',' + color.b + ')';
}
function multiColumnBarPlotter(e) {
var g,
ctx,
set,
y_bottom,
min_sep,
j,
points,
sep,
sets,
bar_width,
fillColors,
strokeColors,
i,
k,
l,
m,
p,
center_x,
x_left;
if (e.seriesIndex !== 0) {
return;
}
g = e.dygraph;
ctx = e.drawingContext;
sets = e.allSeriesPoints;
y_bottom = e.dygraph.toDomYCoord(0);
min_sep = Infinity;
// Find the minimum separation between x-values.
// This determines the bar width.
for (j = 0; j < sets.length; j += 1) {
points = sets[j];
for (i = 1; i < points.length; i++) {
sep = points[i].canvasx - points[i - 1].canvasx;
if (sep < min_sep) {
min_sep = sep;
}
}
}
bar_width = Math.floor(2.0 / 3 * min_sep);
fillColors = [];
strokeColors = g.getColors();
for (m = 0; m < strokeColors.length; m += 1) {
fillColors.push(darkenColor(strokeColors[m]));
}
for (k = 0; k < sets.length; k += 1) {
ctx.fillStyle = fillColors[k];
ctx.strokeStyle = strokeColors[k];
for (l = 0; l < sets[k].length; l += 1) {
p = sets[k][l];
center_x = p.canvasx;
x_left = center_x - (bar_width / 2) * (1 - k / (sets.length - 1));
ctx.fillRect(
x_left,
p.canvasy,
bar_width / sets.length,
y_bottom - p.canvasy
);
ctx.strokeRect(
x_left,
p.canvasy,
bar_width / sets.length,
y_bottom - p.canvasy
);
}
}
}
function prepDataSet(my_data) {
return Object.keys(my_data).map(function (year) {
var reported_year = my_data[year];
return [
new Date(year + "/6/30"),
reported_year.total_assets.value,
reported_year.revenues.value,
reported_year.earnings.value,
reported_year.staff.value
];
});
}
function getElem(my_element, my_selector) {
return my_element.querySelector(my_selector);
}
rJS(window)
.ready(function (gadget) {
gadget.property_dict = {
"graph_wrapper": getElem(gadget.element, ".dygraph-multibar"),
"graph": null,
"deferred": new RSVP.defer()
};
// disable zoom
Dygraph.prototype.doZoomY_ = function () {
return;
};
Dygraph.prototype.doZoomX_ = function () {
return;
};
})
.declareMethod("render", function (options) {
var gadget = this,
dict = gadget.property_dict;
return dict.deferred.resolve(options.data);
})
.declareService(function () {
var gadget = this,
dict = gadget.property_dict;
return new RSVP.Queue()
.push(function () {
return dict.deferred.promise;
})
.push(function (my_data) {
dict.graph = new Dygraph(
dict.graph_wrapper,
prepDataSet(my_data),
{
dateWindow: [ Date.parse("2016/01/01"), Date.parse("2019/01/01")],
legend: 'always',
drawPoints: true,
title: 'Aggregate Financial Performance',
width: "auto",
height: 720,
maxNumberWidth: 20,
includeZero: true,
plotter: multiColumnBarPlotter,
axes : {
x : {
axisLabelFormatter: function (d) {
return d.getFullYear();
},
valueFormatter: function (ms) {
return new Date(ms).getFullYear();
}
},
y: {
axisLabelWidth: 100
},
y2: {
labelsKMB: true,
axisLabelWidth: 100,
independentTicks: true
}
},
labels: ["Year", "Total Assets", "Revenues", "Earnings", "Staff"],
series: {
"Staff": {
axis: "y2"
}
}
}
);
return;
});
});
}(window, RSVP, rJS, Dygraph, Date, Object));
\ No newline at end of file
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45138.58632.4420</string> </value>
<value> <string>978.16910.53194.19217</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496066128.63</float>
<float>1567783876.42</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -35,6 +35,7 @@
<li class="ui-first-child"><a href="{{directory_href}}" class="ui-btn ui-btn-icon-left ui-icon-table" data-i18n="Directory" accesskey="d">Directory</a></li>
<li><a href="{{publisher_statistic_href}}" class="ui.btn ui-btn-icon-left ui-icon-trophy" data-i18n="Statistics" accesskey="t">Statistics</a></li>
<li><a href="{{publisher_href}}" class="ui-btn ui-btn-icon-left ui-icon-university" data-i18n="Publishers" accesskey="a">Publishers</a></li>
<li><a href="{{financial_href}}" class="ui-btn ui-btn-icon-left ui-icon-euro" data-i18n="Financial Data" accesskey="f">Financial Data</a></li>
<li><a href="{{software_href}}" class="ui-btn ui-btn-icon-left ui-icon-cube" data-i18n="Software Products" accesskey="p">Software Products</a></li>
<li class="ui-last-child"><a href="{{success_case_href}}" class="ui-btn ui-btn-icon-left ui-icon-book" data-i18n="Success Cases" accesskey="s">Success Cases</a></li>
<!--div>
......@@ -76,6 +77,6 @@
<body>
<div class="jqm-navmenu-panel"></div>
</body>
</html>
\ No newline at end of file
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.5621.1286.50961</string> </value>
<value> <string>978.15382.2883.35259</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1544004551.94</float>
<float>1567689173.22</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -52,7 +52,8 @@
g.getUrlFor({command: 'display', options: {page: "afs_publisher_statistic"}}),
g.getUrlFor({command: 'display', options: {page: "afs_publisher_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_software_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_success_case_list"}})
g.getUrlFor({command: 'display', options: {page: "afs_success_case_list"}}),
g.getUrlFor({command: 'display', options: {page: "afs_financial_list"}})
]);
})
.push(function (all_result) {
......@@ -63,6 +64,7 @@
"directory_href": all_result[0],
"publisher_statistic_href": all_result[1],
"publisher_href": all_result[2],
"financial_href": all_result[5],
"software_href": all_result[3],
"success_case_href": all_result[4]
});
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.45262.19816.34594</string> </value>
<value> <string>978.13614.57660.49134</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1496066838.57</float>
<float>1567689087.36</float>
<string>UTC</string>
</tuple>
</state>
......
<!Doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Financial Data</title>
<link rel="stylesheet" href="gadget_erp5_afs.css" />
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_page_afs_financial_list.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_afs_dygraph.html"
data-gadget-scope="dygraph"
data-gadget-sandbox="public">
</div>
<div data-gadget-url="gadget_erp5_pt_form_list.html"
data-gadget-scope="form_list"
data-gadget-sandbox="public">
</div>
</body>
</html>
\ No newline at end of file
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) {
"use strict";
rJS(window)
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition('updateHeader', function () {
return;
})
.allowPublicAcquisition('getUrlParameter', function (argument_list) {
return this.getUrlParameter(argument_list)
.push(function (result) {
if ((result === undefined) &&
(argument_list[0] === 'field_listbox_sort_list:json')) {
return [['title', 'ascending']];
}
return result;
});
})
.declareMethod("render", function () {
var gadget = this,
kpi_data;
return gadget.updateHeader({page_title: "Financial Data"})
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget("dygraph"),
gadget.getDeclaredGadget("form_list"),
gadget.jio_allDocs({
query: 'portal_type: "kpi"',
select_list: ['data']
})
]);
})
.push(function (response_list) {
var column_list = [
//['logo', 'Logo'],
['title', 'Title'],
['staff', 'Staff'],
['total_assets', 'Total Assets'],
['revenues', 'Revenues'],
['earnings', 'Earnings']
];
return RSVP.all([
response_list[0].render({
data: response_list[2].data.rows[0].value.data
}),
response_list[1].render({
erp5_document: {
"_embedded": {
"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"key": "field_listbox",
"lines": 20,
"css_class": "financial_listbox",
"list_method": "portal_catalog",
"query": 'urn:jio:allDocs?query=' + 'portal_type:' +
'"publisher"',
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort_on": ["title", "ascending"],
"title": "Documents",
"type": "ListBox"
}
}
},
"_links": {"type": { name: ""}}
},
form_definition: {
group_list: [
[
"bottom",
[["listbox"]]
],
[
"hidden",
["listbox_modification_date"]
]
]
}
})
]);
});
});
}(window, RSVP, rJS));
\ No newline at end of file
......@@ -337,7 +337,7 @@
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; img-src \'self\' https://images.unsplash.com * data:; media-src \'self\' blob:; connect-src \'self\' https://api.unsplash.com https://en.wikipedia.org https://fr.wikipedia.org https://raw.githubusercontent.com https://api.github.com data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' data:; frame-src \'self\' data:</string> </value>
<value> <string>default-src \'self\'; img-src \'self\' https://images.unsplash.com * data:; media-src \'self\' blob:; connect-src \'self\' https://api.unsplash.com https://en.wikipedia.org https://fr.wikipedia.org https://raw.githubusercontent.com https://api.github.com data:; script-src \'self\' \'unsafe-eval\'; font-src \'self\'; style-src \'self\' \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
</item>
<item>
<key> <string>configuration_default_view_action_reference</string> </key>
......@@ -600,7 +600,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>3</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -614,7 +614,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>959.30886.17996.5358</string> </value>
<value> <string>978.15528.13706.25002</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -632,7 +632,7 @@
</tuple>
<state>
<tuple>
<float>1495226845.13</float>
<float>1567697804.89</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -245,6 +245,31 @@
<td>//div[contains(@class, 'custom-success-story-image-wrapper')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Financial Data']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(@class, 'ui-icon-euro')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, 'dygraph-title')]</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Aggregate Financial Performance</td>
<td></td>
</tr>
</tbody></table>
</body>
......
/**
* Default styles for the dygraphs charting library.
*/
.dygraph-legend {
position: absolute;
font-size: 14px;
z-index: 10;
width: 250px; /* labelsDivWidth */
/*
dygraphs determines these based on the presence of chart labels.
It might make more sense to create a wrapper div around the chart proper.
top: 0px;
right: 2px;
*/
background: white;
line-height: normal;
text-align: left;
overflow: hidden;
}
/* styles for a solid line in the legend */
.dygraph-legend-line {
display: inline-block;
position: relative;
bottom: .5ex;
padding-left: 1em;
height: 1px;
border-bottom-width: 2px;
border-bottom-style: solid;
/* border-bottom-color is set based on the series color */
}
/* styles for a dashed line in the legend, e.g. when strokePattern is set */
.dygraph-legend-dash {
display: inline-block;
position: relative;
bottom: .5ex;
height: 1px;
border-bottom-width: 2px;
border-bottom-style: solid;
/* border-bottom-color is set based on the series color */
/* margin-right is set based on the stroke pattern */
/* padding-left is set based on the stroke pattern */
}
.dygraph-roller {
position: absolute;
z-index: 10;
}
/* This class is shared by all annotations, including those with icons */
.dygraph-annotation {
position: absolute;
z-index: 10;
overflow: hidden;
}
/* This class only applies to annotations without icons */
/* Old class name: .dygraphDefaultAnnotation */
.dygraph-default-annotation {
border: 1px solid black;
background-color: white;
text-align: center;
}
.dygraph-axis-label {
/* position: absolute; */
/* font-size: 14px; */
z-index: 10;
line-height: normal;
overflow: hidden;
color: black; /* replaces old axisLabelColor option */
}
.dygraph-axis-label-x {
}
.dygraph-axis-label-y {
}
.dygraph-axis-label-y2 {
}
.dygraph-title {
font-weight: bold;
z-index: 10;
text-align: center;
/* font-size: based on titleHeight option */
}
.dygraph-xlabel {
text-align: center;
/* font-size: based on xLabelHeight option */
}
/* For y-axis label */
.dygraph-label-rotate-left {
text-align: center;
/* See http://caniuse.com/#feat=transforms2d */
transform: rotate(90deg);
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
}
/* For y2-axis label */
.dygraph-label-rotate-right {
text-align: center;
/* See http://caniuse.com/#feat=transforms2d */
transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
}
\ No newline at end of file
......@@ -73,9 +73,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<value> <string>Version 2.1.0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......@@ -97,7 +95,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Dygraph</string> </value>
<value> <string>Dygraph JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -134,6 +132,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>
......@@ -155,7 +159,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>superseb</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -177,7 +181,7 @@
</tuple>
<state>
<tuple>
<float>1490781708.05</float>
<float>1567690543.21</float>
<string>UTC</string>
</tuple>
</state>
......@@ -208,7 +212,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>superseb</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -222,7 +226,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.21273.52560.22391</string> </value>
<value> <string>978.15406.43543.58828</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -240,7 +244,64 @@
</tuple>
<state>
<tuple>
<float>1490878686.29</float>
<float>1567690486.25</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>1567690414.24</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