Commit 9cb8712d authored by Jim Fulton's avatar Jim Fulton

up to date with product and security layout

parent bbef28ee
...@@ -7,25 +7,25 @@ domain-specific customization of web environments. ...@@ -7,25 +7,25 @@ domain-specific customization of web environments.
from Acquisition import Implicit from Acquisition import Implicit
from Globals import Persistent, HTMLFile, MessageDialog from Globals import Persistent, HTMLFile, MessageDialog
import OFS.SimpleItem import OFS.SimpleItem, os
from string import split, join from string import split, join
import AccessControl.Role import AccessControl.Role
braindir=SOFTWARE_HOME+'/Extensions' braindir=SOFTWARE_HOME+'/Extensions'
modules={} modules={}
addForm=HTMLFile('ExternalMethod/methodAdd') addForm=HTMLFile('methodAdd', globals())
def add(self, id, title, external_name, acl_type='A',acl_roles=[], REQUEST=None): def add(self, id, title, external_name, REQUEST=None):
"""Add an external method to a folder""" """Add an external method to a folder"""
names=split(external_name,'.') names=split(external_name,'.')
module, function = join(names[:-1],'.'), names[-1] module, function = join(names[:-1],'.'), names[-1]
i=ExternalMethod(id,title,module,function) i=ExternalMethod(id,title,module,function)
i._setRoles(acl_type,acl_roles)
self._setObject(id,i) self._setObject(id,i)
return self.manage_main(self,REQUEST) return self.manage_main(self,REQUEST)
class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleManager): class ExternalMethod(OFS.SimpleItem.Item, Persistent,
AccessControl.Role.RoleManager):
"""An external method is a web-callable function that encapsulates """An external method is a web-callable function that encapsulates
an external function.""" an external function."""
...@@ -33,6 +33,17 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleMan ...@@ -33,6 +33,17 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleMan
icon='misc_/ExternalMethod/function_icon' icon='misc_/ExternalMethod/function_icon'
func_defaults=() func_defaults=()
func_code=None func_code=None
manage_options=(
{'icon':icon, 'label':'Properties',
'action':'manage_main', 'target':'manage_main'},
{'icon':icon,
'label':'Try It',
'action':'', 'target':'manage_main'},
{'icon':'AccessControl/AccessControl_icon.gif',
'label':'Access Control',
'action':'manage_rolesForm', 'target':'manage_main'},
)
def __init__(self, id='', title='', module='', function=''): def __init__(self, id='', title='', module='', function=''):
if id: if id:
...@@ -43,9 +54,8 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleMan ...@@ -43,9 +54,8 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleMan
self.getFunction() self.getFunction()
self._p_atime=1 self._p_atime=1
manage=HTMLFile('ExternalMethod/methodEdit') manage_main=HTMLFile('methodEdit', globals())
def manage_edit(self, title, external_name, acl_type='A', acl_roles=[], def manage_edit(self, title, REQUEST=None):
REQUEST=None):
"Change the external method" "Change the external method"
self.title=title self.title=title
names=split(external_name,'.') names=split(external_name,'.')
...@@ -53,7 +63,6 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleMan ...@@ -53,7 +63,6 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, AccessControl.Role.RoleMan
self._module=module self._module=module
self._function=function self._function=function
self.getFunction() self.getFunction()
self._setRoles(acl_type,acl_roles)
if REQUEST: return MessageDialog( if REQUEST: return MessageDialog(
title ='Changed %s' % self.id, title ='Changed %s' % self.id,
message='%s has been updated' % self.id, message='%s has been updated' % self.id,
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
# #
############################################################################## ##############################################################################
__doc__='''External Method Product Initialization __doc__='''External Method Product Initialization
$Id: __init__.py,v 1.3 1997/12/22 15:18:13 jeffrey Exp $''' $Id: __init__.py,v 1.4 1997/12/23 22:15:34 jim Exp $'''
__version__='$Revision: 1.3 $'[11:-2] __version__='$Revision: 1.4 $'[11:-2]
import ExternalMethod import ExternalMethod
from ImageFile import ImageFile from ImageFile import ImageFile
...@@ -23,13 +23,17 @@ methods={ ...@@ -23,13 +23,17 @@ methods={
'manage_addExternalMethod': ExternalMethod.add, 'manage_addExternalMethod': ExternalMethod.add,
} }
misc_={'function_icon': ImageFile('function.gif', globals())} misc_={'function_icon':
ImageFile('www/function.gif', globals())}
############################################################################## ##############################################################################
# #
# $Log: __init__.py,v $ # $Log: __init__.py,v $
# Revision 1.4 1997/12/23 22:15:34 jim
# up to date with product and security layout
#
# Revision 1.3 1997/12/22 15:18:13 jeffrey # Revision 1.3 1997/12/22 15:18:13 jeffrey
# typo fix # typo fix
# #
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<TITLE>New External Method</TITLE> <TITLE>New External Method</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<h2>New External Method</h2> <h2>New External Method</h2>
<FORM ACTION="manage_addExternalMethod" METHOD="POST"> <FORM ACTION="manage_addExternalMethod" METHOD="POST">
...@@ -15,7 +16,6 @@ ...@@ -15,7 +16,6 @@
<TD ALIGN="LEFT" VALIGN="TOP"><B>Title</B></TD> <TD ALIGN="LEFT" VALIGN="TOP"><B>Title</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="title" SIZE="50"></TD> <TD ALIGN="LEFT" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="title" SIZE="50"></TD>
</TR> </TR>
<!--#var smallRolesWidget-->
<TR> <TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>External name</B></TD> <TD ALIGN="LEFT" VALIGN="TOP"><B>External name</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP"> <TD ALIGN="LEFT" VALIGN="TOP">
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
<TITLE>Edit <!--#var title_or_id--></TITLE> <TITLE>Edit <!--#var title_or_id--></TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B"> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<!--#var manage_tabs-->
<h2>Edit <!--#var title_or_id--></h2> <h2>Edit <!--#var title_or_id--></h2>
<FORM ACTION="manage_edit" METHOD="POST"> <FORM ACTION="manage_edit" METHOD="POST">
...@@ -17,7 +19,6 @@ ...@@ -17,7 +19,6 @@
<INPUT TYPE="TEXT" NAME="title" SIZE="50" VALUE="<!--#var title-->"> <INPUT TYPE="TEXT" NAME="title" SIZE="50" VALUE="<!--#var title-->">
</TD> </TD>
</TR> </TR>
<!--#var smallRolesWidget-->
<TR> <TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>External name</B></TD> <TD ALIGN="LEFT" VALIGN="TOP"><B>External name</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP"> <TD ALIGN="LEFT" VALIGN="TOP">
......
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