Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
3167be81
Commit
3167be81
authored
Jul 15, 2016
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_catalog: Add dtml file for adding ERP5 SQL Methods
parent
c5b2d827
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
8 deletions
+111
-8
product/ERP5/Document/SQLMethod.py
product/ERP5/Document/SQLMethod.py
+7
-8
product/ERP5/dtml/addSQLMethod.dtml
product/ERP5/dtml/addSQLMethod.dtml
+104
-0
No files found.
product/ERP5/Document/SQLMethod.py
View file @
3167be81
...
@@ -28,23 +28,22 @@
...
@@ -28,23 +28,22 @@
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type.Globals
import
DTMLFile
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
App.special_dtml
import
HTMLFile
from
App.special_dtml
import
HTMLFile
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.PythonScripts.PythonScript
import
\
from
Products.PythonScripts.PythonScript
import
\
PythonScript
as
ZopePythonScript
PythonScript
as
ZopePythonScript
from
Products.ZSQLMethods.SQL
import
SQL
as
ZSQL
from
Products.ZSQLMethods.SQL
import
SQL
as
ZSQL
from
Products.ZSQLMethods.SQL
import
manage_addZSQLMethodForm
# Migration function
# Migration function
def
migrateSQLMethodToERP5Object
(
self
,
id
,
title
=
''
):
def
migrateSQLMethodToERP5Object
(
self
,
id
,
title
=
''
):
pass
pass
manage_addSQLMethodForm
=
manage_addZSQLMethodForm
manage_addSQLMethodForm
=
DTMLFile
(
'../dtml/addSQLMethod.dtml'
,
globals
())
# New ZSQLMethod addition function
# New ZSQLMethod addition function
def
addSQLMethod
(
self
,
id
,
title
=
''
,
def
manage_
addSQLMethod
(
self
,
id
,
title
=
''
,
REQUEST
=
None
,
REQUEST
=
None
,
*
args
,
*
args
,
**
kw
):
**
kw
):
...
@@ -73,8 +72,10 @@ class SQLMethod(XMLObject, ZSQL):
...
@@ -73,8 +72,10 @@ class SQLMethod(XMLObject, ZSQL):
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
constructors
=
(
manage_addSQLMethodForm
,
addSQLMethod
)
# Add constructor methods
#View content list, Force /view, Standart option in python scripts
constructors
=
(
manage_addSQLMethodForm
,
manage_addSQLMethod
)
# View content list, Force /view, Standart option in python scripts
manage_options
=
(
XMLObject
.
manage_options
[
0
],
manage_options
=
(
XMLObject
.
manage_options
[
0
],
{
'icon'
:
''
,
'label'
:
'View'
,
'action'
:
'view'
})
\
{
'icon'
:
''
,
'label'
:
'View'
,
'action'
:
'view'
})
\
+
ZSQL
.
manage_options
+
ZSQL
.
manage_options
...
@@ -93,5 +94,3 @@ class SQLMethod(XMLObject, ZSQL):
...
@@ -93,5 +94,3 @@ class SQLMethod(XMLObject, ZSQL):
"""
"""
XMLObject
.
__init__
(
self
,
*
args
,
**
kw
)
XMLObject
.
__init__
(
self
,
*
args
,
**
kw
)
ZSQL
.
__init__
(
self
,
*
args
,
**
kw
)
ZSQL
.
__init__
(
self
,
*
args
,
**
kw
)
#InitializeClass(SQLMethod)
\ No newline at end of file
product/ERP5/dtml/addSQLMethod.dtml
0 → 100644
View file @
3167be81
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Add ERP5 SQL Method',
help_product='SQLMethods',
)">
<dtml-if SQLConnectionIDs>
<p class="form-help">
A SQL Method allows you to access a SQL database. For more information see
the <a href="http://www.zope.org/Documentation/Guides/ZSQL">Z SQL Methods
User's Guide</a>.
</p>
<p class="form-help">
In the form below <EM>connection id</EM> is the name of the SQL Database
Connection to use. <EM>Arguments</EM> is a list of variables which the
SQL Method accepts. <EM>Query template</EM> is a template of the SQL
statement which the SQL Method will execute.
</p>
<form action="manage_addSQLMethod" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" value="" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Connection Id
</div>
</td>
<td align="left" valign="top">
<div class="form-element">
<select name="connection_id">
<dtml-in SQLConnectionIDs>
<option value="&dtml-sequence-item;">
&dtml-sequence-key;</option>
</dtml-in>
</select>
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
Arguments
</div>
</td>
<td align="left" valign="top">
<textarea name="arguments" cols="40" rows="4"></textarea>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">
<span class="form-label">Query Template</span>
<br />
<div style="width: 100%;">
<textarea style="width: 100%;" name="template:text" rows="9" cols="60"
wrap="off">select * from data</textarea></div>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="2">
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value=" Add " />
<input class="form-element" type="submit" name="submit"
value=" Add and Edit " />
<input class="form-element" type="submit" name="submit"
value=" Add and Test " />
</div>
</td>
</tr>
</table>
</form>
<dtml-else>
<p class="form-text">
There are no SQL database connections. You need to add a Zope
SQL database connection before you can create a Zope SQL Method.
</p>
</dtml-if>
<dtml-var manage_page_footer>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment