Commit f1482d1a authored by Jérome Perrin's avatar Jérome Perrin

Add the ability to define priorities on the skins layers.

skins layers are sorted according to their
'business_template_skin_layer_priority' properties when installing a
business template.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3550 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ac38cc3c
...@@ -291,9 +291,12 @@ class SkinTemplateItem(ObjectTemplateItem): ...@@ -291,9 +291,12 @@ class SkinTemplateItem(ObjectTemplateItem):
if skin_id not in selection: if skin_id not in selection:
new_selection.append(skin_id) new_selection.append(skin_id)
new_selection.extend(selection) new_selection.extend(selection)
# make sure custom is always the first layer # sort the layer according to skin priorities
new_selection.remove('custom') new_selection.sort(lambda a, b : cmp(
new_selection = ['custom'] + new_selection b in ps.objectIds() and ps[b].getProperty(
'business_template_skin_layer_priority', 0) or 0,
a in ps.objectIds() and ps[a].getProperty(
'business_template_skin_layer_priority', 0) or 0))
ps.manage_skinLayers(skinpath = tuple(new_selection), skinname = skin_name, add_skin = 1) ps.manage_skinLayers(skinpath = tuple(new_selection), skinname = skin_name, add_skin = 1)
def uninstall(self, context, **kw): def uninstall(self, context, **kw):
......
...@@ -758,8 +758,10 @@ class ERP5Generator(PortalGenerator): ...@@ -758,8 +758,10 @@ class ERP5Generator(PortalGenerator):
addDirectoryViews(ps, 'skins', cmfactivity_globals) addDirectoryViews(ps, 'skins', cmfactivity_globals)
ps.manage_addProduct['OFSP'].manage_addFolder(id='external_method') ps.manage_addProduct['OFSP'].manage_addFolder(id='external_method')
ps.manage_addProduct['OFSP'].manage_addFolder(id='custom') ps.manage_addProduct['OFSP'].manage_addFolder(id='custom')
#ps.manage_addProduct['OFSP'].manage_addFolder(id='local_pro') # set the 'custom' layer a high priority, so it remains the first
#ps.manage_addProduct['OFSP'].manage_addFolder(id='local_mrp') # layer when installing new business templates
ps['custom'].manage_addProperty(
"business_template_skin_layer_priority", 100.0, "float")
ps.addSkinSelection('View', 'custom, external_method, activity, ' ps.addSkinSelection('View', 'custom, external_method, activity, '
+ 'zpt_content, zpt_generic,' + 'zpt_content, zpt_generic,'
+ 'zpt_control, content, generic, control, Images', + 'zpt_control, content, generic, control, Images',
......
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