[CMF-checkins] CVS: CMF/CMFWorkspaces/skins/workspaces - workspace_add_form.pt:1.1 workspace_add_object.py:1.1 content_add.py:1.2 workspace_view.pt:1.5 workspace_add.py:NONE
Shane Hathaway
shane@zope.com
Thu, 2 Jan 2003 16:51:36 -0500
Update of /cvs-repository/CMF/CMFWorkspaces/skins/workspaces
In directory cvs.zope.org:/tmp/cvs-serv23027/skins/workspaces
Modified Files:
content_add.py workspace_view.pt
Added Files:
workspace_add_form.pt workspace_add_object.py
Removed Files:
workspace_add.py
Log Message:
Added a workspace creation form
=== Added File CMF/CMFWorkspaces/skins/workspaces/workspace_add_form.pt ===
<html metal:use-macro="here/main_template/macros/master">
<head>
<title tal:content="template/title">The title</title>
</head>
<body>
<div metal:fill-slot="header">
</div>
<div metal:fill-slot="main">
<form action="content_add" method="POST" enctype="multipart/form-data">
<table class="FormLayout">
<tr>
<th>
Workspace Id:
</th>
<td>
<input type="text" name="id" size="30" value="" />
</td>
</tr>
<tr>
<th>
Title:
</th>
<td>
<input type="text" name="title" size="80" />
</td>
</tr>
<tr>
<td> <br /> </td>
<td>
<input type="hidden" name="type" value="Workspace" />
<!-- Pass the source workspace -->
<input type="hidden" name="workspace"
tal:attributes="value request/workspace|nothing" />
<input type="submit" name="submit" value="Create Workspace" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
=== Added File CMF/CMFWorkspaces/skins/workspaces/workspace_add_object.py ===
##parameters=type_name, RESPONSE
##title=Redirect to the form for adding the given type.
ws_url = context.absolute_url()
if not type_name:
url = ws_url + '/workspace_view'
else:
url = context.portal_organization.getAddFormURL(type_name, context)
RESPONSE.redirect(url)
=== CMF/CMFWorkspaces/skins/workspaces/content_add.py 1.1 => 1.2 ===
--- CMF/CMFWorkspaces/skins/workspaces/content_add.py:1.1 Fri Jul 12 11:50:22 2002
+++ CMF/CMFWorkspaces/skins/workspaces/content_add.py Thu Jan 2 16:51:32 2003
@@ -1,23 +1,24 @@
-##parameters=type, workspace=None
-##title=Adds an object to a BTreeFolder, generating the ID
-# Example factory skin method that uses IDs generated by a destination
-# BTreeFolder.
+##parameters=type, id=None, title=''
+##title=Adds an object to a BTreeFolder and makes a link in the workspace
+# Also generates the ID if necessary, assuming that dest is a BTreeFolder2.
dest = context.portal_organization.getTypeContainer(type)
-prefix = '%s-%s-' % (container.ZopeTime().strftime('%Y%m%d%H%M'),
- type.replace(' ', ''))
-
-id = dest.generateId(prefix, rand_ceiling=9999)
+if id is None:
+ prefix = '%s-%s-' % (container.ZopeTime().strftime('%Y%m%d%H%M'),
+ type.replace(' ', ''))
+ id = dest.generateId(prefix, rand_ceiling=9999)
if not dest.checkIdAvailable(id):
return dest.error_id_in_use()
+REQUEST = context.REQUEST
RESPONSE = context.REQUEST['RESPONSE']
-dest.invokeFactory(type, id, title='', RESPONSE=RESPONSE)
+dest.invokeFactory(type, id, title=title, RESPONSE=RESPONSE)
ob = dest[id]
-if workspace is not None:
+workspace = REQUEST.get('workspace')
+if workspace:
ws = context.restrictedTraverse(workspace)
ws.addReference(ob)
context.portal_lock.lock(ob) # Lock it on creation
=== CMF/CMFWorkspaces/skins/workspaces/workspace_view.pt 1.4 => 1.5 ===
--- CMF/CMFWorkspaces/skins/workspaces/workspace_view.pt:1.4 Wed May 22 16:40:55 2002
+++ CMF/CMFWorkspaces/skins/workspaces/workspace_view.pt Thu Jan 2 16:51:32 2003
@@ -7,7 +7,7 @@
<div metal:fill-slot="main">
<form name="addform" action="" method="POST" tal:attributes="action
- string:${here/absolute_url}/workspace_add">
+ string:${here/absolute_url}/workspace_add_object">
<p>
<select name="type_name" size="1" onChange="
if (document.addform.type_name.selectedIndex > 0)
=== Removed File CMF/CMFWorkspaces/skins/workspaces/workspace_add.py ===