# HG changeset patch
# User dwinter
# Date 1367244084 -7200
# Node ID 225179dfd89229af3d46750bc1babd0ada266532
# Parent 955d102392dbc6227ff970d2832a3086cbd655db
getPublications erweitert nach Typ
ausserdem erh?lt man jetzt auch einzelne Publicationen nach escidoc:id
diff -r 955d102392db -r 225179dfd892 MPIWGStaff.py
--- a/MPIWGStaff.py Sat Apr 27 10:04:57 2013 +0200
+++ b/MPIWGStaff.py Mon Apr 29 16:01:24 2013 +0200
@@ -1120,11 +1120,11 @@
return tmp
- def getPublications(self,coneId="renn"):
+ def getPublications(self,coneId="renn",limit=None,publicationType=None):
logging.debug("coneID:%s"%coneId)
try:
- pubs=self.mpiwgPubman.getPublications(coneId)
+ pubs=self.mpiwgPubman.getPublications(coneId,limit=limit,publicationType=publicationType)
return pubs
except:
@@ -1230,6 +1230,9 @@
return html%""
+
+
+
def getTalks(self):
return self.folder.executeZSQL("SELECT oid,* FROM talks WHERE key_main = %s",[self.content.key])
@@ -1412,6 +1415,28 @@
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_downloads.zpt')).__of__(self)
return pt()
+ def editPublications(self,REQUEST):
+ """editiere die Publications von der Webseite"""
+
+
+ data=REQUEST.form
+
+ if data.has_key('selectionMode'):
+ query="UPDATE personal_www SET publications_mode=%s WHERE key=%s"
+
+ self.executeZSQL(query,[data['selectionMode'],self.getKey()])
+
+ self.refresh_content()
+
+ pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_publications.zpt')).__of__(self)
+ return pt()
+
+
+ def refresh_content(self,):
+
+ self.content = self.folder.executeZSQL("select * from personal_www where key = %s", [self.getKey()])[0]
+
+
def changeDownloads(self,REQUEST):
""""change the downloadable files"""
self.invalidate_chache();
@@ -1563,13 +1588,126 @@
splitted = ident.split("@");
return splitted[0]
- def getPublications(self):
+ def getPublications(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)
+ return pubs
- coneId = self.getConeId();
- if coneId:
- pubs= self.folder.getPublications(coneId)
+ elif self.content.publications_mode=="priority":
+ selPubs= self.getSelectedPublications()
+
+ pubs=[]
+ for selPub in selPubs:
+ pubs.append((selPub.escidocid,self.mpiwgPubman.getEntryFromPubman(selPub.escidocid)))
+
return pubs
- return []
+ return {}
+
+
+ def publicationsFull(self,REQUEST):
+ """show publication"""
+ pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','show_publications.zpt')).__of__(self)
+ return pt(member=self.content)
+
+
+
+
+
+ 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/staff/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/staff/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():
+
+ query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)"
+
+ if data.get(key)=="add":
+ self.executeZSQL(query,[self.getKey(),key])
+
+
+
+ selectedPublications = self.getSelectedPublications()
+
+ pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self)
+
+ return pt()
+
+
+ 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/staff/pubman','change_publications.zpt')).__of__(self)
+ return pt()
+
+
+ def deleteFromPublicationList(self,escidocid):
+ """Loessche publication with escidoc id from publication list"""
+
+ query ="DELETE FROM pubmanbiblio WHERE escidocid=%s and key_main=%s"
+
+ self.executeZSQL(query,[escidocid,self.getKey()]);
+
+
+ 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()]);
+
+
+ def getSelectedPublications(self):
+ """hole publications aus der datenbank"""
+
+
+ query="select * from pubmanbiblio where key_main = %s order by priority"
+
+
+ return self.executeZSQL(query,[self.getKey()])
+
InitializeClass(MPIWGStaffMember)
diff -r 955d102392db -r 225179dfd892 zpt/staff/edit_publications.zpt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/staff/edit_publications.zpt Mon Apr 29 16:01:24 2013 +0200
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ Selection mode
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 955d102392db -r 225179dfd892 zpt/staff/member_index_html.zpt
--- a/zpt/staff/member_index_html.zpt Sat Apr 27 10:04:57 2013 +0200
+++ b/zpt/staff/member_index_html.zpt Mon Apr 29 16:01:24 2013 +0200
@@ -7,7 +7,7 @@
+ global baseUrl string:$root/${secmap/staff}/members_test/$username" />
@@ -54,12 +54,12 @@
more
-->
-
-
+
+
- more
+ more
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 955d102392db -r 225179dfd892 zpt/staff/pubman/change_publications.zpt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/staff/pubman/change_publications.zpt Mon Apr 29 16:01:24 2013 +0200
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 955d102392db -r 225179dfd892 zpt/staff/pubman/mappings.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/staff/pubman/mappings.xml Mon Apr 29 16:01:24 2013 +0200
@@ -0,0 +1,508 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ????
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 955d102392db -r 225179dfd892 zpt/staff/pubman/show_publications.zpt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/staff/pubman/show_publications.zpt Mon Apr 29 16:01:24 2013 +0200
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ main entry
+
+
+
Selected publications
+
+
+
+ Books
+
+
+
+
+ Book Chapters
+
+
+
+
+ Articles
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file