Changeset 503

Show
Ignore:
Timestamp:
09/01/06 12:49:32
Author:
mylan
Message:

Add possibility of exporting objects to Skin Product for following importing on its installation. Add full css and javascripts registries dumping. Change interface.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneSkinDump/trunk/Extensions/Install.py

    r502 r503  
    1414    controlpanel_tool.registerConfiglet(id=CONFIGURATION_CONFIGLET, name='qPloneSkinDump Configuration', category='Products', 
    1515                                        action='string:${portal_url}/qploneskindump_config', 
    16                                         appId=PROJECTNAME,  permission=ManagePortal, imageUrl='group.gif') 
     16                                        appId=PROJECTNAME,  permission=ManagePortal, imageUrl='skins_icon.gif') 
    1717 
    18     install_subskin(self, out, SKIN_GLOBALS) 
     18    install_subskin(self, out, GLOBALS) 
    1919 
    2020    out.write('Installation qPloneSkinDump successfully completed.\n') 
  • qPloneSkinDump/trunk/HISTORY.txt

    r502 r503  
     1qPloneSkinDump 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 
     27qPloneSkinDump 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 
    133qPloneSkinDump 0.5.3 
    234    - Completly rewrite instal/uninstall procedures of 
  • qPloneSkinDump/trunk/README.txt

    r502 r503  
    11Quintagroup Plone Skin Dump 
    22 
    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. 
    56 
    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 
     14Features: 
     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 
     36Installation: 
     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) 
    842 
    943 
    1044Usage 
    1145 
    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>. 
    1349 
    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: 
    1552 
    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 
    2254        and styles are located in ZMI ../portal_skins/<folder-source>. 
    2355 
    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 
    2557       will be used for creating new skin. (eg "Plone Tableless"). 
    2658 
    27      - <Erace>  is checkbox for erasing <folder-source> folder  
     59     - <Erace>  is checkbox for erasing <folder-source> folder 
    2860       from portal_skins after Product creating. 
    2961 
    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. 
    3466 
    3567     - <Product name> - the name of new Plone product. 
    3668 
    37      - <Do customize slots> - Check it for PROVIDING SLOTS CUSTOMIZATION  
     69     - <Do customize slots> - Check it for PROVIDING SLOTS CUSTOMIZATION 
    3870        in New Skin Product. 
    3971 
    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 
    4375        skin product or are standard for Plone. 
    4476 
    45      - <Slot's list forming> - slot's list forming control on New Plone Product  
    46         installation. 
     77     - <Slot's list forming> - slot's list forming control on New Plone 
     78        Product installation. 
    4779 
    48      - <Main column> - decide in which column leave same slots, in case  
     80     - <Main column> - decide in which column leave same slots, in case 
    4981        of meetings one. 
    5082 
     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      
    51109  5. For using new Plone product you must reload Zope, and install it in quickinstaller. 
    52110 
    53   In file system new product located in ../Products/<Product name>.  
     111  In file system new product located in ../Products/<Product name>. 
    54112 
    55113 
    56114Caution 
    57115 
    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>) 
    62121           
    63122 
  • qPloneSkinDump/trunk/TODO.txt

    r502 r503  
    11*** Under consideration *** 
    22 
    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  
    22from Products.CMFCore.DirectoryView import registerDirectory 
    33from config import * 
     4import qPloneSkinDump, utils, write_utils 
    45 
    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 * 
     6registerDirectory('skins', GLOBALS) 
  • qPloneSkinDump/trunk/config.py

    r502 r503  
     1import re 
    12from Products.CMFCore import CMFCorePermissions 
    23 
    3 SKIN_GLOBALS = globals() 
    4  
     4## Base Product Constants 
     5GLOBALS = globals() 
    56PROJECTNAME = "qPloneSkinDump" 
    6  
    77ADD_CONTENT_PERMISSION = CMFCorePermissions.AddPortalContent 
    8  
    98CONFIGURATION_CONFIGLET = "qploneskindump_configuration" 
    109 
     10 
     11## Constants for Scin Product generation 
    1112TEMPLATE_PATH = "skin_template" 
    1213 
     14 
     15## Constants for slots castomization 
    1316SLOT_FORMING_LIST = ["blend_with_skin", "blend_with_site", "replace"] 
    1417DEFAULT_SLOT_FORMING = "blend_with_skin" 
    15  
    1618MAIN_COLUMN_LIST = ["left", "right", "both"] 
    1719DEFAULT_MAIN_COLUMN = "both" 
     20 
     21 
     22## Constants for Exporting objects 
     23IMPORTING_POLICY_LIST = ["only_new","backup","overwrite"] 
     24DEFAULT_IMPORTING_POLICY = "only_new" 
     25FORBIDDEN_EXP_PREFIXES = re.compile('^(portal_)') 
     26FORBIDDEN_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 
     34CSS_REG_PROPS = ['id', 'expression', 'enabled', 'cookable', 'cacheable' \ 
     35                ,'media', 'rel', 'title', 'rendering', 'compression'] 
     36JS_REG_PROPS = ['id', 'expression', 'enabled', 'cookable', 'cacheable' \ 
     37               ,'inline', 'compression'] 
  • qPloneSkinDump/trunk/i18n/qploneskindump-uk.po

    r502 r503  
    2525# 
    2626msgid "help_ZMISkinName" 
    27 msgstr "ведіть ім'я теки з ../portal_skins, з якої необхідно зкопіювати контент у ФС." 
    28  
    29 # 
    30 # <label class="ZMISkinName_title" i18n:translate="label_ZMISkinName">Source skin folder</label> 
     27msgstr "беріть ім'я теки з ../portal_skins, з якої необхідно зкопіювати контент у файлову систему (ФС)." 
     28 
     29# 
     30# <label class="ZMISkinName_title" i18n:translate="label_ZMISkinName">Source ZMI skin folder</label> 
    3131# 
    3232msgid "label_ZMISkinName" 
    33 msgstr "Джерельна тека шкіри:" 
     33msgstr "Джерельна ZMI тека шкіри:" 
    3434 
    3535# 
     
    3737# 
    3838msgid "help_ZMIBaseSkinName" 
    39 msgstr "ведіть назву шкіри, з якої необхідно взяти слої для створення нової шкіри." 
    40  
    41 # 
    42 # <label class="ZMIBaseSkinName_title" i18n:translate="label_ZMIBaseSkinName">Input ZMI Base Skin Name</label> 
     39msgstr "беріть назву шкіри, з якої необхідно взяти слої для створення нової шкіри." 
     40 
     41# 
     42# <label class="ZMIBaseSkinName_title" i18n:translate="label_ZMIBaseSkinName">ZMI base skin name</label> 
    4343# 
    4444msgid "label_ZMIBaseSkinName" 
    45 msgstr "ведіть iм'я Базової шкіри ZMI:" 
     45msgstr "беріть ім'я базової шкіри ZMI:" 
    4646 
    4747# 
     
    4949# 
    5050msgid "help_Erase" 
    51 msgstr "Відмітьте, якщо необхідно стерти контент з джерельної теки." 
     51msgstr "Відмітьте, якщо необхідно витерти контент з джерельної теки." 
    5252 
    5353# 
     
    5555# 
    5656msgid "label_Erace" 
    57 msgstr "терти:
     57msgstr "итерти
    5858 
    5959# 
     
    6767# 
    6868msgid "help_FSSkinDirectory" 
    69 msgstr "Уведіть ім'я шкіри для нового продукту.<br>Це ім'я в низькому регістрі буде використано як назва теки у шкірах та як назва слою.<br>Ім'я повинно починатись із літери, а далі може містити як літери, так і числа." 
     69msgstr "Уведіть ім'я шкіри для нового продукту.<br>Це ім'я в низькому регістрі буде використано як назва теки у шкірах та як назва слою.<br>Ім'я повинно починатись із літери, а далі може містити літери, числа та символи підкреслення (але він не допускається в кінці назви)." 
    7070 
    7171# 
     
    7979# 
    8080msgid "help_FSProductName" 
    81 msgstr "Уведіть назву нового продукту.<br>Ім'я овинно починатись із літери, а далі може містити як літери, так і числа." 
     81msgstr "Уведіть назву нового продукту.<br>Ім'я е може збігатись із іменами продуктів, що присутні у Products теці Plone інстансу.<br>Ім'я повинно починатись із літери, а далі може містити літери, числа та символи підкреслення (але він не допускається в кінці назви)." 
    8282 
    8383# 
     
    102102# <label i18n:translate="label_DoesCustomizeSlots">Do customize slots</label>  
    103103# 
    104 msgid "label_DoesCustomizeSlots
     104msgid "label_SlotsCustomizing
    105105msgstr "Налаштувати слоти" 
    106106 
     
    188188msgstr "Обидві" 
    189189 
     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# 
     198msgid "label_DoesExportObjects" 
     199msgstr "Експортування об'єктів з кореня порталу" 
     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# 
     204msgid "help_DoesExportObjects" 
     205msgstr "Відмічені нижче об'єкти будуть експортовані до нового ШКІРЯНОГО ПРОДУКТУ. Потім на інсталяції цього продукту обрані об'єкти будуть імпортовані до кореня порталу. Спосіб імпортування визначатиметься обраним методом." 
     206 
     207# 
     208# <label  i18n:translate="label_ImportPolicy">Import Policy</label> 
     209# 
     210msgid "label_ImportPolicy" 
     211msgstr "Метод імпортування" 
     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# 
     216msgid "help_ImportPolicy" 
     217msgstr "Оберіть *Метод імпортування* для генерованого ШКІРЯНОГО ПРОДУКТУ. *Метод імпортування* визначає поведінку в разі присутносі у корені порталу об'єктів із id(ідентифікатором) однаковим з імпортованими. 'Тільки нові' - імпортуються тільки неконфліктні об'єкти (однойменні ігноруються). 'Резервувати' - однойменні об'єкти з кореня порталу пересуваються до новоствореної back_[дата] теки. Усі об'єкти імпортуються до кореня порталу. 'Затерти' - всі однойменні об'єкти у корені порталу затираються імпортованими." 
     218 
     219# 
     220# <label class="default_import_policy" i18n:translate="" tal:content="i_policy_name"></label> 
     221# 
     222msgid "Only new" 
     223msgstr "Тільки нові" 
     224 
     225msgid "Backup" 
     226msgstr "Резервувавати" 
     227 
     228msgid "Overwrite" 
     229msgstr "Затерти" 
     230 
     231# 
     232# <label class="ExportingOjects_title" i18n:translate="label_ExportingOjects">Exporting objects</label> 
     233# 
     234msgid "label_ExportingOjects" 
     235msgstr "Об'єкти до експортування" 
     236 
     237# 
     238# <div i18n:translate="help_ExportingOjects" class="formHelp">Exporting object ids list. All selected objects will be exported to "&lt;Skin Product&gt;/import" directory and WILL BE IMPORTED to portal root on SkinProduct installation.</div> 
     239# 
     240msgid "help_ExportingOjects" 
     241msgstr "Список ідентифікаторів об'єктів. Усі відмічені об'єкти будуть експортовані до '&lt;тека шкірпродукту в ФС&gt;/import' теки і БУДУТЬ ІМПОРТОВАНІ до кореня порталу на встановленні ШКІРПРОДУКТУ." 
     242 
     243# 
     244# <label for="DoesExportResources" style="font-size: 110%" i18n:translate="label_DoesExportResources">Exporting portal resources</label> 
     245# 
     246msgid "label_DoesExportResources" 
     247msgstr "Експортування ресурсів порталу" 
     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# 
     252msgid "help_DoesExportResources" 
     253msgstr "Відмічені ресурси порталу, разом з усіма наборами властивостей, будуть екпортовані до ШКІРПРОДУКТУ із відповідного реєстру (CSS та|або Javascripts). Далі на встановленні ШКІРПРОДУКТУ відповідний реєстр буде налаштовано ідентично до вашого. Це гарантує, що вигляд і поведінка продукту будуть відповідати вашому задуму. Ви можете відкорегувати дані по експортованим ресурсам у config.py модулі ШКІРПРОДУКТУ. Ця опція застосовується тільки коли ваш продукт встановлюватиметься на Plone v2.1+." 
     254 
     255# 
     256# <label class="DumpCSSRegistry_title" i18n:translate="label_DumpCSSRegistry">Dump portal_CSS registry.</label> 
     257# 
     258msgid "label_DumpCSSRegistry" 
     259msgstr "Зтягнути portal_css реєстр." 
     260 
     261# 
     262# <label class="DumpJSRegistry_title" i18n:translate="label_DumpJSRegistry">Dump portal_javascripts registry.</label> 
     263# 
     264msgid "label_DumpJSRegistry" 
     265msgstr "Зтягнути portal_javascripts реєстр." 
     266 
     267 
     268 
     269 
     270 
     271 
     272 
     273 
     274 
    190275# 
    191276# <input class=context type="submit" name="form.button.form_submit" value="Save" i18n:attributes="label_save"/> 
    192277# 
    193 msgid "Save" 
    194 msgstr "Зписати" 
    195  
     278msgid "Generate" 
     279msgstr "Зенерувати" 
     280 
  • qPloneSkinDump/trunk/i18n/qploneskindump.pot

    r502 r503  
    2828 
    2929# 
    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> 
    3131# 
    3232msgid "label_ZMISkinName" 
    33 msgstr "Source skin folder:" 
     33msgstr "Source ZMI skin folder:" 
    3434 
    3535# 
     
    4040 
    4141# 
    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> 
    4343# 
    4444msgid "label_ZMIBaseSkinName" 
    45 msgstr "Input ZMI Base Skin Name:" 
     45msgstr "ZMI base skin name:" 
    4646 
    4747# 
     
    187187msgstr "Both" 
    188188 
    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
     198msgid "label_DoesExportObjects" 
     199msgstr "Exporting objects from portal root" 
     200 
     201
     202#  
     203
     204msgid "" 
     205msgstr "" 
     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
     210msgid "help_DoesExportObjects" 
     211msgstr "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
     216msgid "label_ImportPolicy" 
     217msgstr "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
     222msgid "help_ImportPolicy" 
     223msgstr "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
     228msgid "Only new" 
     229msgstr "Only new" 
     230 
     231msgid "Backup" 
     232msgstr "Backup" 
     233 
     234msgid "Overwrite" 
     235msgstr "Overwrite" 
     236 
     237
     238# <label class="ExportingOjects_title" i18n:translate="label_ExportingOjects">Exporting objects</label> 
     239
     240msgid "label_ExportingOjects" 
     241msgstr "Exporting objects" 
     242 
     243
     244# <div i18n:translate="help_ExportingOjects" class="formHelp">Exporting object ids list. All selected objects will be exported to "&lt;Skin Product&gt;/import" directory and WILL BE IMPORTED to portal root on SkinProduct installation.</div> 
     245
     246msgid "help_ExportingOjects" 
     247msgstr "Exporting object ids list. All selected objects will be exported to '&lt;Skin Product&gt;/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
     252msgid "label_DoesExportResources" 
     253msgstr "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
     258msgid "help_DoesExportResources" 
     259msgstr "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
     264msgid "label_DumpCSSRegistry" 
     265msgstr "Dump portal_css registry." 
     266 
     267
     268# <label class="DumpJSRegistry_title" i18n:translate="label_DumpJSRegistry">Dump portal_javascripts registry.</label> 
     269
     270msgid "label_DumpJSRegistry" 
     271msgstr "Dump portal_javascripts registry." 
     272 
     273 
     274
     275# <input class=context type="submit" name="form.button.form_submit" value="Generate" i18n:attributes="value"/> 
     276
     277msgid "Generate" 
     278msgstr "Generate" 
  • qPloneSkinDump/trunk/qPloneSkinDump.py

    r502 r503  
    1 from sys import stdout 
    2 import os, os.path 
    3 from App.config import getConfiguration 
     1import os, re 
     2from AccessControl import ModuleSecurityInfo 
    43from Products.CMFCore.utils import getToolByName 
    5 from AccessControl import ModuleSecurityInfo 
    64 
    7 from Write import writeProps, writeFileContent, writeObjectsMeta 
    85from config import * 
     6from utils import * 
     7from exportingObjects import exportObjects 
    98 
    109security = ModuleSecurityInfo( 'Products.qPloneSkinDump.qPloneSkinDump' ) 
    1110 
    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  
     11security.declarePublic('getExportingData') 
     12def 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 
    2725 
    2826security.declarePublic('getSlotsFormingList') 
    2927def 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]} 
    3830 
    3931security.declarePublic('getMainColumnList') 
    4032def 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]} 
    5035 
    5136security.declarePublic('isValidProductName') 
    5237def isValidProductName(product_name): 
    5338    """ 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)) 
    6241 
    63  
     42DIR_NAME_PATTERN = re.compile("^[a-zA-Z]+[a-zA-Z0-9_]*[a-zA-Z0-9]$") 
    6443security.declarePublic('isValidDirName') 
    6544def isValidDirName(dir_name): 
    6645    """ 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() 
    8448 
    8549security.declarePublic('createProduct') 
     
    9559                  right_slots=[],\ 
    9660                  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 ) 
    10273    dumpSkin(context, zmi_skin_name, subdir, fs_skin_directory.lower(), 
    10374             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) 
    27676    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.isfile 
    283     isdir = os.path.isdir 
    284     join = os.path.join 
    285     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                 continue 
    292             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     return 
    30777 
    30878security.apply(globals()) 
  • qPloneSkinDump/trunk/skin_template/Extensions/Install.py

    r502 r503  
     1import string 
     2from StringIO import StringIO 
     3from zLOG import LOG, INFO 
    14from Products.CMFCore.utils import getToolByName 
    2 from StringIO import StringIO 
    3 from Products.CMFCore.DirectoryView import addDirectoryViews 
    4 import string 
     5from Products.%(SKIN_PRODUCT_NAME)s.config import * 
     6from Products.%(SKIN_PRODUCT_NAME)s.Extensions.utils import * 
    57 
    6  
    7 def install(self): 
    8     out=StringIO() 
    9     # Checking base condition for installation 
    10   &