Commit d9a4d738 authored by Andreas Jung's avatar Andreas Jung

quick'n dirty Z3 ZPT integration, we can edit and render....

parent 53ca50ef
......@@ -21,19 +21,48 @@ from types import StringType
from Globals import DTMLFile, ImageFile, MessageDialog, package_home, Persistent
from zLOG import LOG, ERROR, INFO
from OFS.SimpleItem import SimpleItem
import AccessControl
from AccessControl import getSecurityManager
from zope.pagetemplate.pagetemplate import PageTemplate
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
class ZPT(PageTemplate):
class ZPT(SimpleItem, PageTemplate):
"Zope wrapper for Page Template using TAL, TALES, and METAL"
meta_type = 'ZPT'
manage_options = (
{'label':'Edit', 'action':'pt_editForm',
'help': ('PageTemplates', 'PageTemplate_Edit.stx')},
{'label':'Test', 'action':'ZScriptHTML_tryForm'},
) \
+ SimpleItem.manage_options \
security = AccessControl.ClassSecurityInfo()
def __init__(self, id, text=None, content_type=None):
self.id = str(id)
security.declareProtected('View', '__call__')
security.declareProtected('View', 'view')
def view(self):
"""view """
return self()
security.declareProtected('Change Page Templates',
'pt_editAction', 'pt_setTitle', 'pt_edit',
'pt_upload', 'pt_changePrefs')
def pt_editAction(self, REQUEST, title, text, content_type, expand):
"""Change the title and document."""
print text
print content_type
self.pt_edit(text, content_type)
message= 'done'
return self.pt_editForm(manage_tabs_message=message)
pt_editForm = PageTemplateFile('www/ptEdit', globals(),
__name__='pt_editForm')
......
......@@ -10,7 +10,7 @@ from a local file by typing the file name or using the <em>browse</em>
button.
</p>
<form action="manage_addPageTemplate" method="post"
<form action="manage_addZPT" method="post"
enctype="multipart/form-data">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
......
......@@ -39,8 +39,10 @@
</div>
</td>
<td align="left" valign="top" colspan=2>
<!--
<a href="source.html" tal:condition="here/html">Browse HTML source</a>
<a href="source.xml" tal:condition="not:here/html">Browse XML source</a>
-->
<br>
<input type="hidden" name="expand:int:default" value="0">
<input type="checkbox" value="1" name="expand:int"
......@@ -49,6 +51,8 @@
</td>
</tr>
<span tal:content="python: context.pt_errors(None)" />
<!--
<tr tal:define="errors here/pt_errors" tal:condition="errors">
<tal:block define="global body python:here.document_src({'raw':1})"/>
<td align="left" valign="middle" class="form-label">Errors</td>
......@@ -57,6 +61,7 @@
<pre tal:content="python:modules['string'].join(errors, '\n')">errors</pre>
</td>
</tr>
-->
<tr tal:define="warnings here/pt_warnings" tal:condition="warnings">
<td align="left" valign="middle" class="form-label">Warnings</td>
......
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