Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
erp5
Commits
e5bb0c4b
Commit
e5bb0c4b
authored
Sep 27, 2018
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_officejs_appstore_base] Add dynamic appstore
parent
929e9a83
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
3 deletions
+118
-3
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/Alarm_updateAppstoreWebSite.py
...rp5_officejs_appstore_base/Alarm_updateAppstoreWebSite.py
+41
-0
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/Alarm_updateAppstoreWebSite.xml
...p5_officejs_appstore_base/Alarm_updateAppstoreWebSite.xml
+62
-0
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_fixRelatedWebSite.py
...ficejs_appstore_base/SoftwareProduct_fixRelatedWebSite.py
+0
-1
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_publishSoftwareRelease.py
...pstore_base/SoftwarePublication_publishSoftwareRelease.py
+3
-0
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_submitSoftwarePublication.py
...ore_base/SoftwarePublication_submitSoftwarePublication.py
+9
-1
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareRelease_fixRelatedWebSection.py
...ejs_appstore_base/SoftwareRelease_fixRelatedWebSection.py
+2
-0
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareRelease_fixRelatedWebSection.xml
...js_appstore_base/SoftwareRelease_fixRelatedWebSection.xml
+1
-1
No files found.
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/Alarm_updateAppstoreWebSite.py
0 → 100644
View file @
e5bb0c4b
import
json
portal
=
context
.
getPortalObject
()
software_product_list
=
portal
.
portal_catalog
(
portal_type
=
'Software Product'
,
validation_state
=
'validated'
)
appstore_data
=
[]
logo_url_list
=
[]
i
=
0
for
software_product
in
software_product_list
:
web_site
=
software_product
.
SoftwareProduct_getRelatedWebSite
()
version
=
web_site
.
getLayoutProperty
(
'configuration_latest_version'
)
web_section
=
web_site
[
version
]
manifest_url
=
web_section
.
getLayoutProperty
(
'configuration_webapp_manifest_url'
,
default
=
None
)
# allow to have application without web manifest
if
manifest_url
is
not
None
:
manifest
=
portal
.
portal_catalog
.
getResultValue
(
reference
=
version
+
'/'
+
manifest_url
)
if
manifest
is
not
None
:
data
=
json
.
loads
(
manifest
.
getData
())
src_icon
=
data
[
'icons'
][
0
][
'src'
]
logo
=
portal
.
portal_catalog
.
getResultValue
(
reference
=
'%'
+
src_icon
,
version
=
version
,
portal_type
=
'File'
)
if
logo
is
not
None
:
logo_url_list
.
append
(
'appstore/'
+
logo
.
getReference
())
# Future domain could be defined by user
app_domain
=
software_product
.
getFollowUpId
(
portal_type
=
"Web Section"
)
appstore_data
.
append
({
"int_index"
:
str
(
i
),
"application_image_type"
:
'image'
,
"application_image_url"
:
logo
.
getReference
(),
"application_toc_accept"
:
'true'
,
"application_published"
:
'some_date'
,
"application_submitted"
:
'other_date'
,
"application_description"
:
data
[
"description"
]
if
"description"
in
data
else
data
[
"name"
],
"application_url"
:
"https://%s.app.officejs.com/"
%
app_domain
,
"application_title"
:
data
[
'short_name'
],
"application_category"
:
data
[
'category'
]
if
"category"
in
data
else
"Documents"
,
"application_title_i18n"
:
"application.custom.%s.title"
%
app_domain
,
"application_description_i18n"
:
"application.custom.%s.description"
%
app_domain
})
i
+=
1
portal
.
document_module
[
'store_officejs_data_application_sample_json'
].
setData
(
json
.
dumps
(
appstore_data
))
manifest_content
=
portal
.
web_page_module
[
'store_officejs_base_appcache'
].
getTextContent
()
portal
.
web_page_module
[
'store_officejs_appcache'
].
setTextContent
(
manifest_content
.
replace
(
'${logo_list}'
,
'
\
n
'
.
join
(
logo_url_list
)))
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/Alarm_updateAppstoreWebSite.xml
0 → 100644
View file @
e5bb0c4b
<?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>
Alarm_updateAppstoreWebSite
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_fixRelatedWebSite.py
View file @
e5bb0c4b
...
...
@@ -16,6 +16,5 @@ if not web_site:
# This is dangerous
if
not
web_site
.
getId
()
==
context
.
getReference
().
lower
():
web_site
.
setId
(
context
.
getReference
().
lower
())
if
batch_mode
:
return
web_site
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_publishSoftwareRelease.py
View file @
e5bb0c4b
...
...
@@ -2,3 +2,6 @@ software_release = context.SoftwarePublication_getRelatedSoftwareRelease()
tag
=
"publish_"
+
software_release
.
getRelativeUrl
()
software_release
.
activate
(
tag
=
tag
).
SoftwareRelease_publishRelatedWebDocument
()
software_release
.
activate
(
after_tag
=
tag
).
publish
()
software_product
=
software_release
.
getFollowUpValue
(
portal_type
=
"Software Product"
)
if
software_product
.
getValidationStateTitle
()
==
'Draft'
:
software_product
.
validate
()
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_submitSoftwarePublication.py
View file @
e5bb0c4b
...
...
@@ -54,6 +54,13 @@ if base:
base
+=
"/"
base_length
=
len
(
base
)
def
extractWebManifest
(
file
):
html
=
context
.
Base_parseHtml
(
file
)
for
tag
in
html
:
if
tag
[
0
]
==
'starttag'
and
tag
[
1
]
==
'link'
and
(
'rel'
,
'manifest'
)
in
tag
[
2
]:
for
attribute
in
tag
[
2
]:
if
attribute
[
0
]
==
'href'
:
return
attribute
[
1
]
software_release_url
=
software_release
.
getRelativeUrl
()
...
...
@@ -87,9 +94,10 @@ for name in zip_reader.namelist():
document
.
getCategoryList
()
+
[
"contributor/"
+
software_publication
.
getSource
()])
if
url
in
(
"index.html"
,
"index.htm"
):
default_page
=
document
.
getRelativeUrl
()
web_manifest_url
=
extractWebManifest
(
document
.
getData
())
document
.
activate
(
tag
=
tag
).
publish
()
software_release
.
SoftwareRelease_fixRelatedWebSection
(
default_page
=
default_page
)
software_release
.
SoftwareRelease_fixRelatedWebSection
(
default_page
=
default_page
,
web_manifest
=
web_manifest_url
)
if
portal
.
portal_workflow
.
isTransitionPossible
(
zip_file
,
'publish'
):
zip_file
.
publish
()
...
...
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareRelease_fixRelatedWebSection.py
View file @
e5bb0c4b
...
...
@@ -47,4 +47,6 @@ if not default_page:
web_section
.
setAggregate
(
aggregate_list
[
0
].
relative_url
)
else
:
web_section
.
setAggregate
(
default_page
)
if
web_manifest
is
not
None
:
web_section
.
setProperty
(
'configuration_webapp_manifest_url'
,
web_manifest
)
return
"Done"
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareRelease_fixRelatedWebSection.xml
View file @
e5bb0c4b
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
default_page=""
</string>
</value>
<value>
<string>
default_page=""
, web_manifest=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment