--- ECHO_content/vlp_xmlhelpers.py 2005/10/26 17:30:26 1.6 +++ ECHO_content/vlp_xmlhelpers.py 2006/11/21 16:49:58 1.7 @@ -212,6 +212,46 @@ def link2html(self,str): return "" + +def related2html(self,str): + """related library items: xlinks in html wandeln / mb 21.11.2006""" + if str: + + str=re.sub("\&","&",str) + dom=xml.dom.minidom.parseString(""+str+"") + links=dom.getElementsByTagName("link") + + for link in links: + link.tagName = "a" + ref = link.getAttribute("ref") + pn = link.getAttribute("page") + + searchStr=str("select fullreference, online from vl_literature where reference =\'%s\' and authorized = 1"%(ref)) + res = self.search(var=searchStr) + + if res: + if res.online == 1: # achtung: syntax?! = feld 'online' vom abfrageergebnis + # item online verfuegbar + link.setAttribute("title", "click to view") + if pn: + link.setAttribute("href",self.REQUEST['SERVER_URL']+"/references?id="+ref+"&page="+pn) + else: + link.setAttribute("href",self.REQUEST['SERVER_URL']+"/references?id="+ref) + else: + # item nur als bibliographische angabe vorhanden + link.setAttribute("alt", res.fullreference) # achtung: syntax? + link.setAttribute("title", "click to expand") + link.setAttribute("onclick", "return toggle(this);") + link.setAttribute("class", "x_offline") + + newxml=dom.toxml('utf-8') + + retStr=regexpTXT.search(newxml) + + return retStr.group(1) + + return "" +