Index: SrvTxtUtils.py
===================================================================
--- SrvTxtUtils.py	(revision 614)
+++ SrvTxtUtils.py	(revision 620)
@@ -11,5 +11,4 @@
 import time
 import re
-import string
 import datetime
 try:
@@ -23,32 +22,52 @@
 import xml.etree.ElementTree as ET
 
-srvTxtUtilsVersion = "1.12.2"
+srvTxtUtilsVersion = "1.12.3"
 
 map_months = {'en': [u"",
-               u"January",
-               u"February",
-               u"March",
-               u"April",
-               u"May",
-               u"June",
-               u"July",
-               u"August",
-               u"September",
-               u"October",
-               u"November",
-               u"December"],
+                     u"January",
+                     u"February",
+                     u"March",
+                     u"April",
+                     u"May",
+                     u"June",
+                     u"July",
+                     u"August",
+                     u"September",
+                     u"October",
+                     u"November",
+                     u"December"],
               'de': [u"",
-               u"Januar",
-               u"Februar",
-               u"M\u00e4rz",
-               u"April",
-               u"Mai",
-               u"Juni",
-               u"Juli",
-               u"August",
-               u"September",
-               u"Oktober",
-               u"November",
-               u"Dezember"]}
+                     u"Januar",
+                     u"Februar",
+                     u"M\u00e4rz",
+                     u"April",
+                     u"Mai",
+                     u"Juni",
+                     u"Juli",
+                     u"August",
+                     u"September",
+                     u"Oktober",
+                     u"November",
+                     u"Dezember"]}
+
+map_weekdays_short = {'en': [
+                             u"Mo",
+                             u"Tu",
+                             u"We",
+                             u"Th",
+                             u"Fr",
+                             u"Sa",
+                             u"Su",
+                             ],
+                      'de': [
+                             u"Mo",
+                             u"Di",
+                             u"Mi",
+                             u"Do",
+                             u"Fr",
+                             u"Sa",
+                             u"So",
+                            ]}
+
 
 def getInt(number, default=0):
@@ -85,11 +104,15 @@
     if isinstance(s, str):
         return s
-    elif isinstance(s, unicode):
+    else:
         return s.encode('utf-8')
-    else:
-        return str(s)
-
-def getText(node, recursive=0):
-    """returns all text content of a (etree) node and its subnodes"""
+
+
+def getTextFromNode(node, recursive=False, length=0):
+    """Return all text content of a (etree) node.
+    
+    :param recursive: descend subnodes
+    
+    :returns: text string
+    """
     if node is None:
         return ''
@@ -114,4 +137,53 @@
     return text
 
+getText = getTextFromNode
+
+def getPlaintext(text, length=0, wordwrap=False, ignoretags=[]):
+    """Return plain text content by filtering out XML tags.
+    
+    :param text: string or etree node
+    :param length: length of text to return (0=all)
+    :param wordwrap: try not to break the last word (may return shorter string)
+    :returns: text string
+    """
+    if text is None:
+        return ''
+    
+    try:
+        if isinstance(text, basestring):
+            xmltext = utf8ify("<div>%s</div>"%text)
+            dom = ET.fromstring(xmltext)
+        else:
+            dom = text
+            
+        plaintext = ''
+        for elem in dom.iter():
+            if elem.tag in ignoretags:
+                # ignore tag
+                continue
+            
+            if elem.text:
+                plaintext += elem.text
+            if elem.tail:
+                plaintext += elem.tail
+                
+            if length > 0 and len(plaintext) > length:
+                break
+
+        text = plaintext
+        
+    except Exception, e:
+        logging.warn("getPlaintext: error parsing text! Returning everything. %s"%e)
+                
+    if length > 0 and len(text) > length:
+        # try to not break words
+        if wordwrap and text[length] not in [' ', '.', '?', '!']:
+            # search the last blank
+            length = text.rfind(' ', 0, length)
+
+        return text[:length] + '...'
+    
+    return text
+
 
 def serialize(node):
@@ -128,8 +200,13 @@
 def getMonthName(mon, lang):
     """returns the name of the month mon in the language lang"""
-    return map_months[lang][mon]
-
-
-def getDateString(date=None, lang='en', withYear=True, monthNames=True, abbrev=False):
+    return map_months[lang.lower()][mon]
+
+
+def getWeekdayName(day, lang, short=True):
+    """returns the name of the weekday day in the language lang"""
+    return map_weekdays_short[lang.lower()][day]
+
+
+def getDateString(date=None, lang='en', short=False, withYear=True, monthNames=True, abbrev=False):
     """Return formatted date string."""
     if date is None:
@@ -149,12 +226,18 @@
         
     if lang.lower() == 'en':
-        ds = "%s %s"%(getMonthName(month, lang), day)
-        if withYear:
-            ds += ", %s"%year
+        if short:
+            ds = "%s/%s/%s"%(year,month,day)
+        else:
+            ds = "%s %s"%(getMonthName(month, lang), day)
+            if withYear:
+                ds += ", %s"%year
             
     elif lang.lower() == 'de':
-        ds = "%s. %s"%(day, getMonthName(month, lang))
-        if withYear:
-            ds += " %s"%year
+        if short:
+            ds = "%s.%s.%s"%(day,month,year)
+        else:
+            ds = "%s. %s"%(day, getMonthName(month, lang))
+            if withYear:
+                ds += " %s"%year
 
     elif lang.lower() == 'iso':
@@ -206,5 +289,5 @@
             
             except httplib2.HttpLib2Error, e:
-                logging.error("getHttp(lib2)Data: HTTP error(%s): %s"%(e.code,e))
+                logging.error("getHttp(lib2)Data: HTTP error(%s): %s"%(getattr(e, 'code','?'),e))
                 errmsg = str(e)
                 # stop trying
@@ -286,29 +369,2 @@
 
 
-def getBrowserType(self):
-    """(legacy) 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
-    if string.find(ua, 'MSIE') > -1:
-        bt['isIE'] = True
-    else:
-        bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)
-        
-    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
-    
-    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
-
Index: zpt/viewer/layer_text_annotator.zpt
===================================================================
--- zpt/viewer/layer_text_annotator.zpt	(revision 619)
+++ zpt/viewer/layer_text_annotator.zpt	(revision 620)
@@ -28,5 +28,5 @@
 
   <script type="text/javascript" 
-    tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager;
+    tal:define="global annServerUrl string:https://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager;
     annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']);
     resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']);
