Index: MpdlXmlTextServer.py
===================================================================
--- MpdlXmlTextServer.py	(revision 477)
+++ MpdlXmlTextServer.py	(revision 478)
@@ -90,5 +90,5 @@
         pagesize = pageinfo['queryPageSize']
         pn = pageinfo.get('searchPN',1)
-        sn = pageinfo['sn']
+        sn = pageinfo.get('sn',None) #TODO: is this s now?
         highlightQuery = pageinfo['highlightQuery']
         query =pageinfo['query']
@@ -270,5 +270,5 @@
         """returns single page from fulltext"""
         logging.debug("getTextPage mode=%s, pn=%s"%(mode,pn))
-        # check for cached text -- but this shouldn't be called twice
+        # check for cached text -- but ideally this shouldn't be called twice
         if pageinfo.has_key('textPage'):
             logging.debug("getTextPage: using cached text")
@@ -288,5 +288,6 @@
         tocPN = pageinfo.get('tocPN',None)
         characterNormalization = pageinfo.get('characterNormalization', None)
-        selfurl = docinfo['viewerUrl']   
+        
+        selfurl = docinfo['viewerUrl']
         
         if mode == "dict" or mode == "text_dict":
@@ -323,4 +324,6 @@
         # plain text mode
         if mode == "text":
+            # get full url assuming documentViewer is parent
+            selfurl = self.getLink()
             if pagediv is not None:
                 links = pagediv.findall(".//a")
@@ -328,5 +331,5 @@
                     href = l.get('href')
                     if href and href.startswith('#note-'):
-                        href = href.replace('#note-',"?mode=%s&url=%s&viewMode=text&tocMode=%s&tocPN=%s&pn=%s#note-"%(urlmode,url,tocMode,tocPN,pn))
+                        href = href.replace('#note-',"%s#note-"%selfurl)
                         l.set('href', href)
 
@@ -336,4 +339,6 @@
         elif mode == "dict":
             if pagediv is not None:
+                viewerurl = docinfo['viewerUrl']
+                selfurl = self.getLink()
                 # check all a-tags
                 links = pagediv.findall(".//a")
@@ -344,12 +349,11 @@
                         # is link with href
                         if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql'):
-                            # is pollux link
-                            selfurl = self.absolute_url()
-                            # change href
-                            l.set('href', href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/head_main_voc'%selfurl))
-                            # add target
+                            # is dictionary link - change href (keeping parameters)
+                            l.set('href', href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/template/viewer_wordinfo'%viewerurl))
+                            # add target to open new page
                             l.set('target', '_blank')
                                                           
-                        if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'):    
+                        # TODO: is this needed?
+                        if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'):
                             selfurl = self.absolute_url()
                             l.set('href', href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql','%s/head_main_lemma'%selfurl))
@@ -359,5 +363,6 @@
                     
                         if href.startswith('#note-'):
-                            l.set('href', href.replace('#note-',"?mode=%s&url=%s&viewMode=text_dict&tocMode=%s&tocPN=%s&pn=%s#note-"%(urlmode,url,tocMode,tocPN,pn)))
+                            # note link
+                            l.set('href', href.replace('#note-',"%s#note-"%selfurl))
                               
                 return serialize(pagediv)
@@ -390,26 +395,8 @@
         return "no text here"
     
-    # WTF: is this needed?
-    def getOrigPages(self, docinfo=None, pageinfo=None):
-        logging.debug("CALLED: getOrigPages!")
-        if not pageinfo.has_key('pageNumberOrig'):
-            logging.warning("getOrigPages: not in pageinfo!")
-            return None
-        
-        return pageinfo['pageNumberOrig']
-    
-    # WTF: is this needed?
-    def getOrigPagesNorm(self, docinfo=None, pageinfo=None):
-        logging.debug("CALLED: getOrigPagesNorm!")
-        if not pageinfo.has_key('pageNumberOrigNorm'):
-            logging.warning("getOrigPagesNorm: not in pageinfo!")
-            return None
-        
-        return pageinfo['pageNumberOrigNorm']
-                
     # TODO: should be getWordInfo
-    def getTranslate(self, word=None, language=None):
-        """translate into another languages"""
-        data = self.getServerData("lt/wordInfo.xql","language="+str(language)+"&word="+urllib.quote(word)+"&output=html")
+    def getWordInfo(self, word='', language='', display=''):
+        """show information (like dictionaries) about word"""
+        data = self.getServerData("lt/wordInfo.xql","language=%s&word=%s&display=%s&output=html"%(language,urllib.quote(word),urllib.quote(display)))
         return data
     
