Commit 99c8bb98 authored by Łukasz Nowak's avatar Łukasz Nowak

Implement computer selection during software instantiation.

Users shall be able to instantiate software instances on their computers. This
is the most often found scenario (add *my* computer and instantiate on *it*
some software).
parent e58b02c7
...@@ -79,6 +79,7 @@ params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n ...@@ -79,6 +79,7 @@ params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n
params["instance_software_product_uid"] = uids[0]\n params["instance_software_product_uid"] = uids[0]\n
params["service_title"] = service_title\n params["service_title"] = service_title\n
params["instance_xml"] = instance_xml\n params["instance_xml"] = instance_xml\n
params["computer"] = computer\n
portal.portal_selections.setSelectionParamsFor(\'vifib_session_id\', params)\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
...@@ -92,7 +93,7 @@ context.WebSection_viewNextStep()\n ...@@ -92,7 +93,7 @@ context.WebSection_viewNextStep()\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>dialog_id, service_title, instance_xml, uids=[], quantity = 1, reset_shopping_cart=True, **kw</string> </value> <value> <string>dialog_id, service_title, instance_xml, computer=\'\', uids=[], quantity = 1, reset_shopping_cart=True, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Update customer informations"""\n <value> <string encoding="cdata"><![CDATA[
"""Update customer informations"""\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
...@@ -71,17 +73,30 @@ params = portal.portal_selections.getSelectionParamsFor(\'vifib_session_id\')\n ...@@ -71,17 +73,30 @@ 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
service_title = params[\'service_title\']\n service_title = params[\'service_title\']\n
instance_xml = params[\'instance_xml\']\n instance_xml = params[\'instance_xml\']\n
computer = params[\'computer\']\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 request_kw = {}\n
request_kw.update(\n
software_release=software_release.getUrlString(),\n software_release=software_release.getUrlString(),\n
software_title=service_title,\n software_title=service_title,\n
instance_xml=instance_xml,\n instance_xml=instance_xml,\n
)\n )\n
\n \n
if computer:\n
computer = context.restrictedTraverse(computer)\n
request_kw[\'sla_xml\'] = """<?xml version=\'1.0\' encoding=\'utf-8\'?>\n
<instance>\n
<parameter id="computer_guid">%s</parameter>\n
</instance>""" % computer.getReference()\n
\n
person.requestSoftwareInstance(**request_kw)\n
\n
message = context.Base_translateString("Your instance is under creation. Thank you for using ViFiB!")\n message = context.Base_translateString("Your instance is under creation. Thank you for using ViFiB!")\n
return context.getWebSiteValue().Base_redirect(keep_items={\'portal_status_message\': message})\n return context.getWebSiteValue().Base_redirect(keep_items={\'portal_status_message\': message})\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
<string>my_description</string> <string>my_description</string>
<string>your_service_title</string> <string>your_service_title</string>
<string>your_instance_xml</string> <string>your_instance_xml</string>
<string>your_computer</string>
</list> </list>
</value> </value>
</item> </item>
......
292 293
\ 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