Commit c1637dcd authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Add missing checkValidity/getContent/triggerSubmit methods.

parent 555356ce
...@@ -61,6 +61,16 @@ ...@@ -61,6 +61,16 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'})
.declareMethod('checkValidity', function () {
if (this.state.editable) {
return this.getDeclaredGadget('sub')
.push(function (gadget) {
return gadget.checkValidity();
}); });
}
return true;
}, {mutex: 'changestate'});
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.11788.48702.26146</string> </value> <value> <string>969.56695.26145.14506</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>1516702186.86</float> <float>1535383243.32</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -266,6 +266,10 @@ ...@@ -266,6 +266,10 @@
.allowPublicAcquisition("notifyValid", function () { .allowPublicAcquisition("notifyValid", function () {
return; return;
})
.declareMethod("checkValidity", function () {
return true;
}); });
}(window, document, rJS, RSVP, Handlebars, JSON)); }(window, document, rJS, RSVP, Handlebars, JSON));
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.13951.51856.38229</string> </value> <value> <string>970.6987.53119.54186</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>1505898245.04</float> <float>1536332923.27</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -82,6 +82,20 @@ ...@@ -82,6 +82,20 @@
.push(function (result) { .push(function (result) {
return result.getContent(); return result.getContent();
}); });
}, {mutex: 'changestate'})
.declareMethod("checkValidity", function () {
var gadget = this;
if (gadget.state.editable) {
return gadget.getDeclaredGadget(gadget.state.key)
.push(function (result) {
if (result.checkValidity !== undefined) {
return result.checkValidity();
}
return true;
});
}
return true;
}, {mutex: 'changestate'}); }, {mutex: 'changestate'});
}(window, rJS, document)); }(window, rJS, document));
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.300.34630.14250</string> </value> <value> <string>970.5118.62758.3362</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516703954.27</float> <float>1536223691.31</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -17,12 +17,21 @@ ...@@ -17,12 +17,21 @@
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
.onStateChange(function (modification_dict) { .onStateChange(function () {
var gadget = this; var gadget = this;
return this.getDeclaredGadget('image') return this.getDeclaredGadget('image')
.push(function (input) { .push(function (input) {
return input.render(gadget.state); return input.render(gadget.state);
}); });
})
.declareMethod('getContent', function () {
// An Image field never modifies a document
return {};
})
.declareMethod('checkValidity', function () {
return true;
}); });
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>954.42813.65502.45670</string> </value> <value> <string>969.56700.2469.47752</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1476691101.85</float> <float>1535383453.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -104,6 +104,9 @@ ...@@ -104,6 +104,9 @@
back_url: result_list[1] back_url: result_list[1]
}); });
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars, UriTemplate, calculatePageTitle, ensureArray)); }(window, rJS, RSVP, Handlebars, UriTemplate, calculatePageTitle, ensureArray));
\ No newline at end of file
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>superkato</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.29724.45106.17220</string> </value> <value> <string>970.5224.10569.36898</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523021357.19</float> <float>1536227065.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
back_url: result_list[1] back_url: result_list[1]
}); });
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars, UriTemplate, calculatePageTitle, ensureArray)); }(window, rJS, RSVP, Handlebars, UriTemplate, calculatePageTitle, ensureArray));
\ No newline at end of file
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>superkato</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.34409.25650.52155</string> </value> <value> <string>967.24634.17714.15001</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1522842712.42</float> <float>1536227193.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -100,5 +100,8 @@ ...@@ -100,5 +100,8 @@
language_url: url_list[1] language_url: url_list[1]
}); });
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery, Query)); }(window, rJS, RSVP, Handlebars, SimpleQuery, ComplexQuery, Query));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.41630.47523.21913</string> </value> <value> <string>968.45482.36373.28842</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530547227.39</float> <float>1536227205.49</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -106,6 +106,9 @@ ...@@ -106,6 +106,9 @@
language_url: url_list[1] language_url: url_list[1]
}); });
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars, URI)); }(window, rJS, RSVP, Handlebars, URI));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.41449.40135.358</string> </value> <value> <string>968.45482.36373.28842</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530537970.6</float> <float>1536227336.81</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.24634.17714.15001</string> </value> <value> <string>970.11296.28491.31965</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1526654723.98</float> <float>1536593428.43</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
return erp5_form.render(form_options); return erp5_form.render(form_options);
}); });
})
.declareMethod('triggerSubmit', function getContent() {
return;
}); });
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.11788.48702.26146</string> </value> <value> <string>965.241.13759.3805</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516351314.5</float> <float>1536323621.12</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -37,17 +37,14 @@ ...@@ -37,17 +37,14 @@
// Proxy methods to the child gadget // Proxy methods to the child gadget
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod('checkValidity', function checkValidity() { .declareMethod('checkValidity', function checkValidity() {
return this.getDeclaredGadget("erp5_form") return true;
.push(function (declared_gadget) { })
return declared_gadget.checkValidity();
});
}, {mutex: 'changestate'})
.declareMethod('getContent', function getContent() { .declareMethod('getContent', function getContent() {
return this.getDeclaredGadget("erp5_form") return {};
.push(function (declared_gadget) { })
return declared_gadget.getContent(); .declareMethod('triggerSubmit', function getContent() {
}); return;
}, {mutex: 'changestate'}) })
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.40859.56331.24132</string> </value> <value> <string>967.44748.35225.6109</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1526655183.34</float> <float>1536323414.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
.declareAcquiredMethod("getUrlForList", "getUrlForList") .declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareMethod('triggerSubmit', function () {
return;
})
.declareMethod('render', function renderHeader() { .declareMethod('render', function renderHeader() {
var gadget = this, var gadget = this,
select_list = ['translated_title', select_list = ['translated_title',
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.41228.46964.12441</string> </value> <value> <string>968.45482.36373.28842</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530545112.7</float> <float>1536323881.35</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -98,6 +98,9 @@ ...@@ -98,6 +98,9 @@
page_title: last_result_list[1] page_title: last_result_list[1]
}); });
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars, URI, calculatePageTitle)); }(window, rJS, RSVP, Handlebars, URI, calculatePageTitle));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>950.28780.17945.40857</string> </value> <value> <string>963.11788.48702.26146</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1460380844.66</float> <float>1536227214.96</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -146,5 +146,8 @@ ...@@ -146,5 +146,8 @@
} }
return gadget.notifySubmitted(); return gadget.notifySubmitted();
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars));
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.44437.7013.18449</string> </value> <value> <string>968.45482.36373.28842</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530715887.18</float> <float>1536227225.62</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -72,5 +72,8 @@ ...@@ -72,5 +72,8 @@
} }
}); });
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, UriTemplate, Handlebars)); }(window, rJS, UriTemplate, Handlebars));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.42609.37775.47428</string> </value> <value> <string>968.45482.36373.28842</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530605895.04</float> <float>1536227235.47</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -22,5 +22,8 @@ ...@@ -22,5 +22,8 @@
return gadget.redirect({command: 'display', return gadget.redirect({command: 'display',
options: {jio_key: jio_key}}); options: {jio_key: jio_key}});
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, URI)); }(window, rJS, URI));
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>968.44430.14790.1621</string> </value> <value> <string>968.45482.36373.28842</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1530715104.96</float> <float>1536227405.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -132,6 +132,16 @@ ...@@ -132,6 +132,16 @@
section_element.appendChild(section_container_element); section_element.appendChild(section_container_element);
}); });
})
.declareMethod('checkValidity', function checkValidity() {
return true;
})
.declareMethod('getContent', function getContent() {
return {};
})
.declareMethod('triggerSubmit', function getContent() {
return;
}); });
}(window, document, rJS, RSVP, URI)); }(window, document, rJS, RSVP, URI));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.58561.19908.14080</string> </value> <value> <string>968.5552.51560.44322</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1527668285.72</float> <float>1536323513.5</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -168,6 +168,9 @@ ...@@ -168,6 +168,9 @@
}; };
return gadget.updateHeader(dict); return gadget.updateHeader(dict);
}); });
})
.declareMethod("triggerSubmit", function () {
return;
}); });
}(window, rJS, RSVP, Handlebars, URI, calculatePageTitle, ensureArray)); }(window, rJS, RSVP, Handlebars, URI, calculatePageTitle, ensureArray));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.40488.36901.26163</string> </value> <value> <string>965.45005.21388.22067</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519115533.6</float> <float>1536227347.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -24,6 +24,15 @@ ...@@ -24,6 +24,15 @@
.push(function (input) { .push(function (input) {
return input.render(gadget.state); return input.render(gadget.state);
}); });
})
.declareMethod('getContent', function () {
// A readonly field never modifies a document
return {};
})
.declareMethod('checkValidity', function () {
return true;
}); });
}(window, rJS)); }(window, rJS));
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.40829.55479.20582</string> </value> <value> <string>967.44748.35225.6109</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1526653377.62</float> <float>1535383574.37</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -95,6 +95,9 @@ ...@@ -95,6 +95,9 @@
data[this.state.name] = ""; data[this.state.name] = "";
} }
return data; return data;
})
.declareMethod("checkValidity", function checkValidity() {
return true;
}); });
}(window, document, rJS, getFirstNonEmpty, isEmpty)); }(window, document, rJS, getFirstNonEmpty, isEmpty));
\ No newline at end of file
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>967.40821.39698.7918</string> </value> <value> <string>967.44748.35225.6109</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1526652886.57</float> <float>1536228266.13</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -204,6 +204,11 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/ ...@@ -204,6 +204,11 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
return result; return result;
} }
return {}; return {};
})
.declareMethod('checkValidity', function () {
// XXX How to implement this for editors?
return true;
}); });
}(window, rJS, RSVP, document, FileReader, Blob, }(window, rJS, RSVP, document, FileReader, Blob,
......
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