Commit dbece842 authored by Tomáš Peterka's avatar Tomáš Peterka

ce est ca

parent 444fadf1
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>action_type/object_action</string> <string>action_type/object_jio_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_jio_action</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>action_type/object_action</string> <string>action_type/object_jio_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_jio_action</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -29,6 +29,15 @@ ...@@ -29,6 +29,15 @@
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>ledger/accounting/general</string>
<string>ledger/accounting/detailed</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <string>organisation_icon.gif</string> </value> <value> <string>organisation_icon.gif</string> </value>
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <string>transaction_icon.gif</string> </value> <value> <string>transaction_icon.gif</string> </value>
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <string>organisation_icon.gif</string> </value> <value> <string>organisation_icon.gif</string> </value>
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <string>organisation_icon.gif</string> </value> <value> <string>organisation_icon.gif</string> </value>
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <string>organisation_icon.gif</string> </value> <value> <string>organisation_icon.gif</string> </value>
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<key> <string>acquire_local_roles</string> </key> <key> <string>acquire_local_roles</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <string>organisation_icon.gif</string> </value> <value> <string>organisation_icon.gif</string> </value>
......
...@@ -69,10 +69,6 @@ ...@@ -69,10 +69,6 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Printing format</string> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>your_format</string> </value> <value> <string>your_format</string> </value>
...@@ -85,10 +81,6 @@ ...@@ -85,10 +81,6 @@
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Format</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
"""Total balance of all accounting transactions having this """Total balance of all accounting transactions having this
account as node account as node
""" """
kw['node_uid'] = context.getUid() kw.update(
node_uid=context.getUid(),
selection_name=selection_name
)
return context.Node_statAccountingBalance(**kw) return context.Node_statAccountingBalance(**kw)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
"""Total credit of all accounting transactions having this """Total credit of all accounting transactions having this
account as node account as a node
""" """
kw['node_uid'] = context.getUid() kw.update(
kw['omit_asset_increase'] = 1 node_uid = context.getUid(),
kw.update(kw['selection'].getParams()) omit_asset_increase = 1,
selection_name=selection_name
)
# force second update to overwrite anything by selection params
if selection_name is not None:
kw.update(
**context.getPortalObject().portal_selections.getSelectionParamsFor(selection_name))
elif "selection" in kw:
# note that passing selection object via parameters is obsolete
kw.update(kw['selection'].getParams())
# here, or 0 is to prevent displaying "- 0" # here, or 0 is to prevent displaying "- 0"
return - context.Node_statAccountingBalance(**kw) or 0 return - context.Node_statAccountingBalance(**kw) or 0
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
"""Total debit of all accounting transactions having this """Total debit of all accounting transactions having this
account as a node account as a node
""" """
kw['node_uid'] = context.getUid()
kw['omit_asset_decrease'] = 1 kw.update(
kw.update(kw['selection'].getParams()) node_uid=context.getUid(),
omit_asset_decrease=1,
selection_name=selection_name
)
# force second update to overwrite anything by selection params
if selection_name is not None:
kw.update(
**context.getPortalObject().portal_selections.getSelectionParamsFor(selection_name))
elif "selection" in kw:
# note that passing selection object via parameters is obsolete
kw.update(kw['selection'].getParams())
return context.Node_statAccountingBalance(**kw) return context.Node_statAccountingBalance(**kw)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>uid</string> </value> <value> <string>relative_url</string> </value>
</item> </item>
<item> <item>
<key> <string>null</string> </key> <key> <string>null</string> </key>
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
</item> </item>
<item> <item>
<key> <string>type</string> </key> <key> <string>type</string> </key>
<value> <string>i</string> </value> <value> <string>t</string> </value>
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>width</string> </key>
<value> <int>11</int> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
<dictionary> <dictionary>
...@@ -51,7 +51,61 @@ ...@@ -51,7 +51,61 @@
</item> </item>
<item> <item>
<key> <string>width</string> </key> <key> <string>width</string> </key>
<value> <int>50</int> </value> <value> <int>0</int> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>name</string> </key>
<value> <string>title</string> </value>
</item>
<item>
<key> <string>null</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>t</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>name</string> </key>
<value> <string>portal_type</string> </value>
</item>
<item>
<key> <string>null</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>t</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>name</string> </key>
<value> <string>validation_state</string> </value>
</item>
<item>
<key> <string>null</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>t</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</list> </list>
......
...@@ -35,8 +35,9 @@ for obj in object_list: ...@@ -35,8 +35,9 @@ for obj in object_list:
if not activated: if not activated:
return context.Base_redirect(form_id, return context.Base_redirect(form_id,
keep_items=dict(portal_status_message= keep_items={
translateString('No valid transaction in your selection.'))) "portal_status_message": translateString(
'No valid transaction in your selection.')})
# activate something on the folder # activate something on the folder
context.activate(after_tag=tag).getTitle() context.activate(after_tag=tag).getTitle()
......
...@@ -154,6 +154,10 @@ ...@@ -154,6 +154,10 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
......
...@@ -4,4 +4,6 @@ bank account as payment node ...@@ -4,4 +4,6 @@ bank account as payment node
kw['payment_uid'] = context.getUid() kw['payment_uid'] = context.getUid()
kw['asset_price'] = False kw['asset_price'] = False
kw['node_category'] = 'account_type/asset/cash/bank' kw['node_category'] = 'account_type/asset/cash/bank'
kw['selection_name'] = selection_name
return context.Node_statAccountingBalance(**kw) return context.Node_statAccountingBalance(**kw)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -5,7 +5,14 @@ kw['payment_uid'] = context.getUid() ...@@ -5,7 +5,14 @@ kw['payment_uid'] = context.getUid()
kw['omit_asset_increase'] = 1 kw['omit_asset_increase'] = 1
kw['asset_price'] = False kw['asset_price'] = False
kw['node_category'] = 'account_type/asset/cash/bank' kw['node_category'] = 'account_type/asset/cash/bank'
kw.update(kw['selection'].getParams()) kw['selection_name'] = selection_name
if selection_name is not None:
kw.update(
**context.getPortalObject().portal_selections.getSelectionParamsFor(selection_name))
elif "selection" in kw:
# note that passing selection object via parameters is obsolete
kw.update(kw['selection'].getParams())
# here, or 0 is to prevent displaying "- 0" # here, or 0 is to prevent displaying "- 0"
return - context.Node_statAccountingBalance(**kw) or 0 return - context.Node_statAccountingBalance(**kw) or 0
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -5,6 +5,13 @@ kw['payment_uid'] = context.getUid() ...@@ -5,6 +5,13 @@ kw['payment_uid'] = context.getUid()
kw['omit_asset_decrease'] = 1 kw['omit_asset_decrease'] = 1
kw['asset_price'] = False kw['asset_price'] = False
kw['node_category'] = 'account_type/asset/cash/bank' kw['node_category'] = 'account_type/asset/cash/bank'
kw.update(kw['selection'].getParams()) kw['selection_name'] = selection_name
if selection_name is not None:
kw.update(
**context.getPortalObject().portal_selections.getSelectionParamsFor(selection_name))
elif "selection" in kw:
# note that passing selection object via parameters is obsolete
kw.update(kw['selection'].getParams())
return context.Node_statAccountingBalance(**kw) return context.Node_statAccountingBalance(**kw)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
"""Returns Accounting Transactions where this entity is mirror section. """Returns Accounting Transactions where this entity is mirror section.
""" """
kw['mirror_section_uid'] = context.getUid() kw.update(
kw['node_category_strict_membership'] = ['account_type/asset/receivable', # following two lines are the reason for this whole script to exist
'account_type/liability/payable'] mirror_section_uid=context.getUid(),
node_category_strict_membership=['account_type/asset/receivable',
'account_type/liability/payable'],
# the rest is to explicitely state which parameters are needed
sort_on=sort_on,
selection_name=selection_name,
)
return context.Node_getAccountingTransactionList(**kw) return context.Node_getAccountingTransactionList(**kw)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name=\'\', sort_on=(), **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -6,7 +6,8 @@ kw['mirror_section_uid'] = context.getUid() ...@@ -6,7 +6,8 @@ kw['mirror_section_uid'] = context.getUid()
kw['omit_asset_increase'] = 1 kw['omit_asset_increase'] = 1
kw['node_category_strict_membership'] = ['account_type/asset/receivable', kw['node_category_strict_membership'] = ['account_type/asset/receivable',
'account_type/liability/payable'] 'account_type/liability/payable']
kw.update(kw['selection'].getParams()) kw.update(
**context.getPortalObject().portal_selections.getSelectionParamsFor(selection_name, REQUEST=kw.get('REQUEST', None)))
# here, or 0 is to prevent displaying "- 0" # here, or 0 is to prevent displaying "- 0"
return - context.Node_statAccountingBalance(**kw) or 0 return - context.Node_statAccountingBalance(**kw) or 0
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -5,6 +5,8 @@ kw['mirror_section_uid'] = context.getUid() ...@@ -5,6 +5,8 @@ kw['mirror_section_uid'] = context.getUid()
kw['omit_asset_decrease'] = 1 kw['omit_asset_decrease'] = 1
kw['node_category_strict_membership'] = ['account_type/asset/receivable', kw['node_category_strict_membership'] = ['account_type/asset/receivable',
'account_type/liability/payable'] 'account_type/liability/payable']
kw.update(kw['selection'].getParams()) kw.update(
**context.getPortalObject().portal_selections.getSelectionParamsFor(selection_name, REQUEST=kw.get('REQUEST', None)))
return context.Node_statAccountingBalance(**kw) return context.Node_statAccountingBalance(**kw)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>selection_name, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -143,87 +143,18 @@ ...@@ -143,87 +143,18 @@
</dictionary> </dictionary>
</value> </value>
</item> </item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>_identity_criterion</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_x_frame_options</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_content_security_policy</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_login</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_logout</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>_range_criterion</string> </key> <key> <string>_range_criterion</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>authorization_forced</string> </key>
<value> <int>1</int> </value>
</item>
<item> <item>
<key> <string>available_language</string> </key> <key> <string>available_language</string> </key>
<value> <value>
...@@ -232,28 +163,6 @@ ...@@ -232,28 +163,6 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'self\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' https://localhost:5000 mail.tiolive.com data: *.host.vifib.net *.node.vifib.com *.erp5.net *.erp5.ru; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data: *.app.officejs.com</string> </value>
</item>
<item>
<key> <string>configuration_login</string> </key>
<value> <string>connection/login_form{?came_from}</string> </value>
</item>
<item>
<key> <string>configuration_logout</string> </key>
<value> <string>connection/WebSite_logout{?came_from}</string> </value>
</item>
<item>
<key> <string>configuration_x_frame_options</string> </key>
<value> <string>ALLOW-FROM-ALL</string> </value>
</item>
<item> <item>
<key> <string>container_layout</string> </key> <key> <string>container_layout</string> </key>
<value> <string>ERP5Document_getHateoas</string> </value> <value> <string>ERP5Document_getHateoas</string> </value>
...@@ -278,7 +187,7 @@ ...@@ -278,7 +187,7 @@
</item> </item>
<item> <item>
<key> <string>layout_configuration_form_id</string> </key> <key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value> <value> <string>WebSection_viewDefaultThemeConfiguration</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -292,7 +201,7 @@ ...@@ -292,7 +201,7 @@
</item> </item>
<item> <item>
<key> <string>skin_selection_name</string> </key> <key> <string>skin_selection_name</string> </key>
<value> <string>HalRestricted</string> </value> <value> <string>Hal</string> </value>
</item> </item>
<item> <item>
<key> <string>static_language_selection</string> </key> <key> <string>static_language_selection</string> </key>
...@@ -309,7 +218,7 @@ ...@@ -309,7 +218,7 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -324,12 +233,6 @@ ...@@ -324,12 +233,6 @@
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -344,15 +247,7 @@ ...@@ -344,15 +247,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -367,15 +262,7 @@ ...@@ -367,15 +262,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="7" aka="AAAAAAAAAAc="> <record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -388,13 +275,13 @@ ...@@ -388,13 +275,13 @@
<item> <item>
<key> <string>category_publication_workflow</string> </key> <key> <string>category_publication_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>edit_workflow</string> </key> <key> <string>edit_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -403,7 +290,7 @@ ...@@ -403,7 +290,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="9" aka="AAAAAAAAAAk="> <record id="6" aka="AAAAAAAAAAY=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -456,7 +343,7 @@ ...@@ -456,7 +343,7 @@
</tuple> </tuple>
</pickle> </pickle>
</record> </record>
<record id="10" aka="AAAAAAAAAAo="> <record id="7" aka="AAAAAAAAAAc=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -485,7 +372,7 @@ ...@@ -485,7 +372,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.45855.48292.47786</string> </value> <value> <string>932.120.18159.59989</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -503,8 +390,8 @@ ...@@ -503,8 +390,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515504053.68</float> <float>1389263689.67</float>
<string>UTC</string> <string>GMT+1</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Section" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_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>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>__before_publishing_traverse__</string> </key>
<value>
<object>
<klass>
<global name="MultiHook" module="ZPublisher.BeforeTraverse"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
<value> <string>__before_publishing_traverse__</string> </value>
</item>
<item>
<key> <string>_list</string> </key>
<value>
<list>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</list>
</value>
</item>
<item>
<key> <string>_prior</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>__before_traverse__</string> </key>
<value>
<dictionary>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Section/connection</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>caching_policy/no-cache</string>
</tuple>
</value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item>
<item>
<key> <string>content_layout</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item>
<item>
<key> <string>custom_render_method_id</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>empty_criterion_valid</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>connection</string> </value>
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewRenderJSPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Section</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>skin_selection_name</string> </key>
<value> <string>RJS</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Connection</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="WebSectionTraversalHook" module="Products.ERP5.Document.WebSection"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -23,5 +23,6 @@ return context.ERP5Document_getHateoas( ...@@ -23,5 +23,6 @@ return context.ERP5Document_getHateoas(
bulk_list=bulk_list, bulk_list=bulk_list,
sort_on=sort_on, sort_on=sort_on,
local_roles=local_roles, local_roles=local_roles,
restricted=1 restricted=1,
prev_view=prev_view
) )
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, local_roles=None, form=None, relative_url=None, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]", sort_on=None</string> </value> <value> <string>REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, local_roles=None, form=None, relative_url=None, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]", sort_on=None, prev_view=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -270,7 +270,6 @@ if True: ...@@ -270,7 +270,6 @@ if True:
# does not exist and we call form method directly # does not exist and we call form method directly
if clean_kw.get("portal_skin", context.getPortalObject().portal_skins.getDefaultSkin()) not in ("Hal", "HalRestricted"): if clean_kw.get("portal_skin", context.getPortalObject().portal_skins.getDefaultSkin()) not in ("Hal", "HalRestricted"):
return dialog_form(**kw) return dialog_form(**kw)
return context.ERP5Document_getHateoas(REQUEST=request, form=dialog_form, mode="form") return context.ERP5Document_getHateoas(REQUEST=request, form=dialog_form, mode="form")
return getattr(context, dialog_method)(**kw) return getattr(context, dialog_method)(**kw)
...@@ -38,7 +38,7 @@ if not silent_mode and not request.AUTHENTICATED_USER.has_permission('Modify por ...@@ -38,7 +38,7 @@ if not silent_mode and not request.AUTHENTICATED_USER.has_permission('Modify por
return context.ERP5Document_getHateoas(form=form, REQUEST=request, mode='form') return context.ERP5Document_getHateoas(form=form, REQUEST=request, mode='form')
try: try:
# Validate # Validate and insert field value into REQUEST under their IDs (no "field_" prefix)
form.validate_all_to_request(request, key_prefix=key_prefix) form.validate_all_to_request(request, key_prefix=key_prefix)
except FormValidationError as validation_errors: except FormValidationError as validation_errors:
# Pack errors into the request # Pack errors into the request
...@@ -91,7 +91,10 @@ def editListBox(listbox_field, listbox): ...@@ -91,7 +91,10 @@ def editListBox(listbox_field, listbox):
def editMatrixBox(matrixbox_field, matrixbox): def editMatrixBox(matrixbox_field, matrixbox):
""" Function called to edit a Matrix box """Go through every field in matrix and call edit on it.
Most of the code is just a copy&paste from ERP5Form/MatrixBox:render and
should be in (non-yet-existing) MatrixBoxEditor instead of here (XXX TODO).
""" """
if matrixbox is None: if matrixbox is None:
return return
...@@ -146,7 +149,7 @@ def editMatrixBox(matrixbox_field, matrixbox): ...@@ -146,7 +149,7 @@ def editMatrixBox(matrixbox_field, matrixbox):
tab_ids = map(lambda x: x[0], tabs) tab_ids = map(lambda x: x[0], tabs)
extra_dimension_category_list_list = [[category for category, label in dimension_list] for dimension_list in extra_dimension_list_list] extra_dimension_category_list_list = [[category for category, label in dimension_list] for dimension_list in extra_dimension_list_list]
# There are 3 cases # There are 4 cases
# Case 1: we do 1 dimensional matrix # Case 1: we do 1 dimensional matrix
# Case 2: we do 2 dimensional matrix # Case 2: we do 2 dimensional matrix
# Case 3: we do 2 dimensional matrix + tabs # Case 3: we do 2 dimensional matrix + tabs
...@@ -170,7 +173,7 @@ def editMatrixBox(matrixbox_field, matrixbox): ...@@ -170,7 +173,7 @@ def editMatrixBox(matrixbox_field, matrixbox):
matrix_context.setCellRange(base_id=cell_base_id, *matrixbox_cell_range) matrix_context.setCellRange(base_id=cell_base_id, *matrixbox_cell_range)
for cell_index_tuple, cell_value_dict in matrixbox.items(): for cell_index_tuple, cell_value_dict in matrixbox.items():
# Only update cells which still exist # after constructing the cell-range we can edit all existing cells
if not matrix_context.hasInRange(*cell_index_tuple, **kd): if not matrix_context.hasInRange(*cell_index_tuple, **kd):
return "Cell %s does not exist" % str(cell_index_tuple) return "Cell %s does not exist" % str(cell_index_tuple)
...@@ -204,7 +207,7 @@ MARKER = [] # placeholder for an empty value ...@@ -204,7 +207,7 @@ MARKER = [] # placeholder for an empty value
message = Base_translateString("Data updated.") message = Base_translateString("Data updated.")
try: try:
# extract all listbox's object form fields from the request and `edit` the object # Extract all form fields from the request and call `edit` on them
for field in form.get_fields(): for field in form.get_fields():
# Dispatch field either to `edit_kwargs` (in case of simple fields) or to `encapsulated_editor_list` in case of editors # Dispatch field either to `edit_kwargs` (in case of simple fields) or to `encapsulated_editor_list` in case of editors
field_name = field.id if not field.has_value('alternate_name') else (field.get_value('alternate_name') or field.id) field_name = field.id if not field.has_value('alternate_name') else (field.get_value('alternate_name') or field.id)
...@@ -217,13 +220,14 @@ try: ...@@ -217,13 +220,14 @@ try:
edit_kwargs[field_name[len(field_prefix):]] = field_value if field_value != '' else None edit_kwargs[field_name[len(field_prefix):]] = field_value if field_value != '' else None
## XXX We need to find a way not to use meta_type. ## XXX We need to find a way not to use meta_type.
# Kato: can be done simply by implementing 'Editors' for fields which are here
field_meta_type = field.meta_type field_meta_type = field.meta_type
if field_meta_type == 'ProxyField': if field_meta_type == 'ProxyField':
field_meta_type = field.getRecursiveTemplateField().meta_type field_meta_type = field.getRecursiveTemplateField().meta_type
if(field_meta_type == 'ListBox'): if(field_meta_type == 'ListBox'):
editListBox(field, request.get(field.id)) editListBox(field, request.get(field.id))
if(field_meta_type == 'MatrixBox'): elif(field_meta_type == 'MatrixBox'):
editMatrixBox(field, request.get(field.id)) editMatrixBox(field, request.get(field.id))
# Return parsed values # Return parsed values
...@@ -235,6 +239,7 @@ try: ...@@ -235,6 +239,7 @@ try:
context.edit(REQUEST=request, edit_order=edit_order, **edit_kwargs) context.edit(REQUEST=request, edit_order=edit_order, **edit_kwargs)
for encapsulated_editor in encapsulated_editor_list: for encapsulated_editor in encapsulated_editor_list:
encapsulated_editor.edit(context) encapsulated_editor.edit(context)
except ActivityPendingError as e: except ActivityPendingError as e:
message = Base_translateString(str(e)) message = Base_translateString(str(e))
......
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
page from a script. It should probably be extended, reviewed and documented page from a script. It should probably be extended, reviewed and documented
so that less code is copied and pasted in dialog scripts. so that less code is copied and pasted in dialog scripts.
TODO: improve API and extensively document. ERP5Site_redirect may TODO: improve API and extensively document. ERP5Site_redirect may
be redundant. be redundant.
""" """
from ZTUtils import make_query from ZTUtils import make_query
import json import json
portal_status_message = "%s" % keep_items.pop("portal_status_message", "")
request_form = context.REQUEST.form request_form = context.REQUEST.form
request_form.update(kw) request_form.update(kw)
request_form = context.ERP5Site_filterParameterList(request_form) request_form = context.ERP5Site_filterParameterList(request_form)
...@@ -40,12 +42,12 @@ response.setHeader("X-Location", "urn:jio:get:%s" % context.getRelativeUrl()) ...@@ -40,12 +42,12 @@ response.setHeader("X-Location", "urn:jio:get:%s" % context.getRelativeUrl())
# therefor we don't need to be afraid of clashes # therefor we don't need to be afraid of clashes
response.setHeader("Content-type", "application/json; charset=utf-8") response.setHeader("Content-type", "application/json; charset=utf-8")
result_dict = { result_dict = {
'portal_status_message': "%s" % keep_items.pop("portal_status_message", ""), 'portal_status_message': portal_status_message,
'_links': { '_links': {
"self": { "self": {
# XXX Include query parameters "href": "{}?{}".format(context.Base_getRequestUrl(), parameters)
"href": context.Base_getRequestUrl()
} }
} }
} }
......
# request.RESPONSE.setStatus(200)
form = getattr(context, form_id)
return context.ERP5Document_getHateoas(form=form, mode='form')
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_renderForm</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -62,9 +62,6 @@ ...@@ -62,9 +62,6 @@
<value> <value>
<list> <list>
<string>left</string> <string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -73,13 +70,7 @@ ...@@ -73,13 +70,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value> <value>
<list> <list>
<string>your_warning</string> <string>your_warning</string>
...@@ -88,18 +79,6 @@ ...@@ -88,18 +79,6 @@
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -205,11 +205,11 @@ ...@@ -205,11 +205,11 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>invisible</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string>Do you want to clone this document?</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Confirmation message</string> </value> <value> <string>Do you want to clone this document:</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
......
...@@ -62,9 +62,6 @@ ...@@ -62,9 +62,6 @@
<value> <value>
<list> <list>
<string>left</string> <string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -73,13 +70,7 @@ ...@@ -73,13 +70,7 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>bottom</string> </key> <key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value> <value>
<list> <list>
<string>your_warning</string> <string>your_warning</string>
...@@ -89,18 +80,6 @@ ...@@ -89,18 +80,6 @@
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
......
...@@ -205,11 +205,11 @@ ...@@ -205,11 +205,11 @@
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>invisible</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string>Do you want to delete this document?</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Confirmation message</string> </value> <value> <string>Do you want to Delete this document:</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, local_roles=None, form=None, relative_url=None, restricted=0, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]", sort_on=None</string> </value> <value> <string>REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, local_roles=None, form=None, relative_url=None, restricted=0, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]", sort_on=None, prev_view=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -1150,14 +1150,16 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id ...@@ -1150,14 +1150,16 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
self.assertEqual(result_dict['_embedded']['contents'][1]['credit_price'], 0.0) self.assertEqual(result_dict['_embedded']['contents'][1]['credit_price'], 0.0)
# Render a Document using Form Field template (only for field 'id') # Render a Document using Form Field template (only for field 'id')
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas( result = self.portal.foo_module.__of__(self.portal.web_site_module.hateoas.web_site_module.hateoas).ERP5Document_getHateoas(
REQUEST=fake_request, REQUEST=fake_request,
mode="search", mode="search",
local_roles=["Assignor", "Assignee"], relative_url="foo_module",
local_roles=["Assignor", "Assignee", "Manager"],
list_method='Test_listProducts', list_method='Test_listProducts',
select_list=['id'], select_list=['id'],
form_relative_url='portal_skins/erp5_ui_test/FooModule_viewFooList/listbox' form_relative_url='portal_skins/erp5_ui_test/FooModule_viewFooList/listbox'
) )
self.logMessage(result)
result_dict = json.loads(result) result_dict = json.loads(result)
self.assertEqual(2, len(result_dict['_embedded']['contents'])) self.assertEqual(2, len(result_dict['_embedded']['contents']))
self.assertIn("field_listbox", result_dict['_embedded']['contents'][0]['id']['key']) self.assertIn("field_listbox", result_dict['_embedded']['contents'][0]['id']['key'])
...@@ -1547,7 +1549,7 @@ return msg" ...@@ -1547,7 +1549,7 @@ return msg"
work_list = [x for x in result_dict['worklist'] if x['name'].startswith('daiyanzhen')] work_list = [x for x in result_dict['worklist'] if x['name'].startswith('daiyanzhen')]
self.assertEqual(len(work_list), 1) self.assertEqual(len(work_list), 1)
self.assertEqual(work_list[0]['name'], 'daiyanzhen') self.assertEqual(work_list[0]['name'], 'daiyanzhen')
self.assertEqual(work_list[0]['count'], 1) self.assertTrue(work_list[0]['count'] > 0)
self.assertFalse('module' in work_list[0]) self.assertFalse('module' in work_list[0])
self.assertEqual(work_list[0]['href'], 'urn:jio:allDocs?query=portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29%20AND%20simulation_state%3A%22draft%22') self.assertEqual(work_list[0]['href'], 'urn:jio:allDocs?query=portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29%20AND%20simulation_state%3A%22draft%22')
......
...@@ -29,10 +29,7 @@ ...@@ -29,10 +29,7 @@
editable: field_json.editable, editable: field_json.editable,
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
state_dict.text_content = state_dict.checked ? '' : ''; state_dict.text_content = state_dict.checked ? '' : '';
return this.changeState(state_dict); return this.changeState(state_dict);
...@@ -84,7 +81,7 @@ ...@@ -84,7 +81,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -94,5 +91,5 @@ ...@@ -94,5 +91,5 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(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>965.10615.49166.8413</string> </value> <value> <string>962.4135.1398.9574</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>1517321807.6</float> <float>1505315155.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -57,10 +57,7 @@ ...@@ -57,10 +57,7 @@
subfield_timezone_key: field_json.subfield_timezone_key, subfield_timezone_key: field_json.subfield_timezone_key,
start_datetime: field_json.start_datetime, start_datetime: field_json.start_datetime,
end_datetime: field_json.end_datetime, end_datetime: field_json.end_datetime,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
...@@ -229,7 +226,7 @@ ...@@ -229,7 +226,7 @@
.push(function (gadget_list) { .push(function (gadget_list) {
var text_content = "", var text_content = "",
state_date, state_date,
offset_time_zone; options;
if (gadget.state.value) { if (gadget.state.value) {
state_date = new Date(gadget.state.value); state_date = new Date(gadget.state.value);
if (gadget.state.timezone_style) { if (gadget.state.timezone_style) {
...@@ -238,13 +235,14 @@ ...@@ -238,13 +235,14 @@
text_content += " " + state_date.toLocaleTimeString(); text_content += " " + state_date.toLocaleTimeString();
} }
} else { } else {
//get timezone difference between server and local browser // We don't know the timezone used by erp5 to store the date
offset_time_zone = timezone + (state_date.getTimezoneOffset() / 60); // display it as displayed in editable
//adjust hour in order to get correct date time string options = {timeZone: "UTC"};
state_date.setUTCHours(state_date.getUTCHours() + offset_time_zone); text_content = state_date.toLocaleDateString(undefined,
text_content = state_date.toLocaleDateString(); options);
if (!gadget.state.date_only) { if (!gadget.state.date_only) {
text_content += " " + state_date.toLocaleTimeString(); text_content += " " + state_date.toLocaleTimeString(undefined,
options);
} }
} }
} }
...@@ -367,7 +365,7 @@ ...@@ -367,7 +365,7 @@
}); });
} }
return result; return result;
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
var gadget = this; var gadget = this;
...@@ -378,6 +376,6 @@ ...@@ -378,6 +376,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP));
\ 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>965.3167.36247.3959</string> </value> <value> <string>964.26946.11355.11605</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>1517321711.65</float> <float>1514370341.04</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,10 +14,7 @@ ...@@ -14,10 +14,7 @@
editable: field_json.editable, editable: field_json.editable,
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
state_dict.inner_html = state_dict.value; state_dict.inner_html = state_dict.value;
return this.changeState(state_dict); return this.changeState(state_dict);
......
...@@ -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>955.2252.33079.47462</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>1479375938.91</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -17,10 +17,7 @@ ...@@ -17,10 +17,7 @@
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
type: 'email', type: 'email',
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
state_dict.text_content = state_dict.value; state_dict.text_content = state_dict.value;
return this.changeState(state_dict); return this.changeState(state_dict);
...@@ -63,7 +60,7 @@ ...@@ -63,7 +60,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -73,6 +70,6 @@ ...@@ -73,6 +70,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(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>965.241.13759.3805</string> </value> <value> <string>955.51162.4768.35123</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>1517321664.03</float> <float>1482843519.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
rJS(window) rJS(window)
.setState({ .setState({
subgadget_template: undefined, subgadget_template: undefined,
editable: undefined, editable: undefined
css_class: ''
}) })
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment") .declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
title: field_json.title, title: field_json.title,
hidden: field_json.hidden, hidden: field_json.hidden,
view: field_json.view, view: field_json.view,
css_class: field_json.css_class,
// field_json._embedded is HATEOASed subobj specs included in FormBox // field_json._embedded is HATEOASed subobj specs included in FormBox
erp5_embedded_document: field_json._embedded erp5_embedded_document: field_json._embedded
}; };
...@@ -77,11 +75,6 @@ ...@@ -77,11 +75,6 @@
// do not preserve objects in the state // do not preserve objects in the state
delete gadget.state.erp5_embedded_document; delete gadget.state.erp5_embedded_document;
// pass CSS class to the DIV element
if (modification_dict.hasOwnProperty('css_class')) {
gadget.element.classList.add(modification_dict.css_class);
}
return gadget.getDeclaredGadget('sub') return gadget.getDeclaredGadget('sub')
.push(function (subgadget) { .push(function (subgadget) {
subgadget.render(form_options); subgadget.render(form_options);
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.29423.48444.21077</string> </value> <value> <string>961.56527.16709.20804</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>1502977334.64</float> <float>1517248866.15</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
required: field_json.required, required: field_json.required,
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
...@@ -61,7 +58,7 @@ ...@@ -61,7 +58,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -71,6 +68,6 @@ ...@@ -71,6 +68,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(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>965.241.13759.3805</string> </value> <value> <string>955.51162.4768.35123</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>1517321650.56</float> <float>1482843418.41</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -41,10 +41,7 @@ ...@@ -41,10 +41,7 @@
// if unspecified we can use "any" value // if unspecified we can use "any" value
step: "any", step: "any",
// `append` is a string to display next to the field ("%", "EUR"...) // `append` is a string to display next to the field ("%", "EUR"...)
append: '', append: ''
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}, },
tmp; tmp;
...@@ -108,7 +105,7 @@ ...@@ -108,7 +105,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -118,6 +115,6 @@ ...@@ -118,6 +115,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(window, rJS, Math)); }(window, rJS, Math));
\ 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.241.13759.3805</string> </value> <value> <string>963.40246.8021.32017</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>1517321634.14</float> <float>1512458225.4</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
return gadget.props.listbox_gadget.getListboxInfo(); return gadget.props.listbox_gadget.getListboxInfo();
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod("getContent", function (options) { .declareMethod("getContent", function (options) {
var form_gadget = this, var form_gadget = this,
k, k,
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
.push(function () { .push(function () {
return data; return data;
}); });
}, {mutex: 'changestate'}) })
.declareMethod("checkValidity", function () { .declareMethod("checkValidity", function () {
var form_gadget = this, var form_gadget = this,
k, k,
...@@ -286,6 +286,6 @@ ...@@ -286,6 +286,6 @@
return result; return result;
}); });
}, {mutex: 'changestate'}); });
}(window, document, rJS, RSVP)); }(window, document, rJS, RSVP));
\ 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>964.25533.41108.47530</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>1516274548.88</float> <float>1515496577.67</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,10 +14,7 @@ ...@@ -14,10 +14,7 @@
url: options.field_json.url, url: options.field_json.url,
sandbox: options.field_json.sandbox || undefined, sandbox: options.field_json.sandbox || undefined,
hidden: options.field_json.hidden, hidden: options.field_json.hidden,
css_class: options.field_json.css_class, css_class: options.field_json.css_class
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}); });
}) })
...@@ -82,6 +79,6 @@ ...@@ -82,6 +79,6 @@
.push(function (result) { .push(function (result) {
return result.getContent(); return result.getContent();
}); });
}, {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>962.24020.58652.57139</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>1507901872.84</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -15,4 +15,46 @@ ...@@ -15,4 +15,46 @@
}); });
}; };
/** Return true if the value truly represents an empty value.
Calling isEmpty(x) is more robust than expression !x.
*/
function isEmpty(value) {
return (value === undefined ||
value === null ||
value.length === 0);
}
window.isEmpty = isEmpty;
/** Make sure that returned object is an Array instance.
*/
function ensureArray(obj) {
if (Array.isArray(obj)) {return obj; }
if (isEmpty(obj)) {return []; }
return [obj];
}
window.ensureArray = ensureArray;
/** Return first non-empty variable or the last one.
Calling getNonEmpy(a, b, "") is more robust way of writing a || b || "".
Variables coercing to false (e.g 0) do not get skipped anymore.
*/
function getFirstNonEmpty() {
var i;
if (arguments.length === 0) {
return null;
}
for (i = 0; i < arguments.length; i++) {
if (!isEmpty(arguments[i])) {
return arguments[i];
}
}
if (arguments.length === 1) {
return arguments[0];
}
return arguments[arguments.length - 1];
}
window.getFirstNonEmpty = getFirstNonEmpty;
}(window, RSVP)); }(window, RSVP));
\ 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.14461.31508.53930</string> </value> <value> <string>960.5523.58984.43537</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>1476894652.41</float> <float>1517406504.9</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -18,10 +18,7 @@ ...@@ -18,10 +18,7 @@
required: field_json.required, required: field_json.required,
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
state_dict.text_content = state_dict.value; state_dict.text_content = state_dict.value;
return this.changeState(state_dict); return this.changeState(state_dict);
...@@ -65,7 +62,7 @@ ...@@ -65,7 +62,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -75,6 +72,6 @@ ...@@ -75,6 +72,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(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>965.241.13759.3805</string> </value> <value> <string>956.15712.57649.37376</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>1517321585.88</float> <float>1482843064.62</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
this.state.label_element.setAttribute('for', gadget.state.scope); this.state.label_element.setAttribute('for', gadget.state.scope);
if (modification_dict.hasOwnProperty('css_class') && this.state.css_class) { if (modification_dict.hasOwnProperty('css_class') && this.state.css_class) {
this.state.label_element.classList.add(this.state.css_class); this.element.classList.add(this.state.css_class);
} }
if (modification_dict.hasOwnProperty('error_text')) { if (modification_dict.hasOwnProperty('error_text')) {
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
} }
return true; return true;
}); });
}, {mutex: 'changestate'}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
var argument_list = arguments; var argument_list = arguments;
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
} }
return {}; return {};
}); });
}, {mutex: 'changestate'}) })
.declareMethod('getListboxInfo', function () { .declareMethod('getListboxInfo', function () {
var argument_list = arguments; var argument_list = arguments;
...@@ -204,22 +204,14 @@ ...@@ -204,22 +204,14 @@
.push(function (gadget) { .push(function (gadget) {
return gadget.getListboxInfo.apply(gadget, argument_list); return gadget.getListboxInfo.apply(gadget, argument_list);
}); });
}, {mutex: 'changestate'}) })
.allowPublicAcquisition("notifyInvalid", function (param_list) { .allowPublicAcquisition("notifyInvalid", function (param_list) {
// Label doesn't know when a subgadget calls notifyInvalid return this.changeState({error_text: param_list[0]});
// Prevent mutex dead lock by defering the changeState call
return this.deferErrorTextRender(param_list[0]);
}) })
.allowPublicAcquisition("notifyValid", function () { .allowPublicAcquisition("notifyValid", function () {
// Label doesn't know when a subgadget calls notifyValid return this.changeState({error_text: ''});
// Prevent mutex dead lock by defering the changeState call
return this.deferErrorTextRender('');
})
.declareJob('deferErrorTextRender', function (error_text) {
return this.changeState({error_text: error_text});
}); });
}(window, document, rJS, RSVP)); }(window, document, rJS, RSVP));
\ 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.59013.39016.42820</string> </value> <value> <string>965.9315.27783.1843</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>1516293734.37</float> <float>1517246822.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, document, RSVP, rJS, /*globals window, document, RSVP, rJS,
URI, location, XMLHttpRequest, console, navigator, ProgressEvent*/ URI, location, XMLHttpRequest, console, navigator*/
/*jslint indent: 2, maxlen: 80*/ /*jslint indent: 2, maxlen: 80*/
(function (window, document, RSVP, rJS, (function (window, document, RSVP, rJS,
XMLHttpRequest, location, console, navigator, ProgressEvent) { XMLHttpRequest, location, console, navigator) {
"use strict"; "use strict";
var MAIN_SCOPE = "m"; var MAIN_SCOPE = "m";
...@@ -133,9 +133,6 @@ ...@@ -133,9 +133,6 @@
// Display it to the user for now, // Display it to the user for now,
// and allow user to go back to the frontpage // and allow user to go back to the frontpage
var error_text = ""; var error_text = "";
if (error instanceof ProgressEvent) {
error = error.target.error;
}
if (error.target instanceof XMLHttpRequest) { if (error.target instanceof XMLHttpRequest) {
error_text = error.target.toString() + " " + error_text = error.target.toString() + " " +
...@@ -650,4 +647,4 @@ ...@@ -650,4 +647,4 @@
}); });
}(window, document, RSVP, rJS, }(window, document, RSVP, rJS,
XMLHttpRequest, location, console, navigator, ProgressEvent)); XMLHttpRequest, location, console, navigator));
\ No newline at end of file \ 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.44401.33443.35072</string> </value> <value> <string>964.44144.54943.18056</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>1516619185.21</float> <float>1515401365.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -21,10 +21,7 @@ ...@@ -21,10 +21,7 @@
"required": options.field_json.required, "required": options.field_json.required,
"hidden": options.field_json.hidden, "hidden": options.field_json.hidden,
"title": options.field_json.title, "title": options.field_json.title,
"key": options.field_json.key, "key": options.field_json.key
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
if (this.state.gadget_rendered === false) { if (this.state.gadget_rendered === false) {
......
...@@ -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>964.54328.21867.14506</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>1517321571.05</float> <float>1516015281.65</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -197,9 +197,7 @@ ...@@ -197,9 +197,7 @@
} }
} }
// Cancel previous line rendering to not conflict with the asynchronous render for now queue = RSVP.Queue();
gadget.fetchLineContent(true);
queue = new RSVP.Queue();
if (!variable.translated_records) { if (!variable.translated_records) {
queue queue
.push(function () { .push(function () {
...@@ -214,6 +212,10 @@ ...@@ -214,6 +212,10 @@
}); });
} }
queue queue
.push(function () {
// Cancel previous line rendering to not conflict with the asynchronous render for now
return gadget.fetchLineContent(true);
})
.push(function () { .push(function () {
// XXX Fix in case of multiple listboxes // XXX Fix in case of multiple listboxes
return RSVP.all([ return RSVP.all([
...@@ -295,7 +297,6 @@ ...@@ -295,7 +297,6 @@
command: field_json.command || 'index', command: field_json.command || 'index',
// Force line calculation in any case // Force line calculation in any case
render_timestamp: new Date().getTime(),
allDocs_result: undefined, allDocs_result: undefined,
// No error message // No error message
...@@ -760,7 +761,7 @@ ...@@ -760,7 +761,7 @@
data[form_gadget.props.listbox_uid_dict.key] = form_gadget.props.listbox_uid_dict.value; data[form_gadget.props.listbox_uid_dict.key] = form_gadget.props.listbox_uid_dict.value;
return data; return data;
}); });
}, {mutex: 'changestate'}) })
.onEvent('click', function (evt) { .onEvent('click', function (evt) {
var gadget = this, var gadget = this,
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.60204.10137.19421</string> </value> <value> <string>964.49926.23272.20514</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>1516364900.78</float> <float>1515755492.39</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS*/ /*global window, rJS, isEmpty, getFirstNonEmpty */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */ /*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
(function (window, rJS) { (function (window, rJS, getFirstNonEmpty) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -11,20 +11,17 @@ ...@@ -11,20 +11,17 @@
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var field_json = options.field_json || {}, var field_json = options.field_json || {},
state_dict = { state_dict = {
value: field_json.value || field_json.default || "", value: getFirstNonEmpty(field_json.value, field_json['default'], ""),
item_list: JSON.stringify(field_json.items), item_list: JSON.stringify(field_json.items),
editable: field_json.editable, editable: field_json.editable,
required: field_json.required, required: field_json.required,
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
first_item: field_json.first_item, first_item: field_json.first_item,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
// first_item means to select the first item by default on empty value
if ((!state_dict.value) && (state_dict.first_item)) { if (isEmpty(state_dict.value) && (state_dict.first_item)) {
state_dict.value = field_json.items[0][1]; state_dict.value = field_json.items[0][1];
} }
return this.changeState(state_dict); return this.changeState(state_dict);
...@@ -99,7 +96,7 @@ ...@@ -99,7 +96,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -109,6 +106,6 @@ ...@@ -109,6 +106,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(window, rJS)); }(window, rJS, getFirstNonEmpty));
\ No newline at end of file \ 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.1659.33258.11707</string> </value> <value> <string>965.10978.44363.39543</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>1516786204.34</float> <float>1517406625.1</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -60,10 +60,7 @@ ...@@ -60,10 +60,7 @@
name: field_json.key, name: field_json.key,
item_list: field_json.items, item_list: field_json.items,
value_list: field_json.value || field_json.default, value_list: field_json.value || field_json.default,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
return this.changeState(state_dict); return this.changeState(state_dict);
...@@ -146,5 +143,5 @@ ...@@ -146,5 +143,5 @@
}); });
} }
return final_result; return final_result;
}, {mutex: 'changestate'}); });
}(window, rJS, RSVP, document)); }(window, rJS, RSVP, document));
\ 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.241.13759.3805</string> </value> <value> <string>960.5523.58984.43537</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>1517321512.62</float> <float>1505309155.21</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, document, RSVP*/ /*global window, rJS, document, RSVP, isEmpty, ensureArray */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80, unparam: true */ /*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80, unparam: true */
(function (window, rJS, document, RSVP) { (function (window, rJS, document, RSVP, isEmpty, ensureArray) {
'use strict'; 'use strict';
/* Make sure that returned object is an Array instance. */ /** More robust way of writing a || b || "" because if b===0 it gets skipped.
function ensureArray(obj) { */
if (!obj) {return []; } function getNonEmpty() {
if (Array.isArray(obj)) {return obj; } var i;
return [obj]; for (i = 0; i < arguments.length; i++) {
if (!isEmpty(arguments[i])) {
return arguments[i];
}
}
if (arguments.length === 1) {
return arguments[0];
}
return arguments[arguments.length - 1];
} }
function appendListField(gadget, value, item_list) { function appendListField(gadget, value, item_list) {
...@@ -37,10 +45,11 @@ ...@@ -37,10 +45,11 @@
rJS(window) rJS(window)
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var field_json = options.field_json || {}, var field_json = options.field_json || {},
item_list = field_json.items, item_list = ensureArray(field_json.items),
state_dict = { state_dict = {
value_list: JSON.stringify( value_list: JSON.stringify(
ensureArray(field_json.value || field_json.default) ensureArray(
getNonEmpty(field_json.value, field_json['default'], []))
), ),
editable: field_json.editable, editable: field_json.editable,
required: field_json.required, required: field_json.required,
...@@ -49,11 +58,13 @@ ...@@ -49,11 +58,13 @@
key: field_json.key, key: field_json.key,
sub_select_key: field_json.sub_select_key, sub_select_key: field_json.sub_select_key,
sub_input_key: field_json.sub_input_key, sub_input_key: field_json.sub_input_key,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
// Items can be simply an array of values. It is a valid input produced
// usually by TALES expression
if (item_list.length > 0 && !Array.isArray(item_list[0])) {
item_list = item_list.map(function (item) {return [item, item]; });
}
if ((item_list.length === 0) || (item_list[0][0] !== "")) { if ((item_list.length === 0) || (item_list[0][0] !== "")) {
item_list.unshift(["", ""]); item_list.unshift(["", ""]);
} }
...@@ -77,17 +88,13 @@ ...@@ -77,17 +88,13 @@
element.removeChild(element.firstChild); element.removeChild(element.firstChild);
} }
function enQueue() { value_list.forEach(function (value) {
var argument_list = arguments;
queue queue
.push(function () { .push(function () {
return appendListField.apply(this, argument_list); return appendListField(gadget, value, item_list);
}); });
} });
for (i = 0; i < value_list.length; i += 1) {
enQueue(gadget, value_list[i], item_list);
}
return queue; return queue;
}) })
...@@ -136,7 +143,7 @@ ...@@ -136,7 +143,7 @@
}); });
} }
return final_result; return final_result;
}, {mutex: 'changestate'}) })
.allowPublicAcquisition('notifyValid', function () { .allowPublicAcquisition('notifyValid', function () {
return; return;
...@@ -197,6 +204,6 @@ ...@@ -197,6 +204,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(window, rJS, document, RSVP)); }(window, rJS, document, RSVP, isEmpty, ensureArray));
\ No newline at end of file \ 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.241.13759.3805</string> </value> <value> <string>965.11854.16357.58572</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>1517321477.39</float> <float>1517406578.58</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
return input_gadget.render({ return input_gadget.render({
editable: gadget.state.editable, editable: gadget.state.editable,
query: gadget.state.query, query: gadget.state.query,
sort_list_json: gadget.state.sort_list_json,
catalog_index: gadget.state.catalog_index, catalog_index: gadget.state.catalog_index,
allow_jump: gadget.state.allow_jump, allow_jump: gadget.state.allow_jump,
// required: field_json.required, // required: field_json.required,
...@@ -48,7 +47,6 @@ ...@@ -48,7 +47,6 @@
state_dict = { state_dict = {
editable: field_json.editable, editable: field_json.editable,
query: field_json.query, query: field_json.query,
sort_list_json: JSON.stringify(field_json.sort),
catalog_index: field_json.catalog_index, catalog_index: field_json.catalog_index,
allow_jump: field_json.allow_jump, allow_jump: field_json.allow_jump,
required: field_json.required, required: field_json.required,
...@@ -60,10 +58,7 @@ ...@@ -60,10 +58,7 @@
portal_types: field_json.portal_types, portal_types: field_json.portal_types,
translated_portal_types: field_json.translated_portal_types, translated_portal_types: field_json.translated_portal_types,
relation_field_id: field_json.relation_field_id, relation_field_id: field_json.relation_field_id,
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
if (field_json.default.hasOwnProperty('value_text_list')) { if (field_json.default.hasOwnProperty('value_text_list')) {
...@@ -242,6 +237,6 @@ ...@@ -242,6 +237,6 @@
}); });
} }
return final_result; return final_result;
}, {mutex: 'changestate'}); });
}(window, rJS, RSVP, document)); }(window, rJS, RSVP, 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.241.13759.3805</string> </value> <value> <string>964.38497.25325.33501</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>1517321450.32</float> <float>1515062767.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -526,13 +526,9 @@ div[data-gadget-scope='panel'] ul li a { ...@@ -526,13 +526,9 @@ div[data-gadget-scope='panel'] ul li a {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
} }
div[data-gadget-scope='panel'] ul li a.active {
color: #1F1F1F;
background-color: #FFFFFF;
}
div[data-gadget-scope='panel'] ul li a:hover, div[data-gadget-scope='panel'] ul li a:hover,
div[data-gadget-scope='panel'] ul li a:active { div[data-gadget-scope='panel'] ul li a:active,
color: #FFFFFF; div[data-gadget-scope='panel'] ul li a.active {
background-color: #2b2b2b; background-color: #2b2b2b;
} }
div[data-gadget-scope='panel'] ul li a::before { div[data-gadget-scope='panel'] ul li a::before {
...@@ -568,13 +564,9 @@ div[data-gadget-scope='panel'] dl dd a { ...@@ -568,13 +564,9 @@ div[data-gadget-scope='panel'] dl dd a {
white-space: nowrap; white-space: nowrap;
padding-left: 36pt; padding-left: 36pt;
} }
div[data-gadget-scope='panel'] dl dd a.active {
color: #1F1F1F;
background-color: #FFFFFF;
}
div[data-gadget-scope='panel'] dl dd a:hover, div[data-gadget-scope='panel'] dl dd a:hover,
div[data-gadget-scope='panel'] dl dd a:active { div[data-gadget-scope='panel'] dl dd a:active,
color: #FFFFFF; div[data-gadget-scope='panel'] dl dd a.active {
background-color: #2b2b2b; background-color: #2b2b2b;
} }
div[data-gadget-scope='panel'] dl dd a::before { div[data-gadget-scope='panel'] dl dd a::before {
...@@ -983,24 +975,6 @@ div[data-gadget-scope='header'] .ui-header ul { ...@@ -983,24 +975,6 @@ div[data-gadget-scope='header'] .ui-header ul {
.gadget-content input[type='submit']:active { .gadget-content input[type='submit']:active {
background-color: #ffa366; background-color: #ffa366;
} }
.gadget-content button[name='action_update'] {
padding: 6pt;
margin-top: 30pt;
margin-right: 12pt;
background-color: #777777;
color: #FFFFFF;
border-radius: 0.325em;
border-width: 1px;
border-style: solid;
min-width: 8em;
}
.gadget-content button[name='action_update']:hover,
.gadget-content button[name='action_update']:focus {
background-color: #919191;
}
.gadget-content button[name='action_update']:active {
background-color: #aaaaaa;
}
@media not screen and (max-width: 85em) { @media not screen and (max-width: 85em) {
div[data-role='page']:not(.desktop-panel-hidden) .gadget-content { div[data-role='page']:not(.desktop-panel-hidden) .gadget-content {
margin-left: 180pt; margin-left: 180pt;
...@@ -1023,13 +997,16 @@ div[data-gadget-scope='header'] .ui-header ul { ...@@ -1023,13 +997,16 @@ div[data-gadget-scope='header'] .ui-header ul {
.gadget-content .field_container > div > div > div.ui-field-contain div { .gadget-content .field_container > div > div > div.ui-field-contain div {
width: 100%; width: 100%;
} }
.gadget-content .horizontal_align_form_box .field_container > div { .gadget-content .field_container > div > div.horizontal_align_form_box > .ui-field-contain {
/* Class .horizontal_align_form_box is here only for backward-compatibility! padding: 0;
It is used to force horizontal rendering of fields inside FormBox. }
The first > div represents form-group ("left", "right" ...) */ .gadget-content .field_container > div > div.horizontal_align_form_box > .ui-field-contain > label {
padding-top: 9pt;
}
.gadget-content .field_container > div > div.horizontal_align_form_box .field_container > div {
display: flex; display: flex;
} }
.gadget-content .horizontal_align_form_box .field_container > div > div { .gadget-content .field_container > div > div.horizontal_align_form_box .field_container > div > div {
flex: 1; flex: 1;
} }
.gadget-content .ui-content-header-plain { .gadget-content .ui-content-header-plain {
...@@ -1118,6 +1095,7 @@ div[data-gadget-scope='header'] .ui-header ul { ...@@ -1118,6 +1095,7 @@ div[data-gadget-scope='header'] .ui-header ul {
} }
.gadget-content .ui-field-contain > label { .gadget-content .ui-field-contain > label {
color: #777777; color: #777777;
padding: 3pt;
} }
.gadget-content .ui-field-contain > label.required { .gadget-content .ui-field-contain > label.required {
font-weight: bold; font-weight: bold;
...@@ -1125,6 +1103,9 @@ div[data-gadget-scope='header'] .ui-header ul { ...@@ -1125,6 +1103,9 @@ div[data-gadget-scope='header'] .ui-header ul {
.gadget-content .ui-field-contain > label.invisible { .gadget-content .ui-field-contain > label.invisible {
display: none; display: none;
} }
.gadget-content .ui-field-contain p {
padding: 3pt;
}
@media only screen and (min-width: 45em) and (max-width: 85em), not screen and (max-width: 85em) { @media only screen and (min-width: 45em) and (max-width: 85em), not screen and (max-width: 85em) {
.gadget-content .ui-field-contain { .gadget-content .ui-field-contain {
display: flex; display: flex;
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.10742.13164.48827</string> </value> <value> <string>965.9378.54486.51763</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>1517329600.93</float> <float>1517248083.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, Handlebars, calculatePageTitle */ /*global window, rJS, RSVP, Handlebars, calculatePageTitle, URL */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars, calculatePageTitle) { (function (window, rJS, RSVP, Handlebars, calculatePageTitle, URL) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -67,24 +67,48 @@ ...@@ -67,24 +67,48 @@
.declareAcquiredMethod("translateHtml", "translateHtml") .declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this, var gadget = this,
erp5_document, erp5_document;
report_list;
return gadget.jio_getAttachment(options.jio_key, "links") return gadget.jio_getAttachment(options.jio_key, "links")
.push(function (result) { .push(function (jio_document) {
erp5_document = result; var report_list = asArray(jio_document._links.action_object_report_jio)
report_list = asArray(erp5_document._links.action_object_report_jio) .concat(asArray(jio_document._links.action_object_jio_report)),
.concat(asArray(erp5_document._links.action_object_jio_report)); print_list = asArray(jio_document._links.action_object_jio_print),
exchange_list = asArray(jio_document._links.action_object_jio_exchange);
erp5_document = jio_document;
return RSVP.all([ return new RSVP.Queue()
renderLinkList(gadget, "Reports", "bar-chart-o", report_list) .push(function () {
]); return gadget.getUrlParameter("view");
})
.push(function (prev_view) {
// prev_view can have two forms
// 1/ action name like "view", "detail"...
// 2/ absolute script URL like "https://erp5.com/erp5/web_site_module/renderjs_runner/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=account_module%2Fbank&view=transaction_list"
if (prev_view.startsWith('http')) {
prev_view = new URL(prev_view).searchParams.get("view");
}
print_list.forEach(function (link) {
if (link.href.search(/\?/) > 0) {
link.href += "&";
} else {
link.href += "?";
}
link.href += "prev_view=" + prev_view;
});
return RSVP.all([
renderLinkList(gadget, "Exchange", "file", exchange_list),
renderLinkList(gadget, "Reports", "bar-chart-o", report_list),
renderLinkList(gadget, "Print", "print", print_list)
]);
});
}) })
.push(function (translated_html_link_list) { .push(function (translated_html_link_list) {
gadget.element.innerHTML = translated_html_link_list.join("\n"); gadget.element.innerHTML = translated_html_link_list.join("\n");
...@@ -101,4 +125,4 @@ ...@@ -101,4 +125,4 @@
}); });
}); });
}(window, rJS, RSVP, Handlebars, calculatePageTitle)); }(window, rJS, RSVP, Handlebars, calculatePageTitle, URL));
...@@ -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.3162.7999.42854</string> </value> <value> <string>964.64570.61398.48110</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>1509097420.01</float> <float>1516871683.64</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -42,19 +42,19 @@ ...@@ -42,19 +42,19 @@
.push(function (g) { .push(function (g) {
return g.triggerSubmit(); return g.triggerSubmit();
}); });
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
return this.getDeclaredGadget('fg') return this.getDeclaredGadget('fg')
.push(function (declared_gadget) { .push(function (declared_gadget) {
return declared_gadget.checkValidity(); return declared_gadget.checkValidity();
}); });
}, {mutex: 'changestate'}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
return this.getDeclaredGadget('fg') return this.getDeclaredGadget('fg')
.push(function (declared_gadget) { .push(function (declared_gadget) {
return declared_gadget.getContent(); return declared_gadget.getContent();
}); });
}, {mutex: 'changestate'}) })
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Own methods // Own 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>964.45640.391.48230</string> </value> <value> <string>963.49235.21851.43451</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>1516294817.06</float> <float>1515078479.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -62,6 +62,15 @@ ...@@ -62,6 +62,15 @@
filter_action: true filter_action: true
}); });
}) })
.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 [];
}
return result;
});
})
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this, var gadget = this,
select_template = options.select_template || ""; select_template = options.select_template || "";
......
...@@ -71,9 +71,7 @@ ...@@ -71,9 +71,7 @@
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <value> <string>text/javascript</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
...@@ -236,7 +234,7 @@ ...@@ -236,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.60339.56148.38212</string> </value> <value> <string>961.17732.18127.14097</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +252,7 @@ ...@@ -254,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1516373132.37</float> <float>1502199416.77</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
} }
// Typing a search query should not modify the header status // Typing a search query should not modify the header status
return; return;
}, {mutex: 'changestate'}) })
.allowPublicAcquisition('notifyValid', function () { .allowPublicAcquisition('notifyValid', function () {
// Typing a search query should not modify the header status // Typing a search query should not modify the header status
return; return;
......
...@@ -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.45640.391.48230</string> </value> <value> <string>964.39835.8408.1945</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>1516295067.02</float> <float>1515142977.99</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -17,10 +17,7 @@ ...@@ -17,10 +17,7 @@
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
type: 'password', type: 'password',
hidden: field_json.hidden, hidden: field_json.hidden
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
}; };
state_dict.text_content = state_dict.value; state_dict.text_content = state_dict.value;
return this.changeState(state_dict); return this.changeState(state_dict);
...@@ -72,7 +69,7 @@ ...@@ -72,7 +69,7 @@
}); });
} }
return {}; return {};
}, {mutex: 'changestate'}) })
.declareMethod('checkValidity', function () { .declareMethod('checkValidity', function () {
if (this.state.editable) { if (this.state.editable) {
...@@ -82,6 +79,6 @@ ...@@ -82,6 +79,6 @@
}); });
} }
return true; return true;
}, {mutex: 'changestate'}); });
}(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>965.241.13759.3805</string> </value> <value> <string>955.51162.4768.35123</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>1517321403.8</float> <float>1482843530.9</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -17,15 +17,6 @@ ...@@ -17,15 +17,6 @@
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script> <script src="jiodev.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script id="dialog-button-template" type="text/x-handlebars-template">
{{#if show_update_button}}
<button name="action_update" type="submit" data-i18n="Update">Update</button>
{{/if}}
<input name="action_confirm" class="dialogconfirm" data-theme="b" data-inline="true" type="submit" data-i18n="[value]Proceed" value="Proceed" data-icon="check" />
<a class="dialogcancel" data-i18n="Cancel">Cancel</a>
</script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_erp5_global.js" type="text/javascript"></script> <script src="gadget_erp5_global.js" type="text/javascript"></script>
...@@ -44,7 +35,8 @@ ...@@ -44,7 +35,8 @@
data-gadget-scope="erp5_form" data-gadget-scope="erp5_form"
data-gadget-sandbox="public"> data-gadget-sandbox="public">
</div> </div>
<div class="dialog_button_container"></div> <input class="dialogconfirm" data-theme="b" data-inline="true" type="submit" data-i18n="[value]Proceed" value="Proceed" data-icon="check" />
<a class="dialogcancel" data-i18n="Cancel">Cancel</a>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.10309.12229.56627</string> </value> <value> <string>962.14191.38290.31931</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>1517304075.06</float> <float>1506093694.63</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>965.10338.33096.47104</string> </value> <value> <string>965.12033.58825.17254</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>1517305313.45</float> <float>1517406854.12</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