Commit 485571b0 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_trial: Make free trial configurable via Web Section

parent 819e3e4d
<?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>software_release</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TrialRequest_getTrialConfiguration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -80,9 +80,7 @@
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>my_layout_hosting_request_notification_reference</string>
</list>
<list/>
</value>
</item>
<item>
......@@ -95,11 +93,16 @@
<key> <string>left</string> </key>
<value>
<list>
<string>my_layout_logo_reference</string>
<string>my_layout_footer_reference</string>
<string>my_layout_subscription_contract_reference</string>
<string>my_layout_terms_of_service_reference</string>
<string>my_layout_software_product_reference</string>
<string>my_layout_subject_list</string>
<string>my_layout_software_release_url</string>
<string>my_layout_is_slave</string>
<string>my_layout_software_type</string>
<string>my_layout_instance_xml</string>
<string>my_layout_sla_xml</string>
<string>my_layout_user_input_list</string>
<string>my_layout_base_software_title</string>
</list>
</value>
</item>
......
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_layout_footer_reference</string> </value>
<value> <string>my_layout_base_software_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -85,7 +85,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Footer Reference</string> </value>
<value> <string>Base Software Title</string> </value>
</item>
</dictionary>
</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>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_layout_instance_xml</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_text_area_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewWebFieldLibrary</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>Instance XML</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_layout_is_slave</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_checkbox</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>Shared</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_layout_sla_xml</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_text_area_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewWebFieldLibrary</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>Sla XML</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_layout_subscription_contract_reference</string> </value>
<value> <string>my_layout_software_release_url</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -85,7 +85,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Subscription Contract Reference</string> </value>
<value> <string>Software Release URL</string> </value>
</item>
</dictionary>
</value>
......
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_layout_logo_reference</string> </value>
<value> <string>my_layout_software_type</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -85,7 +85,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Logo Reference</string> </value>
<value> <string>Software Type</string> </value>
</item>
</dictionary>
</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>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_layout_subject_list</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_lines_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewWebFieldLibrary</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>Expected Connection Parameter List</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -16,7 +16,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_layout_hosting_request_notification_reference</string> </value>
<value> <string>my_layout_user_input_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -73,7 +73,7 @@
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
<value> <string>my_lines_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
......@@ -85,7 +85,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Hosting Subscription Start Notification Reference</string> </value>
<value> <string>User Input List</string> </value>
</item>
</dictionary>
</value>
......
......@@ -14,4 +14,11 @@ else:
if default_email_text is None:
return context.Base_redirect("WebSite_viewFreeTrialForm", keep_items={"portal_status_message", "Please Provide some email!"})
return context.WebSite_requestFreeTrialProxy(software_release, default_email_text, batch_mode=0)
user_input_dict = {
"input0": default_input0,
"input1": default_input1}
return context.WebSite_requestFreeTrialProxy(
software_release, default_email_text,
user_input_dict=user_input_dict, batch_mode=0)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>software_release=None, default_email_text=None, REQUEST=None</string> </value>
<value> <string>software_release=None, default_email_text=None, default_input0=None, default_input1=None, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -7,11 +7,22 @@ if REQUEST is not None:
request = context.REQUEST
portal = context.getPortalObject()
web_section = context.getWebSectionValue()
trial_configuration = context.TrialRequest_getTrialConfiguration(software_release)
def _get(layout_property):
return web_section.getLayoutProperty("layout_" + layout_property)
software_title = trial_configuration["base_software_title"] % (email)
trial_configuration = {
"instance_xml": _get("instance_xml"),
"base_software_title": _get("base_software_title"),
"software_type": _get("software_type"),
"url":_get("software_release_url"),
"shared": _get("is_slave"),
"subject_list": _get("subject_list"),
"sla_xml": _get("sla_xml")
}
software_title = trial_configuration["base_software_title"] % (email)
trial_request = portal.portal_catalog.getResultValue(
portal_type='Trial Request',
......@@ -39,7 +50,7 @@ trial = context.trial_request_module.newContent(
source_reference=trial_configuration["software_type"],
title=software_title,
url_string=trial_configuration["url"],
text_content=trial_configuration["instance_xml"],
text_content=trial_configuration["instance_xml"] % user_input_dict,
start_date=now,
stop_date=now + 30,
root_slave=trial_configuration["shared"],
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>software_release, email, batch_mode=True, REQUEST=None</string> </value>
<value> <string>software_release, email, user_input_dict={}, batch_mode=True, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
......@@ -80,6 +80,8 @@
<list>
<string>my_description</string>
<string>your_default_email_text</string>
<string>your_default_input0</string>