diff --git a/bt5/erp5_knowledge_pad/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_knowledge_pad/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml index fbfc0d8f5275e86f8c49d2b4db86a7f8209d9b9e..a37ee12a1fdbdc5264fd9274ee3b734935c51010 100644 --- a/bt5/erp5_knowledge_pad/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml +++ b/bt5/erp5_knowledge_pad/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml @@ -18,6 +18,9 @@ <portal_type id="Preference"> <item>Knowledge Pad</item> </portal_type> + <portal_type id="System Preference"> + <item>Knowledge Pad</item> + </portal_type> <portal_type id="Types Tool"> <item>Gadget Type</item> </portal_type> diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_createDefaultKnowledgePadListForUser.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_createDefaultKnowledgePadListForUser.xml index 534a44dbc95eeed52e34521bdd0b668dbda732d1..3086eb30f728e30d8df057a2337565545aafccdf 100644 --- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_createDefaultKnowledgePadListForUser.xml +++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_createDefaultKnowledgePadListForUser.xml @@ -54,6 +54,7 @@ \n knowledge_pad = None\n portal = context.getPortalObject()\n +system_pref = context.portal_preferences.getActiveSystemPreference()\n user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n mode,\n @@ -61,9 +62,13 @@ tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n activate_kw = {\'tag\': tag}\n \n is_web_mode = mode in (\'web_front\', \'web_section\',)\n -if user_pref is not None:\n - # use template from user\'s preferences \n - pref_pads = user_pref.contentValues(portal_type=\'Knowledge Pad\')\n +# try to find template KnowledgePad from System Preference (and user Preference\n +# for backward compatibility only).\n +for pref in (system_pref, user_pref):\n + if pref is None:\n + continue\n + # use template from preferences \n + pref_pads = pref.contentValues(portal_type=\'Knowledge Pad\')\n if not is_web_mode:\n # leave only those not having a publication_section\n pref_pads = filter(lambda x: x.getPublicationSection() is None and x.getGroup() is None, \n @@ -78,7 +83,7 @@ if user_pref is not None:\n pref_pads)\n if len(pref_pads):\n pref_pad = pref_pads[0]\n - cp = user_pref.manage_copyObjects(ids=[pref_pad.getId()])\n + cp = pref.manage_copyObjects(ids=[pref_pad.getId()])\n new_id = context.knowledge_pad_module.manage_pasteObjects(\n cb_copy_data=cp)[0][\'new_id\']\n knowledge_pad = context.knowledge_pad_module[new_id]\n diff --git a/bt5/erp5_knowledge_pad/bt/revision b/bt5/erp5_knowledge_pad/bt/revision index e34fb7d8539f34598c7ae48bea32d7b5fdb05260..86ed5c7d2ab3aa173ceaa0384ae37026235e39e2 100644 --- a/bt5/erp5_knowledge_pad/bt/revision +++ b/bt5/erp5_knowledge_pad/bt/revision @@ -1 +1 @@ -716 \ No newline at end of file +717 \ No newline at end of file diff --git a/bt5/erp5_knowledge_pad/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_knowledge_pad/bt/template_portal_type_allowed_content_type_list index 4c8562fd05695c9e0085705db27d556312cd3be8..1c975362805478347aca2dd37c597ba84ce45a08 100644 --- a/bt5/erp5_knowledge_pad/bt/template_portal_type_allowed_content_type_list +++ b/bt5/erp5_knowledge_pad/bt/template_portal_type_allowed_content_type_list @@ -5,4 +5,5 @@ Gadget | Embedded File Knowledge Pad Module | Knowledge Pad Knowledge Pad | Knowledge Box Preference | Knowledge Pad +System Preference | Knowledge Pad Types Tool | Gadget Type \ No newline at end of file