Commit 0c8e71bf authored by Łukasz Nowak's avatar Łukasz Nowak

- force user to provide title of each service

 - force unicity of title


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43816 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d74cc9bd
...@@ -50,24 +50,44 @@ ...@@ -50,24 +50,44 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Add selected product to the cart and continue"""\n <value> <string encoding="cdata"><![CDATA[
"""Add selected product to the cart and continue"""\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
if len(uids) != 1:\n if len(uids) != 1:\n
return context.Base_redirect(dialog_id,\n return context.Base_redirect(dialog_id,\n
keep_items={\'portal_status_message\':context.Base_translateString("Please select one service.")})\n keep_items={\'portal_status_message\':context.Base_translateString("Please select one service.")})\n
else:\n \n
session = context.WebSection_getVifibSession()\n if not service_title:\n
params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n return context.Base_redirect(dialog_id,\n
params["instance_software_product_uid"] = uids[0]\n keep_items={\'portal_status_message\':context.Base_translateString("You have to provide Service Title.")})\n
portal.portal_selections.setSelectionParamsFor(\'vifib_session_id\', params)\n \n
software_instance_list = context.portal_catalog(\n
portal_type=\'Software Instance\',\n
select_expression=\'title\',\n
title={\'query\': service_title, \'key\': \'ExactMatch\'}\n
)\n
\n
if len(software_instance_list) > 0:\n
return context.Base_redirect(dialog_id,\n
keep_items={\'portal_status_message\':context.Base_translateString(\n
"You already have service named ${service_title}. Please choose different unique name.", mapping={\'service_title\': service_title})})\n
\n
session = context.WebSection_getVifibSession()\n
params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n
params["instance_software_product_uid"] = uids[0]\n
params["service_title"] = service_title\n
portal.portal_selections.setSelectionParamsFor(\'vifib_session_id\', params)\n
\n \n
if kw.has_key(\'came_from\'):\n if kw.has_key(\'came_from\'):\n
#we override the context to redirect the user to the next web section\n #we override the context to redirect the user to the next web section\n
context = portal.restrictedTraverse(kw[\'came_from\'])\n context = portal.restrictedTraverse(kw[\'came_from\'])\n
\n \n
context.WebSection_viewNextStep()\n context.WebSection_viewNextStep()\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -77,7 +97,7 @@ context.WebSection_viewNextStep()\n ...@@ -77,7 +97,7 @@ context.WebSection_viewNextStep()\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>dialog_id, uids=[], quantity = 1, reset_shopping_cart=True, **kw</string> </value> <value> <string>dialog_id, service_title, uids=[], quantity = 1, reset_shopping_cart=True, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -97,13 +117,14 @@ context.WebSection_viewNextStep()\n ...@@ -97,13 +117,14 @@ context.WebSection_viewNextStep()\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>4</int> </value> <value> <int>5</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>dialog_id</string> <string>dialog_id</string>
<string>service_title</string>
<string>uids</string> <string>uids</string>
<string>quantity</string> <string>quantity</string>
<string>reset_shopping_cart</string> <string>reset_shopping_cart</string>
...@@ -112,6 +133,7 @@ context.WebSection_viewNextStep()\n ...@@ -112,6 +133,7 @@ context.WebSection_viewNextStep()\n
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
<string>len</string> <string>len</string>
<string>software_instance_list</string>
<string>session</string> <string>session</string>
<string>params</string> <string>params</string>
<string>_getitem_</string> <string>_getitem_</string>
......
...@@ -71,12 +71,12 @@ person.edit(\n ...@@ -71,12 +71,12 @@ person.edit(\n
session = context.WebSection_getVifibSession()\n session = context.WebSection_getVifibSession()\n
params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n
instance_software_release_uid = params[\'instance_software_release_uid\']\n instance_software_release_uid = params[\'instance_software_release_uid\']\n
\n service_title = params[\'service_title\']\n
software_release = portal.portal_catalog.getResultValue(uid=instance_software_release_uid)\n software_release = portal.portal_catalog.getResultValue(uid=instance_software_release_uid)\n
\n \n
person.requestSoftwareInstance(\n person.requestSoftwareInstance(\n
software_release=software_release.getUrlString(),\n software_release=software_release.getUrlString(),\n
software_title=software_release.getTitle(), # XXX: This shall be provided by user to allow him have more then one Software Instance of given Software Release\n software_title=service_title,\n
instance_xml="""<?xml version="1.0" encoding="utf-8"?>\n instance_xml="""<?xml version="1.0" encoding="utf-8"?>\n
<instance>\n <instance>\n
<parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n <parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n
...@@ -142,6 +142,7 @@ return context.getWebSiteValue().Base_redirect(keep_items={\'portal_status_messa ...@@ -142,6 +142,7 @@ return context.getWebSiteValue().Base_redirect(keep_items={\'portal_status_messa
<string>params</string> <string>params</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>instance_software_release_uid</string> <string>instance_software_release_uid</string>
<string>service_title</string>
<string>software_release</string> <string>software_release</string>
<string>message</string> <string>message</string>
</tuple> </tuple>
......
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<value> <value>
<list> <list>
<string>my_description</string> <string>my_description</string>
<string>your_service_title</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StringField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_service_title</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>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Service Title</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
278 279
\ No newline at end of file \ No newline at end of file
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