1 | ## Script (Python) "qploneskindump_config_script" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind state=state |
---|
7 | ##bind subpath=traverse_subpath |
---|
8 | ##parameters= |
---|
9 | ##title= |
---|
10 | ## |
---|
11 | |
---|
12 | #from Products.CMFCore.utils import getToolByName |
---|
13 | from Products.qPloneSkinDump.qPloneSkinDump import createProduct |
---|
14 | from Products.CMFPlone import PloneMessageFactory as _ |
---|
15 | |
---|
16 | REQUEST = context.REQUEST |
---|
17 | # ZMI data |
---|
18 | zmi_skin_names = REQUEST.get('ZMISkinName') |
---|
19 | zmi_base_skin_name = REQUEST.get('ZMIBaseSkinName') |
---|
20 | |
---|
21 | # File system data |
---|
22 | fs_dest_directory = REQUEST.get("FSDestinationDirectory") |
---|
23 | fs_skin_directory = REQUEST.get('FSSkinDirectory') |
---|
24 | fs_product_name = REQUEST.get('FSProductName') |
---|
25 | erase_from_skin = REQUEST.get('EraseFromSkin') |
---|
26 | |
---|
27 | # Slots customization data |
---|
28 | left_slots = right_slots = slot_forming = main_column = None |
---|
29 | doesCustomizeSlots = REQUEST.get('DoesCustomizeSlots') |
---|
30 | if doesCustomizeSlots: |
---|
31 | slot_forming = REQUEST.get('slot_forming') |
---|
32 | main_column = REQUEST.get('main_column') |
---|
33 | |
---|
34 | left_slots = REQUEST.get('left_slots') |
---|
35 | right_slots = REQUEST.get('right_slots') |
---|
36 | if left_slots: |
---|
37 | left_slots = [i for i in left_slots if i] |
---|
38 | if right_slots: |
---|
39 | right_slots = [i for i in right_slots if i] |
---|
40 | |
---|
41 | # Exporting portlets |
---|
42 | dump_portlets = REQUEST.get('dump_portlets', 0) |
---|
43 | dump_policy = REQUEST.get('dump_policy', 'root') |
---|
44 | dump_portlets_selection = REQUEST.get('dump_objects', []) |
---|
45 | |
---|
46 | # Exporting objects |
---|
47 | import_policy = exporting_objects = None |
---|
48 | doesExportObjects = REQUEST.get('DoesExportObjects') |
---|
49 | if doesExportObjects: |
---|
50 | import_policy = REQUEST.get('import_policy') |
---|
51 | exporting_objects = REQUEST.get('exporting_objects') |
---|
52 | #return [doesExportObjects, import_policy, exporting_objects] |
---|
53 | |
---|
54 | # Exporting portal resources |
---|
55 | dump_CSS = dump_JS = None |
---|
56 | dump_CSS = REQUEST.get('DumpCSSRegistry') |
---|
57 | dump_JS = REQUEST.get('DumpJSRegistry') |
---|
58 | |
---|
59 | dump_custom_views = REQUEST.get('dump_viewlets', None) |
---|
60 | |
---|
61 | # create Product |
---|
62 | result = createProduct(context, zmi_skin_names=zmi_skin_names,\ |
---|
63 | zmi_base_skin_name=zmi_base_skin_name,\ |
---|
64 | fs_dest_directory=fs_dest_directory, \ |
---|
65 | fs_skin_directory=fs_skin_directory,\ |
---|
66 | fs_product_name=fs_product_name,\ |
---|
67 | erase_from_skin=erase_from_skin,\ |
---|
68 | doesCustomizeSlots=doesCustomizeSlots,\ |
---|
69 | left_slots=left_slots,\ |
---|
70 | right_slots=right_slots,\ |
---|
71 | slot_forming=slot_forming,\ |
---|
72 | main_column=main_column, |
---|
73 | doesExportObjects=doesExportObjects,\ |
---|
74 | import_policy=import_policy,\ |
---|
75 | exporting_objects=exporting_objects, \ |
---|
76 | dump_CSS=dump_CSS, \ |
---|
77 | dump_JS=dump_JS, \ |
---|
78 | dump_portlets=dump_portlets, \ |
---|
79 | dump_policy=dump_policy, \ |
---|
80 | dump_portlets_selection=dump_portlets_selection, \ |
---|
81 | dump_custom_views=dump_custom_views ) |
---|
82 | |
---|
83 | portal_status_message = u'"%s" Product successfully created.' % fs_product_name |
---|
84 | if result: |
---|
85 | portal_status_message = portal_status_message + u"Failed exporting objects: %s." % str(result) |
---|
86 | |
---|
87 | context.plone_utils.addPortalMessage(_(portal_status_message)) |
---|
88 | return state |
---|