<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <tuple>
          <string>Products.PythonScripts.PythonScript</string>
          <string>PythonScript</string>
        </tuple>
        <none/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Python_magic</string> </key>
            <value> <string encoding="base64">O/INCg==</string> </value>
        </item>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>__ac_local_roles__</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string encoding="cdata"><![CDATA[

from Products.Formulator.Errors import ValidationError, FormValidationError\n
\n
request=context.REQUEST\n
\n
# TODO\n
#   - Allow in the module only the new document, we must activate the filter\n
#   - handle an optionnal "description" parameter\n
#   - set the form action to "Base_edit"\n
#   - print : pdf\n
#   - export : xml\n
#   - report : last modified\n
#   - security : 5A\n
\n
\n
portal = context.getPortalObject()\n
portal_types = portal.portal_types\n
object_portal_type_id = object_portal_type\n
\n
# Create a new portal_type for the module\n
context.portal_types.manage_addTypeInformation( \'ERP5 Type Information\'\n
                                              , typeinfo_name = \'ERP5Type: ERP5 Folder\'\n
                                              , id            = module_portal_type\n
                                              )\n
module_portal_type_value = context.portal_types[module_portal_type]\n
# Set allowed content types\n
# Following is not permitted in a python script\n
# context.portal_types[module_portal_type_value].allowed_content_types = (object_portal_type_id, )\n
# module_portal_type_value.edit( filter_content_types  = 1\n
#                              , allowed_content_types = (object_portal_type_id, )\n
#                              )\n
action_list = module_portal_type_value.listActions()\n
module_portal_type_value.deleteActions(selections=range(0,len(action_list)))\n
# Parameters to addAction : id, name, action, condition, permission, category, visible=1, REQUEST=None\n
module_portal_type_value.addAction( "view"\n
                                  , "View"\n
                                  , "string:${object_url}/Folder_viewContentList"\n
                                  , ""\n
                                  , "View"\n
                                  , "object_view"\n
                                  )\n
module_portal_type_value.addAction( "sort_on"\n
                                  , "Sort"\n
                                  , "string:${object_url}/Folder_viewSortOnDialog"\n
                                  , ""\n
                                  , "View"\n
                                  , "object_sort"\n
                                  )\n
module_portal_type_value.addAction( "list_ui"\n
                                  , "Modify UI"\n
                                  , "string:${object_url}/Base_viewUIDialog"\n
                                  , ""\n
                                  , "View"\n
                                  , "object_ui"\n
                                  )\n
module_portal_type_value.addAction( "print_pdf"\n
                                  , "Print"\n
                                  , "string:${object_url}/Base_printPdf"\n
                                  , ""\n
                                  , "View"\n
                                  , "object_print"\n
                                  )\n
# Create the skin directory if does not exist yet\n
portal_skins_folder_name = portal_skins_folder\n
portal_skins = portal.portal_skins\n
if not portal_skins_folder_name in portal.portal_skins.objectIds():\n
  portal_skins.manage_addFolder(portal_skins_folder_name)\n
skin_folder = portal.portal_skins[portal_skins_folder_name]\n
# Add new folders into skin paths.\n
for skin_name, selection in portal_skins.getSkinPaths():\n
  selection = selection.split(\',\')\n
  if portal_skins_folder_name not in selection:\n
    new_selection = [portal_skins_folder_name,]\n
    new_selection.extend(selection)\n
    portal_skins.manage_skinLayers( skinpath = tuple(new_selection)\n
                                  , skinname = skin_name\n
                                  , add_skin = 1\n
                                  )\n
\n
# Create the default ERP5 Form in order to view the object\n
form_view_id = object_portal_type_id.replace(\' \',\'\') + \'_view\'\n
factory = skin_folder.manage_addProduct[\'ERP5Form\']\n
factory.addERP5Form( form_view_id\n
                   , title  = object_title\n
                   )\n
form_view_object = skin_folder[form_view_id]\n
form_view_object.rename_group(\'Default\', \'left\')\n
default_groups = [\'right\', \'center\', \'bottom\', \'hidden\']\n
for group in default_groups:\n
  form_view_object.add_group(group)\n
\n
# Then add the portal_type corresponding to the new object\n
portal_types.manage_addTypeInformation(\'ERP5 Type Information\'\n
                                      , typeinfo_name = \'ERP5Type: ERP5 Document\'\n
                                      , id            = object_portal_type_id\n
                                      )\n
object_portal_type_value = portal_types[object_portal_type_id]\n
# Set default actions\n
action_list = object_portal_type_value.listActions()\n
object_portal_type_value.deleteActions(selections=range(0,len(action_list)))\n
# parameters to addAction : id, name, action, condition, permission, category, visible=1, REQUEST=None\n
object_portal_type_value.addAction( "view"\n
                                  , "View"\n
                                  , "string:${object_url}/%s" % form_view_id\n
                                  , ""\n
                                  , "View"\n
                                  , "object_view"\n
                                  )\n
object_portal_type_value.addAction( "history"\n
                                  , "History"\n
                                  , "string:${object_url}/Base_viewHistory"\n
                                  , ""\n
                                  , "View"\n
                                  , "object_view"\n
                                  )\n
object_portal_type_value.addAction( "metadata"\n
                                  , "Metadata"\n
                                  , "string:${object_url}/Base_viewMetadata"\n
                                  , ""\n
                                  , "Manage properties"\n
                                  , "object_view"\n
                                  )\n
object_portal_type_value.addAction( "print_pdf"\n
                                  , "Print"\n
                                  , "string:${object_url}/Base_printPdf"\n
                                  , ""\n
                                  , "View"\n
                                  , "object_print"\n
                                  )\n
# Finally add the module to the site\n
portal.newContent( portal_type = module_portal_type\n
                 , id          = module_id\n
                 , title       = module_title\n
                 )\n
\n
if not selection_index:\n
  redirect_url = \'%s/%s?%s\' % ( context.absolute_url()\n
                              , form_id\n
                              , \'portal_status_message=Module+Created.\'\n
                              )\n
else:\n
  redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&%s\' % ( context.absolute_url()\n
                          , form_id\n
                          , selection_index\n
                          , selection_name\n
                          , \'portal_status_message=Module+Created.\'\n
                          )\n
\n
\n
\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value> <string>Script (Python):/nexedi/portal_skins/erp5_core/ERP5Site_createModule</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>form_id, module_portal_type, portal_skins_folder, object_portal_type, object_title, module_id, module_title, selection_index=0, selection_name=\'\'</string> </value>
        </item>
        <item>
            <key> <string>errors</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
        <item>
            <key> <string>func_code</string> </key>
            <value>
              <object>
                <klass>
                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>co_argcount</string> </key>
                        <value> <int>9</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>form_id</string>
                            <string>module_portal_type</string>
                            <string>portal_skins_folder</string>
                            <string>object_portal_type</string>
                            <string>object_title</string>
                            <string>module_id</string>
                            <string>module_title</string>
                            <string>selection_index</string>
                            <string>selection_name</string>
                            <string>Products.Formulator.Errors</string>
                            <string>ValidationError</string>
                            <string>FormValidationError</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>request</string>
                            <string>portal</string>
                            <string>portal_types</string>
                            <string>object_portal_type_id</string>
                            <string>_getitem_</string>
                            <string>module_portal_type_value</string>
                            <string>action_list</string>
                            <string>range</string>
                            <string>len</string>
                            <string>portal_skins_folder_name</string>
                            <string>portal_skins</string>
                            <string>skin_folder</string>
                            <string>_getiter_</string>
                            <string>skin_name</string>
                            <string>selection</string>
                            <string>new_selection</string>
                            <string>tuple</string>
                            <string>form_view_id</string>
                            <string>factory</string>
                            <string>form_view_object</string>
                            <string>default_groups</string>
                            <string>group</string>
                            <string>object_portal_type_value</string>
                            <string>redirect_url</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <int>0</int>
                <string></string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>ERP5Site_createModule</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
