Commit b7c7d1c3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Knowledge Pad template should belong to System Preference, not Preference.

parent 440cfcb8
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
<portal_type id="Preference"> <portal_type id="Preference">
<item>Knowledge Pad</item> <item>Knowledge Pad</item>
</portal_type> </portal_type>
<portal_type id="System Preference">
<item>Knowledge Pad</item>
</portal_type>
<portal_type id="Types Tool"> <portal_type id="Types Tool">
<item>Gadget Type</item> <item>Gadget Type</item>
</portal_type> </portal_type>
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
\n \n
knowledge_pad = None\n knowledge_pad = None\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
system_pref = context.portal_preferences.getActiveSystemPreference()\n
user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n user_pref = context.Base_getActiveGlobalKnowledgePadPreference()\n
tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n
mode,\n mode,\n
...@@ -61,9 +62,13 @@ tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n ...@@ -61,9 +62,13 @@ tag = \'%s_%s_%s\' %(portal.portal_membership.getAuthenticatedMember(),\n
activate_kw = {\'tag\': tag}\n activate_kw = {\'tag\': tag}\n
\n \n
is_web_mode = mode in (\'web_front\', \'web_section\',)\n is_web_mode = mode in (\'web_front\', \'web_section\',)\n
if user_pref is not None:\n # try to find template KnowledgePad from System Preference (and user Preference\n
# use template from user\'s preferences \n # for backward compatibility only).\n
pref_pads = user_pref.contentValues(portal_type=\'Knowledge Pad\')\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 if not is_web_mode:\n
# leave only those not having a publication_section\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 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 ...@@ -78,7 +83,7 @@ if user_pref is not None:\n
pref_pads)\n pref_pads)\n
if len(pref_pads):\n if len(pref_pads):\n
pref_pad = pref_pads[0]\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 new_id = context.knowledge_pad_module.manage_pasteObjects(\n
cb_copy_data=cp)[0][\'new_id\']\n cb_copy_data=cp)[0][\'new_id\']\n
knowledge_pad = context.knowledge_pad_module[new_id]\n knowledge_pad = context.knowledge_pad_module[new_id]\n
......
716 717
\ No newline at end of file \ No newline at end of file
...@@ -5,4 +5,5 @@ Gadget | Embedded File ...@@ -5,4 +5,5 @@ Gadget | Embedded File
Knowledge Pad Module | Knowledge Pad Knowledge Pad Module | Knowledge Pad
Knowledge Pad | Knowledge Box Knowledge Pad | Knowledge Box
Preference | Knowledge Pad Preference | Knowledge Pad
System Preference | Knowledge Pad
Types Tool | Gadget Type Types Tool | Gadget Type
\ 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