Mercurial > hg > MPIWGWeb
changeset 34:b8ced08ebea9
working on projects.
author | casties |
---|---|
date | Thu, 25 Apr 2013 12:07:56 +0200 |
parents | 01b5265264b6 |
children | 38cbbeaf266b |
files | HashTree.py MPIWGDepartment.py MPIWGProjects.py zpt/project/project_template.zpt |
diffstat | 4 files changed, 247 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/HashTree.py Wed Apr 24 20:48:45 2013 +0200 +++ b/HashTree.py Thu Apr 25 12:07:56 2013 +0200 @@ -31,7 +31,7 @@ def getSubtreeAsList(self): - """returns the subtree as list sorted by key (depth first)""" + """returns the subtree as flattened list sorted by key (depth first)""" if self.children is None: if self.value is None: return []
--- a/MPIWGDepartment.py Wed Apr 24 20:48:45 2013 +0200 +++ b/MPIWGDepartment.py Thu Apr 25 12:07:56 2013 +0200 @@ -156,7 +156,7 @@ onlyArchived = 2 : archived projects """ pf = self.en.getProjectFolder() - projects = pf.getProjectList(self.getProjectId(), active=onlyActive, archived=onlyArchived) + projects = pf.getProjectsAsList(self.getProjectId(), active=onlyActive, archived=onlyArchived) #logging.debug("getProjects projects=%s"%repr(projects)) if count > 0: return projects[:count]
--- a/MPIWGProjects.py Wed Apr 24 20:48:45 2013 +0200 +++ b/MPIWGProjects.py Thu Apr 25 12:07:56 2013 +0200 @@ -1777,17 +1777,10 @@ # cached HashTree with project hierarchy _v_projectTree = None - - def __init__(self, id, title=None): - self.id = id - if title is None: - self.title = id - else: - self.title = title - - - def getTree(self): - """returns the hierarchy tree (and caches it)""" + def getProjectTree(self): + """returns the project hierarchy tree (and caches it). + + returns HashTree instance.""" tree = self._v_projectTree if tree is None: tree = HashTree(keySeparator='.', keyFn=lambda x:getInt(x)) @@ -1795,13 +1788,13 @@ tree.add(p.getNumber(), p) self._v_projectTree = tree - #logging.debug("getTree: tree=%s"%(tree.root.getSubtreeAsText())) + #logging.debug("getProjectTree: tree=%s"%(tree.root.getSubtreeAsText())) return tree - def getProjectList(self, start, active=1, archived=1): - """returns list of projects, starting from start. + def getProjectsAsList(self, start, active=1, archived=1): + """returns flattened list of projects, starting from start. active = 0 : all projects active = 1 : active projects @@ -1810,14 +1803,14 @@ archived = 1 : current projects archived = 2 : archived projects """ - #logging.debug("getProjectList(start=%s,active=%s,archived=%s)"%(repr(start),active,archived)) - tree = self.getTree() + #logging.debug("getProjectsAsList(start=%s,active=%s,archived=%s)"%(repr(start),active,archived)) + tree = self.getProjectTree() node = tree.getNode(start) if node is None: return [] pl = node.getSubtreeAsList() - #logging.debug("getProjectList: node=(%s,%s) pl=%s"%(node.key,node.value,pl)) + #logging.debug("getProjectsAsList: node=(%s,%s) pl=%s"%(node.key,node.value,pl)) # return filtered list return [p for p in pl if (p.checkActive(active) and p.checkArchived(archived))] @@ -1836,7 +1829,7 @@ projects = [] # search project numbers res = self.executeZSQL("select * from projects_members where lower(member_key) = %s", [key.lower()]) - tree = self.getTree() + tree = self.getProjectTree() # find projects in tree for r in res: p = tree.get(r.project_number)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/project/project_template.zpt Thu Apr 25 12:07:56 2013 +0200 @@ -0,0 +1,234 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html metal:use-macro="here/pro_sec_template/macros/page"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<tal:block metal:fill-slot="title"> + <title tal:content="python:here.getContent('xdata_05')+' '+here.getContent('WEB_title')" /> +</tal:block> +<tal:block metal:fill-slot="head" + tal:define="global marginImages python:here.sortedByPlace('MPIWGProject_image'); + global dept python:here.getRootProject().getId();" /> +</head> +<body> + + <!-- middle column --> + <div class="center" metal:fill-slot="center"> + <tal:block tal:replace="structure here/versionHeader" /> + <tal:x tal:condition="here/isArchivedProject"> + <p> + ( + <tal:x tal:condition="python:here.getStartedAt()!=''"> + <span tal:content="python:here.getStartedAt()" />-</tal:x> + <tal:x tal:condition="not:python:here.getStartedAt()!=''">Completed:</tal:x> + <span tal:content="python:here.getCompletedAt()" />) + </p> + </tal:x> + + <h1 tal:content="structure python:here.getContent('WEB_title')">History of Scientific Objectivity, 18th-19th Cs</h1> + <p class="maintext_authors"> + <tal:block tal:repeat="person python:here.getNamesOrdered(here.responsibleScientistsList)"> + <tal:block tal:define="name python:person[0]; url python:here.getMemberIdFromKey(person[1])"> + <a tal:condition="python:(url!='') and here.isActiveMember(person[1])" + tal:attributes="href string:$root/${secmap/staff}/members/$url" tal:content="python:here.decode(name)"> Name of + responsible person </a> + <span tal:condition="not:python:(url!='') and here.isActiveMember(person[1])" tal:content="python:here.decode(name)"> + Name of responsible person </span> + </tal:block> + <tal:block tal:condition="not:repeat/person/end">,</tal:block> + </tal:block> + </p> + + <p class="maintext_more" tal:condition="not:python:here.getContent('xdata_08')==''"> + Other involved scholars: <span tal:content="structure python:here.getContent('xdata_08')">Scholars </span> + </p> + <p class="maintext_more" tal:condition="not:python:here.getContent('xdata_12')==''"> + Cooperation Partners: <span tal:content="structure python:here.getContent('xdata_12')">Partners</span> + </p> + + <!-- inline image --> + <div class="pic_inline_container" tal:condition="marginImages"> + <tal:block tal:repeat="marginImage python:marginImages"> + <div class="pic_inline"> + <a tal:condition="python:marginImage[1].width" + tal:attributes="href python:here.REQUEST['URL1']+'/'+marginImage[1].getId()+'/showImage'" target="image"> <img + tal:replace="structure python:marginImage[1].tag(scale=min(220.0/marginImage[1].width,1), border='0')" /> + </a> + <pre tal:condition="not:python:marginImage[1].width">empty image</pre> + </div> + <div class="caption_inline" tal:content="structure python:marginImage[1].caption">J.-A.-D. Ingres: Mme Moitessier, + 1856. Oel/Lw. 120 x 92,1 cm. London, National Gallery.</div> + </tal:block> + </div> + <!-- inline image --> + + <div tal:content="structure python:here.getContent('WEB_project_description',filter='yes')">Project description</div> + + </div> + + <!-- right column --> + <div class="sidebar" metal:fill-slot="sidebar"> + + <div class="sideblock" + tal:define="contexts python:here.getContexts(parents=here.getContent('xdata_05'),depth=1,date=here.REQUEST.get('date',None))" + tal:condition="contexts"> + <!-- this project is part of --> + + <div class="project parent"> + Part of: + <tal:block tal:repeat="context contexts"> + <tal:x tal:condition="not:here/isArchivedProject"> + <a tal:content="python:context[0].getContent('WEB_title')" + tal:attributes="href python:here.generateUrlProject(context[0].absolute_url(),project='yes')+'/index.html'" /> + </tal:x> + <tal:x tal:condition="here/isArchivedProject"> + <a tal:content="python:context[0].getContent('WEB_title')" + tal:attributes="href python:here.generateUrlProject(context[0].absolute_url(),project='yes')+'/index.html?showArchive=yes'" /> + </tal:x> + </tal:block> + </div> + <!-- end parent --> + </div> + <!-- sideblock --> + + <tal:block tal:define="projects python:here.sortedByPlace('MPIWGProject_relatedProject');"> + <div class="sideblock" tal:condition="python:len(projects)>0"> + <h2>Related Projects</h2> + <div class="item" tal:repeat="project python:projects"> + <a tal:attributes="href + python:root+'/'+secmap['research']+'/projects/'+project[1].objid" + tal:content="python:project[1].projectWEB_title" /> + </div> + <!-- end item --> + </div> + <!-- sideblock --> + + </tal:block> + + <!-- <\!-- related publications -\-> --> + + <tal:block tal:define="publications python:here.sortedByPlace('MPIWGProject_publication');"> + <div class="sideblock" tal:condition="python:here.hasRelatedPublicationsOldVersion()"> + <h2>Related Publications</h2> + <div class="item" tal:condition="python:getattr(here,'WEB_related_pub_copied',False)" + tal:define="pub python:here.getContent('WEB_related_pub')" tal:content="structure pub"> + "Die Kultur der wissenschaftlichen Objektivität," in: Michael Hagner, ed., Ansichten der Wissenschaftsgeschichte + (Frankfurt am Main: Fischer Taschenbuchverlag GmbH, 2001): 137-158. <br /> (with Peter Galison), "The Image of + Objectivity," Representations no. 40 (Fall 1992): 81-128. Translated into German (2002) <br /> "Objectivity and the Escape + from Perspective," Social Studies of Science 22(1992): 597-618 + </div> + <!-- end item --> + </div> + <!-- sideblock --> + + <div class="sideblock" tal:condition="python:len(publications)>0"> + <h2>Related Publications</h2> + <div class="item" tal:repeat="publication python:publications"> + <tal:y condition="not:python:publication[1].hasLinkToBookPage(mode='cached')"> + <tal:x condition="python:hasattr(publication[1],'publicationImage1')"> + <a target="_blank" tal:attributes="href python:publication[1].publicationImage1.absolute_url()"> <img width="150" + tal:attributes="src python:publication[1].publicationImage1.absolute_url()" /> + </a> + <a tal:condition="python:hasattr(publication[1],'publicationImage2')" target="_blank" + tal:attributes="href python:publication[1].publicationImage2.absolute_url()"> <img width="150" + tal:condition="python:hasattr(publication[1],'publicationImage2')" + tal:attributes="src python:publication[1].publicationImage2.absolute_url()" /> + </a> + <br /> + </tal:x> + </tal:y> + <tal:y condition="python:publication[1].hasLinkToBookPage(mode='cached')" + tal:define="urls python:publication[1].getImageUrls(mode='cached')"> + <tal:x condition="python:len(urls)>0"> + <a target="_blank" tal:attributes="href python:urls[0]"> <img width="150" tal:attributes="src python:urls[0]" /> + </a> + <a tal:condition="python:len(urls)>1" target="_blank" tal:attributes="href python:urls[1]"> <img width="150" + tal:attributes="src python:urls[1]" /> + </a> + <br /> + </tal:x> + </tal:y> + <tal:y condition="python:getattr(publication[1],'link','')==''"> + <tal:x tal:content="structure python:publication[1].text" /> + <br /> + </tal:y> + <tal:y condition="not:python:getattr(publication[1],'link','')==''"> + <a tal:content="structure python:publication[1].text" tal:attributes="href python:getattr(publication[1],'link','')" /> + <br /> + </tal:y> + <tal:x tal:condition="python:hasattr(publication[1],'description')" + tal:content="structure python:publication[1].description" /> + </div> + <!-- end item --> + </div> + <!-- sideblock --> + + <div class="sideblock" tal:condition="python:here.hasExtendedPublicationList()"> + <h2>Further Publications</h2> + <div class="item"> + <a href="publicationList">Publications in the context of this project</a> + </div> + </div> + </tal:block> + <!-- related publications --> + + <!-- projects covered --> + + <div class="sideblock" + tal:define="showArchive python:here.REQUEST.get('showArchive','no')=='yes'; + contexts python:here.getContexts(childs=here.getContent('xdata_05'),depth=1,date=here.REQUEST.get('date',None))" + tal:condition="contexts"> + <h2> + Projects <span class="proj_state"> <tal:x + tal:condition="not:python:(not(here.isArchivedProject() or showArchive) and here.hasChildren(onlyArchived=2))"> + <a href="?">current</a> + </tal:x> <tal:x tal:condition="python:(not(here.isArchivedProject() or showArchive) and here.hasChildren(onlyArchived=2))"> + current + </tal:x> <tal:x tal:condition="python:(not(here.isArchivedProject() or showArchive) and here.hasChildren(onlyArchived=2))"> + <a href="?showArchive=yes">completed</a> + </tal:x> <tal:x tal:condition="not:python:(not(here.isArchivedProject() or showArchive) and here.hasChildren(onlyArchived=2))"> + completed + </tal:x> + </span> + </h2> + + <tal:y tal:repeat="context contexts"> + <tal:x tal:condition="not:python:context[0].isArchivedProject() or showArchive"> + <div class="project"> + <a tal:content="python:context[0].getContent('short_title')" + tal:attributes="href python:here.generateUrlProject(context[0].absolute_url(),project='yes')+'/index_html'" /> + </div> + </tal:x> + <tal:x tal:condition="python:context[0].isArchivedProject() and (here.isArchivedProject() or showArchive)"> + <div class="project inactive"> + <a tal:content="python:context[0].getContent('short_title')" + tal:attributes="href python:here.generateUrlProject(context[0].absolute_url(),project='yes')+'/index_html'" /> ( + <tal:x tal:condition="python:context[0].getStartedAt()!=''"> + <span tal:content="python:context[0].getStartedAt()" />-</tal:x> + <tal:x tal:condition="not:python:context[0].getStartedAt()!=''">Completed:</tal:x> + <span tal:content="python:context[0].getCompletedAt()" />) + </div> + </tal:x> + </tal:y> + </div> + <!-- projects covered --> + + + <div class="sideblock" tal:condition="python:here.hasRelatedDigitalSources()"> + <h2>Related digital sources</h2> + <div class="item" tal:content="structure python:here.getContent('xdata_11')"> + Item 1 <br /> Item 2 <br /> Item 3 <br /> + </div> + </div> + + <div class="sideblock" tal:condition="not:python:here.getContent('xdata_13')==''"> + <h2>Funding Institutions</h2> + <div class="item" tal:content="structure python:here.getContent('xdata_13')">Funding</div> + </div> + <!-- sideblock --> + + </div> + <!-- sidebar --> + +</body> +</html> \ No newline at end of file