version 1.13, 2004/02/09 11:45:46
|
version 1.16, 2004/03/04 12:59:53
|
Line 10 class ECHO_externalLink contains informa
|
Line 10 class ECHO_externalLink contains informa
|
|
|
""" |
""" |
import string |
import string |
|
import re |
import OFS.Image |
import OFS.Image |
from types import * |
from types import * |
from OFS.Image import Image |
from OFS.Image import Image |
Line 23 from Products.PageTemplates.PageTemplate
|
Line 24 from Products.PageTemplates.PageTemplate
|
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Globals import Persistent |
from Globals import Persistent |
from Acquisition import Implicit |
from Acquisition import Implicit |
from pyPgSQL import libpq |
#from psycopg import libpq |
|
#from pyPgSQL import libpq |
|
import xml.dom.minidom |
|
|
import urllib |
import urllib |
import xml.dom.minidom |
import xml.dom.minidom |
Line 413 class ECHO_collection(Folder, Persistent
|
Line 416 class ECHO_collection(Folder, Persistent
|
security.declarePublic('getCreditObject') |
security.declarePublic('getCreditObject') |
def getCreditObject(self,name): |
def getCreditObject(self,name): |
"""credit id to credititem""" |
"""credit id to credititem""" |
|
try: |
return getattr(self.partners,name) |
return getattr(self.partners,name) |
|
except: |
|
return "" |
|
|
security.declarePublic('ECHO_generateNavBar') |
security.declarePublic('ECHO_generateNavBar') |
def ECHO_generateNavBar(self): |
def ECHO_generateNavBar(self): |
Line 532 class ECHO_collection(Folder, Persistent
|
Line 538 class ECHO_collection(Folder, Persistent
|
def changeECHO_collection(self,title,label,description,content_type,responsible,weight,credits=None,sortfield="weight",coords=None,RESPONSE=None): |
def changeECHO_collection(self,title,label,description,content_type,responsible,weight,credits=None,sortfield="weight",coords=None,RESPONSE=None): |
"""Änderung der Properties""" |
"""Änderung der Properties""" |
|
|
|
try: |
coordsnew=[ string.split(x,",") for x in coords] |
coordsnew=[ string.split(x,",") for x in coords] |
|
except: |
|
coordsnew=[] |
|
|
setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coordsnew) |
setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coordsnew) |
|
|
Line 652 class ECHO_root(Folder,Persistent,Implic
|
Line 661 class ECHO_root(Folder,Persistent,Implic
|
self.id = id |
self.id = id |
self.title=title |
self.title=title |
|
|
|
def deleteSpace(self,str): |
|
"""delete space at the end of a line""" |
|
if str[len(str)-1]==" ": |
|
return str[0:len(str)-1] |
|
else: |
|
return str |
|
|
|
|
|
|
|
# zusaetliche methoden fuer das vlp muessen in ein eigenes produkt |
|
|
|
def formatAscii(self,str,url=None): |
|
"""ersetze ascii umbrueche durch <br>""" |
|
#url=None |
|
if url: |
|
|
|
retStr="" |
|
words=str.split("\n") |
|
|
|
for word in words: |
|
strUrl=url%word |
|
print "str",strUrl |
|
retStr+="""<a href="%s">%s</a><br/>"""%(strUrl,word) |
|
str=retStr |
|
if str: |
|
return re.sub(r"[\n]","<br/>",str) |
|
else: |
|
return "" |
|
|
|
def link2html(self,str): |
|
"""link2html fuer VLP muss hier noch raus""" |
|
if str: |
|
print str |
|
str=re.sub("\&","&",str) |
|
dom=xml.dom.minidom.parseString("<?xml version='1.0' ?><txt>"+str+"</txt>") |
|
links=dom.getElementsByTagName("link") |
|
|
|
print "link",links |
|
for link in links: |
|
link.tagName="a" |
|
ref=link.getAttribute("ref") |
|
if self.checkRef(ref): |
|
link.setAttribute("href",self.aq_parent.absolute_url()+"/vlp_coll?id="+ref) |
|
|
|
return dom.toxml('utf-8') |
|
return "" |
|
|
|
|
|
def checkRef(self,ref): |
|
dbs={'vl_literature':'AND CD LIKE \'%lise%\'','vl_technology':'','vl_people':''} |
|
res=None |
|
for db in dbs.keys(): |
|
#print ref,"select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db]) |
|
|
|
res=res or self.search(var=str("select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db]))) |
|
return res |
|
|
|
#Ende Methode fuer vlp |
|
|
def PgQuoteString(self,string): |
def PgQuoteString(self,string): |
"""Quote string""" |
"""Quote string""" |
print "PG",string |
#print "PG",string |
return libpq.PgQuoteString(string) |
return libpq.PgQuoteString(string) |
|
|
def getPartners(self): |
def getPartners(self): |