Commit 8553a8c0 authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'origin/master' into zope4py2

parents 1c252a94 85317472
Changes
=======
0.4.73 (2022-05-13)
-------------------
* testnode:
- retry ``slapos node instance`` more times before running test
0.4.73 (2022-04-22)
-------------------
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>renderjs</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>renderjs.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>renderjs.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>renderjs.min.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>renderjs.min.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2012-04-06 Ivan
* Initial commit
\ No newline at end of file
2012-2013 © Nexedi SA
\ No newline at end of file
erp5_jquery
erp5_jquery_plugin_json
\ No newline at end of file
This Business Template contains only static files of RenderJS library.
* http://www.renderjs.org/
\ No newline at end of file
portal_skins/erp5_jquery/jquery/plugin/renderjs
portal_skins/erp5_jquery/jquery/plugin/renderjs/**
\ No newline at end of file
erp5_jquery_plugin_renderjs
\ No newline at end of file
......@@ -8,6 +8,9 @@ inventory_list_method_dict = {
if section_category:
kw['section_category'] = section_category
if product_line:
kw['resource_category'] = product_line
for brain in getattr(context.portal_simulation, inventory_list_method_dict[simulation_period])(
node_category=node_category,
group_by_resource=True,
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>at_date=None, node_category=None, section_category=None, positive_stock=None, negative_stock=None, zero_stock=None, simulation_period="current", **kw</string> </value>
<value> <string>at_date=None, node_category=None, section_category=None, product_line=None, positive_stock=None, negative_stock=None, zero_stock=None, simulation_period="current", **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -104,6 +104,7 @@
<string>your_section_category</string>
<string>your_at_date</string>
<string>your_simulation_period</string>
<string>your_product_line</string>
<string>your_currency</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_product_line</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Product Line</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>request/product_line | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories.product_line, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\', base=True)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -111,6 +111,7 @@
<string>your_negative_stock</string>
<string>your_zero_stock</string>
<string>your_item_stock</string>
<string>your_product_line</string>
<string>your_inventory_valuation_method</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_product_line</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Product Line</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories.product_line, preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\', base=True)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -120,6 +120,16 @@ class TestTradeReports(ERP5ReportTestCase):
base_unit_quantity=0.01,
).validate()
# product line
for product_line in ('product_line_a','product_line_b'):
if not self.portal_categories.product_line.has_key(product_line):
self.portal_categories.product_line.newContent(
portal_type='Category',
title=product_line,
reference=product_line,
id=product_line
)
# create organisations (with no organisation member of g3)
if not self.organisation_module.has_key('Organisation_1'):
self.portal.organisation_module.newContent(
......@@ -185,6 +195,7 @@ class TestTradeReports(ERP5ReportTestCase):
id='product_A',
title='product_A',
reference='ref 2',
product_line='product_line/product_line_a',
quantity_unit_list=('mass/g', 'mass/kg'),
default_purchase_supply_line_base_price=3,
default_internal_supply_line_base_price=5,
......@@ -1572,6 +1583,49 @@ class TestTradeReports(ERP5ReportTestCase):
self.assertEqual(0, len(data_line_list))
def testStockReport_product_line(self):
self._createConfirmedSalePackingListForStockReportTest()
request = self.portal.REQUEST
request.form['at_date'] = DateTime(2007, 3, 3)
request.form['node_category'] = 'site/demo_site_A'
request.form['product_line'] = 'product_line/product_line_b'
request.form['simulation_period'] = 'future'
request.form['inventory_valuation_method'] = 'default_purchase_price'
line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
get_value('default',
render_format='list', REQUEST=self.portal.REQUEST)
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(0, len(data_line_list))
# change product line parameter
request.form['product_line'] = 'product_line/product_line_a'
line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
get_value('default',
render_format='list', REQUEST=self.portal.REQUEST)
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
data_line = data_line_list[0]
self.assertEqual(
data_line.column_id_list,
['resource_title', 'resource_reference', 'variation_category_item_list', 'inventory', 'quantity_unit', 'total_price'])
self.checkLineProperties(
data_line_list[0],
resource_title='product_A',
resource_reference='ref 2',
variation_category_item_list=[],
inventory=1,
quantity_unit='G',
total_price=3,
)
# listbox_total_price is an editable field using this for precision
self.assertEqual(self.portal.REQUEST.get('precision'), 2)
def testStockReport_valuation_method_default_default_purchase_price(self):
self._createConfirmedSalePackingListForStockReportTest()
request = self.portal.REQUEST
......
......@@ -30,7 +30,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>A form with only only a float field</string> </value>
<value> <string>A form with only float fields</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
......
......@@ -95,6 +95,7 @@
<list>
<string>my_redirect_domain</string>
<string>my_use_moved_temporarily</string>
<string>my_configuration_service_worker_url</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_configuration_service_worker_url</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_reference</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Service Worker URL</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -20,8 +20,56 @@ try:
source_path = REQUEST.other["source_path"]
redirect_url = "/".join([redirect_url, source_path])
except(KeyError):
source_path = None
redirect_url = redirect_url + "/"
service_worker_to_unregister = context.getLayoutProperty("configuration_service_worker_url")
if (service_worker_to_unregister) and (source_path == service_worker_to_unregister) and (not query_string):
# Do not redirect the service worker URL
# instead, unregister it and force all clients to reload themself
response = REQUEST.RESPONSE
response.setHeader('Content-Type', 'application/javascript')
return """/*jslint indent: 2*/
/*global self, Promise, caches*/
(function (self, Promise, caches) {
"use strict";
self.addEventListener('install', function (event) {
event.waitUntil(self.skipWaiting());
});
self.addEventListener('activate', function (event) {
event.waitUntil(
caches
.keys()
.then(function (keys) {
return Promise.all(
keys
.map(function (key) {
return caches.delete(key);
})
);
})
.then(function () {
return self.registration.unregister();
})
.then(function () {
return self.clients.matchAll({type: 'window'});
})
.then(function (client_list) {
var i,
promise_list = [];
for (i = 0; i < client_list.length; i += 1) {
promise_list.push(client_list[i].navigate(client_list[i].url));
}
return Promise.all(promise_list);
})
);
});
}(self, Promise, caches));
"""
if query_string:
redirect_url = '?'.join([redirect_url, query_string])
if redirect_url.find(INDEX) > -1 and not redirect_url.endswith(INDEX):
......
......@@ -33,7 +33,7 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestZeleniumCore(ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "erp5_web_manifest_ui_zuite"
def getBusinessTemplateList(self):
return (
'erp5_web_renderjs_ui',
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testManifest</string> </value>
<value> <string>testFunctionalManifest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -18,7 +18,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testManifest</string> </value>
<value> <string>test.erp5.testFunctionalManifest</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
test.erp5.testManifest
\ No newline at end of file
test.erp5.testFunctionalManifest
\ No newline at end of file
......@@ -73,12 +73,15 @@ class TestStaticWebSiteRedirection(ERP5TypeTestCase):
self.tic()
return website
def runTestRedirect(self, source_path, expected_failure=None, use_moved_temporarily=None, **kw):
def runTestRedirect(self, source_path, expected_failure=None,
use_moved_temporarily=None,
configuration_service_worker_url=None, **kw):
"""
Redirect to backend configuration redirect_domain
"""
# create website and websection
website = self.setupWebSite(use_moved_temporarily=use_moved_temporarily)
website = self.setupWebSite(use_moved_temporarily=use_moved_temporarily,
configuration_service_worker_url=configuration_service_worker_url)
absolute_url = website.absolute_url()
......@@ -119,8 +122,20 @@ class TestStaticWebSiteRedirection(ERP5TypeTestCase):
url=url_to_check
)
response = connection.getresponse()
self.assertEquals(response.status, status_to_assert, '%s: %s' % (response.status, url_to_check))
self.assertEquals(response.getheader(LOCATION), redirect_location)
response_body = response.read()
if (source_path == configuration_service_worker_url):
# Test service worker URL
self.assertEquals(response.status, httplib.OK, '%s: %s' % (response.status, url_to_check))
self.assertEquals(response.getheader('Content-Type'), 'application/javascript')
self.assertTrue('self.registration.unregister()' in response_body,
response_body)
else:
self.assertEquals(response.status, status_to_assert, '%s: %s' % (response.status, url_to_check))
self.assertEquals(response.getheader(LOCATION), redirect_location)
self.assertEquals(response.getheader('Content-Type'), 'text/plain; charset=utf-8')
self.assertEquals(response_body, redirect_location)
##############################################################################
......@@ -191,6 +206,10 @@ class TestStaticWebSiteRedirection(ERP5TypeTestCase):
def test_302queryStringRedirectFolderDeepNested(self):
self.runTestRedirect("foo/bar/baz?baz=bam&cous=cous&amp;the=end", use_moved_temporarily=1)
def test_unregisterServiceWorker(self):
worker_url = 'worker.js'
self.runTestRedirect(worker_url,
configuration_service_worker_url=worker_url)
class TestStaticWebSectionRedirection(TestStaticWebSiteRedirection):
......
......@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testStaticWebSiteRedirection</string> </value>
......@@ -43,11 +37,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 91, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W: 91, 16: Unused variable \'api_netloc\' (unused-variable)</string>
<string>W: 91, 4: Unused variable \'api_scheme\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -57,28 +47,13 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<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="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -91,7 +66,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -100,7 +75,7 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
from Products.ERP5Form.ListBox import ListBoxHTMLRenderer
from Products.CMFCore.Expression import getExprContext
def getListBoxRenderer(self, field, REQUEST, render_prefix=None):
""" XXXX"""
return ListBoxHTMLRenderer(self, field, REQUEST, render_prefix)
def execExpression(self, expression):
"""
Allow exec <Products.CMFCore.Expression.Expression object ..> instances from
within restricted environment.
XXX: consider its security impact
"""
econtext = getExprContext(self)
return expression(econtext)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>HTML5</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.HTML5</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1377844685.09</float>
<string>GMT+9</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_xhtml_gadget_core</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>d</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_asJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_contextBox</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Return action and modules links for ERP5's navigation
box.
"""
from json import dumps
portal= context.getPortalObject()
actions = context.Base_filterDuplicateActions(portal.portal_actions.listFilteredActionsFor(context))
preferred_html_style_developper_mode = portal.portal_preferences.getPreferredHtmlStyleDevelopperMode()
# XXX: use client side translation!
translate = context.Base_translateString
def unLazyActionList(action_list):
# convert to plain dict as list items are lazy calculated ActionInfo instances
fixed_action_list = []
for action in action_list:
d = {}
for k,v in action.items():
if k in ['url', 'title']:
if k == 'url':
# escape '&' as not possible use it in a JSON string
if type(v)!=type('s'):
# this is a tales expression so we need to calculate it
v = str(context.execExpression(v))
d[k] = v
fixed_action_list.append(d)
return fixed_action_list
result = {}
result['type_info_list'] = []
result['workflow_list'] = []
result['document_template_list'] = []
result['object_workflow_action_list'] = []
result['object_action_list'] = []
result['object_view_list'] = []
result['folder_action_list'] = []
result['object_jump_list'] = unLazyActionList(actions['object_jump'])
# add links to edit current portal type
if preferred_html_style_developper_mode:
type_info_list = []
type_info = portal.portal_types.getTypeInfo(context)
if type_info is not None:
type_info_list = [{"title": "-- %s --" %translate("Developer Mode"),
"url": ""},
{"title": "Edit Portal Type %s" %type_info.getPortalTypeName(),
"url": type_info.absolute_url()}]
result['type_info_list'] = type_info_list
# add links for workflows
if portal.portal_workflow.Base_getSourceVisibility():
workflow_list = portal.portal_workflow.getWorkflowValueListFor(context)
if workflow_list:
result['workflow_list'] = [{"title": "-- %s --" %translate("Workflows"),
"url": ""}]
result['workflow_list'].extend([{"title": x.title,
"url": "%s/manage_main" %x.absolute_url()} for x in workflow_list])
# allowed types to add
visible_allowed_content_type_list = context.getVisibleAllowedContentTypeList()
result['visible_allowed_content_type_list'] = [{"title": "Add %s" %x,
"url": "add %s" %x} for x in visible_allowed_content_type_list]
document_template_list = context.getDocumentTemplateList()
if document_template_list:
result['document_template_list'] = [{"title": "-- %s --" %translate("Templates"),
"url": ""}]
result['document_template_list'].extend([{"title": "Add %s" %x,
"url": "template %s" %x} for x in document_template_list])
# workflow actions
object_workflow_action_list = unLazyActionList(actions["workflow"])
if object_workflow_action_list:
result['object_workflow_action_list'] = [{"title": "-- %s --" %translate("Workflows"),
"url": ""}]
result['object_workflow_action_list'].extend([{"title": "%s" %x['title'],
"url": "workflow %s" %x['url']} for x in object_workflow_action_list])
# object actions
object_action_list = unLazyActionList(actions["object_action"])
if object_action_list:
result['object_action_list'] = [{"title": "-- %s --" %translate("Object"),
"url": ""}]
result['object_action_list'].extend([{"title": "%s" %x['title'],
"url": "object %s" %x['url']} for x in object_action_list])
# object_view
object_view_list = [i for i in actions["object_view"] if i['id']=='module_view']
object_view_list = unLazyActionList(object_view_list)
if object_view_list:
result['object_view_list'].extend([{"title": "%s" %x['title'],
"url": "object %s" %x['url']} for x in object_view_list])
# folder ones
folder_action_list = unLazyActionList(actions["folder"])
if folder_action_list:
result['folder_action_list'] = [{"title": "-- %s --" %translate("Folder"),
"url": ""}]
result['folder_action_list'].extend([{"title": "%s" %x['title'],
"url": "folder %s" %x['url']} for x in object_action_list])
# XXX: buttons
return dumps(result)
<?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>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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>id</string> </key>
<value> <string>ERP5Site_getContextBoxActionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Return action and modules links for ERP5's navigation
box.
"""
from json import dumps
portal= context.getPortalObject()
def unLazyActionList(action_list):
# convert to plain dict as list items are lazy calculated ActionInfo instances
fixed_action_list = []
for action in action_list:
d = {}
for k,v in action.items():
if k in ['url', 'title']:
if k == 'url':
# escape '&' as not possible use it in a JSON string
if type(v)!=type('s'):
# this is a tales expression so we need to calculate it
v = str(context.execExpression(v))
d[k] = v
fixed_action_list.append(d)
return fixed_action_list
result = {}
module_list = portal.ERP5Site_getModuleItemList()
search_portal_type_list = portal.getPortalDocumentTypeList() + ('Person', 'Organisation',)
language_list = portal.Localizer.get_languages_map()
actions = portal.portal_actions.listFilteredActionsFor(context)
ordered_global_actions = context.getOrderedGlobalActionList(actions['global']);
user_actions = actions['user']
ordered_global_action_list = unLazyActionList(ordered_global_actions)
user_action_list = unLazyActionList(user_actions)
result['favourite_dict'] = {"ordered_global_action_list": ordered_global_action_list,
"user_action_list": user_action_list
}
result['module_list'] = module_list
result['language_list'] = language_list
result['search_portal_type_list'] = [ [x,x] for x in search_portal_type_list]
return dumps(result)
<?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>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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>id</string> </key>
<value> <string>ERP5Site_getNavigationBoxActionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_navigationBox</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<span class="first">
<span id="favourites" class="favourites">
<select name="select_favorite"
onchange="submitAction(this.form,'Base_doFavorite')">
<option selected="selected" value=""
i18n:translate="" i18n:domain="ui">My Favourites</option>
</select>
<button type="submit" name="Base_doFavorite:method" title="Select Favourite"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description"
i18n:translate="" i18n:domain="ui">Select Favourite</span>
</button>
</span>
<span class="separator"><!--separator--></span>
<span id="modules" class="modules">
<select name="select_module"
onchange="submitAction(this.form,'Base_doModule')">
<option selected="selected" value="" i18n:translate="" i18n:domain="ui">Modules</option>
</select>
<button type="submit" name="Base_doModule:method" title="Select Module"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description"
i18n:translate="" i18n:domain="ui">Select Module</span>
</button>
</span>
</span>
<span class="second">
<span id="language" class="language">
<select name="select_language"
onchange="submitAction(this.form,'Base_doLanguage')">
<option value=""
i18n:translate="" i18n:domain="ui">My Language</option>
</select>
<button type="submit" name="Base_doLanguage:method" title="Select Language"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description"
i18n:translate="" i18n:domain="ui">Select Language</span>
</button>
</span>
<span class="separator"><!--separator--></span>
<span id="search" class="search" tal:define="search_default_text python:here.Base_translateString('Search')">
<input type="hidden" name="all_languages" value="1" />
<input class="quick_search_field" accesskey="4"
type="text" name="field_your_search_text"
value="Search"
tal:attributes="value string:${search_default_text};
onfocus string:if (this.value=='${search_default_text}') this.value='';"
onfocus="this.value='';"
onkeypress="submitFormOnEnter(event, this.form, 'ERP5Site_processAdvancedSearch');" />
<select size="1" class="input" name="field_your_search_portal_type">
<option value="" selected="selected" i18n:translate="" i18n:domain="ui">Everything</option>
<option value="all" i18n:translate="" i18n:domain="ui">All Documents</option>
</select>
<button type="submit" name="ERP5Site_processAdvancedSearch:method" title="Search"
i18n:attributes="title" i18n:domain="ui">
<span class="image"></span>
<span class="description"
i18n:translate="" i18n:domain="ui">Search</span>
</button>
</span>
</span>
<p class="clear"></p>
</tal:block>
<script type="text/javascript">
//<![CDATA[
gadget = RenderJs.getSelfGadget();
gadget.render = ERP5UI.updateNavigationBox;
gadget.render();
//]]>
</script>
\ No newline at end of file
return context.ERP5Site_viewQuickSearchResultList(
field_your_search_text = field_your_search_text,
field_your_search_portal_type = field_your_search_portal_type,
all_languages=all_languages)
<?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>field_your_search_text=\'\', field_your_search_portal_type=None, all_languages=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_processAdvancedSearch</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_renderBreadcrumb</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<div tal:define="portal here/getPortalObject;
portal_url portal/absolute_url;">
<div id="breadcrumb" class="breadcrumb">
<tal:block metal:use-macro="here/breadcrumb_render/macros/breadcrumb" />
</div>
<div id="logged_in_as" class="logged_in_as">
<tal:block tal:condition="not: portal/portal_membership/isAnonymousUser">
<span class="logged_txt" i18n:translate="" i18n:domain="ui">Logged In as :</span>
<tal:block tal:replace="python:portal.Base_getUserCaption()" />
</tal:block>
</div>
<p class="clear"></p>
<div data-gadget="ERP5Site_renderPortalStatusMessage"
tal:attributes="data-gadget string:${portal_url}/ERP5Site_renderPortalStatusMessage"
id="portal_status_message"></div>
</div>
\ No newline at end of file
from Products.ERP5Type.Cache import CachingMethod
navigation_box_render = context.ERP5Site_navigationBox
navigation_box_render = CachingMethod(navigation_box_render,
("ERP5Site_renderCachedNavigationBox",
context.portal_membership.getAuthenticatedMember().getIdOrUserName(),
context.Localizer.get_selected_language(),
context.portal_url(),
),cache_factory='erp5_ui_short')
return navigation_box_render()
<?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>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_renderNavigationBox</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_renderPortalStatusMessage</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
</head>
<body>
<div class="transition_message"
id="transition_message"
style="display:none; color:red;font-weight:bold;"></div>
<script type="text/javascript" language="javascript">
//<![CDATA[
$(document).ready(function() {
var portal_status_message,
gadget = RenderJs.getSelfGadget();
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
};
gadget.showMessage = function (message, timeout) {
// show message in UI
var msg_element = $("#transition_message");
if (timeout===undefined) {
timeout = 4000;
}
msg_element.toggle();
msg_element.html(message);
window.setTimeout('$("#transition_message").toggle();', timeout);
};
// in some cases a message can be inside current URL as well
// so show it.
portal_status_message = getURLParameter("portal_status_message");
if (portal_status_message!==undefined && portal_status_message!==null && portal_status_message!=='null') {
gadget.showMessage(portal_status_message, 5000);
}
});
//]]>
</script>
</body>
</html>
\ No newline at end of file
"""
This script provides all required details of an ERP5 form + values
on respective context. Using these values a javascript client can construct
form at client side.
"""
from json import dumps
LIST_FIELDS = ["ListField", "ParallelListField"]
MARKER = ['', None]
result = {'form_data': {}, }
# use form_id to get list of keys we care for
form = getattr(context, form_id)
for field_id in form.get_field_ids():
base_field_id = field_id.replace("my_", "")
field = getattr(form, field_id)
original_field = field
if field.meta_type == "ProxyField":
field = field.getRecursiveTemplateField()
field_meta_type = field.meta_type
field_value = original_field.get_value("default")
field_dict = result['form_data'][field_id] = {}
field_dict['type'] = field_meta_type
field_dict['editable'] = original_field.get_value("editable")
field_dict['css_class'] = original_field.get_value("css_class")
field_dict['hidden'] = original_field.get_value("hidden")
field_dict['description'] = original_field.get_value("description")
field_dict['enabled'] = original_field.get_value("enabled")
field_dict['title'] = original_field.get_value("title")
field_dict['required'] = original_field.is_required()
field_dict['alternate_name'] = original_field.get_value("alternate_name")
# XXX: some fields have display_width some not (improve)
try:
field_dict['display_width'] = original_field.get_value("display_width")
except:
field_dict['display_width'] = None
if field_meta_type in ["DateTimeField"]:
if field_value not in MARKER:
field_value = field_value.millis()
field_dict['format'] = context.portal_preferences.getPreferredDateOrder('ymd')
# listbox
if field_meta_type in ["ListBox"]:
field_dict['listbox'] = {}
if render_client_side_listbox:
# client side can request its javascript representation so it can generate it using jqgrid
# or ask server generate its entire HTML
field_dict['type'] = 'ListBoxJavaScript'
field_dict['listbox']['lines'] = original_field.get_value("lines")
field_dict['listbox']['columns'] = [x for x in original_field.get_value("columns")]
field_dict['listbox']['listbox_data_url'] = "Listbox_asJSON"
else:
# server generates entire HTML
field_dict['listbox']['listbox_html'] = original_field.render()
if field_meta_type in LIST_FIELDS:
# form contains selects, pass list of selects' values and calculate default one?
field_dict['items'] = original_field.get_value("items")
if field_meta_type in ["FormBox"]:
# this is a special case as this field is part of another form's fields
formbox_target_id = original_field.get_value("formbox_target_id")
formbox_form = getattr(context, formbox_target_id)
# get all values
for formbox_field_id in formbox_form.get_field_ids():
formbox_field_id_field = getattr(formbox_form, formbox_field_id)
field_value = formbox_field_id_field.get_value("default") # only last wins ?
# add field value
field_dict['value'] = field_value
return dumps(result)
<?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=None, render_client_side_listbox=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Form_asJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Form_asRenderJSGadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:define="group_list here/Form_getGroupTitleAndId;
form_id here/getId;
portal here/getPortalObject;
portal_url portal/absolute_url">
<tal:block tal:repeat="group group_list">
<tal:block tal:define="gid group/gid;">
<fieldset tal:attributes="class python:gid +' editable';">
<tal:block tal:repeat="field python: here.get_fields_in_group(group['goid'])">
<tal:block tal:define="title field/title;
field_name python: 'field_%s' %field.getId();
proxied_field python: test(field.meta_type=='ProxyField', field.getRecursiveTemplateField(), field);
field_type python: proxied_field.meta_type;
is_listbox python: field_type=='ListBox'">
<div class="field">
<label tal:content="title" tal:condition="not:is_listbox"/>
<div class="input">
<!-- render gadget asynchronously -->
<div tal:attributes="data-gadget string:${portal_url}/gadgets/form/${field_type}/gadget?field_name=${field_name}&form_id=${form_id};
id string:${form_id}_${field_name};"></div>
</div>
</div>
</tal:block>
</tal:block>
</fieldset>
</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
"""
Save form on context.
"""
from json import dumps
from Products.Formulator.Errors import FormValidationError
from Products.CMFActivity.Errors import ActivityPendingError
request = context.REQUEST
# Prevent users who don't have rights to edit the object from
# editing it by calling the Base_edit script with correct
# parameters directly.
# XXX: implement it (above)
# Get the form
form = getattr(context,form_id)
edit_order = form.edit_order
try:
# Validate
form.validate_all_to_request(request, key_prefix=key_prefix)
except FormValidationError, validation_errors:
# Pack errors into the request
result = {}
result['field_errors'] = {}
field_errors = form.ErrorFields(validation_errors)
for key, value in field_errors.items():
result['field_errors'][key] = value.error_text
return dumps(result)
(kw, encapsulated_editor_list), action = context.Base_edit(form_id, silent_mode=1)
context.log(kw)
context.edit(REQUEST=request, edit_order=edit_order, **kw)
for encapsulated_editor in encapsulated_editor_list:
encapsulated_editor.edit(context)
# XXX: consider some kind of protocol ?
return dumps({})
<?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, key_prefix = None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Form_save</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from json import dumps
REQUEST = context.REQUEST
form = getattr(context, form_id)
listbox = getattr(form, listbox_id)
lines = listbox.get_value("lines")
columns = listbox.get_value("columns")
listbox_renderer = context.getListBoxRenderer(listbox, REQUEST)
# listbox pagination for jqgrid
# XXX: jqgrid always sends page which makes server side slection be resetted
selection_name = listbox.get_value("selection_name")
page = REQUEST.get("page")
if page is not None:
page = int(page)
REQUEST.form['page_start'] = page
context.portal_selections.setPage(list_selection_name=selection_name, \
listbox_uid=[],
REQUEST=REQUEST)
#context.log ("Set page = %s %s" %(page, selection_name))
row_list= []
line_list = listbox_renderer.query()
for line in line_list:
value_line = line.getValueList()
row = {"id": value_line[0][0],
"cell": [x[1] for x in value_line]}
row_list.append(row)
# return real listbox data here by using form and context
listbox_max_lines = int(listbox_renderer.getMaxLineNumber())
total_pages = listbox_renderer.total_pages
total_line = int(listbox_renderer.total_size)
current_page = int(listbox_renderer.current_page) + 1
current_page_max = listbox_max_lines * current_page
current_page_start = (listbox_max_lines * (current_page - 1)) + 1
current_page_stop = (total_line < current_page_max) and total_line or current_page_max
#context.log("%s %s %s %s %s %s" %(listbox_max_lines, total_line, current_page,
# current_page_max, current_page_start, current_page_stop))
json = {"page": page,
"total": total_pages,
"records": total_line,
"rows":row_list}
return dumps(json)
<?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, listbox_id="listbox"</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Listbox_asJSON</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>context_box_render_wrapper</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block metal:use-macro="here/global_definitions/macros/header_definitions" />
<tal:block metal:use-macro="here/ERP5Site_contextBox/macros/master" />
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_tabbular_form_renderer</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<title tal:content="template/title">The title</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<script type="text/javascript" language="javascript">
//<![CDATA[
$(document).ready(function() {
gadget = RenderJs.getSelfGadget();
// default tab should be openned fist
gadget.redirect = function () {
$.url.redirect('/' + gadget.default_tab_url + '/');
};
// default route
RenderJs.RouteGadget.add('', gadget.redirect, 1);
$.each(gadget.action_id_list, function(index, value) {
// add dynamic function to gadget that will take care to render tab using gadgets
gadget[value] = function () {
ERP5Form.openFormInTabbularGadget(gadget.tab_container_id, value);
};
//add dynamic route
RenderJs.RouteGadget.add('/' + value + '/', gadget[value], 1);
});
});
//]]>
</script>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>execExpression</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>HTML5</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>execExpression</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget-style-lib</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>erp5_form.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
// Contains ERP5 UI's build javascript code
var ERP5UI = ( function () {
function addOptionTagDict(dom, list) {
$.each(list, function (index,value) {
if (value.url!==undefined) {
dom.append('<option value="' + value.url + '">' + value.title + '</option>');
}
else {
dom.append('<option disabled="disabled">-- ' + value.title + ' --</option>');
}
});
}
return {
updateNavigationBox: function () {
/*
* Used by navigation_box gadget. Added here to reduce number of .js files.
*/
$.ajax({
url: "ERP5Site_getNavigationBoxActionList",
dataType: "json",
success: function (data) {
var module_dom = $('select[name="select_module"]'),
search_type_dom = $('select[name="field_your_search_portal_type"]'),
language_dom = $('select[name="select_language"]'),
favorite_dom = $('select[name="select_favorite"]');
ERP5Form.addOptionTagList(module_dom, data.module_list, "");
ERP5Form.addOptionTagList(search_type_dom, data.search_portal_type_list, "");
ERP5Form.addOptionTagDictList(language_dom, data.language_list);
// add global actions
addOptionTagDict(favorite_dom, data.favourite_dict.ordered_global_action_list);
// add user action
favorite_dom.append('<option disabled="disabled">-- User --</option>');
addOptionTagDict(favorite_dom, data.favourite_dict.user_action_list);
}
});
},
updateContextBox: function () {
/*
* Used by context_box gadget. Added here to reduce number of .js files.
*/
$.ajax({
url: "ERP5Site_getContextBoxActionList",
dataType: "json",
success: function (data) {
var jump_dom = $('select[name="select_jump"]'),
action_dom = $('select[name="select_action"]');
console.log(data);
addOptionTagDict(jump_dom, data.object_jump_list);
addOptionTagDict(jump_dom, data.type_info_list);
addOptionTagDict(jump_dom, data.workflow_list);
addOptionTagDict(action_dom, data.visible_allowed_content_type_list);
addOptionTagDict(action_dom, data.document_template_list);
addOptionTagDict(action_dom, data.object_workflow_action_list);
addOptionTagDict(action_dom, data.object_action_list);
addOptionTagDict(action_dom, data.object_view_list);
addOptionTagDict(action_dom, data.folder_action_list);
}
});
}
}} ());
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>erp5_ui.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
// JavaScript file that is used to load ERP5's JavaScript depenencies
require.config({
paths: {
"erp5_form": "gadget-style-lib/erp5_form",
route: "gadget-style-lib/route",
url: "gadget-style-lib/url",
jquery: "jquery/core/jquery",
renderjs: "jquery/plugin/renderjs/renderjs",
"jquery-ui": "jquery/ui/js/jquery-ui.min",
"jquery.jqGrid.src": "jquery/plugin/jqgrid/jquery.jqGrid.src",
"grid.locale-en": "jquery/plugin/jqgrid/i18n/grid.locale-en"
},
shim: {
erp5: ["jquery"],
erp5_xhtml_appearance: ["erp5"],
erp5_knowledge_box: ["jquery", "jquery-ui"],
route: ["jquery"],
url: ["jquery"],
"jquery-ui": ["jquery"],
"jquery.jqGrid.src": ["jquery"],
"grid.locale-en": ["jquery.jqGrid.src"]
}
});
require(["erp5_xhtml_appearance", "erp5_knowledge_box", "erp5", "erp5_form", "erp5_ui",
"renderjs", "jquery", "jquery-ui", "route", "url",
"jquery.jqGrid.src", "grid.locale-en"],
function(domReady) {
RenderJs.init();
RenderJs.bindReady(function (){
$.url.onhashchange(function () {
//console.log("go to route", $.url.getPath());
RenderJs.RouteGadget.go($.url.getPath(),
function () {
//console.log("bad route");
// All routes have been deleted by fail.
// So recreate the default routes using RouteGadget
RenderJs.RouteGadget.init();
});
});
});
});
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>require-erp5.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>require.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>require.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, jQuery */
/*!
* route.js v1.0.0
*
* Copyright 2012, Romain Courteaud
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Date: Mon Jul 16 2012
*/
"use strict";
(function (window, $) {
$.extend({
StatelessDeferred: function () {
var doneList = $.Callbacks("memory"),
promise = {
done: doneList.add,
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function (obj) {
var i,
keys = ['done', 'promise'];
if (obj === undefined) {
obj = promise;
} else {
for (i = 0; i < keys.length; i += 1) {
obj[keys[i]] = promise[keys[i]];
}
}
return obj;
}
},
deferred = promise.promise({});
deferred.resolveWith = doneList.fireWith;
// All done!
return deferred;
}
});
var routes = [],
current_priority = 0,
methods = {
add: function (pattern, priority) {
var i = 0,
inserted = false,
length = routes.length,
dfr = $.StatelessDeferred(),
context = $(this),
escapepattern,
matchingpattern;
if (priority === undefined) {
priority = 0;
}
if (pattern !== undefined) {
// http://simonwillison.net/2006/Jan/20/escape/
escapepattern = pattern.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
matchingpattern = escapepattern
.replace(/<int:\w+>/g, "(\\d+)")
.replace(/<path:\w+>/g, "(.+)")
.replace(/<\w+>/g, "([^/]+)");
while (!inserted) {
if ((i === length) || (priority >= routes[i][2])) {
routes.splice(i, 0, [new RegExp('^' + matchingpattern + '$'), dfr, priority, context]);
inserted = true;
} else {
i += 1;
}
}
}
return dfr.promise();
},
go: function (path, min_priority) {
var dfr = $.Deferred(),
context = $(this),
result;
if (min_priority === undefined) {
min_priority = 0;
}
setTimeout(function () {
var i = 0,
found = false,
slice_index = -1,
slice_priority = -1;
for (i = 0; i < routes.length; i += 1) {
if (slice_priority !== routes[i][2]) {
slice_priority = routes[i][2];
slice_index = i;
}
if (routes[i][2] < min_priority) {
break;
} else if (routes[i][0].test(path)) {
result = routes[i][0].exec(path);
dfr = routes[i][1];
context = routes[i][3];
current_priority = routes[i][2];
found = true;
break;
}
}
if (i === routes.length) {
slice_index = i;
}
if (slice_index > -1) {
routes = routes.slice(slice_index);
}
if (found) {
dfr.resolveWith(
context,
result.slice(1)
);
} else {
dfr.rejectWith(context);
}
});
return dfr.promise();
},
};
$.routereset = function () {
routes = [];
current_priority = 0;
};
$.routepriority = function () {
return current_priority;
};
$.fn.route = function (method) {
var result;
if (methods.hasOwnProperty(method)) {
result = methods[method].apply(
this,
Array.prototype.slice.call(arguments, 1)
);
} else {
$.error('Method ' + method +
' does not exist on jQuery.route');
}
return result;
};
}(window, jQuery));
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>route.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>route.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*!
* url.js v1.0.0
*
* Copyright 2012, Romain Courteaud
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Date: Mon Jul 16 2012
*/
"use strict";
(function (window, $) {
var hashchangeinitialized = false,
previousurl,
currentcallback,
getRawHash = function () {
return window.location.toString().split('#')[1];
},
callbackwrapper = function () {
if (previousurl !== window.location.hash) {
previousurl = window.location.hash;
if (currentcallback !== undefined) {
currentcallback();
}
}
},
timeoutwrapper = function () {
callbackwrapper();
window.setTimeout(timeoutwrapper, 500);
};
function UrlHandler() {}
UrlHandler.prototype = {
'generateUrl': function (path, options) {
var pathhash,
hash = '#',
key;
if (path !== undefined) {
hash += encodeURIComponent(path);
}
hash = hash.replace(/%2F/g, '/');
pathhash = hash;
for (key in options) {
if (options.hasOwnProperty(key)) {
if (hash === pathhash) {
hash = hash + '?';
} else {
hash = hash + '&';
}
hash += encodeURIComponent(key) +
'=' + encodeURIComponent(options[key]);
}
}
return hash;
},
'go': function (path, options) {
window.location.hash = this.generateUrl(path, options);
},
'redirect': function (path, options) {
var host = window.location.protocol + '//' +
window.location.host +
window.location.pathname +
window.location.search;
window.location.replace(host + this.generateUrl(path, options));
// window.location.replace(window.location.href.replace(/#.*/, ""));
},
'getPath': function () {
var hash = getRawHash(),
result = '';
if (hash !== undefined) {
result = decodeURIComponent(hash.split('?')[0]);
}
return result;
},
'getOptions': function () {
var options = {},
hash = getRawHash(),
subhashes,
subhash,
index,
keyvalue;
if (hash !== undefined) {
hash = hash.split('?')[1];
if (hash !== undefined) {
subhashes = hash.split('&');
for (index in subhashes) {
if (subhashes.hasOwnProperty(index)) {
subhash = subhashes[index];
if (subhash !== '') {
keyvalue = subhash.split('=');
if (keyvalue.length === 2) {
options[decodeURIComponent(keyvalue[0])] =
decodeURIComponent(keyvalue[1]);
}
}
}
}
}
}
return options;
},
'onhashchange': function (callback) {
previousurl = undefined;
currentcallback = callback;
if (!hashchangeinitialized) {
if (window.onhashchange !== undefined) {
$(window).bind('hashchange', callbackwrapper);
window.setTimeout(callbackwrapper);
} else {
timeoutwrapper();
}
hashchangeinitialized = true;
}
},
};
// Expose to the global object
$.url = new UrlHandler();
}(window, jQuery));
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>url.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>url.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
.document .content{
min-height:100px;
}
.required-field label{
font-weight: bold;
}
.validation-failed {
border: 1px solid red;
}
.center_left {
float:left;
width: 50%;
}
.center_right {
float: left;
margin-left: 0.5%;
width: 47.5%;
}
fieldset.left {
margin-right:0px;
}
fieldset.right {
width:47.5%;
margin-left:0.5%;
}
.center_left,
.center_right{
border: 1px solid #97B0D1;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
margin-bottom: 5px;
}
//portal_status_gadget CSS
#portal_status_message p {
display:none;
color:red;
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget-style.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadgets</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Portal Gadgets</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>form</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CheckBoxField</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:define="field_name request/field_name | options/field_name">
<input type="checkbox"
tal:attributes="name field_name"/>
</tal:block>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DateTimeField</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:define="field_name request/field_name | options/field_name">
<input type="text"
tal:attributes="name field_name"/>
</tal:block>
\ No newline at end of file
<tal:block tal:define="field_name request/field_name | options/field_name">
<div tal:attributes="id field_name"/>
</tal:block>
\ No newline at end of file
<tal:block tal:define="field_name request/field_name | options/field_name">
<input type="text"
tal:attributes="name field_name"/>
</tal:block>
\ No newline at end of file
<tal:block tal:define="field_name request/field_name | options/field_name">
<input type="file"
size="20"
tal:attributes="name field_name"/>
</tal:block>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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