Changeset 503
- Timestamp:
- 09/01/06 12:49:32
- Files:
-
- qPloneSkinDump/trunk/Extensions/Install.py (modified) (1 diff)
- qPloneSkinDump/trunk/HISTORY.txt (modified) (1 diff)
- qPloneSkinDump/trunk/README.txt (modified) (1 diff)
- qPloneSkinDump/trunk/TODO.txt (modified) (1 diff)
- qPloneSkinDump/trunk/Write.py (deleted)
- qPloneSkinDump/trunk/__init__.py (modified) (1 diff)
- qPloneSkinDump/trunk/config.py (modified) (1 diff)
- qPloneSkinDump/trunk/exportingObjects.py (added)
- qPloneSkinDump/trunk/i18n/qploneskindump-uk.po (modified) (8 diffs)
- qPloneSkinDump/trunk/i18n/qploneskindump.pot (modified) (3 diffs)
- qPloneSkinDump/trunk/qPloneSkinDump.py (modified) (2 diffs)
- qPloneSkinDump/trunk/skin_template/Extensions/Install.py (modified) (4 diffs)
- qPloneSkinDump/trunk/skin_template/Extensions/utils.py (added)
- qPloneSkinDump/trunk/skin_template/README.txt (modified) (2 diffs)
- qPloneSkinDump/trunk/skin_template/__init__.py (modified) (1 diff)
- qPloneSkinDump/trunk/skin_template/config.py (modified) (1 diff)
- qPloneSkinDump/trunk/skin_template/import (added)
- qPloneSkinDump/trunk/skins/qploneskindump/getFavourColumnList.py (deleted)
- qPloneSkinDump/trunk/skins/qploneskindump/getPortalSlotsInLine.py (deleted)
- qPloneSkinDump/trunk/skins/qploneskindump/getSlotsFormers.py (deleted)
- qPloneSkinDump/trunk/skins/qploneskindump/qploneskindump_config.cpt (modified) (7 diffs)
- qPloneSkinDump/trunk/skins/qploneskindump/qploneskindump_config_script.cpy (modified) (2 diffs)
- qPloneSkinDump/trunk/skins/qploneskindump/validate_qploneskindump_form.vpy (modified) (1 diff)
- qPloneSkinDump/trunk/utils.py (added)
- qPloneSkinDump/trunk/version.txt (modified) (1 diff)
- qPloneSkinDump/trunk/write_utils.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneSkinDump/trunk/Extensions/Install.py
r502 r503 14 14 controlpanel_tool.registerConfiglet(id=CONFIGURATION_CONFIGLET, name='qPloneSkinDump Configuration', category='Products', 15 15 action='string:${portal_url}/qploneskindump_config', 16 appId=PROJECTNAME, permission=ManagePortal, imageUrl=' group.gif')16 appId=PROJECTNAME, permission=ManagePortal, imageUrl='skins_icon.gif') 17 17 18 install_subskin(self, out, SKIN_GLOBALS)18 install_subskin(self, out, GLOBALS) 19 19 20 20 out.write('Installation qPloneSkinDump successfully completed.\n') qPloneSkinDump/trunk/HISTORY.txt
r502 r503 1 qPloneSkinDump 0.7 2 3 - Added registration/unregistration possibility 4 for Skin Product's ECMA scripts in portal_javascripts 5 registry through installation/uninstallation new Skin Product. 6 Only for Plone 2.1+ 7 - Performed complete dumping of CSS and JavaScripts 8 registries from skin's designer Plone instance 9 to Skin Product. Was realised dumping only "enable" 10 property. 11 - Added opportunity for skin designer to make desigion if perform 12 portal resources(css and|or javascripts) dumping or not. 13 This feature added to configlet and also present in config.py 14 module of new Skin Product. 15 - Added complete documentation for Skin Product's config.py 16 module's 17 constants. 18 - Added flexible opportunity to extend installation 19 tuning functions in config.py module of generated Skin 20 Product. This function will be called on new Skin Product 21 installation. 22 - Purify qPloneSkinDump and serving modules. 23 - Resolved controller resources .metadata file dumping bug. 24 - Purify Install and utils modules of generated Skin Product. 25 - Changed qPloneSkinDump control interface. 26 27 qPloneSkinDump 0.5.6 28 - Added possibility to import to portal root objects from 29 '<Product>/import' directory, based on import policy 30 ["only_new","backup","overwrite"] from config.py of 31 Skin Product. 32 1 33 qPloneSkinDump 0.5.3 2 34 - Completly rewrite instal/uninstall procedures of qPloneSkinDump/trunk/README.txt
r502 r503 1 1 Quintagroup Plone Skin Dump 2 2 3 qPloneSkinDump allows to create Plone product from some 4 ZMI based skin folder (eg "custom") from portal_skins. 3 qPloneSkinDump allows to create Plone product 4 (in file system) from some ZMI based skin folder 5 (eg "custom") from portal_skins. 5 6 6 So you can easy create Plone product with skin 7 based on folder with customized styles and page tamplates. 7 So you can easy design new Plone skin with all 8 customized styles, page tamplates, python scripts, 9 ECMA-scripts, Images and other objects, located 10 in some folder of portal_skins. Than dump it to 11 new Plone Skin Product to file system. 12 13 14 Features: 15 16 - Support dumping objects from generated portal's root 17 to Skin Product for adding this objects to 18 destination portal root on iinstalling Skin Product. 19 20 - Dump css and ecma-cripts resources registries from 21 generated portal to Skin Product for right working 22 styles and ecma-scripts. 23 24 - Allow dumping sorce skin folder with subfolder tree. 25 26 - Allow add aditional installation functions in config.py 27 module generated Skin Product. 28 29 - Allow customize slots for generated Skin Product. 30 31 - All configuration data for Skin Procut can be easy 32 changed in file system, cause all constants has 33 detailed explanations and examples. 34 35 36 Installation: 37 38 1. Install qPloneSkinDump as Zope product 39 40 2. Install qPloneSkinDump in your Plone instance with QuickInstaller 41 (Plone Control Panel -> Add/remove Products) 8 42 9 43 10 44 Usage 11 45 12 1. Install qPloneSkinDump as Zope product 46 1. Create standart Plone Folder ( <folder-source> ) in portal_skins 47 or use standard 'custom' folder and fill it with content according 48 to your needs. You can create subfolders in <folder-source>. 13 49 14 2. Install qPloneSkinDump in your Plone instance with QuickInstaller (Plone Control Panel -> Add/remove Products) 50 2. Go to the Plone Control Panel, select "qPloneSkinDump Configuration" 51 configlet and edit corresponding form fields: 15 52 16 3. Create folder ( <folder-source> ) in portal_skins 17 and fill it according to your needs. 18 19 4. Go to the Plone Control Panel and edit corresponding data: 20 21 - <folder-source> is the name of the folder where all the content 53 - <folder-source> is the name of the folder where all the content 22 54 and styles are located in ZMI ../portal_skins/<folder-source>. 23 55 24 - <ZMI Base Skin Name> is name of the Plone Skin, which list of layers 56 - <ZMI Base Skin Name> is name of the Plone Skin, which list of layers 25 57 will be used for creating new skin. (eg "Plone Tableless"). 26 58 27 - <Erace> is checkbox for erasing <folder-source> folder 59 - <Erace> is checkbox for erasing <folder-source> folder 28 60 from portal_skins after Product creating. 29 61 30 - <Skin's Name> is the name of skin folder for new product ( Actually 31 Products/<Product name>/skin/<skin's name> ), that will be based 32 on the <folder-source> staff. 33 This <Skin's Name> also used as name of new Plone skin. 62 - <Skin's Name> is the name of skin folder for new product ( Actually 63 Products/<Product name>/skin/<skin's name> ), that will be based 64 on the <folder-source> staff. 65 This <Skin's Name> also used as name of new Plone skin. 34 66 35 67 - <Product name> - the name of new Plone product. 36 68 37 - <Do customize slots> - Check it for PROVIDING SLOTS CUSTOMIZATION 69 - <Do customize slots> - Check it for PROVIDING SLOTS CUSTOMIZATION 38 70 in New Skin Product. 39 71 40 - <Left portal slots customizing>, <Right portal slots customizing> 41 - left and right slots lists for New Plone Product. You are 42 responsible for leaving only those portlets, which relate to your 72 - <Left portal slots customizing>, <Right portal slots customizing> 73 - left and right slots lists for New Plone Product. You are 74 responsible for leaving only those portlets, which relate to your 43 75 skin product or are standard for Plone. 44 76 45 - <Slot's list forming> - slot's list forming control on New Plone Product46 installation.77 - <Slot's list forming> - slot's list forming control on New Plone 78 Product installation. 47 79 48 - <Main column> - decide in which column leave same slots, in case 80 - <Main column> - decide in which column leave same slots, in case 49 81 of meetings one. 50 82 83 - <Exporting objects from portal root> - check it for export objects 84 from your Portal root to Skin Product. Than chosed objects will be 85 added to Portal root (where Skin Product will be installed) on 86 installation. 87 88 - <Import Policy> - define how will be imports objects to portal root 89 on installation Skin Product if will be meeting same named (id) 90 objects. 91 92 - <Exporting objects> multyselected list for choosing objects from 93 generated portal, which must be imported to portal root on Skin 94 Product's installation. 95 96 - <Dump portal_CSS registry> - switch on|off dumping portal_css registry 97 resources with all properties sets. Be attentive when switch-off this checkbox. 98 When switch-on - all css-es of your new Skin Product and other portal_css 99 resources will be sets identically to your settings and this guarantee 100 identical look and behavior of your skeen on other Plone site. 101 102 - <Dump portal_JS registry> - switch on|off dumping portal_javascripts registry 103 resources with all properties sets. Be attentive when switch-off this checkbox. 104 When switch-on - all ECMA-scripts of your new Skin Product and other 105 portal_javascripts resources will be sets identically to your settings 106 and this guarantee identical look and behavior of your skeen on other 107 Plone site. 108 51 109 5. For using new Plone product you must reload Zope, and install it in quickinstaller. 52 110 53 In file system new product located in ../Products/<Product name>. 111 In file system new product located in ../Products/<Product name>. 54 112 55 113 56 114 Caution 57 115 58 If you wish distribute generated product, you must 59 - (for Plone 2.1+) before run generation remove all non-standard 60 (for Plone dstribution) css resources from plone_css registry, 61 which aren't in the <folder-source> 116 If you wish distribute generated Skin Product, you must 117 - (for Plone 2.1+) before run generation remove all non-standard 118 (for Plone dstribution) css and jvascripts resources from 119 plone_css and plone_javascripts registries, which aren't 120 related to new Skin Product (not in the <folder-source>) 62 121 63 122 qPloneSkinDump/trunk/TODO.txt
r502 r503 1 1 *** Under consideration *** 2 2 3 * improve installation/uninstallation procedures 4 of generating skin-product for adding possibility 5 of simultaniosely presenting several skin-products 3 - Create more usable interface. qPloneSkinDump/trunk/__init__.py
r502 r503 2 2 from Products.CMFCore.DirectoryView import registerDirectory 3 3 from config import * 4 import qPloneSkinDump, utils, write_utils 4 5 5 registerDirectory('skins', SKIN_GLOBALS) 6 7 def initialize(context): 8 ##Import Types here to register them 9 from qPloneSkinDump import createProduct 10 from Write import * 6 registerDirectory('skins', GLOBALS) qPloneSkinDump/trunk/config.py
r502 r503 1 import re 1 2 from Products.CMFCore import CMFCorePermissions 2 3 3 SKIN_GLOBALS = globals() 4 4 ## Base Product Constants 5 GLOBALS = globals() 5 6 PROJECTNAME = "qPloneSkinDump" 6 7 7 ADD_CONTENT_PERMISSION = CMFCorePermissions.AddPortalContent 8 9 8 CONFIGURATION_CONFIGLET = "qploneskindump_configuration" 10 9 10 11 ## Constants for Scin Product generation 11 12 TEMPLATE_PATH = "skin_template" 12 13 14 15 ## Constants for slots castomization 13 16 SLOT_FORMING_LIST = ["blend_with_skin", "blend_with_site", "replace"] 14 17 DEFAULT_SLOT_FORMING = "blend_with_skin" 15 16 18 MAIN_COLUMN_LIST = ["left", "right", "both"] 17 19 DEFAULT_MAIN_COLUMN = "both" 20 21 22 ## Constants for Exporting objects 23 IMPORTING_POLICY_LIST = ["only_new","backup","overwrite"] 24 DEFAULT_IMPORTING_POLICY = "only_new" 25 FORBIDDEN_EXP_PREFIXES = re.compile('^(portal_)') 26 FORBIDDEN_EXP_NAMES = ["MailHost", "HTTPCache", "Members", "RAMCache", "acl_users",\ 27 "archetype_tool", "caching_policy_manager", "content_type_registry", \ 28 "cookie_authentication", "error_log", "kupu_library_tool",\ 29 "mimetypes_registry", "plone_utils", "reference_catalog",\ 30 "translation_service", "uid_catalog"] 31 32 33 ## Resource registries proprties 34 CSS_REG_PROPS = ['id', 'expression', 'enabled', 'cookable', 'cacheable' \ 35 ,'media', 'rel', 'title', 'rendering', 'compression'] 36 JS_REG_PROPS = ['id', 'expression', 'enabled', 'cookable', 'cacheable' \ 37 ,'inline', 'compression'] qPloneSkinDump/trunk/i18n/qploneskindump-uk.po
r502 r503 25 25 # 26 26 msgid "help_ZMISkinName" 27 msgstr " ведіть ім'я теки з ../portal_skins, з якої необхідно зкопіювати контент у ФС."28 29 # 30 # <label class="ZMISkinName_title" i18n:translate="label_ZMISkinName">Source skin folder</label>27 msgstr "беріть ім'я теки з ../portal_skins, з якої необхідно зкопіювати контент у файлову систему (ФС)." 28 29 # 30 # <label class="ZMISkinName_title" i18n:translate="label_ZMISkinName">Source ZMI skin folder</label> 31 31 # 32 32 msgid "label_ZMISkinName" 33 msgstr "Джерельна тека шкіри:"33 msgstr "Джерельна ZMI тека шкіри:" 34 34 35 35 # … … 37 37 # 38 38 msgid "help_ZMIBaseSkinName" 39 msgstr " ведіть назву шкіри, з якої необхідно взяти слої для створення нової шкіри."40 41 # 42 # <label class="ZMIBaseSkinName_title" i18n:translate="label_ZMIBaseSkinName"> Input ZMI Base Skin Name</label>39 msgstr "беріть назву шкіри, з якої необхідно взяти слої для створення нової шкіри." 40 41 # 42 # <label class="ZMIBaseSkinName_title" i18n:translate="label_ZMIBaseSkinName">ZMI base skin name</label> 43 43 # 44 44 msgid "label_ZMIBaseSkinName" 45 msgstr " ведіть iм'я Базової шкіри ZMI:"45 msgstr "беріть ім'я базової шкіри ZMI:" 46 46 47 47 # … … 49 49 # 50 50 msgid "help_Erase" 51 msgstr "Відмітьте, якщо необхідно стерти контент з джерельної теки."51 msgstr "Відмітьте, якщо необхідно витерти контент з джерельної теки." 52 52 53 53 # … … 55 55 # 56 56 msgid "label_Erace" 57 msgstr " терти:"57 msgstr "итерти" 58 58 59 59 # … … 67 67 # 68 68 msgid "help_FSSkinDirectory" 69 msgstr "Уведіть ім'я шкіри для нового продукту.<br>Це ім'я в низькому регістрі буде використано як назва теки у шкірах та як назва слою.<br>Ім'я повинно починатись із літери, а далі може містити як літери, так і числа."69 msgstr "Уведіть ім'я шкіри для нового продукту.<br>Це ім'я в низькому регістрі буде використано як назва теки у шкірах та як назва слою.<br>Ім'я повинно починатись із літери, а далі може містити літери, числа та символи підкреслення (але він не допускається в кінці назви)." 70 70 71 71 # … … 79 79 # 80 80 msgid "help_FSProductName" 81 msgstr "Уведіть назву нового продукту.<br>Ім'я овинно починатись із літери, а далі може містити як літери, так і числа."81 msgstr "Уведіть назву нового продукту.<br>Ім'я е може збігатись із іменами продуктів, що присутні у Products теці Plone інстансу.<br>Ім'я повинно починатись із літери, а далі може містити літери, числа та символи підкреслення (але він не допускається в кінці назви)." 82 82 83 83 # … … 102 102 # <label i18n:translate="label_DoesCustomizeSlots">Do customize slots</label> 103 103 # 104 msgid "label_ DoesCustomizeSlots"104 msgid "label_SlotsCustomizing" 105 105 msgstr "Налаштувати слоти" 106 106 … … 188 188 msgstr "Обидві" 189 189 190 191 192 193 194 195 # 196 # <label for="DoesExportObjects" style="font-size: 110%" i18n:translate="label_DoesExportObjects">Exporting objects from portal root</label> 197 # 198 msgid "label_DoesExportObjects" 199 msgstr "Експортування об'єктів з кореня порталу" 200 201 # 202 # <div class="formHelp" i18n:translate="help_DoesExportObjects">Selected below objects will be exported to New Skin Product. Then on installation generated Skin Product they will be imported to portal root, based on choosed policy. 203 # 204 msgid "help_DoesExportObjects" 205 msgstr "Відмічені нижче об'єкти будуть експортовані до нового ШКІРЯНОГО ПРОДУКТУ. Потім на інсталяції цього продукту обрані об'єкти будуть імпортовані до кореня порталу. Спосіб імпортування визначатиметься обраним методом." 206 207 # 208 # <label i18n:translate="label_ImportPolicy">Import Policy</label> 209 # 210 msgid "label_ImportPolicy" 211 msgstr "Метод імпортування" 212 213 # 214 # <div i18n:translate="help_ImportPolicy" class="formHelp">Choose *Import policy* for generated Skin Product. *Import policy* define behavior in case of meeting same id object in portal root with imported one. "only_new" - imported objects with ids, identical to portal root objects ids Not imported. "backup" - for portal root objects with same ids creates back_[date] directory and they moved there. All imported objects - importing to portal root. "overwrite" - all objects in portal root with same id overwrited with imported one.</div> 215 # 216 msgid "help_ImportPolicy" 217 msgstr "Оберіть *Метод імпортування* для генерованого ШКІРЯНОГО ПРОДУКТУ. *Метод імпортування* визначає поведінку в разі присутносі у корені порталу об'єктів із id(ідентифікатором) однаковим з імпортованими. 'Тільки нові' - імпортуються тільки неконфліктні об'єкти (однойменні ігноруються). 'Резервувати' - однойменні об'єкти з кореня порталу пересуваються до новоствореної back_[дата] теки. Усі об'єкти імпортуються до кореня порталу. 'Затерти' - всі однойменні об'єкти у корені порталу затираються імпортованими." 218 219 # 220 # <label class="default_import_policy" i18n:translate="" tal:content="i_policy_name"></label> 221 # 222 msgid "Only new" 223 msgstr "Тільки нові" 224 225 msgid "Backup" 226 msgstr "Резервувавати" 227 228 msgid "Overwrite" 229 msgstr "Затерти" 230 231 # 232 # <label class="ExportingOjects_title" i18n:translate="label_ExportingOjects">Exporting objects</label> 233 # 234 msgid "label_ExportingOjects" 235 msgstr "Об'єкти до експортування" 236 237 # 238 # <div i18n:translate="help_ExportingOjects" class="formHelp">Exporting object ids list. All selected objects will be exported to "<Skin Product>/import" directory and WILL BE IMPORTED to portal root on SkinProduct installation.</div> 239 # 240 msgid "help_ExportingOjects" 241 msgstr "Список ідентифікаторів об'єктів. Усі відмічені об'єкти будуть експортовані до '<тека шкірпродукту в ФС>/import' теки і БУДУТЬ ІМПОРТОВАНІ до кореня порталу на встановленні ШКІРПРОДУКТУ." 242 243 # 244 # <label for="DoesExportResources" style="font-size: 110%" i18n:translate="label_DoesExportResources">Exporting portal resources</label> 245 # 246 msgid "label_DoesExportResources" 247 msgstr "Експортування ресурсів порталу" 248 249 # 250 # <div class="formHelp" i18n:translate="help_DoesExportResources">Checked Portal Resources with current property sets will be exported from corresponding portal registries to New Skin Product. Then on generated Skin Product installation, appropriate portal registry will be made identical to yours. This guarantee look and behavior of generated Skin Product in desired way. You can make corrections of exported resources in config.py module of New Skin Product. This feature work only when generated Skin Product install on Plone v2.1+.</div> 251 # 252 msgid "help_DoesExportResources" 253 msgstr "Відмічені ресурси порталу, разом з усіма наборами властивостей, будуть екпортовані до ШКІРПРОДУКТУ із відповідного реєстру (CSS та|або Javascripts). Далі на встановленні ШКІРПРОДУКТУ відповідний реєстр буде налаштовано ідентично до вашого. Це гарантує, що вигляд і поведінка продукту будуть відповідати вашому задуму. Ви можете відкорегувати дані по експортованим ресурсам у config.py модулі ШКІРПРОДУКТУ. Ця опція застосовується тільки коли ваш продукт встановлюватиметься на Plone v2.1+." 254 255 # 256 # <label class="DumpCSSRegistry_title" i18n:translate="label_DumpCSSRegistry">Dump portal_CSS registry.</label> 257 # 258 msgid "label_DumpCSSRegistry" 259 msgstr "Зтягнути portal_css реєстр." 260 261 # 262 # <label class="DumpJSRegistry_title" i18n:translate="label_DumpJSRegistry">Dump portal_javascripts registry.</label> 263 # 264 msgid "label_DumpJSRegistry" 265 msgstr "Зтягнути portal_javascripts реєстр." 266 267 268 269 270 271 272 273 274 190 275 # 191 276 # <input class=context type="submit" name="form.button.form_submit" value="Save" i18n:attributes="label_save"/> 192 277 # 193 msgid " Save"194 msgstr "З писати"195 278 msgid "Generate" 279 msgstr "Зенерувати" 280 qPloneSkinDump/trunk/i18n/qploneskindump.pot
r502 r503 28 28 29 29 # 30 # <label class="ZMISkinName_title" i18n:translate="label_ZMISkinName">Source skin folder</label>30 # <label class="ZMISkinName_title" i18n:translate="label_ZMISkinName">Source ZMI skin folder</label> 31 31 # 32 32 msgid "label_ZMISkinName" 33 msgstr "Source skin folder:"33 msgstr "Source ZMI skin folder:" 34 34 35 35 # … … 40 40 41 41 # 42 # <label class="ZMIBaseSkinName_title" i18n:translate="label_ZMIBaseSkinName"> Input ZMI Base Skin Name</label>42 # <label class="ZMIBaseSkinName_title" i18n:translate="label_ZMIBaseSkinName">ZMI base skin name</label> 43 43 # 44 44 msgid "label_ZMIBaseSkinName" 45 msgstr " Input ZMI Base Skin Name:"45 msgstr "ZMI base skin name:" 46 46 47 47 # … … 187 187 msgstr "Both" 188 188 189 # 190 # <input class=context type="submit" name="form.button.form_submit" value="Save" i18n:attributes="value"/> 191 # 192 msgid "Save" 193 msgstr "Save" 189 190 191 192 193 194 195 # 196 # <label for="DoesExportObjects" style="font-size: 110%" i18n:translate="label_DoesExportObjects">Exporting objects from portal root</label> 197 # 198 msgid "label_DoesExportObjects" 199 msgstr "Exporting objects from portal root" 200 201 # 202 # 203 # 204 msgid "" 205 msgstr "" 206 207 # 208 # <div class="formHelp" i18n:translate="help_DoesExportObjects">Selected below objects will be exported to New Skin Product. Then on installation generated Skin Product they will be imported to portal root, based on choosed policy. 209 # 210 msgid "help_DoesExportObjects" 211 msgstr "Selected below objects will be exported to New Skin Product. Then on installation generated Skin Product they will be imported to portal root, based on choosed policy." 212 213 # 214 # <label i18n:translate="label_ImportPolicy">Import Policy</label> 215 # 216 msgid "label_ImportPolicy" 217 msgstr "Import Policy" 218 219 # 220 # <div i18n:translate="help_ImportPolicy" class="formHelp">Choose *Import policy* for generated Skin Product. *Import policy* define behavior in case of meeting same id object in portal root with imported one. "only_new" - imported objects with ids, identical to portal root objects ids Not imported. "backup" - for portal root objects with same ids creates back_[date] directory and they moved there. All imported objects - importing to portal root. "overwrite" - all objects in portal root with same id overwrited with imported one.</div> 221 # 222 msgid "help_ImportPolicy" 223 msgstr "Choose *Import policy* for generated Skin Product. *Import policy* define behavior in case of meeting same id object in portal root with imported one. 'only_new' - imported objects with ids, identical to portal root objects ids Not imported. 'backup' - for portal root objects with same ids creates back_[date] directory and they moved there. All imported objects - importing to portal root. 'overwrite' - all objects in portal root with same id overwrited with imported one." 224 225 # 226 # <label class="default_import_policy" i18n:translate="" tal:content="i_policy_name"></label> 227 # 228 msgid "Only new" 229 msgstr "Only new" 230 231 msgid "Backup" 232 msgstr "Backup" 233 234 msgid "Overwrite" 235 msgstr "Overwrite" 236 237 # 238 # <label class="ExportingOjects_title" i18n:translate="label_ExportingOjects">Exporting objects</label> 239 # 240 msgid "label_ExportingOjects" 241 msgstr "Exporting objects" 242 243 # 244 # <div i18n:translate="help_ExportingOjects" class="formHelp">Exporting object ids list. All selected objects will be exported to "<Skin Product>/import" directory and WILL BE IMPORTED to portal root on SkinProduct installation.</div> 245 # 246 msgid "help_ExportingOjects" 247 msgstr "Exporting object ids list. All selected objects will be exported to '<Skin Product>/import' directory and WILL BE IMPORTED to portal root on SkinProduct installation." 248 249 # 250 # <label for="DoesExportResources" style="font-size: 110%" i18n:translate="label_DoesExportResources">Exporting portal resources</label> 251 # 252 msgid "label_DoesExportResources" 253 msgstr "Exporting portal resources" 254 255 # 256 # <div class="formHelp" i18n:translate="help_DoesExportResources">Checked Portal Resources with current property sets will be exported from corresponding portal registries to New Skin Product. Then on generated Skin Product installation, appropriate portal registry will be made identical to yours. This guarantee look and behavior of generated Skin Product in desired way. You can make corrections of exported resources in config.py module of New Skin Product. This feature work only when generated Skin Product install on Plone v2.1+.</div> 257 # 258 msgid "help_DoesExportResources" 259 msgstr "Checked Portal Resources with current property sets will be exported from corresponding portal registries to New Skin Product. Then on generated Skin Product installation, appropriate portal registry will be made identical to yours. This guarantee look and behavior of generated Skin Product in desired way. You can make corrections of exported resources in config.py module of New Skin Product. This feature work only when generated Skin Product install on Plone v2.1+." 260 261 # 262 # <label class="DumpCSSRegistry_title" i18n:translate="label_DumpCSSRegistry">Dump portal_CSS registry.</label> 263 # 264 msgid "label_DumpCSSRegistry" 265 msgstr "Dump portal_css registry." 266 267 # 268 # <label class="DumpJSRegistry_title" i18n:translate="label_DumpJSRegistry">Dump portal_javascripts registry.</label> 269 # 270 msgid "label_DumpJSRegistry" 271 msgstr "Dump portal_javascripts registry." 272 273 274 # 275 # <input class=context type="submit" name="form.button.form_submit" value="Generate" i18n:attributes="value"/> 276 # 277 msgid "Generate" 278 msgstr "Generate" qPloneSkinDump/trunk/qPloneSkinDump.py
r502 r503 1 from sys import stdout 2 import os, os.path 3 from App.config import getConfiguration 1 import os, re 2 from AccessControl import ModuleSecurityInfo 4 3 from Products.CMFCore.utils import getToolByName 5 from AccessControl import ModuleSecurityInfo6 4 7 from Write import writeProps, writeFileContent, writeObjectsMeta8 5 from config import * 6 from utils import * 7 from exportingObjects import exportObjects 9 8 10 9 security = ModuleSecurityInfo( 'Products.qPloneSkinDump.qPloneSkinDump' ) 11 10 12 _write_custom_meta_type_list = [ 13 'Controller Page Template', 14 'Controller Python Script', 15 'Controller Validator', 16 'DTML Method', 17 'File', 18 'Image', 19 'Page Template', 20 'Script (Python)' ] 21 22 security.declarePrivate('getProductsFSPath') 23 def getProductsFSPath(): 24 cfg = getConfiguration() 25 return os.path.join(cfg.instancehome,'Products') 26 11 security.declarePublic('getExportingData') 12 def getExportingData(context): 13 result_list = { 'default_import_policy':DEFAULT_IMPORTING_POLICY 14 ,'import_policy_list':{} 15 ,'export_object_id_list':[] } 16 # Form allowed id list for exporting 17 portal_ids = getToolByName(context, 'portal_url').getPortalObject().objectIds() 18 result_list['export_object_id_list'] = [id for id in portal_ids \ 19 if id not in FORBIDDEN_EXP_NAMES \ 20 and not FORBIDDEN_EXP_PREFIXES.match(id)] 21 # Form importing_policy_list dictionary with readable names 22 result_list['import_policy_list'] = ipols = {} 23 [ipols.update({ip:ip.replace("_"," ").capitalize()}) for ip in IMPORTING_POLICY_LIST] 24 return result_list 27 25 28 26 security.declarePublic('getSlotsFormingList') 29 27 def getSlotsFormingList(): 30 result_list = [] 31 for s in SLOT_FORMING_LIST: 32 item = [s, s.replace("_"," ").capitalize()] 33 if s == DEFAULT_SLOT_FORMING: 34 item.append(1) 35 result_list.append(item) 36 return result_list 37 28 return {'default':DEFAULT_SLOT_FORMING \ 29 ,'data':[[s, s.replace("_"," ").capitalize()] for s in SLOT_FORMING_LIST]} 38 30 39 31 security.declarePublic('getMainColumnList') 40 32 def getMainColumnList(): 41 result_list = [] 42 for s in MAIN_COLUMN_LIST: 43 item = [s, s.capitalize()] 44 if s == DEFAULT_MAIN_COLUMN: 45 item.append(1) 46 result_list.append(item) 47 return result_list 48 49 33 return {'default':DEFAULT_MAIN_COLUMN \ 34 ,'data':[[s, s.capitalize()] for s in MAIN_COLUMN_LIST]} 50 35 51 36 security.declarePublic('isValidProductName') 52 37 def isValidProductName(product_name): 53 38 """ Check for product presence in installed products list""" 54 path_join=os.path.join 55 isdir=os.path.isdir 56 products_path = getProductsFSPath() 57 products_list=os.listdir(products_path) 58 products_list.sort() 59 if not (product_name in products_list): 60 return isValidDirName(product_name) 61 return 0 39 return (product_name not in os.listdir(getProductsFSPath()) \ 40 and isValidDirName(product_name)) 62 41 63 42 DIR_NAME_PATTERN = re.compile("^[a-zA-Z]+[a-zA-Z0-9_]*[a-zA-Z0-9]$") 64 43 security.declarePublic('isValidDirName') 65 44 def isValidDirName(dir_name): 66 45 """ Check for validity directory name""" 67 import re 68 dir_name_pattern = re.compile("^[a-zA-Z]+[a-zA-Z0-9]*") 69 m = dir_name_pattern.match(dir_name) 70 if m and dir_name == m.group(): 71 return 1 72 return 0 73 74 security.declarePublic('isValidSlotForming') 75 def isValidSlotForming(slot_forming): 76 """ Check for slot forming name validity""" 77 return slot_forming in SLOT_FORMING_LIST 78 79 security.declarePublic('isValidMainColumn') 80 def isValidMainColumn(main_column): 81 """ Check for main column name validity""" 82 return main_column in MAIN_COLUMN_LIST 83 46 m = DIR_NAME_PATTERN.match(dir_name) 47 return m and dir_name == m.group() 84 48 85 49 security.declarePublic('createProduct') … … 95 59 right_slots=[],\ 96 60 slot_forming=DEFAULT_SLOT_FORMING,\ 97 main_column=DEFAULT_MAIN_COLUMN): 98 99 # stdout.write('makeNewProduct::\nfs_product_name:%s\n' % (fs_product_name)) 100 makeNewProduct(context, fs_product_name, fs_skin_directory, zmi_skin_name, zmi_base_skin_name,\ 101 subdir, doesCustomizeSlots, left_slots, right_slots, slot_forming, main_column) 61 main_column=DEFAULT_MAIN_COLUMN,\ 62 doesExportObjects=None,\ 63 import_policy=DEFAULT_IMPORTING_POLICY,\ 64 exporting_objects=[], \ 65 dump_CSS=True, \ 66 dump_JS=True ): 67 """ Main Skin Product creating procedure.""" 68 makeNewProduct(context, fs_product_name, fs_skin_directory, \ 69 zmi_skin_name, zmi_base_skin_name, subdir, \ 70 doesCustomizeSlots, left_slots, right_slots, slot_forming, main_column, \ 71 doesExportObjects, import_policy, \ 72 dump_CSS, dump_JS ) 102 73 dumpSkin(context, zmi_skin_name, subdir, fs_skin_directory.lower(), 103 74 fs_product_name, erase_from_skin) 104 105 106 security.declarePrivate('dumpSkin') 107 def dumpSkin(context, \ 108 skin_name='custom', \ 109 subdir=None, \ 110 fs_skin_directory='custom', \ 111 fs_product_name='QSkinTemplate', \ 112 erase_from_skin=0): 113 """Dump custom information to file.""" 114 115 skinpath = "%s/%s/skins/%s" % (getProductsFSPath(), fs_product_name, fs_skin_directory) 116 117 # go into subdir in skin folder 118 if not subdir: 119 subdir = getToolByName( context, 'portal_skins' )[skin_name] 120 121 # Get objects from ZMI skin folder 122 objects = subdir.objectValues() 123 124 # find path to subdir 125 # getPhysicalPath() returns a list of folderids 126 skinp = getToolByName( context, 'portal_skins' )[skin_name].getPhysicalPath() 127 subp = subdir.getPhysicalPath() 128 129 if len(subp) != len(skinp): 130 # adapt skinpath and create directory 131 import string 132 skinpath += '/' + string.join( subp[len(skinp):], '/' ) 133 134 # Create directory in FS if not yet exist 135 if not os.path.exists( skinpath ): 136 os.makedirs( skinpath ) 137 138 # Loop of copying content from ZMIskin-folder to FSskin-folder 139 deletelist = [] 140 obj_meta = {} 141 for o in objects: 142 meta_type = o.meta_type 143 id = o.id 144 if callable(id): id = id() 145 assert o.getId() == id, "expected identical ids: '%s' != '%s'" % (o.getId(), id) 146 if meta_type == 'Folder': 147 # very plone specific 148 if id in ['stylesheet_properties', 'base_properties'] or id.startswith('base_properties'): 149 writeProps( o, skinpath, extension = '.props' ) 150 else: 151 dumpSkin( context, skin_name, subdir = o,\ 152 fs_skin_directory=fs_skin_directory,\ 153 fs_product_name=fs_product_name,\ 154 erase_from_skin = erase_from_skin ) 155 deletelist.append( o.getId() ) 156 elif meta_type in _write_custom_meta_type_list: 157 # write object's properties 158 #writeProps( o, skinpath ) 159 # extract content from object(depend on metatype) and write it to the file 160 if id.find('.') < 0 : obj_meta[id] = meta_type 161 if meta_type in ['Image', 'File']: data = o.manage_FTPget() # not o.data, which only returns the first 64K! 162 else: data = o.document_src() 163 writeFileContent( o, skinpath, data ) 164 deletelist.append( o.getId() ) 165 else: 166 print 'metod ignoring ', meta_type 167 # write '.objects' file to directory if present objects with id without extension 168 if obj_meta : 169 #stdout.write('obj_meta:%s, skinpath:%s\n'% (obj_meta, skinpath)) 170 writeObjectsMeta(obj_meta, skinpath) 171 # delete objects from the skin, if request 172 if erase_from_skin: 173 subdir.manage_delObjects( ids = deletelist ) 174 175 176 security.declarePrivate('makeNewProduct') 177 def makeNewProduct(context, productName, productSkinName, zmi_skin_name, zmi_base_skin_name,\ 178 subdir, doesCustomizeSlots, left_slots, right_slots, slot_forming, main_column): 179 """Create new skin-product's directory and 180 copy skin-product template with little modification""" 181 products_path = getProductsFSPath() 182 productPath = os.path.join(products_path, productName) 183 if not ( productName in os.listdir(products_path) ): 184 os.mkdir(productPath) 185 186 # Get list css objects from zmi_skin_name for Plone 2.1.0+ 187 # go into subdir in skin folder 188 if not subdir: 189 subdir = getToolByName( context, 'portal_skins' )[zmi_skin_name] 190 191 # Get objects from ZMI skin folder 192 #objects = subdir.objectValues() 193 # Loop of copying content from ZMIskin-folder to FSskin-folder 194 css_list = getCSSList(subdir, css_list=[]) 195 result_css_list = [] 196 dummy = [result_css_list.append(item) for item in css_list if item not in result_css_list] 197 # Get Data from CSS Regestry 198 skin_css_regdata = getCSSRegData(context) 199 200 201 # Get Slots customization information 202 if not doesCustomizeSlots: 203 left_slots = right_slots = None 204 slot_forming = main_column = None 205 206 207 templatePath = os.path.join(products_path,\ 208 PROJECTNAME,\ 209 TEMPLATE_PATH) 210 211 copyDir(templatePath, productPath, productName) 212 213 config_file_path = os.path.join(productPath, 'config.py') 214 f_cnfg = open(config_file_path, 'a') 215 f_cnfg.write("\nGENERATOR_PRODUCT = '%s'" % PROJECTNAME) 216 f_cnfg.write("\nPRODUCT_NAME = '%s'" % productName) 217 f_cnfg.write("\nSKIN_NAME = '%s'" % productSkinName) 218 f_cnfg.write("\nBASE_SKIN_NAME = '%s'" % zmi_base_skin_name) 219 f_cnfg.write("\nCSS_LIST = %s" % result_css_list) 220 f_cnfg.write("\nLEFT_SLOTS = %s" % left_slots) 221 f_cnfg.write("\nRIGHT_SLOTS = %s" % right_slots) 222 f_cnfg.write("\nSLOT_FORMING = '%s'" % slot_forming) 223 f_cnfg.write("\nMAIN_COLUMN = '%s'" % main_column) 224 f_cnfg.write("\nSKIN_CSS_REGDATA = %s" % skin_css_regdata) 225 f_cnfg.close() 226 227 # Create product's README.txt file 228 readme_file_path = os.path.join(productPath, 'README.txt') 229 f_readme = open(readme_file_path, 'r+') 230 text = f_readme.read() 231 text = "%s\n%s" % (productName, text) 232 f_readme.seek(0) 233 f_readme.write(text) 234 f_readme.close() 235 # Create product's INSTALL.txt file 236 install_file_path = os.path.join(productPath, 'INSTALL.txt') 237 f_install = open(install_file_path, 'w') 238 f_install.write(text) 239 f_install.close() 240 241 return 242 243 244 import re 245 css_patern = re.compile("^.+\.css$") 246 from zLOG import LOG 247 248 security.declarePrivate('getCSSList') 249 def getCSSList(directory, css_list): 250 #LOG("getCSSList: ", 100, "debug", "directory_id: %s" % directory.id) 251 objects = directory.objectValues() 252 #LOG("getCSSList: ", 100, "debug", "directory_objects: %s" % objects) 253 for o in objects: 254 meta_type = o.meta_type 255 id = o.id 256 if callable(id): id = id() 257 #assert o.getId() == id, "expected identical ids: '%s' != '%s'" % (o.getId(), id) 258 if meta_type == 'Folder': 259 # very plone specific 260 if id not in ['stylesheet_properties', 'base_properties'] \ 261 and not id.startswith('base_properties'): 262 css_list = getCSSList(o, css_list) 263 264 elif css_patern.match(id): 265 css_list.append( id ) 266 #LOG("getCSSList: ", 100, "debug", "css_list: %s" % css_list) 267 return css_list 268 269 270 def getCSSRegData(context): 271 # Return list of lists : [[resource_id, resource_enabling], ... ] 272 result = [] 273 css_reg = getToolByName(context, 'portal_css', None) 274 if css_reg: 275 result = [(r.getId(), not not r.getEnabled()) for r in css_reg.getResources()] 75 result = exportObjects(context, doesExportObjects, exporting_objects, fs_product_name) 276 76 return result 277 278 279 security.declarePrivate('copyDir')280 def copyDir(srcDirectory, dstDirectory, productName):281 """Recursive copying from ZMIskin-folder to FS one"""282 isfile = os.path.isfile283 isdir = os.path.isdir284 join = os.path.join285 for item in os.listdir(srcDirectory):286 src_path = join(srcDirectory, item)287 dst_path = join(dstDirectory, item)288 # stdout.write('src_path:%s, dst_path:%s\n'% (src_path, dst_path))289 if isfile(src_path):290 if os.path.exists(dst_path):291 continue292 f_sorce = open(src_path,'r')293 data = f_sorce.read()294 f_sorce.close()295 f_dst = open(dst_path,'w')296 if item == 'Install.py'\297 and os.path.split(srcDirectory)[1]=="Extensions" :298 f_dst.write("from Products.%s.config import *\n" % productName)299 f_dst.write(data)300 f_dst.close()301 elif isdir(src_path):302 if not os.path.exists(dst_path):303 os.mkdir(dst_path)304 # stdout.write('created:%s directory\n'% (dst_path))305 copyDir(src_path, dst_path, productName)306 return307 77 308 78 security.apply(globals()) qPloneSkinDump/trunk/skin_template/Extensions/Install.py
r502 r503 1 import string 2 from StringIO import StringIO 3 from zLOG import LOG, INFO 1 4 from Products.CMFCore.utils import getToolByName 2 from StringIO import StringIO 3 from Products.CMFCore.DirectoryView import addDirectoryViews 4 import string 5 from Products.%(SKIN_PRODUCT_NAME)s.config import * 6 from Products.%(SKIN_PRODUCT_NAME)s.Extensions.utils import * 5 7 6 7 def install(self): 8 out=StringIO() 9 # Checking base condition for installation 10 &
