version 1.98, 2010/08/24 14:10:13
|
version 1.168, 2011/02/18 11:21:46
|
Line 5 from Products.PageTemplates.PageTemplate
|
Line 5 from Products.PageTemplates.PageTemplate
|
from AccessControl import ClassSecurityInfo |
from AccessControl import ClassSecurityInfo |
from AccessControl import getSecurityManager |
from AccessControl import getSecurityManager |
from Globals import package_home |
from Globals import package_home |
|
from Products.zogiLib.zogiLib import browserCheck |
|
|
from Ft.Xml import EMPTY_NAMESPACE, Parse |
from Ft.Xml import EMPTY_NAMESPACE, Parse |
import Ft.Xml.Domlette |
import Ft.Xml.Domlette |
Line 16 import logging
|
Line 17 import logging
|
import math |
import math |
import urlparse |
import urlparse |
import cStringIO |
import cStringIO |
|
import re |
|
import string |
|
|
def logger(txt,method,txt2): |
def logger(txt,method,txt2): |
"""logging""" |
"""logging""" |
Line 48 def serializeNode(node, encoding='utf-8'
|
Line 51 def serializeNode(node, encoding='utf-8'
|
buf.close() |
buf.close() |
return s |
return s |
|
|
|
def browserCheck(self): |
|
"""check the browsers request to find out the browser type""" |
|
bt = {} |
|
ua = self.REQUEST.get_header("HTTP_USER_AGENT") |
|
bt['ua'] = ua |
|
bt['isIE'] = False |
|
bt['isN4'] = False |
|
bt['versFirefox']="" |
|
bt['versIE']="" |
|
bt['versSafariChrome']="" |
|
bt['versOpera']="" |
|
|
|
if string.find(ua, 'MSIE') > -1: |
|
bt['isIE'] = True |
|
else: |
|
bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1) |
|
# Safari oder Chrome identification |
|
try: |
|
nav = ua[string.find(ua, '('):] |
|
nav1=ua[string.find(ua,')'):] |
|
nav2=nav1[string.find(nav1,'('):] |
|
nav3=nav2[string.find(nav2,')'):] |
|
ie = string.split(nav, "; ")[1] |
|
ie1 =string.split(nav1, " ")[2] |
|
ie2 =string.split(nav3, " ")[1] |
|
ie3 =string.split(nav3, " ")[2] |
|
if string.find(ie3, "Safari") >-1: |
|
bt['versSafariChrome']=string.split(ie2, "/")[1] |
|
except: pass |
|
# IE identification |
|
try: |
|
nav = ua[string.find(ua, '('):] |
|
ie = string.split(nav, "; ")[1] |
|
if string.find(ie, "MSIE") > -1: |
|
bt['versIE'] = string.split(ie, " ")[1] |
|
except:pass |
|
# Firefox identification |
|
try: |
|
nav = ua[string.find(ua, '('):] |
|
nav1=ua[string.find(ua,')'):] |
|
if string.find(ie1, "Firefox") >-1: |
|
nav5= string.split(ie1, "/")[1] |
|
logging.debug("FIREFOX: %s"%(nav5)) |
|
bt['versFirefox']=nav5[0:3] |
|
except:pass |
|
#Opera identification |
|
try: |
|
if string.find(ua,"Opera") >-1: |
|
nav = ua[string.find(ua, '('):] |
|
nav1=nav[string.find(nav,')'):] |
|
bt['versOpera']=string.split(nav1,"/")[2] |
|
except:pass |
|
|
|
bt['isMac'] = string.find(ua, 'Macintosh') > -1 |
|
bt['isWin'] = string.find(ua, 'Windows') > -1 |
|
bt['isIEWin'] = bt['isIE'] and bt['isWin'] |
|
bt['isIEMac'] = bt['isIE'] and bt['isMac'] |
|
bt['staticHTML'] = False |
|
|
|
return bt |
|
|
|
|
def getParentDir(path): |
def getParentDir(path): |
"""returns pathname shortened by one""" |
"""returns pathname shortened by one""" |
Line 117 class documentViewer(Folder):
|
Line 181 class documentViewer(Folder):
|
toc_text = PageTemplateFile('zpt/toc_text', globals()) |
toc_text = PageTemplateFile('zpt/toc_text', globals()) |
toc_figures = PageTemplateFile('zpt/toc_figures', globals()) |
toc_figures = PageTemplateFile('zpt/toc_figures', globals()) |
page_main_images = PageTemplateFile('zpt/page_main_images', globals()) |
page_main_images = PageTemplateFile('zpt/page_main_images', globals()) |
|
page_main_double = PageTemplateFile('zpt/page_main_double', globals()) |
page_main_text = PageTemplateFile('zpt/page_main_text', globals()) |
page_main_text = PageTemplateFile('zpt/page_main_text', globals()) |
page_main_text_dict = PageTemplateFile('zpt/page_main_text_dict', globals()) |
page_main_text_dict = PageTemplateFile('zpt/page_main_text_dict', globals()) |
page_main_gis =PageTemplateFile ('zpt/page_main_gis', globals()) |
page_main_gis =PageTemplateFile ('zpt/page_main_gis', globals()) |
page_main_xml = PageTemplateFile('zpt/page_main_xml', globals()) |
page_main_xml = PageTemplateFile('zpt/page_main_xml', globals()) |
|
page_main_pureXml = PageTemplateFile('zpt/page_main_pureXml', globals()) |
head_main = PageTemplateFile('zpt/head_main', globals()) |
head_main = PageTemplateFile('zpt/head_main', globals()) |
docuviewer_css = PageTemplateFile('css/docuviewer.css', globals()) |
docuviewer_css = PageTemplateFile('css/docuviewer.css', globals()) |
info_xml = PageTemplateFile('zpt/info_xml', globals()) |
info_xml = PageTemplateFile('zpt/info_xml', globals()) |
Line 166 class documentViewer(Folder):
|
Line 232 class documentViewer(Folder):
|
return self.template.fulltextclient.getTextPage(**args) |
return self.template.fulltextclient.getTextPage(**args) |
|
|
def getQuery(self, **args): |
def getQuery(self, **args): |
"""get query""" |
"""get query in search""" |
return self.template.fulltextclient.getQuery(**args) |
return self.template.fulltextclient.getQuery(**args) |
|
|
def getSearch(self, **args): |
def getSearch(self, **args): |
"""get search""" |
"""get search""" |
return self.template.fulltextclient.getSearch(**args) |
return self.template.fulltextclient.getSearch(**args) |
|
|
def getNumPages(self, docinfo): |
def getGisPlaces(self, **args): |
"""get numpages""" |
"""get gis places""" |
return self.template.fulltextclient.getNumPages(docinfo) |
return self.template.fulltextclient.getGisPlaces(**args) |
|
|
|
def getAllGisPlaces(self, **args): |
|
"""get all gis places """ |
|
return self.template.fulltextclient.getAllGisPlaces(**args) |
|
|
def getTranslate(self, **args): |
def getTranslate(self, **args): |
"""get translate""" |
"""get translate""" |
Line 214 class documentViewer(Folder):
|
Line 284 class documentViewer(Folder):
|
self.digilibBaseUrl = self.findDigilibUrl() or "http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary" |
self.digilibBaseUrl = self.findDigilibUrl() or "http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary" |
|
|
docinfo = self.getDocinfo(mode=mode,url=url) |
docinfo = self.getDocinfo(mode=mode,url=url) |
|
#pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo) |
pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo) |
pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo) |
|
''' ZDES ''' |
pt = getattr(self.template, 'thumbs_main_rss') |
pt = getattr(self.template, 'thumbs_main_rss') |
|
|
if viewMode=="auto": # automodus gewaehlt |
if viewMode=="auto": # automodus gewaehlt |
if docinfo.has_key("textURL") or docinfo.has_key('textURLPath'): #texturl gesetzt und textViewer konfiguriert |
if docinfo.has_key("textURL") or docinfo.get('textURLPath',None): #texturl gesetzt und textViewer konfiguriert |
viewMode="text" |
viewMode="text" |
else: |
else: |
viewMode="images" |
viewMode="images" |
Line 226 class documentViewer(Folder):
|
Line 298 class documentViewer(Folder):
|
return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode) |
return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode) |
|
|
security.declareProtected('View','index_html') |
security.declareProtected('View','index_html') |
def index_html(self,url,mode="texttool",viewMode="auto",tocMode="thumbs",start=None,pn=1,mk=None, query=None, querySearch=None, characterNormalization=""): |
def index_html(self,url,mode="texttool",viewMode="auto",tocMode="thumbs",start=None,pn=1,mk=None): |
''' |
''' |
view it |
view it |
@param mode: defines how to access the document behind url |
@param mode: defines how to access the document behind url |
Line 254 class documentViewer(Folder):
|
Line 326 class documentViewer(Folder):
|
docinfo = self.getToc(mode=tocMode, docinfo=docinfo) |
docinfo = self.getToc(mode=tocMode, docinfo=docinfo) |
|
|
if viewMode=="auto": # automodus gewaehlt |
if viewMode=="auto": # automodus gewaehlt |
if docinfo.has_key('textURL') or docinfo.has_key('textURLPath'): #texturl gesetzt und textViewer konfiguriert |
if docinfo.has_key('textURL') or docinfo.get('textURLPath',None): #texturl gesetzt und textViewer konfiguriert |
viewMode="text_dict" |
viewMode="text_dict" |
else: |
else: |
viewMode="images" |
viewMode="images" |
|
|
pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo,viewMode=viewMode,tocMode=tocMode) |
pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo,viewMode=viewMode,tocMode=tocMode) |
|
|
pt = getattr(self.template, 'viewer_main') |
if (docinfo.get('textURLPath',None)): |
|
page = self.getTextPage(docinfo=docinfo, pageinfo=pageinfo) |
|
pageinfo['textPage'] = page |
|
tt = getattr(self, 'template') |
|
pt = getattr(tt, 'viewer_main') |
return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode,mk=self.generateMarks(mk)) |
return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode,mk=self.generateMarks(mk)) |
|
|
def generateMarks(self,mk): |
def generateMarks(self,mk): |
Line 275 class documentViewer(Folder):
|
Line 351 class documentViewer(Folder):
|
return ret |
return ret |
|
|
|
|
|
def getBrowser(self): |
|
"""getBrowser the version of browser """ |
|
bt = browserCheck(self) |
|
logging.debug("BROWSER VERSION: %s"%(bt)) |
|
return bt |
|
|
def findDigilibUrl(self): |
def findDigilibUrl(self): |
"""try to get the digilib URL from zogilib""" |
"""try to get the digilib URL from zogilib""" |
url = self.template.zogilib.getDLBaseUrl() |
url = self.template.zogilib.getDLBaseUrl() |
Line 292 class documentViewer(Folder):
|
Line 374 class documentViewer(Folder):
|
else: |
else: |
return style |
return style |
|
|
def getLink(self,param=None,val=None): |
def getLink(self, param=None, val=None, params=None, baseUrl=None, paramSep='&'): |
"""link to documentviewer with parameter param set to val""" |
"""returns URL to documentviewer with parameter param set to val or from dict params""" |
params=self.REQUEST.form.copy() |
# copy existing request params |
|
urlParams=self.REQUEST.form.copy() |
|
# change single param |
if param is not None: |
if param is not None: |
if val is None: |
if val is None: |
if params.has_key(param): |
if urlParams.has_key(param): |
del params[param] |
del urlParams[param] |
else: |
else: |
params[param] = str(val) |
urlParams[param] = str(val) |
|
|
|
# change more params |
|
if params is not None: |
|
for k in params.keys(): |
|
v = params[k] |
|
if v is None: |
|
# val=None removes param |
|
if urlParams.has_key(k): |
|
del urlParams[k] |
|
|
|
else: |
|
urlParams[k] = v |
|
|
|
# FIXME: does this belong here? |
|
if urlParams.get("mode", None) == "filepath": #wenn beim erst Aufruf filepath gesetzt wurde aendere das nun zu imagepath |
|
urlParams["mode"] = "imagepath" |
|
urlParams["url"] = getParentDir(urlParams["url"]) |
|
|
|
# quote values and assemble into query string (not escaping '/') |
|
ps = paramSep.join(["%s=%s"%(k,urllib.quote_plus(v,'/')) for (k, v) in urlParams.items()]) |
|
#ps = urllib.urlencode(urlParams) |
|
if baseUrl is None: |
|
baseUrl = self.REQUEST['URL1'] |
|
|
if params.get("mode", None) == "filepath": #wenn beim erst Aufruf filepath gesetzt wurde aendere das nun zu imagepath |
url = "%s?%s"%(baseUrl, ps) |
params["mode"] = "imagepath" |
|
params["url"] = getParentDir(params["url"]) |
|
|
|
# quote values and assemble into query string |
|
#ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()]) |
|
ps = urllib.urlencode(params) |
|
url=self.REQUEST['URL1']+"?"+ps |
|
return url |
return url |
|
|
def getLinkAmp(self,param=None,val=None): |
|
"""link to documentviewer with parameter param set to val""" |
|
params=self.REQUEST.form.copy() |
|
if param is not None: |
|
if val is None: |
|
if params.has_key(param): |
|
del params[param] |
|
else: |
|
params[param] = str(val) |
|
|
|
# quote values and assemble into query string |
def getLinkAmp(self, param=None, val=None, params=None, baseUrl=None): |
logging.debug("XYXXXXX: %s"%repr(params.items())) |
"""link to documentviewer with parameter param set to val""" |
ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()]) |
return self.getLink(param, val, params, baseUrl, '&') |
url=self.REQUEST['URL1']+"?"+ps |
|
return url |
|
|
|
def getInfo_xml(self,url,mode): |
def getInfo_xml(self,url,mode): |
"""returns info about the document as XML""" |
"""returns info about the document as XML""" |
Line 338 class documentViewer(Folder):
|
Line 427 class documentViewer(Folder):
|
pt = getattr(self.template, 'info_xml') |
pt = getattr(self.template, 'info_xml') |
return pt(docinfo=docinfo) |
return pt(docinfo=docinfo) |
|
|
|
def getOptionToggle(self, newState=None, optionName='text_options_open', initialState=True): |
|
"""returns new option state""" |
|
if not self.REQUEST.SESSION.has_key(optionName): |
|
# not in session -- initial |
|
opt = {'lastState': newState, 'state': initialState} |
|
else: |
|
opt = self.REQUEST.SESSION.get(optionName) |
|
if opt['lastState'] != newState: |
|
# state in session has changed -- toggle |
|
opt['state'] = not opt['state'] |
|
opt['lastState'] = newState |
|
|
|
self.REQUEST.SESSION[optionName] = opt |
|
return opt['state'] |
|
|
def isAccessible(self, docinfo): |
def isAccessible(self, docinfo): |
"""returns if access to the resource is granted""" |
"""returns if access to the resource is granted""" |
Line 390 class documentViewer(Folder):
|
Line 493 class documentViewer(Folder):
|
|
|
return docinfo |
return docinfo |
|
|
|
def getIndexMetaPath(self,url): |
|
"""gib nur den Pfad zurueck""" |
|
regexp = re.compile(r".*(experimental|permanent)/(.*)") |
|
regpath = regexp.match(url) |
|
if (regpath==None): |
|
return "" |
|
logging.debug("(getDomFromIndexMeta): URLXAXA: %s"%regpath.group(2)) |
|
return ("/mpiwg/online/"+regpath.group(1)+"/"+regpath.group(2)) |
|
|
|
|
|
|
|
def getIndexMetaUrl(self,url): |
|
"""returns utr of index.meta document at url""" |
|
|
def getIndexMeta(self, url): |
|
"""returns dom of index.meta document at url""" |
|
dom = None |
|
metaUrl = None |
metaUrl = None |
if url.startswith("http://"): |
if url.startswith("http://"): |
# real URL |
# real URL |
Line 405 class documentViewer(Folder):
|
Line 518 class documentViewer(Folder):
|
if not metaUrl.endswith("index.meta"): |
if not metaUrl.endswith("index.meta"): |
metaUrl += "/index.meta" |
metaUrl += "/index.meta" |
|
|
logging.debug("(getIndexMeta): METAURL: %s"%metaUrl) |
return metaUrl |
|
|
|
def getDomFromIndexMeta(self, url): |
|
"""get dom from index meta""" |
|
dom = None |
|
metaUrl = self.getIndexMetaUrl(url) |
|
|
|
logging.debug("(getDomFromIndexMeta): METAURL: %s"%metaUrl) |
txt=getHttpData(metaUrl) |
txt=getHttpData(metaUrl) |
if txt is None: |
if txt is None: |
raise IOError("Unable to read index meta from %s"%(url)) |
raise IOError("Unable to read index meta from %s"%(url)) |
Line 445 class documentViewer(Folder):
|
Line 565 class documentViewer(Folder):
|
if dom is None: |
if dom is None: |
for x in range(cut): |
for x in range(cut): |
path=getParentDir(path) |
path=getParentDir(path) |
dom = self.getIndexMeta(path) |
dom = self.getDomFromIndexMeta(path) |
|
|
acctype = dom.xpath("//access-conditions/access/@type") |
acctype = dom.xpath("//access-conditions/access/@type") |
if acctype and (len(acctype)>0): |
if acctype and (len(acctype)>0): |
Line 467 class documentViewer(Folder):
|
Line 587 class documentViewer(Folder):
|
if dom is None: |
if dom is None: |
for x in range(cut): |
for x in range(cut): |
path=getParentDir(path) |
path=getParentDir(path) |
dom = self.getIndexMeta(path) |
dom = self.getDomFromIndexMeta(path) |
|
|
|
docinfo['indexMetaPath']=self.getIndexMetaPath(path); |
|
|
logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path)) |
logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path)) |
# put in all raw bib fields as dict "bib" |
# put in all raw bib fields as dict "bib" |
Line 489 class documentViewer(Folder):
|
Line 611 class documentViewer(Folder):
|
bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC) |
bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC) |
docinfo['bib_type'] = bibtype |
docinfo['bib_type'] = bibtype |
bibmap=metaData.generateMappingForType(bibtype) |
bibmap=metaData.generateMappingForType(bibtype) |
|
logging.debug("documentViewer (getbibinfofromindexmeta) bibmap:"+repr(bibmap)) |
|
logging.debug("documentViewer (getbibinfofromindexmeta) bibtype:"+repr(bibtype)) |
# if there is no mapping bibmap is empty (mapping sometimes has empty fields) |
# if there is no mapping bibmap is empty (mapping sometimes has empty fields) |
if len(bibmap) > 0 and len(bibmap['author'][0]) > 0: |
if len(bibmap) > 0 and len(bibmap['author'][0]) > 0: |
try: |
try: |
Line 505 class documentViewer(Folder):
|
Line 629 class documentViewer(Folder):
|
docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) |
docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) |
except: |
except: |
docinfo['lang']='' |
docinfo['lang']='' |
|
try: |
|
docinfo['city']=getTextFromNode(dom.xpath("//bib/city")[0]) |
|
except: |
|
docinfo['city']='' |
|
try: |
|
docinfo['number_of_pages']=getTextFromNode(dom.xpath("//bib/number_of_pages")[0]) |
|
except: |
|
docinfo['number_of_pages']='' |
|
try: |
|
docinfo['series_volume']=getTextFromNode(dom.xpath("//bib/series_volume")[0]) |
|
except: |
|
docinfo['series_volume']='' |
|
try: |
|
docinfo['number_of_volumes']=getTextFromNode(dom.xpath("//bib/number_of_volumes")[0]) |
|
except: |
|
docinfo['number_of_volumes']='' |
|
try: |
|
docinfo['translator']=getTextFromNode(dom.xpath("//bib/translator")[0]) |
|
except: |
|
docinfo['translator']='' |
|
try: |
|
docinfo['edition']=getTextFromNode(dom.xpath("//bib/edition")[0]) |
|
except: |
|
docinfo['edition']='' |
|
try: |
|
docinfo['series_author']=getTextFromNode(dom.xpath("//bib/series_author")[0]) |
|
except: |
|
docinfo['series_author']='' |
|
try: |
|
docinfo['publisher']=getTextFromNode(dom.xpath("//bib/publisher")[0]) |
|
except: |
|
docinfo['publisher']='' |
|
try: |
|
docinfo['series_title']=getTextFromNode(dom.xpath("//bib/series_title")[0]) |
|
except: |
|
docinfo['series_title']='' |
|
try: |
|
docinfo['isbn_issn']=getTextFromNode(dom.xpath("//bib/isbn_issn")[0]) |
|
except: |
|
docinfo['isbn_issn']='' |
return docinfo |
return docinfo |
|
|
|
|
|
def getNameFromIndexMeta(self,path,docinfo=None,dom=None,cut=0): |
|
"""gets name info from the index.meta file at path or given by dom""" |
|
if docinfo is None: |
|
docinfo = {} |
|
|
|
if dom is None: |
|
for x in range(cut): |
|
path=getParentDir(path) |
|
dom = self.getDomFromIndexMeta(path) |
|
|
|
docinfo['name']=getTextFromNode(dom.xpath("/resource/name")[0]) |
|
logging.debug("documentViewer docinfo[name] %s"%docinfo['name']) |
|
return docinfo |
|
|
def getDocinfoFromTextTool(self, url, dom=None, docinfo=None): |
def getDocinfoFromTextTool(self, url, dom=None, docinfo=None): |
"""parse texttool tag in index meta""" |
"""parse texttool tag in index meta""" |
logging.debug("documentViewer (getdocinfofromtexttool) url: %s" % (url)) |
logging.debug("documentViewer (getdocinfofromtexttool) url: %s" % (url)) |
Line 517 class documentViewer(Folder):
|
Line 694 class documentViewer(Folder):
|
if docinfo.get('lang', None) is None: |
if docinfo.get('lang', None) is None: |
docinfo['lang'] = '' # default keine Sprache gesetzt |
docinfo['lang'] = '' # default keine Sprache gesetzt |
if dom is None: |
if dom is None: |
dom = self.getIndexMeta(url) |
dom = self.getDomFromIndexMeta(url) |
|
|
archivePath = None |
archivePath = None |
archiveName = None |
archiveName = None |
Line 589 class documentViewer(Folder):
|
Line 766 class documentViewer(Folder):
|
if textUrls and (len(textUrls) > 0): |
if textUrls and (len(textUrls) > 0): |
textUrl = getTextFromNode(textUrls[0]) |
textUrl = getTextFromNode(textUrls[0]) |
docinfo['textURLPath'] = textUrl |
docinfo['textURLPath'] = textUrl |
if not docinfo['imagePath']: |
#if not docinfo['imagePath']: |
# text-only, no page images |
# text-only, no page images |
docinfo = self.getNumPages(docinfo) |
#docinfo = self.getNumTextPages(docinfo) |
|
|
|
|
presentationUrls = dom.xpath("//texttool/presentation") |
presentationUrls = dom.xpath("//texttool/presentation") |
docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom) # get info von bib tag |
docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom) # get info von bib tag |
|
docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom) |
|
|
|
|
if presentationUrls and (len(presentationUrls) > 0): # ueberschreibe diese durch presentation informationen |
if presentationUrls and (len(presentationUrls) > 0): # ueberschreibe diese durch presentation informationen |
# presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten |
# presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten |
Line 674 class documentViewer(Folder):
|
Line 854 class documentViewer(Folder):
|
logging.error("documentViewer (getdocinfo) unknown mode: %s!"%mode) |
logging.error("documentViewer (getdocinfo) unknown mode: %s!"%mode) |
raise ValueError("Unknown mode %s! Has to be one of 'texttool','imagepath','filepath'."%(mode)) |
raise ValueError("Unknown mode %s! Has to be one of 'texttool','imagepath','filepath'."%(mode)) |
|
|
|
# FIXME: fake texturlpath |
|
if not docinfo.has_key('textURLPath'): |
|
docinfo['textURLPath'] = None |
|
|
logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo) |
logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo) |
|
#logging.debug("documentViewer (getdocinfo) docinfo: %s"%) |
self.REQUEST.SESSION['docinfo'] = docinfo |
self.REQUEST.SESSION['docinfo'] = docinfo |
return docinfo |
return docinfo |
|
|
def getPageinfo(self, current, start=None, rows=None, cols=None, docinfo=None, viewMode=None, tocMode=None,characterNormalization=""): |
def getPageinfo(self, current, start=None, rows=None, cols=None, docinfo=None, viewMode=None, tocMode=None): |
"""returns pageinfo with the given parameters""" |
"""returns pageinfo with the given parameters""" |
pageinfo = {} |
pageinfo = {} |
current = getInt(current) |
current = getInt(current) |
|
|
pageinfo['current'] = current |
pageinfo['current'] = current |
rows = int(rows or self.thumbrows) |
rows = int(rows or self.thumbrows) |
pageinfo['rows'] = rows |
pageinfo['rows'] = rows |
Line 701 class documentViewer(Folder):
|
Line 887 class documentViewer(Folder):
|
pageinfo['numgroups'] += 1 |
pageinfo['numgroups'] += 1 |
pageinfo['viewMode'] = viewMode |
pageinfo['viewMode'] = viewMode |
pageinfo['tocMode'] = tocMode |
pageinfo['tocMode'] = tocMode |
#pageinfo['characterNormalization'] =characterNormalization |
pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','reg') |
pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization',' ') |
pageinfo['optionToggle'] = self.REQUEST.get('optionToggle','') |
pageinfo['query'] = self.REQUEST.get('query',' ') |
pageinfo['query'] = self.REQUEST.get('query',' ') |
pageinfo['queryType'] = self.REQUEST.get('queryType',' ') |
pageinfo['queryType'] = self.REQUEST.get('queryType',' ') |
pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext') |
pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext') |
Line 711 class documentViewer(Folder):
|
Line 897 class documentViewer(Folder):
|
pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30') |
pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30') |
pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10') |
pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10') |
pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1') |
pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1') |
|
|
toc = int (pageinfo['tocPN']) |
toc = int (pageinfo['tocPN']) |
pageinfo['textPages'] =int (toc) |
pageinfo['textPages'] =int (toc) |
|
|
|
|
|
|
if 'tocSize_%s'%tocMode in docinfo: |
if 'tocSize_%s'%tocMode in docinfo: |
tocSize = int(docinfo['tocSize_%s'%tocMode]) |
tocSize = int(docinfo['tocSize_%s'%tocMode]) |
tocPageSize = int(pageinfo['tocPageSize']) |
tocPageSize = int(pageinfo['tocPageSize']) |