comparison MPIWGStaff.py @ 56:a6ace48c2bf2

publication management f?r projekte
author dwinter
date Tue, 30 Apr 2013 18:35:08 +0200
parents e718d9a72f19
children 84879a3f91a6
comparison
equal deleted inserted replaced
55:12cb73494367 56:a6ace48c2bf2
1125 tmp=[x for x in list] 1125 tmp=[x for x in list]
1126 tmp.sort(sort) 1126 tmp.sort(sort)
1127 1127
1128 return tmp 1128 return tmp
1129 1129
1130 def getPublications(self,coneId="renn",limit=None,publicationType=None): 1130 def getPublicationsFromPubman(self,coneId="renn",limit=None,publicationType=None):
1131 1131
1132 logging.debug("coneID:%s"%coneId) 1132 logging.debug("coneID:%s"%coneId)
1133 try: 1133 try:
1134 pubs=self.mpiwgPubman.getPublications(coneId,limit=limit,publicationType=publicationType) 1134 pubs=self.mpiwgPubman.getPublications(coneId,limit=limit,publicationType=publicationType)
1135 1135
1593 def getStaffURL(self): 1593 def getStaffURL(self):
1594 ident = self.content.e_mail; 1594 ident = self.content.e_mail;
1595 splitted = ident.split("@"); 1595 splitted = ident.split("@");
1596 return splitted[0] 1596 return splitted[0]
1597 1597
1598 def getPublications(self,limit=None,publicationType=None): 1598 def getPublicationsFromPubman(self,limit=None,publicationType=None):
1599 1599
1600 1600
1601 if self.content.publications_mode=="year" or publicationType is not None: 1601 if self.content.publications_mode=="year" or publicationType is not None:
1602 coneId = self.getConeId(); 1602 coneId = self.getConeId();
1603 if coneId: 1603 if coneId:
1604 pubs= self.folder.getPublications(coneId,limit=limit,publicationType=publicationType) 1604 pubs= self.folder.getPublicationsFromPubman(coneId,limit=limit,publicationType=publicationType)
1605 return pubs 1605 return pubs
1606 1606
1607 elif self.content.publications_mode=="priority": 1607 elif self.content.publications_mode=="priority":
1608 selPubs= self.getSelectedPublications() 1608 selPubs= self.getSelectedPublications()
1609 1609
1657 @param data Map mit escidocID --> value 1657 @param data Map mit escidocID --> value
1658 value muss "add" sein damit hinzugefuegt wird""" 1658 value muss "add" sein damit hinzugefuegt wird"""
1659 1659
1660 for key in data.keys(): 1660 for key in data.keys():
1661 1661
1662 query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)" 1662 if key.startswith('escidoc:'):
1663 1663
1664 if data.get(key)=="add": 1664
1665 self.executeZSQL(query,[self.getKey(),key]) 1665 query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)"
1666 1666
1667 1667 if data.get(key)=="add":
1668 1668 self.executeZSQL(query,[self.getKey(),key])
1669 selectedPublications = self.getSelectedPublications() 1669
1670 1670
1671 pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self) 1671
1672 1672 #selectedPublications = self.getSelectedPublications()
1673 return pt() 1673
1674 #pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self)
1675
1676 #return pt()
1677 if hasattr(self,'REQUEST'):
1678 return self.REQUEST.response.redirect("changePublications")
1674 1679
1675 1680
1676 def changePublications(self,REQUEST): 1681 def changePublications(self,REQUEST):
1677 """change published publications""" 1682 """change published publications"""
1678 1683
1701 1706
1702 self.executeZSQL(query,[escidocid,self.getKey()]); 1707 self.executeZSQL(query,[escidocid,self.getKey()]);
1703 1708
1704 1709
1705 def setPublicationPriority(self,escidocid,value): 1710 def setPublicationPriority(self,escidocid,value):
1706 1711 try:
1707 query="update pubmanbiblio set priority=%s where escidocid=%s and key_main=%s" 1712 query="update pubmanbiblio set priority=%s where escidocid=%s and key_main=%s"
1708 1713
1709 self.executeZSQL(query,[value,escidocid,self.getKey()]); 1714 self.executeZSQL(query,[value,escidocid,self.getKey()]);
1710 1715
1711 1716 except:
1717 logging.error("couldn't change:")
1718 logging.error(escidocid)
1719 logging.error(value)
1720
1712 def getSelectedPublications(self): 1721 def getSelectedPublications(self):
1713 """hole publications aus der datenbank""" 1722 """hole publications aus der datenbank"""
1714 1723
1715 1724
1716 query="select * from pubmanbiblio where lower(key_main) = lower(%s) order by priority DESC" 1725 query="select * from pubmanbiblio where lower(key_main) = lower(%s) order by priority DESC"