Changeset 68:b8457fc33446 in documentViewer


Ignore:
Timestamp:
Jun 25, 2008, 10:47:58 AM (16 years ago)
Author:
dwinter
Branch:
default
Message:

piclens rss/support

Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r65 r68  
    8484    info_xml = PageTemplateFile('zpt/info_xml', globals())
    8585
     86    thumbs_main_rss = PageTemplateFile('zpt/thumbs_main_rss', globals())
    8687    security.declareProtected('View management screens','changeDocumentViewerForm')   
    8788    changeDocumentViewerForm = PageTemplateFile('zpt/changeDocumentViewer', globals())
     
    107108
    108109
     110    security.declareProtected('View','thumbs_rss')
     111    def thumbs_rss(self,mode,url,viewMode="auto",start=None,pn=1):
     112        '''
     113        view it
     114        @param mode: defines how to access the document behind url
     115        @param url: url which contains display information
     116        @param viewMode: if images display images, if text display text, default is images (text,images or auto)
     117       
     118        '''
     119        logging.info("HHHHHHHHHHHHHH:load the rss")
     120        logger("documentViewer (index)", logging.INFO, "mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn))
     121       
     122        if not hasattr(self, 'template'):
     123            # create template folder if it doesn't exist
     124            self.manage_addFolder('template')
     125           
     126        if not self.digilibBaseUrl:
     127            self.digilibBaseUrl = self.findDigilibUrl() or "http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary"
     128           
     129        docinfo = self.getDocinfo(mode=mode,url=url)
     130        pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo)
     131        pt = getattr(self.template, 'thumbs_main_rss')
     132       
     133        if viewMode=="auto": # automodus gewaehlt
     134            if docinfo.get("textURL",'') and self.textViewerUrl: #texturl gesetzt und textViewer konfiguriert
     135                viewMode="text"
     136            else:
     137                viewMode="images"
     138               
     139        return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode)
     140 
    109141    security.declareProtected('View','index_html')
    110142    def index_html(self,mode,url,viewMode="auto",start=None,pn=1):
     
    154186        return url
    155187
    156 
     188    def getLinkAmp(self,param=None,val=None):
     189        """link to documentviewer with parameter param set to val"""
     190        params=self.REQUEST.form.copy()
     191        if param is not None:
     192            if val is None:
     193                if params.has_key(param):
     194                    del params[param]
     195            else:
     196                params[param] = str(val)
     197               
     198        # quote values and assemble into query string
     199        logging.info("XYXXXXX: %s"%repr(params.items()))
     200        ps = "&".join(["%s=%s"%(k,urllib.quote(v)) for (k, v) in params.items()])
     201        url=self.REQUEST['URL1']+"?"+ps
     202        return url
    157203    def getInfo_xml(self,url,mode):
    158204        """returns info about the document as XML"""
Note: See TracChangeset for help on using the changeset viewer.