Commit 3484454e authored by Sebastien Robin's avatar Sebastien Robin

Initial revision

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@226 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dae22c5b
.AppleDouble
*.pyc
# (C) Copyright 2004 Nexedi SARL <http://nexedi.com>
# Authors: Sebastien Robin <seb@nexedi.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# 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.
#
from Products.CPSCore.ProxyBase import ProxyBase
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Globals import InitializeClass
from Products.ERP5Type.Base import Base
from Products.CMFCore.CMFCorePermissions import View
from Products.CMFCore.CMFCorePermissions import ModifyPortalContent
from Products.CMFCore.CMFCorePermissions import ViewManagementScreens
from zLOG import LOG
# First we should make ProxyBase a subclass of Base
# XXX doesn't works at all
#ProxyBase.__bases__ += (ERP5Base,)
#ProxyDocument.__bases__ += (ERP5Base,)
class PatchedProxyBase(ProxyBase):
security = ClassSecurityInfo()
# Object attributes update method
security.declarePrivate( '_edit' )
def _edit(self, REQUEST=None, force_update = 0, **kw):
"""
call also the proxytool
"""
Base._edit(self, REQUEST=REQUEST,force_update=force_update, **kw)
px_tool= getToolByName(self,'portal_proxies')
utool = getToolByName(self, 'portal_url')
rpath = utool.getRelativeUrl(self)
px_tool._modifyProxy(self,rpath)
def _propertyMap(self):
"""
Returns fake property sheet
"""
property_sheet = []
#property_sheet += self._properties
property_sheet += [
{
'id' : 'docid',
'type' : 'string'
},
# { 'id' : 'workflow_history', # XXX Added for ERP5 SyncML
# 'type' : 'pickle'
# },
{
'id' : 'default_language',
'type' : 'string'
},
{
'id' : 'sync_language_revisions', # XXX we have to manage dict type
'type' : 'dict'
}
]
return tuple(property_sheet + list(getattr(self, '_local_properties', ())))
security.declareProtected(View, 'getSyncLanguageRevisions')
def getSyncLanguageRevisions(self):
"""Get the mapping of language -> revision."""
return self._language_revs.copy()
security.declareProtected(View, 'setSyncLanguageRevisions')
def setSyncLanguageRevisions(self, dict):
"""Set the mapping of language -> revision."""
for lang in dict.keys():
self.setLanguageRevision(lang,dict[lang])
security.declareProtected(View, 'getSyncRepoHistory')
def getSyncRepoHistory(self):
"""Get the mapping of language -> revision."""
return self._language_revs.copy()
security.declareProtected(View, 'setSyncRepoHistory')
def setSyncRepoHistory(self, dict):
"""Set the mapping of language -> revision."""
repotool = getToolByName(self, 'portal_repository')
#repotool.
for lang in dict.keys():
self.setLanguageRevision(lang,dict[lang])
ProxyBase.getPath = Base.getPath
ProxyBase.getProperty = Base.getProperty
ProxyBase._edit = PatchedProxyBase._edit
ProxyBase._propertyMap = PatchedProxyBase._propertyMap
ProxyBase.getSyncLanguageRevisions = PatchedProxyBase.getSyncLanguageRevisions
ProxyBase.setSyncLanguageRevisions = PatchedProxyBase.setSyncLanguageRevisions
ProxyBase.getSyncRepoHistory = PatchedProxyBase.getSyncRepoHistory
ProxyBase.setSyncRepoHistory = PatchedProxyBase.setSyncRepoHistory
# (C) Copyright 2004 Nexedi SARL <http://nexedi.com>
# Authors: Sebastien Robin <seb@nexedi.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# 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.
#
from Products.CPSDefault.Folder import Folder
from Products.ERP5Type.Base import Base
Folder._setProperty = Base._setProperty
Folder.setProperty = Base.setProperty
Folder.getProperty = Base.getProperty
Folder._edit = Base._edit
\ No newline at end of file
# (C) Copyright 2004 Nexedi SARL <http://nexedi.com>
# Authors: Sebastien Robin <seb@nexedi.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# 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.
#
from Products.CPSDocument.CPSDocument import CPSDocument
from Products.CPSSchemas.BasicFields import CPSImageField, CPSFileField, CPSDateTimeField
from Products.ERP5Type.Base import Base
class PatchedCPSDocument(CPSDocument):
def _propertyMap(self):
"""
Returns fake property sheet
"""
property_sheet = []
for schema in self.getTypeInfo().getSchemas():
for field in schema.objectValues():
#LOG('testjp',0,'field: %s' % str(field))
f_type = ''
for p in field._properties:
if p['id'] == 'default':
f_type = p['type']
if isinstance(field,CPSImageField):
#f_type = 'image'
f_type = 'pickle'
if isinstance(field,CPSDateTimeField):
f_type = 'date'
if isinstance(field,CPSFileField):
#f_type = 'file'
f_type = 'pickle'
if isinstance(field,CPSDocument):
#f_type = 'document'
f_type = 'pickle'
prop_id = schema.getIdUnprefixed(field.id)
if prop_id in ('file_text','content','attachedFile',
'attachedFile_html','attachedFile_text', 'content'):
f_type = 'pickle' # this should be string, but this strings
# do so bad xml
#if not (prop_id in ('file_text','content','attachedFile','attachedFile_html','attachedFile_text')):
#if not (prop_id in ('content',)):
if 1:
property_sheet.append(
{
'id' : prop_id,
'type' : f_type
}
)
return tuple(property_sheet + list(getattr(self, '_local_properties', ())))
CPSDocument._propertyMap = PatchedCPSDocument._propertyMap
CPSDocument.getProperty = Base.getProperty
CPSDocument.setProperty = Base.setProperty
# (C) Copyright 2004 Nexedi SARL <http://nexedi.com>
# Authors: Sebastien Robin <seb@nexedi.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# 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.
#
import CPSCorePatch, CPSDocumentPatch, CPSDefaultPatch
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