Commit 4d5d4c93 authored by Roque's avatar Roque

Fix dynamic appstore website

See merge request nexedi/erp5!1452
parents f3c88876 326a4c9a
Pipeline #16463 passed with stage
in 0 seconds
...@@ -3,7 +3,7 @@ from DateTime import DateTime ...@@ -3,7 +3,7 @@ from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
preference_tool = portal.portal_preferences preference_tool = portal.portal_preferences
software_product_list = portal.portal_catalog(portal_type='Software Product', validation_state='validated') software_product_list = portal.portal_catalog(portal_type='Software Product', validation_state='validated', sort_on='creation_date')
appstore_data = [] appstore_data = []
logo_url_list = [] logo_url_list = []
i = 0 i = 0
...@@ -31,8 +31,8 @@ for software_product in software_product_list: ...@@ -31,8 +31,8 @@ for software_product in software_product_list:
"application_image_type": 'image', "application_image_type": 'image',
"application_image_url": logo.getReference(), "application_image_url": logo.getReference(),
"application_toc_accept": 'true', "application_toc_accept": 'true',
"application_published": 'some_date', "application_published": web_section.getModificationDate().strftime("%m/%d/%Y"),
"application_submitted": 'other_date', "application_submitted": web_section.getModificationDate().strftime("%m/%d/%Y"),
"application_description": data["description"] if "description" in data else data["name"], "application_description": data["description"] if "description" in data else data["name"],
"application_url": "%s://%s.%s/" % (preference_tool.getPreferredSystemAppstoreWildcardProtocol(), "application_url": "%s://%s.%s/" % (preference_tool.getPreferredSystemAppstoreWildcardProtocol(),
app_domain, app_domain,
......
...@@ -4621,8 +4621,19 @@ ...@@ -4621,8 +4621,19 @@
"url": "data/" + parcel.type + "_sample.json" "url": "data/" + parcel.type + "_sample.json"
}) })
.then(function (e) { .then(function (e) {
var i, string_response,
app_list = JSON.parse(e.target.response),
site_tld = window.location.origin.split('.').pop();
// change all application urls TDL to current appstore site TDL
// e.g. if site is 'officejs.com' then all app urls will be '.com'
for (i = 0; i < app_list.length; i += 1) {
app_list[i].application_url = app_list[i].application_url.replace(
app_list[i].application_url.split('.').pop(), site_tld
);
}
string_response = JSON.stringify(app_list);
return { return {
"response": e.target.response, "response": string_response,
"baggage": parcel.baggage "baggage": parcel.baggage
}; };
}) })
......
...@@ -76,7 +76,9 @@ ...@@ -76,7 +76,9 @@
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>application/js</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
...@@ -221,7 +223,7 @@ ...@@ -221,7 +223,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>P1</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -235,7 +237,7 @@ ...@@ -235,7 +237,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>970.31366.57108.55859</string> </value> <value> <string>992.61706.2773.41130</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -253,7 +255,7 @@ ...@@ -253,7 +255,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1537795617.18</float> <float>1624541145.81</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment