Mercurial > hg > MPIWGThesaurus
changeset 35:cfb5bb05253a
direct oeffne des thesaurus mit neuem parameter open
author | dwinter |
---|---|
date | Thu, 24 Oct 2013 14:46:22 +0200 |
parents | 0b58b298ef44 |
children | e13200d8d473 |
files | MPIWGThesaurus.py zpt/levelFormatted.zpt |
diffstat | 2 files changed, 53 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGThesaurus.py Wed Jun 12 16:06:57 2013 +0200 +++ b/MPIWGThesaurus.py Thu Oct 24 14:46:22 2013 +0200 @@ -645,6 +645,16 @@ def getTitle(self,entry): return entry.title + def thes_quote(self,txt): + import md5 + logging.debug("@*%s*@"%txt) + return md5.md5(txt.lower()).hexdigest() + + + def formatTag(self,tag): + splitted= tag.split("_") + return splitted[-1] + def getEntriesFormatted(self,entries,formatType): if not hasattr(self,'levelFormatted'): pt=PageTemplateFile('zpt/levelFormatted', globals()).__of__(self) @@ -657,7 +667,7 @@ #return self.levelFormatted(level1_entries=entries,type=formatType) def getEntries(self,entry): - logging.debug("GETENTRY:"+repr(entry)) + #logging.debug("GETENTRY:"+repr(entry)) return entry.entries #nimmt ein eine Text der Form @@ -702,10 +712,47 @@ return self.tagList + def getTagsAsHash(self,projectID,tagType=None): + """get all tags""" + retHash={} + + tags = getattr(self,"tags",None) + + if tags is None: + return; + + #falls nicht gesetzt + if tagType is None: + tagTypes = tags.keys() + else: + tagTypes = [tagType] + + for tagType in tagTypes: + retHash[tagType]=[] + tagsStored=tags.get(tagType,None) + + if tagsStored is None: + return; + + for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached + logging.debug("checking:"+tag) + currentTag = tagsStored.get(tag,None) + if currentTag is None: + continue + if currentTag.has_key(projectID): + retHash[tagType].append("""%s"""%tag) + + logging.debug(retHash) + return retHash + + + + + def getTagsJSON(self,projectID,tagType,RESPONSE=None): """get all selected tagList""" - logging.debug("asking:"+projectID) - logging.debug("asking tag::"+tagType) + #logging.debug("asking:"+projectID) + #logging.debug("asking tag::"+tagType) retList=[] tags = getattr(self,"tags",None) if tags is None: @@ -736,7 +783,7 @@ """get all selected tagList""" #projectTags = self.getProjectsAndTags() - logging.debug(projectTags) + #logging.debug(projectTags) project = projectTags.get(projectID) if project is None:
--- a/zpt/levelFormatted.zpt Wed Jun 12 16:06:57 2013 +0200 +++ b/zpt/levelFormatted.zpt Thu Oct 24 14:46:22 2013 +0200 @@ -6,7 +6,7 @@ <h3> <img class="fold_open" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_open.png'" alt="" /><img class="fold_closed" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_closed.png'" alt=""> - <span class="linklike" tal:content="python:here.getTitle(level1) +' ('+ str(len(level1entries)) +')' ">Lorem</span> + <span tal:attributes="id python:here.thes_quote(here.getTitle(level1))" class="linklike" tal:content="python:here.getTitle(level1) +' ('+ str(len(level1entries)) +')' ">Lorem</span> </h3> </li> @@ -29,7 +29,7 @@ <h3 class="fold_head2"> <img class="fold_open" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_open.png'" alt="" /><img class="fold_closed" tal:attributes="src python:root.absolute_url()+'/www/images/foldout_closed.png'" alt=""> - <span class="linklike" tal:content="python:here.getTitle(proj)+' ('+str(len(subitems))+')'">Lor</span> + <span tal:attributes="id python:here.thes_quote((here.getTitle(level1)+'_'+here.getTitle(proj)))" class="linklike" tal:content="python:here.getTitle(proj)+' ('+str(len(subitems))+')'">Lor</span> </h3> <div class="level2 fold_body2"> <table class="items">