Commit 2d84f327 authored by Roque's avatar Roque

Appstore improvements

See merge request nexedi/erp5!1462
parents 09119539 feac976f
Pipeline #16989 passed with stage
in 0 seconds
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
"lines": 20, "lines": 20,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22" + "query": "urn:jio:allDocs?query=portal_type%3A%22" +
"Software%20Product%22", "Software%20Product%22" +
"%20AND%20validation_state%3A%28%22validated%22%" +
"20OR%20%22draft%22%29",
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": column_list,
"sort_column_list": column_list, "sort_column_list": column_list,
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>970.20979.24542.29201</string> </value> <value> <string>993.20432.30464.11673</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1537777459.12</float> <float>1625851332.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Metadata Status</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_ojs_appstore_metadata.js"></script>
</head>
<body>
<div></div>
</body>
</html>
/*global window, rJS*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
rJS(window)
.declareMethod('render', function (options) {
var value = "Not found";
if (options.metadata.message) {
value = options.metadata.message;
}
return this.changeState({
value: value
});
})
.onStateChange(function (modification_dict) {
var div = this.element.querySelector("div");
if (modification_dict.hasOwnProperty('value')) {
div.textContent = modification_dict.value;
}
});
}(window, rJS));
\ No newline at end of file
...@@ -37,6 +37,6 @@ div[data-gadget-scope='field_publication_action'] a{ ...@@ -37,6 +37,6 @@ div[data-gadget-scope='field_publication_action'] a{
-webkit-border-radius: .3125em /*{global-radii-blocks}*/; -webkit-border-radius: .3125em /*{global-radii-blocks}*/;
border-radius: .3125em /*{global-radii-blocks}*/; border-radius: .3125em /*{global-radii-blocks}*/;
color: white; color: white;
padding: 0.5em 2em; padding: 0.45em 2em;
margin: auto; margin: auto;
} }
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>970.12324.25659.5154</string> </value> <value> <string>992.13065.39275.59033</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1537779679.88</float> <float>1626464688.12</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<string>list_method</string> <string>list_method</string>
<string>portal_types</string> <string>portal_types</string>
<string>search</string> <string>search</string>
<string>sort</string>
<string>style_columns</string> <string>style_columns</string>
<string>title</string> <string>title</string>
<string>url_columns</string> <string>url_columns</string>
...@@ -149,6 +150,17 @@ ...@@ -149,6 +150,17 @@
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
</item> </item>
<item>
<key> <string>sort</string> </key>
<value>
<list>
<tuple>
<string>creation_date</string>
<string>descending</string>
</tuple>
</list>
</value>
</item>
<item> <item>
<key> <string>style_columns</string> </key> <key> <string>style_columns</string> </key>
<value> <value>
......
import json
portal = context.getPortalObject()
software_publication = context
return_dict = {
"status": 1,
"message": "Wait for Submit"
}
if software_publication.getSimulationState() == 'draft':
return return_dict
software_publication_line = software_publication.objectValues(
portal_type="Software Publication Line",
)[0]
software_product = software_publication_line.getResourceValue(portal_type="Software Product")
web_site = software_product.SoftwareProduct_getRelatedWebSite()
version = software_publication.getReference().replace("SP-", "")
try:
web_section = web_site[version]
except KeyError:
return_dict["message"] = 'Not found'
return return_dict
manifest_url = web_section.getLayoutProperty('configuration_webapp_manifest_url', default=None)
if manifest_url is None:
return_dict["message"] = 'Configuration webapp manifest url not found'
return return_dict
manifest = portal.portal_catalog.getResultValue(reference=version + '/' + manifest_url)
if manifest is None:
return_dict["message"] = 'Configuration webapp manifest not found'
return return_dict
try:
data = json.loads(manifest.getData())
except ValueError:
return_dict["message"] = 'Invalid configuration webapp manifest JSON'
return return_dict
src_icon = data['icons'][0]['src']
logo = portal.portal_catalog.getResultValue(reference='%' + src_icon, version=version, portal_type='File')
if not logo:
return_dict["message"] = "App logo '%s' not found" % src_icon
return return_dict
return_dict["status"] = 0
return_dict["message"] = "OK"
return return_dict
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwarePublication_getMetadataStatus</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
<string>my_title</string> <string>my_title</string>
<string>my_translated_simulation_state_title</string> <string>my_translated_simulation_state_title</string>
<string>publication_action</string> <string>publication_action</string>
<string>metadata_configuration</string>
</list> </list>
</value> </value>
</item> </item>
......
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