Index: MpdlXmlTextServer.py
===================================================================
--- MpdlXmlTextServer.py	(revision 559)
+++ MpdlXmlTextServer.py	(revision 561)
@@ -33,9 +33,10 @@
     manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals())
         
-    def __init__(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40):
+    def __init__(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40, repositoryType='production'):
         """constructor"""
         self.id=id
         self.title=title
         self.timeout = timeout
+        self.repositoryType = repositoryType
         if serverName is None:
             self.serverUrl = serverUrl
@@ -52,4 +53,8 @@
         return getHttpData(url,data,timeout=self.timeout)
 
+
+    def getRepositoryType(self):
+        """returns the repository type, e.g. 'production'"""
+        return self.repositoryType
 
     def getTextDownloadUrl(self, type='xml', docinfo=None):
@@ -565,9 +570,11 @@
            
     
-    def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
+    def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,repositoryType=None,RESPONSE=None):
         """change settings"""
         self.title=title
         self.timeout = timeout
         self.serverUrl = serverUrl
+        if repositoryType:
+            self.repositoryType = repositoryType
         if RESPONSE is not None:
             RESPONSE.redirect('manage_main')
Index: documentViewer.py
===================================================================
--- documentViewer.py	(revision 560)
+++ documentViewer.py	(revision 561)
@@ -33,4 +33,11 @@
     #    stream.close()
     return s
+
+def getMDText(node):
+    """returns the @text content from the MetaDataProvider metadata node"""
+    if isinstance(node, dict):
+        return node.get('@text', None)
+    
+    return node
 
 def browserCheck(self):
@@ -220,4 +227,8 @@
         return self.template.fulltextclient.getTocPage(**args)
 
+    def getRepositoryType(self, **args):
+        """get repository type"""
+        return self.template.fulltextclient.getRepositoryType(**args)
+
     def getTextDownloadUrl(self, **args):
         """get list of gis places on one page"""
@@ -571,5 +582,5 @@
 
             # texttool info
-            texttool = self.metadataService.getTexttoolData(dom=metaDom)
+            texttool = self.metadataService.getTexttoolData(dom=metaDom, recursive=1, all=True)
             if texttool:
                 docinfo = self.getDocinfoFromTexttool(docinfo, texttool)
@@ -676,7 +687,12 @@
     def getDocinfoFromTexttool(self, docinfo, texttool):
         """reads contents of texttool element into docinfo"""
+        logging.debug("texttool=%s"%repr(texttool))
+        # unpack list if necessary
+        if isinstance(texttool, list):
+            texttool = texttool[0]
+                                    
         # image dir
-        imageDir = texttool.get('image', None)
-        docPath = docinfo.get('documentPath', None)
+        imageDir = getMDText(texttool.get('image', None))
+        docPath = getMDText(docinfo.get('documentPath', None))
         if imageDir and docPath:
             #print "image: ", imageDir, " archivepath: ", archivePath
@@ -686,5 +702,5 @@
         
         # old style text URL
-        textUrl = texttool.get('text', None)
+        textUrl = getMDText(texttool.get('text', None))
         if textUrl and docPath:
             if urlparse.urlparse(textUrl)[0] == "": #keine url
@@ -693,20 +709,35 @@
             docinfo['textURL'] = textUrl
     
-        # new style text-url-path
-        textUrl = texttool.get('text-url-path', None)
-        if textUrl:
-            docinfo['textURLPath'] = textUrl
+        # new style text-url-path (can be more than one with "repository" attribute)
+        textUrlNode = texttool.get('text-url-path', None)
+        if not isinstance(textUrlNode, list):
+            textUrlNode = [textUrlNode]
+
+        for tun in textUrlNode:
+            textUrl = getMDText(tun)
+            if textUrl:
+                textUrlAtts = tun.get('@attr')
+                if (textUrlAtts and 'repository' in textUrlAtts):
+                    textRepo = textUrlAtts['repository']
+                    # use matching repository
+                    if self.getRepositoryType() == textRepo:
+                        docinfo['textURLPath'] = textUrl
+                        docinfo['textURLRepository'] = textRepo
+                
+                else:
+                    # no repo attribute - use always
+                    docinfo['textURLPath'] = textUrl
             
         # page flow
-        docinfo['pageFlow'] = texttool.get('page-flow', 'ltr')
+        docinfo['pageFlow'] = getMDText(texttool.get('page-flow', 'ltr'))
             
         # odd pages are left
-        docinfo['oddPage'] = texttool.get('odd-scan-position', 'left')
+        docinfo['oddPage'] = getMDText(texttool.get('odd-scan-position', 'left'))
             
         # number of title page (default 1)
-        docinfo['titlePage'] = texttool.get('title-scan-no', 1)
+        docinfo['titlePage'] = getMDText(texttool.get('title-scan-no', 1))
             
         # old presentation stuff
-        presentation = texttool.get('presentation', None)
+        presentation = getMDText(texttool.get('presentation', None))
         if presentation and docPath:
             if presentation.startswith('http:'):
Index: zpt/manage_changeMpdlXmlTextServer.zpt
===================================================================
--- zpt/manage_changeMpdlXmlTextServer.zpt	(revision 6)
+++ zpt/manage_changeMpdlXmlTextServer.zpt	(revision 561)
@@ -12,4 +12,6 @@
         <p class="form-optional">Timeout (s)</p>
         <p class="form-element"><input size="3" tal:attributes="value here/timeout | default" name="timeout"></p>
+        <p class="form-optional">Repository type</p>
+        <p class="form-element"><input size="10" tal:attributes="value here/repositoryType | default" name="repositoryType"></p>
 		<p><input type="submit" value="change"></p>
 		</form>
