Changeset 486:f2c5417b7ff4 in documentViewer
- Timestamp:
- Aug 22, 2011, 3:00:28 PM (13 years ago)
- Branch:
- elementtree
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
__init__.py
r130 r486 13 13 14 14 context.registerClass( 15 documentViewer.DocumentViewerTemplate,16 constructors = (17 documentViewer.manage_addDocumentViewerTemplateForm,18 documentViewer.manage_addDocumentViewerTemplate19 )20 )21 22 context.registerClass(23 15 MpdlXmlTextServer.MpdlXmlTextServer, 24 16 constructors = ( -
documentViewer.py
r483 r486 2 2 from OFS.Image import File 3 3 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate 4 from Products.PageTemplates.PageTemplateFile import PageTemplateFile 4 from Products.PageTemplates.PageTemplateFile import PageTemplateFile 5 from Products.ZSimpleFile import ZSimpleFile 5 6 from AccessControl import ClassSecurityInfo 6 7 from AccessControl import getSecurityManager … … 140 141 info_xml = PageTemplateFile('zpt/info_xml', globals()) 141 142 # TODO: can this be nicer? 142 docuviewer_css = File('docuviewer_css','',open(os.path.join(package_home(globals()),'css/docuviewer.css')), content_type='text/css')143 docuviewer_css = ZSimpleFile(content_type='text/css',filename='css/docuviewer.css', id='docuviewer_css',_prefix=globals()) 143 144 144 145 … … 920 921 if RESPONSE is not None: 921 922 RESPONSE.redirect('manage_main') 922 923 ## DocumentViewerTemplate class924 class DocumentViewerTemplate(ZopePageTemplate):925 """Template for document viewer"""926 meta_type="DocumentViewer Template"927 928 929 def manage_addDocumentViewerTemplateForm(self):930 """Form for adding"""931 pt=PageTemplateFile('zpt/addDocumentViewerTemplate', globals()).__of__(self)932 return pt()933 934 def manage_addDocumentViewerTemplate(self, id='viewer_main', title=None, text=None,935 REQUEST=None, submit=None):936 "Add a Page Template with optional file content."937 938 self._setObject(id, DocumentViewerTemplate(id))939 ob = getattr(self, id)940 txt=file(os.path.join(package_home(globals()),'zpt/viewer_main.zpt'),'r').read()941 logging.info("txt %s:"%txt)942 ob.pt_edit(txt,"text/html")943 if title:944 ob.pt_setTitle(title)945 try:946 u = self.DestinationURL()947 except AttributeError:948 u = REQUEST['URL1']949 950 u = "%s/%s" % (u, urllib.quote(id))951 REQUEST.RESPONSE.redirect(u+'/manage_main')952 return ''953 954 955
Note: See TracChangeset
for help on using the changeset viewer.