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 @@
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>WebPage_getRenderJSSubstitutionMappingDict</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -230,7 +232,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>cedric.le.ninivin</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -244,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.19443.53509.7185</string> </value>
<value> <string>958.21401.8615.61559</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1463665193.7</float>
<float>1493976571.58</float>
<string>UTC</string>
</tuple>
</state>
......
portal = context.getPortalObject()
web_site = context.getFollowUpValue(portal_type="Web Site")
web_site = context.getFollowUpValue(portal_type="Web Section")
# Create Web Site if necessary
if not web_site:
# 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(
title=context.getTitle(),
short_title=context.getTitle(),
......@@ -17,8 +17,5 @@ if not web_site:
if not web_site.getId() == context.getReference().lower():
web_site.setId(context.getReference().lower())
if portal.portal_workflow.isTransitionPossible(web_site, 'publish'):
web_site.publish()
if batch_mode:
return web_site
return context.getFollowUpValue(portal_type="Web Site")
return context.getFollowUpValue(portal_type="Web Section")
raise ValueError("Unimplemented")
......@@ -85,15 +85,14 @@
<list>
<string>listbox_delivery_start_date</string>
<string>listbox_delivery_stop_date</string>
<string>listbox_modification_date</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>listbox_modification_date</string>
</list>
<list/>
</value>
</item>
<item>
......
......@@ -5,11 +5,11 @@ software_publication_line = software_publication_line_list[0]
software_release = software_publication_line.getAggregateValue(portal_type="Software Release")
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
software_release_version = software_release.getReference()
#if as_link:
# return '<a href="%(link)s">%(link)s</a>' % {"link": (software_product.getFollowUpValue(portal_type="Web Site")[software_release_version].absolute_url() + "/")}
return software_product.getFollowUpValue(portal_type="Web Site")[software_release_version].absolute_url() + "/"
# XXX Hardcoded
return "https://%s.app.officejs.com/%s/" % (
software_product.getFollowUpId(portal_type="Web Section"),
software_release.getReference(),
)
......@@ -58,6 +58,7 @@ base_length = len(base)
software_release_url = software_release.getRelativeUrl()
tag = "preparing_sr_%s" % software_release_url
default_page = ""
for name in zip_reader.namelist():
if zip_reader.getinfo(name).file_size == 0:
continue
......@@ -84,12 +85,14 @@ for name in zip_reader.namelist():
# XX Hackish
document.setCategoryList(
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'):
zip_file.submit()
if portal.portal_workflow.isTransitionPossible(zip_file, 'publish'):
zip_file.publish()
if portal.portal_workflow.isTransitionPossible(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
web_site = software_product.SoftwareProduct_fixRelatedWebSite(batch_mode=True)
version = software_release.getReference()
context.log(version)
context.log("%s" % web_site.getRelativeUrl())
try:
web_section = web_site.restrictedTraverse(version)
except KeyError:
source = portal.web_site_module.officejs_app_template
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 = web_site.template.Base_createCloneDocument(batch_mode=True)
web_section.edit(
id=version,
title=software_release.getVersion(),
......@@ -24,30 +21,26 @@ except KeyError:
# Update development section to use version and follow_up
web_section.setCriterionPropertyList([
"version",
"validation_state",
])
web_section.setCriterion('version', version[:10])
web_section.setCriterion('validation_state', 'submitted')
web_section.setMembershipCriterionBaseCategoryList(['follow_up'])
web_section.setMembershipCriterionCategoryList(['follow_up/' + context.getRelativeUrl()])
if portal.portal_workflow.isTransitionPossible(web_section, 'publish'):
web_section.publish()
# Update default page for development version.
landing_publication_uid = portal.portal_categories.publication_section.application.landing_page.getUid()
aggregate_list = portal.portal_catalog(
portal_type="File",
strict_follow_up_uid=context.getUid(),
strict_publication_section_uid=landing_publication_uid,
validation_state="submitted",
#XXX Hackish
sort_on=[("modification_date", "descending")],
limit=1,
select_list=["relative_url"],
)
if aggregate_list:
web_section.setAggregate(aggregate_list[0].relative_url)
if not default_page:
# Update default page for development version.
landing_publication_uid = portal.portal_categories.publication_section.application.landing_page.getUid()
aggregate_list = portal.portal_catalog(
portal_type="File",
strict_follow_up_uid=context.getUid(),
strict_publication_section_uid=landing_publication_uid,
#XXX Hackish
sort_on=[("modification_date", "descending")],
limit=1,
select_list=["relative_url"],
)
if aggregate_list:
web_section.setAggregate(aggregate_list[0].relative_url)
else:
web_section.setAggregate(default_page)
return "Done"
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>default_page=""</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
portal = context.getPortalObject()
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")
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(
configuration_latest_version=software_release.getVersion(),
configuration_latest_version=software_release.getReference(),
)
# Update appcache
......
......@@ -8,6 +8,6 @@ web_section = REQUEST.get("current_web_section")
#raise ValueError(web_section.getLayoutProperty("configuration_latest_version", default="development"))
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",
})
web_page_module/gadget_ojs_*
web_site_module/officejs_appstore
web_site_module/officejs_appstore/**
web_site_module/officejs_app_template
web_site_module/officejs_app_template/**
\ No newline at end of file
web_site_module/application-list
web_site_module/application-list/template
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_site_module/officejs_appstore
web_site_module/officejs_appstore/**
web_site_module/officejs_app_template
web_site_module/officejs_app_template/**
\ No newline at end of file
web_site_module/application-list
web_site_module/application-list/template
web_site_module/application-list/template/**
\ No newline at end of file
......@@ -3,7 +3,8 @@ portal_categories/product_line/software
portal_categories/product_line/software/**
portal_categories/publication_section/**
web_page_module/gadget_ojs_*
web_site_module/officejs_app_template
web_site_module/officejs_app_template/**
web_site_module/application-list
web_site_module/application-list/template
web_site_module/application-list/template/**
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