--- ECHO_content/ECHO_helpers.py 2008/09/08 19:23:18 1.91 +++ ECHO_content/ECHO_helpers.py 2008/12/17 12:02:53 1.95 @@ -27,6 +27,10 @@ def logger(txt,method,txt2): displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder','extVersionedFileFolder','ECHO_movie'] +def normalizeCt(str): + """normalizes content_type""" + #str= str.replace(" ","_") + return str.replace("-"," ").lower() #decode and compress for xmlrpc communication with OSAS_server @@ -84,6 +88,33 @@ class ECHO_basis: management_page_charset="utf-8" isVisible = True + # Managment for the PID + def setPID(self,pid): + """set the pid""" + self.pid=pid + return True + + def getPID(self): + """get the pid""" + pid =getattr(self,'pid',None) + + # teste ob dieses pid wirklich die des objektes und nich vererbt wurde + if pid == self.getParentPID(): + return None + else: + return pid + + def getParentPID(self): + """get the PID of the parent""" + parent = self.aq_parent + + pidF = getattr(parent,'getPID',None) + + if pidF is None: + return None + + else: + return pidF() def unicodify(self, s): """return unicode object for string (utf-8 or latin1) or unicode object s""" @@ -207,6 +238,12 @@ class ECHO_basis: return self.isVisible return True + def getDescription(self): + """get content of description field""" + + + return self.unicodify(getattr(self,'description','')); + def getTitle(self): """title""" if hasattr(self,'getLanguage'): @@ -456,6 +493,17 @@ class ECHO_basis: bt = BrowserCheck(self) id = ob.getFullId() link = ob.getLinkId() + url = ob.getTargetUrl() + if url == "": + # ECHOResource with empty link -> no link + href = 'href="#" onclick="return false;"' + else: + href = 'href="%s"'%ob.getLinkId() + + if target is None: + targetattr = "" + else: + targetattr = 'target="%s"'%target tiptext = ob.getTip() tag = "" @@ -481,7 +529,7 @@ class ECHO_basis: if float(rot) < 0: marksrc = circlesrc - tag += ''%(link,marksrc,rot) + tag += ''%(href,marksrc,rot) elif ob.isTypeText(): # N4 - Text tag += '
'%(id,id,id,link,target) + tag = ''%(id,id,id,href,targetattr) if ob.isTypeArrow(): # DOM - Arrow rot = ob.angle