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