Commit 76aa17d4 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_travel_expense: manually synchronize data

synchronize automatically data block web site
parent 1ac975cf
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
gadget.options = options; gadget.options = options;
if (!options.can_add_discussion) {
return;
}
return gadget.allDocs({ return gadget.allDocs({
query: 'portal_type: Person' , query: 'portal_type: Person' ,
select_list: ['first_name', 'last_name'], select_list: ['first_name', 'last_name'],
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.40065.53190.1553</string> </value> <value> <string>956.54664.34823.8977</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>1484312482.87</float> <float>1485180096.34</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -327,10 +327,6 @@ ...@@ -327,10 +327,6 @@
database: gadget.state_parameter_dict.jio_storage.__storage._signature_hash database: gadget.state_parameter_dict.jio_storage.__storage._signature_hash
}); });
gadget.state_parameter_dict.jio_storage.__storage._signature_sub_storage.__storage._sub_storage = gadget.state_parameter_dict.jio_storage.__storage._local_sub_storage; gadget.state_parameter_dict.jio_storage.__storage._signature_sub_storage.__storage._sub_storage = gadget.state_parameter_dict.jio_storage.__storage._local_sub_storage;
return gadget.setSetting('user_title', '')
.push(function () {
return wrapJioCall(gadget, 'repair');
});
}); });
}) })
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.46157.19522.56490</string> </value> <value> <string>956.48987.17944.33809</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1484839396.38</float> <float>1485178892.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -16,6 +16,20 @@ ...@@ -16,6 +16,20 @@
<body> <body>
<article class="ui-body-c document-access"> <article class="ui-body-c document-access">
<section class="ui-body-c ui-content-section">
<div class="ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-b ui-responsive">
<div class="ui-block-a">
<form class="synchro-form view-web-page-form">
<button type="submit" data-i18n="Send & Receive" data-theme="c" class=" ui-btn ui-btn-c ui-shadow ui-corner-all">Send & Receive</button>
<span>Last Synchronization Date:</span>
<span class="last_sync_date"></span>
</form>
</div>
</div>
</section>
<section class=""> <section class="">
<h3 class="ui-body-c"> <h3 class="ui-body-c">
<span class="ui-icon ui-icon-custom ui-icon-plus">&nbsp;</span> <span class="ui-icon ui-icon-custom ui-icon-plus">&nbsp;</span>
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.40408.63388.54664</string> </value> <value> <string>956.54718.44080.11008</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>1484325943.14</float> <float>1485187816.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -34,7 +34,10 @@ ...@@ -34,7 +34,10 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting') .declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('setSetting', 'setSetting')
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("repair", "jio_repair")
.declareAcquiredMethod("reload", "reload")
.allowPublicAcquisition("jio_allDocs", function (param_list) { .allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this; var gadget = this;
return this.jio_allDocs.apply(this, param_list) return this.jio_allDocs.apply(this, param_list)
...@@ -59,6 +62,10 @@ ...@@ -59,6 +62,10 @@
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.getSetting('last_sync_date');
})
.push(function (result) {
gadget.props.element.querySelector('.last_sync_date').innerHTML = result || 'not synchronize yet';
gadget.props.portal_type = "Expense Record"; gadget.props.portal_type = "Expense Record";
gadget.props.document_title_plural = "Expense Requests"; gadget.props.document_title_plural = "Expense Requests";
return RSVP.all([ return RSVP.all([
...@@ -133,6 +140,26 @@ ...@@ -133,6 +140,26 @@
]); ]);
}); });
})
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return loopEventListener(
gadget.props.element.querySelector('form.synchro-form'),
'submit',
false,
function () {
gadget.props.element.querySelector("button").disabled = true;
return gadget.repair()
.push(function () {
return gadget.setSetting('last_sync_date', new Date().toLocaleString());
})
.push(function () {
return gadget.reload();
});
});
});
}); });
}(window, RSVP, rJS)); }(window, RSVP, rJS));
\ No newline at end of file
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.40380.9203.49100</string> </value> <value> <string>956.54730.11019.41386</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1484323000.68</float> <float>1485187819.16</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<li><a href="#page=localisation" data-i18n="localisation">localisation</a></li> <li><a href="#page=localisation" data-i18n="localisation">localisation</a></li>
<li><a href="#page=expense_report" data-i18n="Reports">Reports</a></li> <li><a href="#page=expense_report" data-i18n="Reports">Reports</a></li>
<!-- li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li --> <!-- li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li -->
<!-- li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li --> <li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li>
</ul> </ul>
</div> </div>
</script> </script>
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.44329.14852.21316</string> </value> <value> <string>956.47536.31130.48230</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1484752348.45</float> <float>1485178390.73</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
} }
} }
html article section.ui-content-section form { html .document-access section.ui-content-section form:not(.synchro-form) {
display: none; display: none;
} }
html .ui-content-section { html .document-access .ui-content-section {
box-shadow: none; box-shadow: none;
border: none; border: none;
margin: 0.1em auto; margin: 0.1em auto;
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.46088.59015.55244</string> </value> <value> <string>956.54681.27023.32750</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>1484739474.04</float> <float>1485181045.01</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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