diff --git a/bt5/erp5_corporate_identity/ActionTemplateItem/portal_types/Preference/corporate_identity_style_preferences.xml b/bt5/erp5_corporate_identity/ActionTemplateItem/portal_types/Preference/corporate_identity_style_preferences.xml new file mode 100644 index 0000000000000000000000000000000000000000..d1d1852dd565880a14cb4dd5fa5affea00dde871 --- /dev/null +++ b/bt5/erp5_corporate_identity/ActionTemplateItem/portal_types/Preference/corporate_identity_style_preferences.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>action_type/object_view</string> + </tuple> + </value> + </item> + <item> + <key> <string>category</string> </key> + <value> <string>object_view</string> </value> + </item> + <item> + <key> <string>condition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Default parameters (theme, css-files, js-files) for template configuration.</string> </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>corporate_identity_style_preferences</string> </value> + </item> + <item> + <key> <string>permissions</string> </key> + <value> + <tuple> + <string>View</string> + </tuple> + </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Action Information</string> </value> + </item> + <item> + <key> <string>priority</string> </key> + <value> <float>51.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Template Defaults</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Expression" module="Products.CMFCore.Expression"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>string:${object_url}/Preference_viewCorporateIdentityStyle</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_css_color_swatch_property.xml b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_css_color_swatch_property.xml deleted file mode 100644 index c15967fcc70cc50e4a9152d1e0e7a4190b77aca0..0000000000000000000000000000000000000000 --- a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_css_color_swatch_property.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="Standard Property" module="erp5.portal_type"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>categories</string> </key> - <value> - <tuple> - <string>elementary_type/string</string> - </tuple> - </value> - </item> - <item> - <key> <string>description</string> </key> - <value> <string>List of 3 color swatches to be used in (Gantt) report generation.</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>preferred_corporate_identity_template_css_color_swatch_property</string> </value> - </item> - <item> - <key> <string>multivalued</string> </key> - <value> <int>1</int> </value> - </item> - <item> - <key> <string>portal_type</string> </key> - <value> <string>Standard Property</string> </value> - </item> - <item> - <key> <string>preference</string> </key> - <value> <int>1</int> </value> - </item> - <item> - <key> <string>property_default</string> </key> - <value> - <none/> - </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_css_property.xml b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_css_property.xml index 50b36e0006ad81b401a512ed7aa5b687855247fb..d461256ea41cc098946980c07bd4a825e74a2fd1 100644 --- a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_css_property.xml +++ b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_css_property.xml @@ -36,9 +36,7 @@ </item> <item> <key> <string>property_default</string> </key> - <value> - <none/> - </value> + <value> <string>python: []</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_js_property.xml b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_js_property.xml index 3e833a5c9d9afe32eb005b0cd5037966f0f3dba9..49e3ca88fbc9e65abae510e604e6c0510b7431c6 100644 --- a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_js_property.xml +++ b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_report_js_property.xml @@ -10,7 +10,7 @@ <key> <string>categories</string> </key> <value> <tuple> - <string>elementary_type/string</string> + <string>elementary_type/lines</string> </tuple> </value> </item> @@ -36,9 +36,7 @@ </item> <item> <key> <string>property_default</string> </key> - <value> - <none/> - </value> + <value> <string>python: []</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_miibeian_id_property.xml b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_id_property.xml similarity index 95% rename from bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_miibeian_id_property.xml rename to bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_id_property.xml index 352afe8dd8e8d9a4da6b80d627645a4af4a07d5b..df19995ebea6cc468f291b85776651b8a24c774e 100644 --- a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_miibeian_id_property.xml +++ b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_id_property.xml @@ -20,7 +20,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>preferred_corporate_identity_template_site_registration_miibeian_id_property</string> </value> + <value> <string>preferred_corporate_identity_template_site_registration_id_property</string> </value> </item> <item> <key> <string>portal_type</string> </key> diff --git a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_miibeian_url_property.xml b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_url_property.xml similarity index 95% rename from bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_miibeian_url_property.xml rename to bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_url_property.xml index 10533bc2900ab510373fc1a0a7e2bb9d6e71d987..5e71540a2b0ba526404af41a8f4cc734f5658d4d 100644 --- a/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_miibeian_url_property.xml +++ b/bt5/erp5_corporate_identity/PropertySheetTemplateItem/portal_property_sheets/CorporateIdentityTemplatePreference/preferred_corporate_identity_template_site_registration_url_property.xml @@ -20,7 +20,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>preferred_corporate_identity_template_site_registration_miibeian_url_property</string> </value> + <value> <string>preferred_corporate_identity_template_site_registration_url_property</string> </value> </item> <item> <key> <string>portal_type</string> </key> diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getSourceDict.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getSourceDict.py index 8fdbaa7acdb126334221fb4a4b687f74649b9ed4..83aed4c54b46194b469596e477308eae4cfaf9b5 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getSourceDict.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getSourceDict.py @@ -16,11 +16,12 @@ from Products.PythonScripts.standard import html_quote # ------------------------------- Set Source ---------------------------------- source_logo_url = None -default_bank_account_relative_url=context.Base_getTemplateParameter("default_bank_account_relative_url") source_organisation = None +pref = context.getPortalObject().portal_preferences +default_bank_account_relative_url=pref.getPreferredCorporateIdentityTemplateDefaultBankAccountRelativeUrl() if source is None: - default_company_relative_url=context.Base_getTemplateParameter("default_company_relative_url") + default_company_relative_url=pref.getPreferredCorporateIdentityTemplateDefaultOrganisationRelativeUrl() contributor_title_string = blank source_person = None source_person_list = [] @@ -80,21 +81,23 @@ if default_bank_account_relative_url is not None: source["bic"] = override_bank_account.get("bic") source["iban"] = override_bank_account.get("iban") -# social media +# social media, used for website (WIP) if source_organisation is not None: - source["social_media_handle_facebook"] = context.Base_getTemplateParameter('social_media_handle_facebook') - source["social_media_handle_twitter"] = context.Base_getTemplateParameter('social_media_handle_twitter') - source["social_media_handle_google"] = context.Base_getTemplateParameter('social_media_handle_google') + source["social_media_handle_facebook"] = pref.getPreferredCorporateIdentityTemplateSocialMediaHandleFacebook() + source["social_media_handle_twitter"] = pref.getPreferredCorporateIdentityTemplateSocialMediaHandleTwitter() + source["social_media_handle_google"] = pref.getPreferredCorporateIdentityTemplateSocialMediaHandleGoogle() + source["site_registration_url"] = pref.getPreferredCorporateIdentityTemplateSiteRegistrationUrl() + source["site_registration_id"] = pref.getPreferredCorporateIdentityTemplateSiteRegistrationId() # social capital currency and registered court fallbacks if source.get("social_capital_currency") is blank: currency_short_title = None - currency_relative_url = context.Base_getTemplateParameter("default_source_company_capital_currency_relative_url") + currency_relative_url = pref.getPreferredCorporateIdentityTemplateDefaultCurrencyRelativeUrl() if currency_relative_url: currency_short_title = context.restrictedTraverse(currency_relative_url).getShortTitle() source["social_capital_currency"] = currency_short_title or "" if source.get("corporate_registration_code") is blank: - source["corporate_registration_code"] = context.Base_getTemplateParameter("default_source_registered_court") + source["corporate_registration_code"] = pref.getPreferredCorporateIdentityTemplateDefaultOrganisationRegisteredCourt() # XXX images stored on organisation (as do images in skin folders) if override_logo_reference: diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateParameter.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateParameter.py deleted file mode 100644 index df78b95723069b24f6d70ef0aa21c05a1c603dcd..0000000000000000000000000000000000000000 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateParameter.py +++ /dev/null @@ -1,19 +0,0 @@ -""" -================================================================================ -Return template parameters from portal-preferences (all calls go through here) -================================================================================ -""" -# parameters: -# ------------------------------------------------------------------------------ -# parameter Parameter to lookup - -pref = context.getPortalObject().portal_preferences - -if parameter == "default_company_relative_url": - return pref.getPreferredCorporateIdentityTemplateDefaultOrganisationRelativeUrl() -if parameter == "default_theme": - return pref.getPreferredCorporateIdentityTemplateDefaultTheme() -if parameter == "default_theme_css_url": - return pref.getPreferredCorporateIdentityTemplateThemeCssRelativeUrl() -if parameter == "fallback_image": - return pref.getPreferredCorporateIdentityTemplateFallbackLogoRelativeUrl() diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateParameter.xml b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateParameter.xml deleted file mode 100644 index c9dffa12ed81cb1d23cb2bf7a84e3cba30884ad2..0000000000000000000000000000000000000000 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateParameter.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?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>parameter=None, source_data=None</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>Base_getTemplateParameter</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateProxyParameter.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateProxyParameter.py index ed7e18a95765b1eefa6654d29cb025939b89cf27..31439c4d6cd6b80f24745239603f61bd403ac91d 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateProxyParameter.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getTemplateProxyParameter.py @@ -290,11 +290,19 @@ if pass_parameter is not None and pass_source_data is not None: return populateBankDict([context.restrictedTraverse(pass_source_data)]) # ------------------ Theme Logo (Prefix + Theme) ----------------------------- - # returns [{logo_dict}] used in themes + # returns [{logo_dict}] used in themes, needs to be language-agnostic, but not + # all contexts (eg sale-order) have language + # XXX improve if pass_parameter == "logo": + + try: + use_language = context.getLanguage() or "en" + except AttributeError: + use_language = "en" + return populateImageDict(portal_object.portal_catalog( portal_type="Image", - language=context.getLanguage() or 'en', + language=use_language, validation_state=validation_state, reference=pass_source_data )) diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py index 82841303a2db154d43e3180ea96ce080dfd9dc29..10c7778a6e55c2c5729f6c333fce85d3c998cf31 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py @@ -14,9 +14,7 @@ blank = '' # XXX images in portal_skins folders don't convert with ?params. Only format # is kept in Base_convertHtmlToSingleFile pdf = ".pdf.css" if doc_format == "pdf" else ".css" -css = "default_theme_css_url" -font = "default_theme_font_css_url_list" -param = "?format=png" +pref = context.getPortalObject().portal_preferences # theme content might not be visible on the default View lookup_skin = blank @@ -28,32 +26,38 @@ theme_logo_dict = {} theme_reference = None theme = ( context.Base_getTemplateProxyParameter(parameter="theme", source_data=None) or - context.Base_getTemplateParameter("default_theme") + pref.getPreferredCorporateIdentityTemplateDefaultTheme() ) + if theme is not None: theme = theme.lower() - theme_logo_prefix = context.Base_getTemplateParameter("default_logo_prefix") + theme_logo_prefix = pref.getPreferredCorporateIdentityTemplateDefaultLogoPrefix() if theme_logo_prefix: theme_reference = theme_logo_prefix + theme.capitalize() theme_logo_list = context.Base_getTemplateProxyParameter(parameter="logo", source_data=theme_reference) or [] if len(theme_logo_list) > 0: theme_logo_dict = theme_logo_list[0] - theme_dict = {} +theme_logo_url = pref.getPreferredCorporateIdentityTemplateFallbackLogoRelativeUrl() + theme_dict["theme"] = theme theme_dict["theme_logo_description"] = theme_logo_dict.get("description", blank) -theme_dict["theme_logo_url"] = context.Base_getTemplateParameter("fallback_image") +theme_dict["theme_logo_url"] = theme_logo_url + +# if a theme logo is available, use it instead and add format=png (note, image +# conversion doesn't seem to work with files loaded from skins folders) if theme_logo_dict.get("relative_url", None) is not None: - theme_dict["theme_logo_url"] = theme_logo_dict.get("relative_url") + param + theme_dict["theme_logo_url"] = theme_logo_dict.get("relative_url") + "?format=png" + theme_dict["template_css_url"] = css_path + pdf -theme_dict["fallback_img_url"] = context.Base_getTemplateParameter("fallback_image") or blank +theme_dict["fallback_img_url"] = theme_logo_url or blank theme_dict["theme_css_font_list"] = [] -theme_font_list = context.Base_getTemplateParameter(font) or [] +theme_font_list = pref.getPreferredCorporateIdentityTemplateDefaultThemeFontList() or [] for font in theme_font_list: theme_dict["theme_css_font_list"].append(font + pdf) -theme_css_url = context.Base_getTemplateParameter(css) +theme_css_url = pref.getPreferredCorporateIdentityTemplateThemeCssRelativeUrl() if theme_css_url: - theme_dict["theme_css_url"] = context.Base_getTemplateParameter(css) + lookup_skin + theme_dict["theme_css_url"] = theme_css_url + lookup_skin else: theme_dict["theme_css_url"] = blank return theme_dict diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsLetter.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsLetter.py index cea719d05957526f3d830c426aff44d722ebf509..0abd2a78d3f8988b0979bed84260b8731c4d0a1b 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsLetter.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsLetter.py @@ -30,6 +30,7 @@ import re from base64 import b64encode blank = '' +pref = context.getPortalObject().portal_preferences # -------------------------- Setup --------------------------------------------- letter = context @@ -50,7 +51,7 @@ override_batch_mode = kw.get('batch_mode', None) # -------------------------- Document Parameters ------------------------------ letter_portal_type = letter.getPortalType() letter_relative_url = letter.getRelativeUrl() -letter_prefix = "Letter." +letter_prefix = pref.getPreferredCorporateIdentityTemplateLetterDocumentPrefix() or "Letter." # letter can be Web Page or Event created in Ticket module if letter_portal_type == "Web Page": diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py index ecb4cd3832c66e758472e0f74b74589ca237e883..82faa491bcfd6e4a9c2c65b7f91605543a07ce14 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py @@ -39,12 +39,15 @@ from Products.PythonScripts.standard import html_quote from base64 import b64encode blank = '' +pref = context.getPortalObject().portal_preferences + # ------------------ HTML cleanup/converter methods ---------------------------- def translateText(snip): return doc_localiser.erp5_ui.gettext(snip, lang=doc_language).encode('utf-8').strip() # -------------------------- Setup --------------------------------------------- doc = context +doc_prefix = pref.getPreferredCorporateIdentityTemplateReportDocumentPrefix() or "Report." doc_download = None #XXX not yet implemented doc_save = int(kw.get('document_save') or 0) doc_display_header = int(kw.get('display_header') or 0) @@ -124,7 +127,7 @@ if doc_language is not None: if doc_language is None: doc_language = blank if doc_reference == blank: - doc_reference = "Report." + doc_title.replace(" ", ".") + doc_reference = doc_prefix + doc_title.replace(" ", ".") doc_full_reference = '-'.join([doc_reference, doc_version, doc_language]) doc_short_date = doc_modification_date.strftime('%Y-%m-%d') @@ -154,8 +157,8 @@ if doc_format == "html": book_template_css_url=doc_theme.get("template_css_url"), book_logo_url=doc.Base_setUrl(path=doc_source.get("enhanced_logo_url"), display=None), book_logo_title=doc_source.get("theme_logo_description"), - book_report_css_list=doc.Base_getTemplateParameter("report_css_list") or [], - book_report_js_list=doc.Base_getTemplateParameter("report_js_list") or [], + book_report_css_list=pref.getPreferredCorporateIdentityTemplateReportCssList() or [], + book_report_js_list=pref.getPreferredCorporateIdentityTemplateReportJsList() or [], book_short_title=doc_short_title, book_reference=doc_reference, book_revision=doc_revision, @@ -190,8 +193,8 @@ if doc_format == "pdf": book_theme_css_font_list=doc_theme.get("theme_css_font_list"), book_theme_css_url=doc_theme.get("theme_css_url"), book_template_css_url=doc_theme.get("template_css_url"), - book_report_css_list=doc.Base_getTemplateParameter("report_css_list") or [], - book_report_js_list=doc.Base_getTemplateParameter("report_js_list") or [], + book_report_css_list=pref.getPreferredCorporateIdentityTemplateReportCssList() or [], + book_report_js_list=pref.getPreferredCorporateIdentityTemplateReportJsList() or [], book_content=doc_content, ) diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py index b5463139b3426f3ae13e1c63ba4730bc586ac649..515cfc0b96134d9802462ca3812e899cbdccdd7f 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py @@ -38,6 +38,7 @@ from Products.PythonScripts.standard import html_quote from base64 import b64encode blank = '' +pref = context.getPortalObject().portal_preferences # ------------------ HTML cleanup/converter methods ---------------------------- def translateText(snip): @@ -69,7 +70,7 @@ override_batch_mode = kw.get('batch_mode') # -------------------------- Document Parameters ------------------------------ book_localiser = book.getPortalObject().Localizer book_relative_url = book.getRelativeUrl() -book_prefix = "Book." +book_prefix = pref.getPreferredCorporateIdentityTemplateBookDocumentPrefix() or "Book." book_rendering_fix = book.WebPage_getPdfOutputRenderingFix() or blank book_content = book.getTextContent() book_aggregate_list = [] @@ -143,8 +144,8 @@ if book_include_linked_content: # embed reports if book_include_report_content: - book_report_css_list = book.Base_getTemplateParameter("report_css_list") or [] - book_report_js_list = book.Base_getTemplateParameter("report_js_list") or [] + book_report_css_list = pref.getPreferredCorporateIdentityTemplateReportCssList() or [] + book_report_js_list = pref.getPreferredCorporateIdentityTemplateReportJsList() or [] book_content = book.WebPage_embedReportDocumentList(doc_content=book_content, doc_language=book_language, doc_format=book_format) # table of links diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py index 812a1a07a25d101dbd04fa67d6c52f65252229f7..2c0dfa5d2bd79df11b1e5af590f80cf0cf66a046 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py @@ -27,6 +27,7 @@ from Products.PythonScripts.standard import html_quote from base64 import b64encode blank = '' +pref = context.getPortalObject().portal_preferences # ------------------ HTML cleanup/converter methods ---------------------------- def removeLegalesePlaceholders(content): @@ -36,7 +37,7 @@ def removeLegalesePlaceholders(content): # -------------------------- Setup --------------------------------------------- leaflet = context -leaflet_prefix = "Leaflet." +leaflet_prefix = pref.getPreferredCorporateIdentityTemplateLeafletDocumentPrefix() or "Leaflet." leaflet_format = kw.get('format') or 'html' leaflet_display_svg = kw.get('display_svg') or "png" leaflet_download = int(kw.get('document_download') or 0) diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py index 33898390d294d4476c40b10a4686936c1f438ee5..ea5cc7755daa032485d285ca3a171606aa9e2f9d 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py @@ -24,6 +24,7 @@ import re from base64 import b64encode blank = '' +pref = context.getPortalObject().portal_preferences re_tag = re.compile(r'<[^>]+>') # ------------------ HTML cleanup/converter methods ---------------------------- @@ -38,7 +39,7 @@ def removeHardcodedAbout(my_content): # -------------------------- Setup --------------------------------------------- release = context -release_prefix = "Release." +release_prefix = pref.getPreferredCorporateIdentityTemplateReleaseDocumentPrefix() or "Release." release_format = kw.get('format') or 'html' release_display_about = int(kw.get('display_about') or 0) release_display_svg = kw.get('display_svg') or "png" diff --git a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py index 3139dcad40aa5df95e375d7f51c00d523069ec06..bcde97efb9b38e6d55a81b21f7e9f3f3da4822cc 100644 --- a/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py +++ b/bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsSlideshow.py @@ -29,6 +29,7 @@ from base64 import b64encode blank = '' details_separator = '</section><section class="ci-notes-continue"><section><h1>cont.</h1></section>' +pref = context.getPortalObject().portal_preferences # ------------------ HTML cleanup/converter methods ---------------------------- def getSlideList(my_content): @@ -148,7 +149,7 @@ def sortContent(my_page_list): # -------------------------- Setup --------------------------------------------- doc = context -doc_prefix = "Slideshow." +doc_prefix = pref.getPreferredCorporateIdentityTemplateSlideDocumentPrefix() or "Slideshow." doc_converted_content = None doc_format = kw.get('format') or 'html' doc_display_notes = int(kw.get('display_note') or 0) diff --git a/bt5/erp5_corporate_identity/bt/template_action_path_list b/bt5/erp5_corporate_identity/bt/template_action_path_list index 966dffdfd7ff48592a5e91d4888f04d1dbd8a328..9e8fa0330ff59a365ff4085bbbd3cfb52a104092 100644 --- a/bt5/erp5_corporate_identity/bt/template_action_path_list +++ b/bt5/erp5_corporate_identity/bt/template_action_path_list @@ -1,3 +1,4 @@ +Preference | corporate_identity_style_preferences Web Page | export_book Web Page | export_leaflet Web Page | export_letter