version 1.30, 2004/10/14 09:48:50
|
version 1.33, 2004/11/18 12:35:48
|
Line 1
|
Line 1
|
|
""" |
|
This module contains extensions which where originally made for the VLP. |
|
""" |
|
from OFS.Cache import Cacheable |
from Products.ECHO_content.ECHO_collection import * |
from Products.ECHO_content.ECHO_collection import * |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
Line 13 import urllib
|
Line 17 import urllib
|
import xmlrpclib |
import xmlrpclib |
import vlp_xmlhelpers |
import vlp_xmlhelpers |
from types import * |
from types import * |
|
from Globals import package_home |
|
|
|
|
|
|
Line 52 class sendMailForm(ZopePageTemplate):
|
Line 57 class sendMailForm(ZopePageTemplate):
|
"""sendMailForm""" |
"""sendMailForm""" |
meta_type="sendMailForm" |
meta_type="sendMailForm" |
|
|
_default_content_fn = os.path.join(package_home(globals()), 'vlp/sendMail_template.zpt') |
_default_content_fn = os.path.join(package_home(globals()), 'vlp','sendMail_template.zpt') |
|
|
manage_options = ZopePageTemplate.manage_options+( |
manage_options = ZopePageTemplate.manage_options+( |
{'label':'Main Config','action':'main_configForm'}, |
{'label':'Main Config','action':'main_configForm'}, |
Line 157 class VLP_essay(Folder):
|
Line 162 class VLP_essay(Folder):
|
obj=getattr(self,type+"_template") |
obj=getattr(self,type+"_template") |
return obj() |
return obj() |
else: |
else: |
pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_%s_template_standard.zpt'%type).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','ECHO_%s_template_standard.zpt'%type)).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
|
|
def ConfigVLP_essayForm(self): |
def ConfigVLP_essayForm(self): |
"""Form for adding""" |
"""Form for adding""" |
pt=PageTemplateFile('Products/ECHO_content/vlp/ChangeVLP_essay.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','ChangeVLP_essay.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def ChangeVLP_essay(self,title,label,description,RESPONSE=None): |
def ChangeVLP_essay(self,title,label,description,RESPONSE=None): |
Line 188 class VLP_essay(Folder):
|
Line 193 class VLP_essay(Folder):
|
if hasattr(self,'essayTemplate.html'): |
if hasattr(self,'essayTemplate.html'): |
return getattr(self,'essayTemplate.html')() |
return getattr(self,'essayTemplate.html')() |
|
|
pt=PageTemplateFile('Products/ECHO_content/vlp/essay_template.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','essay_template.zpt')).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
|
|
Line 263 class VLP_essay(Folder):
|
Line 268 class VLP_essay(Folder):
|
|
|
def manage_addVLP_essayForm(self): |
def manage_addVLP_essayForm(self): |
"""Form for adding""" |
"""Form for adding""" |
pt=PageTemplateFile('Products/ECHO_content/vlp/AddVLP_essay.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','AddVLP_essay.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def manage_addVLP_essay(self, id,title,label,RESPONSE=None): |
def manage_addVLP_essay(self, id,title,label,RESPONSE=None): |
Line 288 class VLP_encyclopaedia(VLP_essay):
|
Line 293 class VLP_encyclopaedia(VLP_essay):
|
|
|
def loadNewFileForm(self): |
def loadNewFileForm(self): |
"""Neues XML-File einlesen""" |
"""Neues XML-File einlesen""" |
pt=PageTemplateFile('Products/ECHO_content/vlp/VLP_newfile.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','VLP_newfile.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def loadNewFile(self,RESPONSE=None): |
def loadNewFile(self,RESPONSE=None): |
Line 321 class VLP_encyclopaedia(VLP_essay):
|
Line 326 class VLP_encyclopaedia(VLP_essay):
|
|
|
def manage_addVLP_encycForm(self): |
def manage_addVLP_encycForm(self): |
"""Form for adding""" |
"""Form for adding""" |
pt=PageTemplateFile('Products/ECHO_content/vlp/AddVLP_encyc.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','AddVLP_encyc.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def manage_addVLP_encyc(self, id,title,label,RESPONSE=None): |
def manage_addVLP_encyc(self, id,title,label,RESPONSE=None): |
Line 346 class VLP_collection(ECHO_collection):
|
Line 351 class VLP_collection(ECHO_collection):
|
|
|
def VLP_path_configForm(self): |
def VLP_path_configForm(self): |
"""change pt""" |
"""change pt""" |
path=PageTemplateFile('Products/ECHO_content/vlp/ChangeVLPPath.zpt').__of__(self) |
path=PageTemplateFile(os.path.join(package_home(globals()),'vlp','ChangeVLPPath.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def VLP_path_config(self,path,RESPONSE=None): |
def VLP_path_config(self,path,RESPONSE=None): |
Line 363 class VLP_collection(ECHO_collection):
|
Line 368 class VLP_collection(ECHO_collection):
|
if fileName[0:3]=="lit": |
if fileName[0:3]=="lit": |
|
|
metalink=self.REQUEST['URL1']+"/"+fileName+"/index_meta" |
metalink=self.REQUEST['URL1']+"/"+fileName+"/index_meta" |
|
if not hasattr(self,fileName): |
newObj=VLP_resource(fileName,'',metalink,fileName,fileName,fileName,'generated','book','','','','','','') |
newObj=VLP_resource(fileName,'',metalink,fileName,fileName,fileName,'generated','book','','','','','','') |
self._setObject(fileName,newObj) |
self._setObject(fileName,newObj) |
|
|
Line 404 class VLP_collection(ECHO_collection):
|
Line 410 class VLP_collection(ECHO_collection):
|
|
|
def manage_addVLP_collectionForm(self): |
def manage_addVLP_collectionForm(self): |
"""Form for adding a ressource""" |
"""Form for adding a ressource""" |
pt=PageTemplateFile('Products/ECHO_content/vlp/AddVLP_collectionForm.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','AddVLP_collectionForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
|
Line 423 def manage_addVLP_collection(self,id,tit
|
Line 429 def manage_addVLP_collection(self,id,tit
|
|
|
|
|
|
|
class VLP_resource(ECHO_resource): |
class VLP_resource(ECHO_resource,Cacheable): |
"""VLP spezifische Erweiterung""" |
"""VLP spezifische Erweiterung""" |
|
|
meta_type="VLP_resource" |
meta_type="VLP_resource" |
Line 447 class VLP_resource(ECHO_resource):
|
Line 453 class VLP_resource(ECHO_resource):
|
if hasattr(self,'libraryTranscriptionTemplate.html'): |
if hasattr(self,'libraryTranscriptionTemplate.html'): |
return getattr(self,'libraryTranscriptionTemplate.html')() |
return getattr(self,'libraryTranscriptionTemplate.html')() |
|
|
pt=PageTemplateFile('Products/ECHO_content/vlp/library_transcriptionTemplate.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','library_transcriptionTemplate.zpt')).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
|
|
Line 508 class VLP_resource(ECHO_resource):
|
Line 514 class VLP_resource(ECHO_resource):
|
if hasattr(self,'libraryTemplate.html'): |
if hasattr(self,'libraryTemplate.html'): |
return getattr(self,'libraryTemplate.html')() |
return getattr(self,'libraryTemplate.html')() |
|
|
pt=PageTemplateFile('Products/ECHO_content/vlp/library_template.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','library_template.zpt')).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
|
|
Line 535 class VLP_resource(ECHO_resource):
|
Line 541 class VLP_resource(ECHO_resource):
|
def index_meta(self): |
def index_meta(self): |
"""index_meta""" |
"""index_meta""" |
|
|
pt=PageTemplateFile('Products/ECHO_content/vlp/index_meta.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','index_meta.zpt')).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
|
|
Line 554 class VLP_resource(ECHO_resource):
|
Line 560 class VLP_resource(ECHO_resource):
|
"""dir to index""" |
"""dir to index""" |
|
|
def calculateName(str): |
def calculateName(str): |
ret="%s: %s"%(str[0],str[1:5]) |
name=os.path.splitext(str[1:])[0] |
|
ret="%s: %s"%(str[0],name) |
return ret |
return ret |
|
|
try: |
try: |
Line 564 class VLP_resource(ECHO_resource):
|
Line 571 class VLP_resource(ECHO_resource):
|
ret=os.listdir(os.path.join(self.vlp_basis,self.resourceID,'pagesHi')) |
ret=os.listdir(os.path.join(self.vlp_basis,self.resourceID,'pagesHi')) |
self.imagePath='pagesHi' |
self.imagePath='pagesHi' |
temp=[] |
temp=[] |
|
ret.sort() |
for x in ret: |
for x in ret: |
if not (x[0]=="."): |
if not (x[0]=="."): |
|
|
Line 634 class VLP_resource(ECHO_resource):
|
Line 642 class VLP_resource(ECHO_resource):
|
|
|
def readIndexFile(self,url=None): |
def readIndexFile(self,url=None): |
"""reads the indexfile. presently url not None isn't implemented. In the future url can be defined.""" |
"""reads the indexfile. presently url not None isn't implemented. In the future url can be defined.""" |
pagelist=[] |
|
if not url: |
if not url: |
url=self.absolute_url()+"/index.xml" |
url=self.absolute_url()+"/index.xml" |
|
|
|
if self.ZCacheable_isCachingEnabled(): |
|
|
|
result = self.ZCacheable_get(view_name=url) |
|
if result is not None: |
|
# Got a cached value. |
|
print "CACHEXX" |
|
return result |
|
|
|
pagelist=[] |
|
|
fh=ECHO_helpers.urlopen(url) |
fh=ECHO_helpers.urlopen(url) |
dom=xml.dom.minidom.parse(fh) |
dom=xml.dom.minidom.parse(fh) |
|
|
Line 648 class VLP_resource(ECHO_resource):
|
Line 665 class VLP_resource(ECHO_resource):
|
fileName=page.getAttribute('file') |
fileName=page.getAttribute('file') |
pagelist.append((pageNum,text,fileName)) |
pagelist.append((pageNum,text,fileName)) |
|
|
|
self.ZCacheable_set(pagelist,view_name=url) |
return pagelist |
return pagelist |
|
|
def getFileName(self): |
def getFileName(self): |
Line 663 class VLP_resource(ECHO_resource):
|
Line 681 class VLP_resource(ECHO_resource):
|
"""create index file""" |
"""create index file""" |
|
|
|
|
pt=PageTemplateFile('Products/ECHO_content/vlp/index_template.zpt').__of__(self)() |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','index_template.zpt')).__of__(self)() |
|
|
|
|
|
|
Line 682 class VLP_resource(ECHO_resource):
|
Line 700 class VLP_resource(ECHO_resource):
|
|
|
def manage_addVLP_resourceForm(self): |
def manage_addVLP_resourceForm(self): |
"""Form for adding a ressource""" |
"""Form for adding a ressource""" |
pt=PageTemplateFile('Products/ECHO_content/vlp/AddVLP_resourceForm.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'vlp','AddVLP_resourceForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
|