Mercurial > hg > documentViewer
comparison documentViewer.py @ 106:9f11913bc132
*** empty log message ***
author | abukhman |
---|---|
date | Thu, 20 May 2010 11:28:36 +0200 |
parents | 6bffb612cd6a |
children | 53c395d3175f |
comparison
equal
deleted
inserted
replaced
105:6bffb612cd6a | 106:9f11913bc132 |
---|---|
665 pageinfo['query'] = self.REQUEST.get('query',' ') | 665 pageinfo['query'] = self.REQUEST.get('query',' ') |
666 pageinfo['queryType'] = self.REQUEST.get('queryType',' ') | 666 pageinfo['queryType'] = self.REQUEST.get('queryType',' ') |
667 pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext') | 667 pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext') |
668 | 668 |
669 pageinfo['textPN'] = self.REQUEST.get('textPN','1') | 669 pageinfo['textPN'] = self.REQUEST.get('textPN','1') |
670 | 670 pageinfo['highlightQuery'] = self.REQUEST.get('highlightQuery','') |
671 pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30') | 671 pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30') |
672 pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10') | 672 pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10') |
673 pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1') | 673 pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1') |
674 toc = int (pageinfo['tocPN']) | 674 toc = int (pageinfo['tocPN']) |
675 pageinfo['textPages'] =int (toc) | 675 pageinfo['textPages'] =int (toc) |
697 logging.debug("documentViewer (gettoc) docpath: %s"%(docpath)) | 697 logging.debug("documentViewer (gettoc) docpath: %s"%(docpath)) |
698 logging.debug("documentViewer (gettoc) url: %s"%(url)) | 698 logging.debug("documentViewer (gettoc) url: %s"%(url)) |
699 pagesize = pageinfo['queryPageSize'] | 699 pagesize = pageinfo['queryPageSize'] |
700 pn = pageinfo['searchPN'] | 700 pn = pageinfo['searchPN'] |
701 sn = pageinfo['sn'] | 701 sn = pageinfo['sn'] |
702 highlightQuery = pageinfo['highlightQuery'] | |
702 query =pageinfo['query'] | 703 query =pageinfo['query'] |
703 queryType =pageinfo['queryType'] | 704 queryType =pageinfo['queryType'] |
704 viewMode= pageinfo['viewMode'] | 705 viewMode= pageinfo['viewMode'] |
705 tocMode = pageinfo['tocMode'] | 706 tocMode = pageinfo['tocMode'] |
706 tocPN = pageinfo['tocPN'] | 707 tocPN = pageinfo['tocPN'] |
722 selfurl = self.absolute_url() | 723 selfurl = self.absolute_url() |
723 #l.setAttributeNS(None, "span class = 'hit highlight'", "background-color: #77DD77;") | 724 #l.setAttributeNS(None, "span class = 'hit highlight'", "background-color: #77DD77;") |
724 pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s'%(viewMode,queryType,query,pagesize,pn,tocMode,pn,tocPN)) | 725 pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s'%(viewMode,queryType,query,pagesize,pn,tocMode,pn,tocPN)) |
725 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) | 726 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) |
726 l.setAttributeNS(None, "onClick", "id='highlighting'") | 727 l.setAttributeNS(None, "onClick", "id='highlighting'") |
728 logging.debug("documentViewer (gettoc) highlightQuery: %s"%(highlightQuery)) | |
727 l.setAttributeNS(None, "highlightQuery", "id='highlighting'") | 729 l.setAttributeNS(None, "highlightQuery", "id='highlighting'") |
728 return serializeNode(pagenode) | 730 return serializeNode(pagenode) |
729 | 731 |
730 if (queryType=="fulltextMorph"): | 732 if (queryType=="fulltextMorph"): |
731 pagedivs = pagedom.xpath("//div[@class='queryResult']") | 733 pagedivs = pagedom.xpath("//div[@class='queryResult']") |
760 href = hrefNode.nodeValue | 762 href = hrefNode.nodeValue |
761 hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s'%(viewMode,tocMode,tocPN,pn)) | 763 hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s'%(viewMode,tocMode,tocPN,pn)) |
762 | 764 |
763 if href.startswith('../lt/lex.xql'): | 765 if href.startswith('../lt/lex.xql'): |
764 # selfurl = self.absolute_url() | 766 # selfurl = self.absolute_url() |
765 hrefNode.nodeValue = href.replace('../lt/lex.xql','%s../template/head_main_voc'%selfurl) | 767 hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_voc'%selfurl) |
766 l.setAttributeNS(None, 'target', '_blank') | 768 l.setAttributeNS(None, 'target', '_blank') |
767 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") | 769 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") |
768 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') | 770 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') |
769 if href.startswith('../lt/lemma.xql'): | 771 if href.startswith('../lt/lemma.xql'): |
770 #selfurl = self.absolute_url() | 772 #selfurl = self.absolute_url() |
771 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s../template/head_main_lemma'%selfurl) | 773 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl) |
772 l.setAttributeNS(None, 'target', '_blank') | 774 l.setAttributeNS(None, 'target', '_blank') |
773 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") | 775 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") |
774 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') | 776 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') |
775 return serializeNode(pagenode) | 777 return serializeNode(pagenode) |
776 return "no text here" | 778 return "no text here" |