[Zapp-cvs-commit] ZApp/skins/zapp_generic zapp_cmf_view_relations.pt,NONE,1.1 zapp_cmf_xml_delete.py
Brought to you by:
sspickle
|
From: Steve S. <ssp...@us...> - 2004-03-19 16:03:20
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30660/skins/zapp_generic Modified Files: zapp_cmf_xml_edit.py zapp_cmf_xml_form.pt Added Files: zapp_cmf_view_relations.pt zapp_cmf_xml_delete.py Log Message: add relationship management views to CMF display --- NEW FILE: zapp_cmf_xml_delete.py --- ## Script (Python) "zapp_cmf_xml_delete" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=dataType="", no_redir=0, redirect_url='', clearFlag=0 ##title= ## """ Save xml directly.... """ import xmlrpclib miscData = context.getMiscData(dataType=dataType) if miscData: miscData.manage_delete() if no_redir: return "OK!" else: if not redirect_url: redirect_url = context.absolute_url() + ('/zapp_cmf_xml_form?portal_status_message=MiscData+type+%s+Deleted.' % dataType) context.REQUEST.RESPONSE.redirect(redirect_url) return "redirecting.. " Index: zapp_cmf_xml_edit.py =================================================================== RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_xml_edit.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** zapp_cmf_xml_edit.py 25 Jan 2004 20:58:46 -0000 1.2 --- zapp_cmf_xml_edit.py 19 Mar 2004 15:53:32 -0000 1.3 *************** *** 32,36 **** else: if not redirect_url: ! redirect_url = context.absolute_url() + '/zapp_cmf_xml_form?portal_status_message=ZApp+CMF+Object+Changed.' context.REQUEST.RESPONSE.redirect(redirect_url) --- 32,36 ---- else: if not redirect_url: ! redirect_url = context.absolute_url() + ('/zapp_cmf_xml_form?dataType=%s&portal_status_message=ZApp+CMF+Object+Changed.' % dataType) context.REQUEST.RESPONSE.redirect(redirect_url) --- NEW FILE: zapp_cmf_view_relations.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"> <metal:block fill-slot="base"> <base href="" tal:attributes="href python: here.absolute_url() + '/'"> </metal:block> <body> <div metal:fill-slot="main"> <div tal:define="app python:here.findApplication(); appURL app/absolute_url; objRelations python:here.objectRelations( returnObjects=1 ); managerIDs here/findSpecialistsForRelationship; myCMFId python:here.calcPathID()"> <form action="" tal:attributes="action string:${appURL}/CMFData/${myCMFId}"> <input type="hidden" name="responseURL" tal:attributes="value request/URL0"> <table > <tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Info</td><td>Context ID</td></tr> <tr tal:condition="objRelations" tal:repeat="objRelation objRelations"> <span tal:omit-tag="" tal:define="otherObject python:objRelation.get('otherObject',None)"> <input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID"> <td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td> <td tal:content="objRelation/otherManagerID"/> <td><a tal:content="objRelation/otherObjectID" tal:attributes="href string:${objRelation/otherObject/absolute_url}/displayUpdateForm_html"/></td> <td tal:content="otherObject/Info | otherObject/name | otherObject/description | otherObject/objectType | nothing"/> <td><input name="relationInfo.contextID:records" tal:attributes="value objRelation/otherContextID"/></td> </span> </tr> <tr tal:condition="objRelations"><td colspan="3"> <input type="submit" value="Delete Relation" name="removeObjectRelations_ui:method"> <input tal:condition="objRelations" type="submit" value="Edit Selected Relations" name="editRelations_ui:method"> </td></tr> <tr tal:condition="managerIDs"><td colspan="3"><input type="submit" value="Relate Other Object" name="addRelationship_pt:method"> </td></tr> </table> </form> </div> </div> </body> </html> Index: zapp_cmf_xml_form.pt =================================================================== RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_xml_form.pt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** zapp_cmf_xml_form.pt 20 Jan 2004 03:42:53 -0000 1.1 --- zapp_cmf_xml_form.pt 19 Mar 2004 15:53:32 -0000 1.2 *************** *** 10,21 **** <div metal:fill-slot="main"> ! <form action="" tal:attributes="action string:${here/absolute_url}/zapp_cmf_xml_edit" ! tal:define="dataType here/dataType | request/dataType | nothing; ! miscData python:here.getMiscData( dataType=dataType or '', createIfNone=1);" ! method="post"> <textarea tal:condition="miscData" rows="30" cols="70" name="xml" tal:content="miscData/xml"/> <span tal:condition="not:miscData" tal:content="string:Sorry... no misc data"/> ! <input type="submit" name="save"/> </form> </div> --- 10,54 ---- <div metal:fill-slot="main"> ! <div tal:define="mds python:here.getMiscDataSpecialist(); ! mdObjs python:mds.ZApp_getItems( objectID = here.getMiscObjectID(), Manager = here.miscDataManager); ! dTypes python:[x.dataType for x in mdObjs]; ! dataType here/dataType | request/dataType | string:; ! miscData python:here.getMiscData( dataType=dataType or '', createIfNone=1); ! "> ! ! <form tal:condition="python:len(dTypes)>1" action="" tal:attributes="action string:${here/absolute_url}/${template/id}"> ! ! <span tal:condition="python:len(dTypes)>2"> ! View Other Data Type:<select name="dataType" > ! <tal:block tal:omit-tag="" tal:repeat="dType dTypes"> <option tal:condition="python:dType != dataType" tal:content="dType" tal:attributes="value dType"/></tal:block> ! </select> ! <input type="submit" tal:attributes="value string:Click here to view selected dataType's XML"> ! </span> ! ! <tal:block tal:omit-tag="" tal:condition="python:len(dTypes)==2"> ! <span tal:define="newDataIndex python:((dTypes[0]==dataType) and 1) or 0; ! newDataType python:dTypes[newDataIndex]; ! "> ! <input type="hidden" name="dataType" tal:attributes="value newDataType"> ! <input type="submit" tal:attributes="value string:Click here to view dataType->'${newDataType}'"/> ! </span> ! </tal:block> ! ! </form> ! <hr> ! <form action="" tal:attributes="action string:${here/absolute_url}/zapp_cmf_xml_edit" method="post"> ! Data Type (edit to create new data type): <input name="dataType" tal:attributes="value dataType"><br> <textarea tal:condition="miscData" rows="30" cols="70" name="xml" tal:content="miscData/xml"/> <span tal:condition="not:miscData" tal:content="string:Sorry... no misc data"/> ! <input type="submit" value="save xml" name="save"/> ! </form> ! ! <form action="" tal:attributes="action string:${here/absolute_url}/zapp_cmf_xml_delete" method="post"> ! <input name="dataType" type="hidden" tal:attributes="value dataType"><br> ! <input type="submit" value="delete this xml/dataType"> </form> + + + </div> </div> |