Mercurial > hg > MPIWGWeb
changeset 56:a6ace48c2bf2
publication management f?r projekte
author | dwinter |
---|---|
date | Tue, 30 Apr 2013 18:35:08 +0200 |
parents | 12cb73494367 |
children | 84879a3f91a6 |
files | MPIWGProjects.py MPIWGStaff.py zpt/project/edit_publications.zpt zpt/project/project_template.zpt zpt/project/pubman/add_publications.zpt zpt/project/pubman/change_publications.zpt zpt/project/pubman/show_publications.zpt zpt/staff/member_index_html.zpt zpt/staff/pubman/show_publications.zpt |
diffstat | 9 files changed, 300 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGProjects.py Tue Apr 30 16:46:32 2013 +0200 +++ b/MPIWGProjects.py Tue Apr 30 18:35:08 2013 +0200 @@ -641,28 +641,6 @@ pt = self.edit_related_projects return pt() - - def hasExtendedPublicationList(self): - """test if extended publication list exists""" - if not hasattr(self, "publicationList"): - return False - else: - return True - - def createExtendedPublicationList(self, RESPONSE=None): - """erzeuge erweiterte publications liste""" - pl = BibliographyManager("publicationList", "", "institutsbiblio", self.connection_id) - self._setObject("publicationList", pl) - - zt = ZopePageTemplate('index.html') - pl._setObject('index.html', zt) - default_content_fn = os.path.join(package_home(globals()), - 'zpt/showExtendedProjectBibliography.zpt') - text = open(default_content_fn).read() - zt.pt_edit(text, 'text/html') - - if RESPONSE: - self.redirect(RESPONSE, "managePublications") def getPublications(self): @@ -1620,6 +1598,131 @@ self.executeZSQL("insert into projects_members (project_number, member_key) values (%s, %s)", (pNum, memberKey)) + + + def addPublicationsFromPubman(self,REQUEST): + """addPublications from pubman""" + + data=REQUEST.form + + if data.get("method",None) is None: + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','add_publications.zpt')).__of__(self) + return pt() + + + + if data.get("method") == "search": + entries= self.mpiwgPubman.search(data) + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','add_publications.zpt')).__of__(self) + + + return pt(values=entries) + + + + if data.get("method") == "add": + + return self.addEntriesToPublicationList(data) + #pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self) + + def addEntriesToPublicationList(self,data): + """fuege eintrage aus data zur publications liste, + @param data Map mit escidocID --> value + value muss "add" sein damit hinzugefuegt wird""" + + for key in data.keys(): + + if key.startswith('escidoc:'): + + query="INSERT INTO pubmanbiblio_projects (key_main,escidocId) values (%s,%s)" + + if data.get(key)=="add": + self.executeZSQL(query,[self.getId(),key]) + + + #selectedPublications = self.getSelectedPublications() + + #pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','change_publications.zpt')).__of__(self) + + #return pt() + + if hasattr(self,'REQUEST'): + return self.REQUEST.response.redirect("changePublications") + + def changePublications(self,REQUEST): + """change published publications""" + + data=REQUEST.form + + + if data.get("method","change"): + for key in data.keys(): + splitted=key.split("__") #format escidoc_id__p fuer priority, nur escidocid + value=data[key] + if len(splitted)==1: + self.deleteFromPublicationList(key); + + elif(splitted[1]) == "p": + self.setPublicationPriority(splitted[0],value); + + + pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','change_publications.zpt')).__of__(self) + return pt() + + def deleteFromPublicationList(self,escidocid): + """Loessche publication with escidoc id from publication list""" + + query ="DELETE FROM pubmanbiblio_projects WHERE escidocid=%s and key_main=%s" + + self.executeZSQL(query,[escidocid,self.getId()]); + + def setPublicationPriority(self,escidocid,value): + + query="update pubmanbiblio_projects set priority=%s where escidocid=%s and key_main=%s" + + try: + + value = int(value) + self.executeZSQL(query,[value,escidocid,self.getId()]); + + + except: + logging.error("couldn't change:") + logging.error(escidocid) + logging.error(value) + + def getSelectedPublications(self): + """hole publications aus der datenbank""" + + + query="select * from pubmanbiblio_projects where lower(key_main) = lower(%s) order by priority DESC" + + + return self.executeZSQL(query,[self.getId()]) + + + + def hasExtendedPublicationList(self): + """test if extended publication list exists""" + + + + query="select count(*) from pubmanbiblio_projects where lower(key_main) = lower(%s)" + + + res= self.executeZSQL(query,[self.getId()]) + + if res[0].count>0: + return True + else: + return False + + def publicationsFull(self,REQUEST): + """show publication""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','show_publications.zpt')).__of__(self) + return pt() + + def manage_addMPIWGProjectForm(self): """form for adding the project"""
--- a/MPIWGStaff.py Tue Apr 30 16:46:32 2013 +0200 +++ b/MPIWGStaff.py Tue Apr 30 18:35:08 2013 +0200 @@ -1127,7 +1127,7 @@ return tmp - def getPublications(self,coneId="renn",limit=None,publicationType=None): + def getPublicationsFromPubman(self,coneId="renn",limit=None,publicationType=None): logging.debug("coneID:%s"%coneId) try: @@ -1595,13 +1595,13 @@ splitted = ident.split("@"); return splitted[0] - def getPublications(self,limit=None,publicationType=None): + def getPublicationsFromPubman(self,limit=None,publicationType=None): if self.content.publications_mode=="year" or publicationType is not None: coneId = self.getConeId(); if coneId: - pubs= self.folder.getPublications(coneId,limit=limit,publicationType=publicationType) + pubs= self.folder.getPublicationsFromPubman(coneId,limit=limit,publicationType=publicationType) return pubs elif self.content.publications_mode=="priority": @@ -1659,18 +1659,23 @@ for key in data.keys(): - query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)" + if key.startswith('escidoc:'): + - if data.get(key)=="add": - self.executeZSQL(query,[self.getKey(),key]) + query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)" + if data.get(key)=="add": + self.executeZSQL(query,[self.getKey(),key]) + - selectedPublications = self.getSelectedPublications() + #selectedPublications = self.getSelectedPublications() + + #pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self) - pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self) - - return pt() + #return pt() + if hasattr(self,'REQUEST'): + return self.REQUEST.response.redirect("changePublications") def changePublications(self,REQUEST): @@ -1703,12 +1708,16 @@ def setPublicationPriority(self,escidocid,value): - - query="update pubmanbiblio set priority=%s where escidocid=%s and key_main=%s" - - self.executeZSQL(query,[value,escidocid,self.getKey()]); - - + try: + query="update pubmanbiblio set priority=%s where escidocid=%s and key_main=%s" + + self.executeZSQL(query,[value,escidocid,self.getKey()]); + + except: + logging.error("couldn't change:") + logging.error(escidocid) + logging.error(value) + def getSelectedPublications(self): """hole publications aus der datenbank"""
--- a/zpt/project/edit_publications.zpt Tue Apr 30 16:46:32 2013 +0200 +++ b/zpt/project/edit_publications.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -27,7 +27,8 @@ <textarea name="text" rows="3" cols="80"></textarea> <p><input type="submit" value="submit"/></p> </form> - <p>(If the publications from your current project description are not showing in this list, click <a href="copyPublicationsToList">here</a> to copy them.)</p> +<!-- <p>(If the publications from your current project description are not showing in this list, click <a href="copyPublicationsToList">here</a> to copy them.)</p> + <h3><tal:x condition="python:here.hasExtendedPublicationList()"> <a href="publicationList/editEntries"> Manage Extended Publication List</a> @@ -36,7 +37,10 @@ <a href="createExtendedPublicationList"> Create Extended Publication List</a> </tal:x> -</h3> +</h3>--> + +<h3><a href=" addPublicationsFromPubman"> Add publication to extended list</a></h3> +<h3><a href=" changePublications"> Change publication list</a></h3> </tal:block> </body> </html>
--- a/zpt/project/project_template.zpt Tue Apr 30 16:46:32 2013 +0200 +++ b/zpt/project/project_template.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -130,7 +130,7 @@ <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> + <a href="publicationsFull">Publications in the context of this project</a> </div> </div> </tal:block>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/project/pubman/add_publications.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -0,0 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html metal:use-macro="here/edit_template/macros/page"> +<body> +<tal:block metal:fill-slot="navsel" tal:define="global menusel string:talks" /> + +<tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'"> + <form action="" method="post"> + <input type="hidden" name="method" value="search"/> + <div> Author/Editor: <input type="text" size="30" name="author"/></div> + <div> Title: <input type="text" size="30" name="title"/></div> + <div> Somewhere in the metadata: <input type="text" size="30" name="any"/></div> + + <input type="submit" value="submit"> + + </form> + + +<div tal:condition="python:options.has_key('values')"> +<form action="" method="post"> + <input type="hidden" name="method" value="add"/> + +<table> + + +<tr tal:repeat="entry python:options['values'].items()"> +<td><input type="checkbox" value="add" tal:attributes="name python:entry[0]"/></td> +<td><tal:x tal:replace="structure python:entry[1]"/></td> +</tr> + +</table> +<input type="submit" value="submit"/> + +</form> + +</div> +</tal:block> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/project/pubman/change_publications.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -0,0 +1,30 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html metal:use-macro="here/edit_template/macros/page"> +<body> +<tal:block metal:fill-slot="navsel" tal:define="global menusel string:talks" /> + +<tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'"> + + +<div> +<form action="" method="post"> + +<table> + +<input type="hidden" method="change"/> +<tr tal:repeat="entry python:here.getSelectedPublications()"> +<td><input type="checkbox" value="delete" tal:attributes="name python:entry.escidocid"/></td> +<td><input type="text" size="5" tal:attributes="name python:entry.escidocid+'__p'; value python:entry.priority"/></td> +<td><tal:x tal:replace="structure python:here.mpiwgPubman.getEntryFromPubman(entry.escidocid)"/></td> +</tr> + +</table> +<input type="submit" value="submit"/> + +</form> + +</div> +</tal:block> +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/project/pubman/show_publications.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" metal:use-macro="here/main_template/macros/page"> + <head> + <tal:block metal:fill-slot="head"> + </tal:block> + </head> + <body> + <div class="center" metal:fill-slot="center"> + + <h2 tal:condition="not:here/isCurrentVersion"> + This is an outdated version of this project! For the current version, please refer to + <a tal:define="parentUrl python:here.aq_parent.getUrl(baseUrl=proBaseUrl)" + tal:attributes="href parentUrl" tal:content="parentUrl"/> + </h2> + <tal:x tal:define="started here/getStartedAt" tal:condition="here/isArchivedProject"> + <p> + (<span tal:condition="started" tal:content="string:$started-"/><span tal:condition="not:started">Completed:</span> + <span tal:content="here/getCompletedAt"/>) + </p> + </tal:x> + + <h1 tal:content="here/getProjectTitle">History of Scientific Objectivity, 18th-19th Cs</h1> + <p class="maintext_authors"> + <tal:block tal:repeat="person here/getResponsibleScientistsList"> + <a tal:define="username person/username|nothing" tal:omit-tag="python:not username or not here.getStaffFolder().isActiveMember(key=person.get('key',None))" + tal:attributes="href string:$root/${secmap/staff}/members/$username" tal:content="person/name"> Name of + responsible person</a><tal:block tal:condition="not:repeat/person/end">, </tal:block> + </tal:block> + </p> + + <p class="maintext_more" tal:define="others here/getInvolvedScholars" tal:condition="others"> + Other involved scholars: <span tal:content="structure others">Scholars </span> + </p> + <p class="maintext_more" tal:define="partners here/getCooperationPartners" tal:condition="partners"> + Cooperation Partners: <span tal:content="structure partners">Partners</span> + </p> + + <h2>Selected publications</h2> + <tal:block tal:define=" + books python:here.getSelectedPublications(); + + "> + + <tal:block > + + <ul class="publicationlist"> + <li tal:repeat="found3 books"> + <span> + <a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+found3.escidocid"><span tal:replace="structure python:here.mpiwgPubman.getEntryFromPubman(found3.escidocid)"/> + </a> + </span> + + </li> + </ul> + </tal:block> + + + + </tal:block> + +<!-- + <p> + <a href="/institutsbiblio/FMPro?-db=personal-www&-max=1&-Lay=ALL&-format=search_inst_bib.html&ID=[FMP-Field: ID]&-Error=null.html&-find" target="_new"> + search the institute's bibliography </a> + --> + +</div> + </body> +</html> \ No newline at end of file
--- a/zpt/staff/member_index_html.zpt Tue Apr 30 16:46:32 2013 +0200 +++ b/zpt/staff/member_index_html.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -54,7 +54,7 @@ <a class="internal" tal:attributes="href string:$baseUrl/publications_full">more</a> </p>--> - <p tal:repeat="publication python:member.getPublications(limit=5)"> + <p tal:repeat="publication python:member.getPublicationsFromPubman(limit=5)"> <a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+publication[0]" tal:content="structure python:publication[1]" /> </p>
--- a/zpt/staff/pubman/show_publications.zpt Tue Apr 30 16:46:32 2013 +0200 +++ b/zpt/staff/pubman/show_publications.zpt Tue Apr 30 18:35:08 2013 +0200 @@ -18,9 +18,9 @@ <h2>Selected publications</h2> <tal:block tal:define=" - books python:here.getPublications(publicationType='http://purl.org/eprint/type/Book'); - book_article python:here.getPublications(publicationType='http://purl.org/eprint/type/BookItem'); - articles python:here.getPublications(publicationType='http://purl.org/escidoc/metadata/ves/publication-types/article'); + books python:here.getPublicationsFromPubman(publicationType='http://purl.org/eprint/type/Book'); + book_article python:here.getPublicationsFromPubman(publicationType='http://purl.org/eprint/type/BookItem'); + articles python:here.getPublicationsFromPubman(publicationType='http://purl.org/escidoc/metadata/ves/publication-types/article'); "> <tal:block >