Commit cffc1834 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make cmf_activity_sql_connection if necessary.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2007 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4a7b5cc8
......@@ -49,18 +49,22 @@ def manage_addERP5Site(self, id, title='ERP5', description='',
email_from_address='postmaster@localhost',
email_from_name='Portal Administrator',
validate_email=0,
sql_connection_type='Z MySQL Database Connection',
sql_connection_string='test test',
erp5_sql_connection_type='Z MySQL Database Connection',
erp5_sql_connection_string='test test',
cmf_activity_sql_connection_type='Z MySQL Database Connection',
cmf_activity_sql_connection_string='test test',
RESPONSE=None):
'''
Adds a portal instance.
'''
LOG('manage_addERP5Site, create_activities',0,create_activities)
LOG('manage_addERP5Site, create_activities==1',0,create_activities==1)
#LOG('manage_addERP5Site, create_activities',0,create_activities)
#LOG('manage_addERP5Site, create_activities==1',0,create_activities==1)
gen = ERP5Generator()
from string import strip
id = strip(id)
p = gen.create(self, id, create_userfolder,sql_connection_type,sql_connection_string,
p = gen.create(self, id, create_userfolder,
erp5_sql_connection_type,erp5_sql_connection_string,
cmf_activity_sql_connection_type,cmf_activity_sql_connection_string,
create_activities=create_activities)
gen.setupDefaultProperties(p, title, description,
email_from_address, email_from_name,
......@@ -464,15 +468,20 @@ class ERP5Generator(PortalGenerator):
product_path = package_home(globals())
return os.path.join(product_path, 'bootstrap')
def create(self, parent, id, create_userfolder, sql_connection_type, sql_connection_string,**kw):
def create(self, parent, id, create_userfolder,
erp5_sql_connection_type, erp5_sql_connection_string,
cmf_activity_sql_connection_type,cmf_activity_sql_connection_string,
**kw):
LOG('setupTools, create',0,kw)
id = str(id)
portal = self.klass(id=id)
parent._setObject(id, portal)
# Return the fully wrapped object.
p = parent.this()._getOb(id)
p._setProperty('sql_connection_type', sql_connection_type, 'string')
p._setProperty('sql_connection_string', sql_connection_string, 'string')
p._setProperty('erp5_sql_connection_type', erp5_sql_connection_type, 'string')
p._setProperty('erp5_sql_connection_string', erp5_sql_connection_string, 'string')
p._setProperty('cmf_activity_sql_connection_type', cmf_activity_sql_connection_type, 'string')
p._setProperty('cmf_activity_sql_connection_string', cmf_activity_sql_connection_string, 'string')
p._setProperty('management_page_charset', 'UTF-8', 'string') # XXX hardcoded charset
self.setup(p, create_userfolder,**kw)
return p
......@@ -509,10 +518,15 @@ class ERP5Generator(PortalGenerator):
p._delObject('portal_catalog')
addTool('ERP5 Catalog', None)
# Add Default SQL connection
if p.sql_connection_type == 'Z MySQL Database Connection':
if p.erp5_sql_connection_type == 'Z MySQL Database Connection':
addSQLConnection = p.manage_addProduct['ZSQLMethods'].manage_addZMySQLConnection
addSQLConnection('erp5_sql_connection', 'ERP5 SQL Server Connection', p.sql_connection_string)
elif p.sql_connection_type == 'Z Gadfly':
addSQLConnection('erp5_sql_connection', 'ERP5 SQL Server Connection', p.erp5_sql_connection_string)
elif p.erp5_sql_connection_type == 'Z Gadfly':
pass
if p.cmf_activity_sql_connection_type == 'Z MySQL Database Connection':
addSQLConnection = p.manage_addProduct['ZSQLMethods'].manage_addZMySQLConnection
addSQLConnection('cmf_activity_sql_connection', 'CMF Activity SQL Server Connection', p.cmf_activity_sql_connection_string)
elif p.cmf_activity_sql_connection_type == 'Z Gadfly':
pass
# Create default methods in Catalog XXX
portal_catalog = getToolByName(p, 'portal_catalog')
......@@ -766,4 +780,4 @@ class ERP5Generator(PortalGenerator):
template_tool[id].install()
# Patch the standard method
CMFSite.getPhysicalPath = ERP5Site.getPhysicalPath
CMFSite.getPhysicalPath = ERP5Site.getPhysicalPath
\ No newline at end of file
......@@ -84,11 +84,11 @@
<tr>
<td align="left" valign="top">
<div class="form-label">
Database Connection Type
ERP5 Database Connection Type
</div>
</td>
<td align="left" valign="top">
<select name="sql_connection_type">
<select name="erp5_sql_connection_type">
<option value="Z MySQL Database Connection" selected>Z MySQL Database Connection</option>
</select>
</td>
......@@ -97,11 +97,35 @@
<tr>
<td align="left" valign="top">
<div class="form-label">
Database Connection String
ERP5 Database Connection String
</div>
</td>
<td align="left" valign="top">
<input type="text" name="sql_connection_string" size="40" value="test test" />
<input type="text" name="erp5_sql_connection_string" size="40" value="test test" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
CMF Activity Database Connection Type
</div>
</td>
<td align="left" valign="top">
<select name="cmf_activity_sql_connection_type">
<option value="Z MySQL Database Connection" selected>Z MySQL Database Connection</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
CMF Activity Database Connection String
</div>
</td>
<td align="left" valign="top">
<input type="text" name="cmf_activity_sql_connection_string" size="40" value="test test" />
</td>
</tr>
......
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