Mercurial > hg > MPIWGWeb
comparison MPIWGStaff.py @ 47:225179dfd892
getPublications erweitert nach Typ
ausserdem erh?lt man jetzt auch einzelne Publicationen nach escidoc:id
author | dwinter |
---|---|
date | Mon, 29 Apr 2013 16:01:24 +0200 |
parents | 955d102392db |
children | f59bdd5f4890 |
comparison
equal
deleted
inserted
replaced
46:955d102392db | 47:225179dfd892 |
---|---|
1118 tmp=[x for x in list] | 1118 tmp=[x for x in list] |
1119 tmp.sort(sort) | 1119 tmp.sort(sort) |
1120 | 1120 |
1121 return tmp | 1121 return tmp |
1122 | 1122 |
1123 def getPublications(self,coneId="renn"): | 1123 def getPublications(self,coneId="renn",limit=None,publicationType=None): |
1124 | 1124 |
1125 logging.debug("coneID:%s"%coneId) | 1125 logging.debug("coneID:%s"%coneId) |
1126 try: | 1126 try: |
1127 pubs=self.mpiwgPubman.getPublications(coneId) | 1127 pubs=self.mpiwgPubman.getPublications(coneId,limit=limit,publicationType=publicationType) |
1128 | 1128 |
1129 return pubs | 1129 return pubs |
1130 except: | 1130 except: |
1131 return [] | 1131 return [] |
1132 def manage_addMPIWGStaffFolderForm(self): | 1132 def manage_addMPIWGStaffFolderForm(self): |
1228 else: | 1228 else: |
1229 | 1229 |
1230 return html%"" | 1230 return html%"" |
1231 | 1231 |
1232 | 1232 |
1233 | |
1234 | |
1235 | |
1233 def getTalks(self): | 1236 def getTalks(self): |
1234 | 1237 |
1235 return self.folder.executeZSQL("SELECT oid,* FROM talks WHERE key_main = %s",[self.content.key]) | 1238 return self.folder.executeZSQL("SELECT oid,* FROM talks WHERE key_main = %s",[self.content.key]) |
1236 #return self.folder.ZSQLInlineSearch(_table='talks',key_main=self.content.key) | 1239 #return self.folder.ZSQLInlineSearch(_table='talks',key_main=self.content.key) |
1237 | 1240 |
1410 """editiere die Downloads von der Webseite""" | 1413 """editiere die Downloads von der Webseite""" |
1411 | 1414 |
1412 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_downloads.zpt')).__of__(self) | 1415 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_downloads.zpt')).__of__(self) |
1413 return pt() | 1416 return pt() |
1414 | 1417 |
1418 def editPublications(self,REQUEST): | |
1419 """editiere die Publications von der Webseite""" | |
1420 | |
1421 | |
1422 data=REQUEST.form | |
1423 | |
1424 if data.has_key('selectionMode'): | |
1425 query="UPDATE personal_www SET publications_mode=%s WHERE key=%s" | |
1426 | |
1427 self.executeZSQL(query,[data['selectionMode'],self.getKey()]) | |
1428 | |
1429 self.refresh_content() | |
1430 | |
1431 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_publications.zpt')).__of__(self) | |
1432 return pt() | |
1433 | |
1434 | |
1435 def refresh_content(self,): | |
1436 | |
1437 self.content = self.folder.executeZSQL("select * from personal_www where key = %s", [self.getKey()])[0] | |
1438 | |
1439 | |
1415 def changeDownloads(self,REQUEST): | 1440 def changeDownloads(self,REQUEST): |
1416 """"change the downloadable files""" | 1441 """"change the downloadable files""" |
1417 self.invalidate_chache(); | 1442 self.invalidate_chache(); |
1418 | 1443 |
1419 data=REQUEST.form | 1444 data=REQUEST.form |
1561 def getStaffURL(self): | 1586 def getStaffURL(self): |
1562 ident = self.content.e_mail; | 1587 ident = self.content.e_mail; |
1563 splitted = ident.split("@"); | 1588 splitted = ident.split("@"); |
1564 return splitted[0] | 1589 return splitted[0] |
1565 | 1590 |
1566 def getPublications(self): | 1591 def getPublications(self,limit=None,publicationType=None): |
1567 | 1592 |
1568 coneId = self.getConeId(); | 1593 |
1569 if coneId: | 1594 if self.content.publications_mode=="year" or publicationType is not None: |
1570 pubs= self.folder.getPublications(coneId) | 1595 coneId = self.getConeId(); |
1596 if coneId: | |
1597 pubs= self.folder.getPublications(coneId,limit=limit,publicationType=publicationType) | |
1571 return pubs | 1598 return pubs |
1572 return [] | 1599 |
1573 | 1600 elif self.content.publications_mode=="priority": |
1574 | 1601 selPubs= self.getSelectedPublications() |
1602 | |
1603 pubs=[] | |
1604 for selPub in selPubs: | |
1605 pubs.append((selPub.escidocid,self.mpiwgPubman.getEntryFromPubman(selPub.escidocid))) | |
1606 | |
1607 return pubs | |
1608 return {} | |
1609 | |
1610 | |
1611 def publicationsFull(self,REQUEST): | |
1612 """show publication""" | |
1613 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','show_publications.zpt')).__of__(self) | |
1614 return pt(member=self.content) | |
1615 | |
1616 | |
1617 | |
1618 | |
1619 | |
1620 def addPublicationsFromPubman(self,REQUEST): | |
1621 """addPublications from pubman""" | |
1622 | |
1623 data=REQUEST.form | |
1624 | |
1625 if data.get("method",None) is None: | |
1626 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self) | |
1627 return pt() | |
1628 | |
1629 | |
1630 | |
1631 if data.get("method") == "search": | |
1632 entries= self.mpiwgPubman.search(data) | |
1633 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self) | |
1634 | |
1635 | |
1636 return pt(values=entries) | |
1637 | |
1638 | |
1639 | |
1640 if data.get("method") == "add": | |
1641 | |
1642 return self.addEntriesToPublicationList(data) | |
1643 #pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self) | |
1644 | |
1645 | |
1646 | |
1647 def addEntriesToPublicationList(self,data): | |
1648 """fuege eintrage aus data zur publications liste, | |
1649 @param data Map mit escidocID --> value | |
1650 value muss "add" sein damit hinzugefuegt wird""" | |
1651 | |
1652 for key in data.keys(): | |
1653 | |
1654 query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)" | |
1655 | |
1656 if data.get(key)=="add": | |
1657 self.executeZSQL(query,[self.getKey(),key]) | |
1658 | |
1659 | |
1660 | |
1661 selectedPublications = self.getSelectedPublications() | |
1662 | |
1663 pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self) | |
1664 | |
1665 return pt() | |
1666 | |
1667 | |
1668 def changePublications(self,REQUEST): | |
1669 """change published publications""" | |
1670 | |
1671 data=REQUEST.form | |
1672 | |
1673 | |
1674 if data.get("method","change"): | |
1675 for key in data.keys(): | |
1676 splitted=key.split("__") #format escidoc_id__p fuer priority, nur escidocid | |
1677 value=data[key] | |
1678 if len(splitted)==1: | |
1679 self.deleteFromPublicationList(key); | |
1680 | |
1681 elif(splitted[1]) == "p": | |
1682 self.setPublicationPriority(splitted[0],value); | |
1683 | |
1684 | |
1685 pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self) | |
1686 return pt() | |
1687 | |
1688 | |
1689 def deleteFromPublicationList(self,escidocid): | |
1690 """Loessche publication with escidoc id from publication list""" | |
1691 | |
1692 query ="DELETE FROM pubmanbiblio WHERE escidocid=%s and key_main=%s" | |
1693 | |
1694 self.executeZSQL(query,[escidocid,self.getKey()]); | |
1695 | |
1696 | |
1697 def setPublicationPriority(self,escidocid,value): | |
1698 | |
1699 query="update pubmanbiblio set priority=%s where escidocid=%s and key_main=%s" | |
1700 | |
1701 self.executeZSQL(query,[value,escidocid,self.getKey()]); | |
1702 | |
1703 | |
1704 def getSelectedPublications(self): | |
1705 """hole publications aus der datenbank""" | |
1706 | |
1707 | |
1708 query="select * from pubmanbiblio where key_main = %s order by priority" | |
1709 | |
1710 | |
1711 return self.executeZSQL(query,[self.getKey()]) | |
1712 | |
1575 InitializeClass(MPIWGStaffMember) | 1713 InitializeClass(MPIWGStaffMember) |