Commit 35763182 authored by Romain Courteaud's avatar Romain Courteaud

Add license header.

Update layout.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19467 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f15c6df1
##############################################################################
#
# Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
def ERP5Site_createModuleScribus(self,
module_id=None,
module_portal_type=None,
......@@ -18,7 +45,6 @@ def ERP5Site_createModuleScribus(self,
PDFForm file"""
context = self
# IMPORTING MODULES
from Products.Formulator.Errors import ValidationError, FormValidationError
from Products.ERP5Form.ScribusUtils import ScribusParser
......@@ -87,7 +113,7 @@ def ERP5Site_createModuleScribus(self,
# run the factory to create the new object (ERP5Form)
ManageFiles.setERP5Form(factory,
str(object_names['view_list']),
str(object_title + ' Module View'))
'%s Module View' % object_title)
# manage the module form and set up the list inside
# update form properties with generic module values
......@@ -108,7 +134,6 @@ def ERP5Site_createModuleScribus(self,
global_properties = ScribusParser.initFieldDict()
# PARSER VARIABLES DECLARATION
# the following variable will recover the final CSS
# file's content object (string) before saving it
......@@ -118,7 +143,7 @@ def ERP5Site_createModuleScribus(self,
properties_css_dict = {}
# init page number
page_number_int = 0
scale_factor=0
scale_factor = 0
# import scribus file
# take the input ScribusFile and read the content
xml_string = ScribusParser.getContentFile(import_scribus_file)
......@@ -141,7 +166,8 @@ def ERP5Site_createModuleScribus(self,
# unnecessary page_objects off.
#import pdb
#pdb.set_trace()
(text_field_list,keep_page,page_gap) = ScribusParser.getXmlObjectsPropertiesDict(xml_string)
(text_field_list, keep_page, page_gap) = \
ScribusParser.getXmlObjectsPropertiesDict(xml_string)
print " createmodule < ScribusParser.getXmlObjectPropertiesDict\n"
......@@ -150,15 +176,14 @@ def ERP5Site_createModuleScribus(self,
# to extract all the usefull properties and organize elements. Then check
# attributes to get properties values.
# This represents the main process of the script.
(widget_properties) = ScribusParser.getPropertiesConversionDict(text_field_list)
widget_properties = \
ScribusParser.getPropertiesConversionDict(text_field_list)
print " createmodule < ScribusParser.getPropertiesConversionDict\n"
# testing if final rendering is PDF-like
if option_html == 1 :
if option_html == 1:
print " createmodule > generating background"
## BACKGROUND GENERATOR
# extract background pictures from the PDF document, convert them in the right
......@@ -166,8 +191,8 @@ def ERP5Site_createModuleScribus(self,
# used only with option_html == 1
# recover image_size
image_size = ManageFiles.setBackgroundPictures(import_pdf_file,
object_names,skin_folder,desired_height,desired_width,resolution,
background_format)
object_names, skin_folder, desired_height, desired_width,
resolution, background_format)
page_width, page_height = image_size
......@@ -204,11 +229,11 @@ def ERP5Site_createModuleScribus(self,
# get CSS class properties relative to the actual page
# (background picture position, picture size, etc.)
# and add them to the css dict
width_groups,height_groups = ManageFiles.getPageattributes(
width_groups, height_groups = ManageFiles.getPageattributes(
global_properties,
import_pdf_file)
properties_css_dict, properties_page = \
ManageCSS.setPageProperties( properties_css_dict,
ManageCSS.setPageProperties(properties_css_dict,
page_iterator,
page_id,
page_height,
......@@ -254,16 +279,14 @@ def ERP5Site_createModuleScribus(self,
# add last properties to css dict, including implementation
# of a n+1 page to prevent bug when rendering under Konqueror
ManageCSS.setFinalProperties(properties_css_dict,page_height,
ManageCSS.setFinalProperties(properties_css_dict, page_height,
space_between_pages)
# generate output string from dict
form_css_content = ManageCSS.generateOutputContent(properties_css_dict)
# save CSS string content into ERP5
ManageFiles.setCSSFile(factory,object_names['css'],form_css_content)
ManageFiles.setCSSFile(factory, object_names['css'], form_css_content)
# CREATING OBJECT FORM AND MANAGING GROUPS
......@@ -305,7 +328,7 @@ def ERP5Site_createModuleScribus(self,
skin_folder,
object_names,
object_title,
pdf_file = import_pdf_file
pdf_file=import_pdf_file
)
print " createmodule < PDF settings managed\n"
......@@ -330,8 +353,6 @@ def ERP5Site_createModuleScribus(self,
print " createmodule < PropertySheet and Document imported\n"
# OBJECT PORTAL TYPE
# create PortalType for the object
ManageModule.setObjectPortalType(portal_types,
......@@ -341,7 +362,6 @@ def ERP5Site_createModuleScribus(self,
)
# Finally add the module to the site
ManageModule.registerModule(portal,
module_id,
......@@ -352,15 +372,15 @@ def ERP5Site_createModuleScribus(self,
# manage redirection URL
if not selection_index:
redirect_url = '%s/view?%s' % ( portal.absolute_url()
, 'portal_status_message=Module+Created.'
redirect_url = '%s/view?%s' % (portal.absolute_url(),
'portal_status_message=Module+Created.'
)
else:
redirect_url = '%s/view?selection_index=%s&selection_name=%s&%s' % (
portal.absolute_url()
, selection_index
, selection_name
, 'portal_status_message=Module+Created.'
portal.absolute_url(),
selection_index,
selection_name,
'portal_status_message=Module+Created.'
)
# redirect
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment