[Zapp-cvs-commit] ZApp/skins/zapp_generic zapp_zodb_image_edit.py,NONE,1.1 zapp_zodb_image_edit_form
Brought to you by:
sspickle
|
From: Steve S. <ssp...@us...> - 2005-01-07 15:48:39
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1578/skins/zapp_generic Added Files: zapp_zodb_image_edit.py zapp_zodb_image_edit_form.pt Log Message: finally got to fix these image files. --- NEW FILE: zapp_zodb_image_edit.py --- ## Script (Python) "zapp_zodb_image_edit" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## # Example code: REQUEST = context.REQUEST file = REQUEST.form.get('file',None) id = REQUEST.form.get('id','') title = REQUEST.form.get('title','') description = REQUEST.form.get('description','') filename=getattr(file,'filename', '') if file and filename: if not id: id = filename[max( string.rfind(filename, '/') , string.rfind(filename, '\\') , string.rfind(filename, ':') )+1:] if file and hasattr(file, 'seek'): file.seek(0) oldID=context.getId() newID = id context.plone_utils.contentEdit(context, id= oldID, title=title, description=description) if file: context.edit(precondition='', file=file) REQUEST.RESPONSE.redirect( "%s/folder_rename?ids:list=%s&new_ids:list=%s&new_titles:list=%s" % (REQUEST.get('URL2'), oldID, newID, title)) --- NEW FILE: zapp_zodb_image_edit_form.pt --- <html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal" metal:use-macro="here/main_template/macros/master"> <body> <div metal:fill-slot="main" i18n:domain="cmf_default"> <div class="Desktop"> <span tal:replace="request/message" tal:condition="request/message|nothing"><hr /></span> <div class="Image"> <h2 i18n:translate="">Edit <span tal:replace="here/getId" i18n:name="objectid">My ID</span></h2> <form action="." method="post" enctype="multipart/form-data" tal:attributes="action string:${here/absolute_url}/zapp_zodb_image_edit" > <table class="FormLayout"> <tr> <th i18n:translate="">Short Name (id: no spaces!)</th> <td> <input name="id" tal:attributes="value here/id" value=""/></td> </tr> <tr> <th i18n:translate="">Title</th> <td> <input name="title" tal:attributes="value here/Title" value=""/></td> </tr> <tr> <th i18n:translate="">Description</th> <td> <textarea name="description" rows="10" cols="40" tal:content="here/Description"></textarea></td> </tr> <tr> <th i18n:translate="">Upload image</th> <td> <input type="file" name="file" size="25" /> </td> </tr> <tr> <td> <br /> </td> <td> <input type="submit" name="change" value=" Change " i18n:attributes="value" /> </td> </tr> </table> </form> </div> </div> </div> </body> </html> |