Commit 16408ff8 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_officejs_appstore_base: Put all apps in one website

parent ef54976b
...@@ -109,7 +109,9 @@ ...@@ -109,7 +109,9 @@
</item> </item>
<item> <item>
<key> <string>text_content_substitution_mapping_method_id</string> </key> <key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>WebPage_getRenderJSSubstitutionMappingDict</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -230,7 +232,7 @@ ...@@ -230,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>cedric.le.ninivin</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -244,7 +246,7 @@ ...@@ -244,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.19443.53509.7185</string> </value> <value> <string>958.21401.8615.61559</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +264,7 @@ ...@@ -262,7 +264,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1463665193.7</float> <float>1493976571.58</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
portal = context.getPortalObject() portal = context.getPortalObject()
web_site = context.getFollowUpValue(portal_type="Web Site") web_site = context.getFollowUpValue(portal_type="Web Section")
# Create Web Site if necessary # Create Web Site if necessary
if not web_site: if not web_site:
# XXX Hardcoded templ # XXX Hardcoded templ
web_site = portal.web_site_module.officejs_app_template.Base_createCloneDocument(batch_mode=True) web_site = portal.web_site_module['application-list'].template.Base_createCloneDocument(batch_mode=True)
web_site.edit( web_site.edit(
title=context.getTitle(), title=context.getTitle(),
short_title=context.getTitle(), short_title=context.getTitle(),
...@@ -17,8 +17,5 @@ if not web_site: ...@@ -17,8 +17,5 @@ if not web_site:
if not web_site.getId() == context.getReference().lower(): if not web_site.getId() == context.getReference().lower():
web_site.setId(context.getReference().lower()) web_site.setId(context.getReference().lower())
if portal.portal_workflow.isTransitionPossible(web_site, 'publish'):
web_site.publish()
if batch_mode: if batch_mode:
return web_site return web_site
return context.getFollowUpValue(portal_type="Web Site") return context.getFollowUpValue(portal_type="Web Section")
raise ValueError("Unimplemented") raise ValueError("Unimplemented")
...@@ -85,15 +85,14 @@ ...@@ -85,15 +85,14 @@
<list> <list>
<string>listbox_delivery_start_date</string> <string>listbox_delivery_start_date</string>
<string>listbox_delivery_stop_date</string> <string>listbox_delivery_stop_date</string>
<string>listbox_modification_date</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list/>
<string>listbox_modification_date</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -5,11 +5,11 @@ software_publication_line = software_publication_line_list[0] ...@@ -5,11 +5,11 @@ software_publication_line = software_publication_line_list[0]
software_release = software_publication_line.getAggregateValue(portal_type="Software Release") software_release = software_publication_line.getAggregateValue(portal_type="Software Release")
software_product = software_publication_line.getResourceValue(portal_type="Software Product") software_product = software_publication_line.getResourceValue(portal_type="Software Product")
if not software_product or not software_release: if not software_product or not software_release or not software_product.getFollowUpId(portal_type="Web Section"):
return return
software_release_version = software_release.getReference() # XXX Hardcoded
#if as_link: return "https://%s.app.officejs.com/%s/" % (
# return '<a href="%(link)s">%(link)s</a>' % {"link": (software_product.getFollowUpValue(portal_type="Web Site")[software_release_version].absolute_url() + "/")} software_product.getFollowUpId(portal_type="Web Section"),
software_release.getReference(),
return software_product.getFollowUpValue(portal_type="Web Site")[software_release_version].absolute_url() + "/" )
...@@ -58,6 +58,7 @@ base_length = len(base) ...@@ -58,6 +58,7 @@ base_length = len(base)
software_release_url = software_release.getRelativeUrl() software_release_url = software_release.getRelativeUrl()
tag = "preparing_sr_%s" % software_release_url tag = "preparing_sr_%s" % software_release_url
default_page = ""
for name in zip_reader.namelist(): for name in zip_reader.namelist():
if zip_reader.getinfo(name).file_size == 0: if zip_reader.getinfo(name).file_size == 0:
continue continue
...@@ -84,12 +85,14 @@ for name in zip_reader.namelist(): ...@@ -84,12 +85,14 @@ for name in zip_reader.namelist():
# XX Hackish # XX Hackish
document.setCategoryList( document.setCategoryList(
document.getCategoryList() + ["contributor/" + software_publication.getSource()]) document.getCategoryList() + ["contributor/" + software_publication.getSource()])
document.activate(tag=tag).submit() if url in ("index.html", "index.htm"):
default_page = document.getRelativeUrl()
document.activate(tag=tag).publish()
software_release.activate(after_tag=tag, tag=tag + "_2").SoftwareRelease_fixRelatedWebSection() software_release.SoftwareRelease_fixRelatedWebSection(default_page=default_page)
if portal.portal_workflow.isTransitionPossible(zip_file, 'submit'): if portal.portal_workflow.isTransitionPossible(zip_file, 'publish'):
zip_file.submit() zip_file.publish()
if portal.portal_workflow.isTransitionPossible(software_release, 'submit'): if portal.portal_workflow.isTransitionPossible(software_release, 'submit'):
software_release.submit() software_release.submit()
software_publication.activate(after_tag=tag + "_2").submit() software_publication.activate(after_tag=tag).submit()
...@@ -6,15 +6,12 @@ software_product = software_release.getFollowUpValue(portal_type="Software Produ ...@@ -6,15 +6,12 @@ software_product = software_release.getFollowUpValue(portal_type="Software Produ
web_site = software_product.SoftwareProduct_fixRelatedWebSite(batch_mode=True) web_site = software_product.SoftwareProduct_fixRelatedWebSite(batch_mode=True)
version = software_release.getReference() version = software_release.getReference()
context.log(version)
context.log("%s" % web_site.getRelativeUrl())
try: try:
web_section = web_site.restrictedTraverse(version) web_section = web_site.restrictedTraverse(version)
except KeyError: except KeyError:
source = portal.web_site_module.officejs_app_template web_section = web_site.template.Base_createCloneDocument(batch_mode=True)
clipboard = source.manage_copyObjects(ids=["template"])
context.REQUEST.set('__cp', clipboard) # CopySupport is using this to set
# tracebility information in edit_workflow history
paste_result = web_site.manage_pasteObjects(cb_copy_data=clipboard)
web_section = web_site[paste_result[0]['new_id']]
web_section.edit( web_section.edit(
id=version, id=version,
title=software_release.getVersion(), title=software_release.getVersion(),
...@@ -24,30 +21,26 @@ except KeyError: ...@@ -24,30 +21,26 @@ except KeyError:
# Update development section to use version and follow_up # Update development section to use version and follow_up
web_section.setCriterionPropertyList([ web_section.setCriterionPropertyList([
"version", "version",
"validation_state",
]) ])
web_section.setCriterion('version', version[:10]) web_section.setCriterion('version', version[:10])
web_section.setCriterion('validation_state', 'submitted')
web_section.setMembershipCriterionBaseCategoryList(['follow_up']) web_section.setMembershipCriterionBaseCategoryList(['follow_up'])
web_section.setMembershipCriterionCategoryList(['follow_up/' + context.getRelativeUrl()]) web_section.setMembershipCriterionCategoryList(['follow_up/' + context.getRelativeUrl()])
if portal.portal_workflow.isTransitionPossible(web_section, 'publish'): if not default_page:
web_section.publish() # Update default page for development version.
landing_publication_uid = portal.portal_categories.publication_section.application.landing_page.getUid()
# Update default page for development version. aggregate_list = portal.portal_catalog(
landing_publication_uid = portal.portal_categories.publication_section.application.landing_page.getUid()
aggregate_list = portal.portal_catalog(
portal_type="File", portal_type="File",
strict_follow_up_uid=context.getUid(), strict_follow_up_uid=context.getUid(),
strict_publication_section_uid=landing_publication_uid, strict_publication_section_uid=landing_publication_uid,
validation_state="submitted",
#XXX Hackish #XXX Hackish
sort_on=[("modification_date", "descending")], sort_on=[("modification_date", "descending")],
limit=1, limit=1,
select_list=["relative_url"], select_list=["relative_url"],
) )
if aggregate_list: if aggregate_list:
web_section.setAggregate(aggregate_list[0].relative_url) web_section.setAggregate(aggregate_list[0].relative_url)
else:
web_section.setAggregate(default_page)
return "Done" return "Done"
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>default_page=""</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
portal = context.getPortalObject() portal = context.getPortalObject()
software_release = context software_release = context
# Publish Web Document
web_document_list = portal.portal_catalog(
portal_type=portal.getPortalDocumentTypeList(),
strict_follow_up_uid=software_release.getUid(),
validation_state="submitted",
)
today = DateTime().earliestTime()
for web_document in web_document_list:
web_document.setEffectiveDate(today)
web_document.publish()
software_product = context.getFollowUpValue(portal_type="Software Product") software_product = context.getFollowUpValue(portal_type="Software Product")
web_site = software_product.SoftwareProduct_getRelatedWebSite() web_site = software_product.SoftwareProduct_getRelatedWebSite()
# Publish Web Site, Websection and update version
today = DateTime().earliestTime()
if web_site.getValidationState() != 'published':
web_site.setEffectiveDate(today)
web_site.publish()
version_web_section = web_site[software_release.getReference()]
version_web_section.setCriterion('validation_state', 'published')
if portal.portal_workflow.isTransitionPossible(version_web_section, 'publish'):
version_web_section.publish()
def webSectionUpdatePredicate(current_section):
current_section.setCriterion('validation_state', 'published')
for child_section in current_section.objectValues(portal_type="Web Section"):
webSectionUpdatePredicate(child_section)
webSectionUpdatePredicate(version_web_section)
web_site.edit( web_site.edit(
configuration_latest_version=software_release.getVersion(), configuration_latest_version=software_release.getReference(),
) )
# Update appcache # Update appcache
......
...@@ -8,6 +8,6 @@ web_section = REQUEST.get("current_web_section") ...@@ -8,6 +8,6 @@ web_section = REQUEST.get("current_web_section")
#raise ValueError(web_section.getLayoutProperty("configuration_latest_version", default="development")) #raise ValueError(web_section.getLayoutProperty("configuration_latest_version", default="development"))
return default_web_page.WebPage_viewAsWeb(mapping_dict={ return default_web_page.WebPage_viewAsWeb(mapping_dict={
#"latest_version": web_section.getLayoutProperty("configuration_latest_version", default="development"), "latest_version": web_section.getLayoutProperty("configuration_latest_version", default="development"),
#"application_appcache": web_section.getId() + ".appcache", #"application_appcache": web_section.getId() + ".appcache",
}) })
web_page_module/gadget_ojs_* web_page_module/gadget_ojs_*
web_site_module/officejs_appstore web_site_module/officejs_appstore
web_site_module/officejs_appstore/** web_site_module/officejs_appstore/**
web_site_module/officejs_app_template web_site_module/application-list
web_site_module/officejs_app_template/** web_site_module/application-list/template
\ No newline at end of file web_site_module/application-list/template/**
\ No newline at end of file
web_site_module/officejs_app_template
web_site_module/officejs_app_template/**
\ No newline at end of file
web_page_module/gadget_ojs_* web_page_module/gadget_ojs_*
web_site_module/officejs_appstore web_site_module/officejs_appstore
web_site_module/officejs_appstore/** web_site_module/officejs_appstore/**
web_site_module/officejs_app_template web_site_module/application-list
web_site_module/officejs_app_template/** web_site_module/application-list/template
\ No newline at end of file web_site_module/application-list/template/**
\ No newline at end of file
...@@ -3,7 +3,8 @@ portal_categories/product_line/software ...@@ -3,7 +3,8 @@ portal_categories/product_line/software
portal_categories/product_line/software/** portal_categories/product_line/software/**
portal_categories/publication_section/** portal_categories/publication_section/**
web_page_module/gadget_ojs_* web_page_module/gadget_ojs_*
web_site_module/officejs_app_template web_site_module/application-list
web_site_module/officejs_app_template/** web_site_module/application-list/template
web_site_module/application-list/template/**
web_site_module/officejs_appstore web_site_module/officejs_appstore
web_site_module/officejs_appstore/** web_site_module/officejs_appstore/**
\ 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