version 1.78, 2008/10/08 08:35:20
|
version 1.83, 2008/11/16 12:15:42
|
Line 524 class VLP_collection(ECHO_collection,Acq
|
Line 524 class VLP_collection(ECHO_collection,Acq
|
|
|
if name.startswith("lit"): #umleitung wenn lit aufgerufen wirk |
if name.startswith("lit"): #umleitung wenn lit aufgerufen wirk |
# umleitung auf den eigentlichen folder nur wenn direkt der Folder litXXX oder dessen index_html methode aufgerufen wird |
# umleitung auf den eigentlichen folder nur wenn direkt der Folder litXXX oder dessen index_html methode aufgerufen wird |
if lastActual.startswith("lit") or (lastActual=="index_html"): |
if lastActual.startswith("lit") or (lastActual=="index_html") or (lastActual=="index_meta"): |
#obj=self. ZopeFind(self,obj_ids=[name],search_sub=1) |
#obj=self. ZopeFind(self,obj_ids=[name],search_sub=1) |
ob=self.findObjFromLitName(name) |
ob=self.findObjFromLitName(name) |
if not ob: |
if not ob: |
Line 533 class VLP_collection(ECHO_collection,Acq
|
Line 533 class VLP_collection(ECHO_collection,Acq
|
|
|
logging.error("request:"+repr(ob)) |
logging.error("request:"+repr(ob)) |
request.response.setStatus(200) |
request.response.setStatus(200) |
|
#if (lastActual=="index_meta"): |
|
# logging.debug("index_meta requested") |
|
# return ob.index_meta |
return ob |
return ob |
|
|
else: ## andern falls transversiere zum parent. |
else: ## andern falls transversiere zum parent. |
obj = self.aq_parent |
obj = self.aq_parent |
return obj |
return obj |
Line 553 class VLP_collection(ECHO_collection,Acq
|
Line 557 class VLP_collection(ECHO_collection,Acq
|
{'label':'Update Library','action':'updateCollection'}, |
{'label':'Update Library','action':'updateCollection'}, |
{'label':'Update Metadata','action':'updateCollectionMD'}, |
{'label':'Update Metadata','action':'updateCollectionMD'}, |
) |
) |
|
def getAllRessources(self): |
|
"""getallressources""" |
|
res=self.ZopeFind(self,obj_metatypes=['VLP_resource'],search_sub=1) |
|
ret=[] |
|
for r in res: |
|
ret.append([r[0],r[1].absolute_url()]) |
|
|
|
return ret |
|
|
def generateSubCollections(self,errorsTXT="",forceUpdate=False,RESPONSE=None): |
def generateSubCollections(self,errorsTXT="",forceUpdate=False,RESPONSE=None): |
"""erzeuge subcollectionen""" |
"""erzeuge subcollectionen""" |
Line 565 class VLP_collection(ECHO_collection,Acq
|
Line 577 class VLP_collection(ECHO_collection,Acq
|
for found in founds: |
for found in founds: |
try: |
try: |
litid = str(found.reference) |
litid = str(found.reference) |
foundCol=self.ZopeFind(self,obj_ids=[litid]) |
foundCol=self.findObjFromLitName(litid) |
|
#foundCol=self.ZopeFind(self,obj_ids=[litid]) |
if foundCol: |
if foundCol: |
col = foundCol[0][1] |
col = foundCol |
logging.debug("generateSubCollections: subcollection %s exists (%s)"%(col.getId(),found.reference)) |
logging.debug("generateSubCollections: subcollection %s exists (%s)"%(repr(col),found.reference)) |
if (col.title != found.titlerefdisplay) or (col.label != found.titlerefdisplay): |
if (col.title != found.titlerefdisplay) or (col.label != found.titlerefdisplay): |
# subcollection seems to have changed |
# subcollection seems to have changed |
logging.debug("generateSubCollections: subcollection has changed, recreating!") |
logging.debug("generateSubCollections: subcollection has changed, recreating!") |
self.manage_delObjects([foundCol[0][0]]) |
col.aq_parent.manage_delObjects([col.getId()]) |
manage_addVLP_subCollection(self,litid,found.titlerefdisplay,found.titlerefdisplay) |
manage_addVLP_subCollection(self.getOrCreateFolderForFile(litid),litid,found.titlerefdisplay,found.titlerefdisplay) |
else: |
else: |
logging.debug("generateSubCollections: creating new subcollection %s"%found.reference) |
logging.debug("generateSubCollections: creating new subcollection %s"%found.reference) |
manage_addVLP_subCollection(self,litid,found.titlerefdisplay,found.titlerefdisplay) |
manage_addVLP_subCollection(self.getOrCreateFolderForFile(litid),litid,found.titlerefdisplay,found.titlerefdisplay) |
|
|
#teste ob es Images auf dem Server gibt mit gleichem Namen (frontmatter) |
#teste ob es Images auf dem Server gibt mit gleichem Namen (frontmatter) |
if os.path.exists(os.path.join(self.vlp_basis,litid)): |
if os.path.exists(os.path.join(self.vlp_basis,litid)): |
logging.debug("generateSubCollections: found frontmatter in %s"%litid) |
logging.debug("generateSubCollections: found frontmatter in %s"%litid) |
obj=getattr(self,litid) |
obj=self.findObjFromLitName(litid) |
if not self.ZopeFind(obj,obj_ids=[litid]): |
if not self.ZopeFind(obj,obj_ids=[litid]): |
metalink=self.REQUEST['URL1']+"/"+litid+"/"+litid+"/index_meta" |
metalink=self.REQUEST['URL1']+"/"+litid+"/"+litid+"/index_meta" |
newObj=VLP_resource(litid,'',metalink,litid,litid,litid,'generated','book','','','','','','') |
newObj=VLP_resource(litid,'',metalink,litid,litid,litid,'generated','book','','','','','','') |
Line 954 class VLP_resource(ECHO_resource,Cacheab
|
Line 967 class VLP_resource(ECHO_resource,Cacheab
|
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
|
def index_meta(self): |
def index_meta(self,RESPONSE=None): |
"""index_meta""" |
"""index_meta""" |
|
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'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/xml" |
return pt() |
x= pt.pt_render() |
|
#logging.debug("index_meta 4:"+x) |
|
if RESPONSE: |
|
RESPONSE.setHeader("Content-Type","text/xml") |
|
return x |
def file2page(self,p): |
def file2page(self,p): |
"""converts filename to pagenumber""" |
"""converts filename to pagenumber""" |
dom=xml.dom.minidom.parse(ECHO_helpers.urlopen(getattr(self,'index.xml').absolute_url())) |
|
|
#dom=xml.dom.minidom.parse(ECHO_helpers.urlopen(getattr(self,'index.xml').absolute_url())) |
|
index=getattr(self,'index.xml') |
|
|
|
txt=index.pt_render() |
|
dom=xml.dom.minidom.parseString(txt) |
|
|
for page in dom.getElementsByTagName('page'): |
for page in dom.getElementsByTagName('page'): |
# pageummer mit lo oder hi sind aequivalent |
# pageummer mit lo oder hi sind aequivalent |
if (page.getAttribute('file')==p) or ("%slo"%page.getAttribute('file')==p) or ("%shi"%page.getAttribute('file')==p): |
if (page.getAttribute('file')==p) or ("%slo"%page.getAttribute('file')==p) or ("%shi"%page.getAttribute('file')==p): |
return page.getAttribute('nr') |
nr=page.getAttribute('nr') |
|
|
|
return nr |
|
|
return 0 |
return 0 |
|
|