changeset 79:7f26c8e6c8e9

more styles for project lists.
author casties
date Wed, 08 May 2013 17:03:50 +0200
parents d15cd451b5a9
children b1893c4c9d2c
files MPIWGProjects.py MPIWGStaff.py css/mpiwg.css
diffstat 3 files changed, 68 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGProjects.py	Wed May 08 10:33:39 2013 +0200
+++ b/MPIWGProjects.py	Wed May 08 17:03:50 2013 +0200
@@ -1607,24 +1607,37 @@
                 projects.append(p)
 
         # sort by project number            
-        projects.sort(key=lambda p:[int(n) for n in p.getNumber().split('.')])
+        projects.sort(key=lambda p:[getInt(n) for n in p.getNumber().split('.')])
         return projects
         
         
-    def getMembersWithProjects(self):
+    def getMembersWithProjects(self, onlyActive=True):
         """Return a list of all members that have projects.
         
-        Returns a list of member keys.
+        @param onlyActive: only active members
+         
+        Returns a list of member objects.
         """
+        members = []
+        sf = self.en.getStaffFolder()
         res = self.executeZSQL("select distinct member_key from projects_members")
-        return [r.member_key for r in res]
+        if onlyActive:
+            for r in res:
+                m = sf.getMember(key=r.member_key)
+                if m is not None and m.isActive():
+                    members.append(m)
+                    
+        else:
+            # not only active
+            members = [sf.getMember(key=r.member_key) for r in res]
+
+        return members
         
         
     security.declareProtected('View management screens', 'changeProjectTree')
     def changeProjectTree(self, RESPONSE=None):
         """change the complete tree"""
         form=self.REQUEST.form
-        hashList={}
         onlyArchived=int(form.get("onlyArchived",0))
         onlyActive=int(form.get("onlyActive",0))
         dep=form.get("dep",None)
--- a/MPIWGStaff.py	Wed May 08 10:33:39 2013 +0200
+++ b/MPIWGStaff.py	Wed May 08 17:03:50 2013 +0200
@@ -1183,6 +1183,10 @@
         """returns if this member exists"""
         return len(self.content) > 0
 
+    def isActive(self):
+        """Return if this member is visible (published)."""
+        return (self.content.publish_the_data == 'yes')
+
     def getKey(self):
         """returns the db key"""
         return self.content.key
@@ -1196,7 +1200,7 @@
         """return cone ID"""
         results= self.folder.executeZSQL("SELECT coneid FROM keys  WHERE  key_main = %s",[self.content.key]) 
         for res in results:
-             return res.coneid
+            return res.coneid
         return None
     
     def getPublishedImageUrl(self):
@@ -1214,7 +1218,7 @@
     
     # TODO: ugly!
     security.declarePublic('sortBibliography')    
-    def sortBibliography(self,bib,sortingMode=None,max=None):
+    def sortBibliography(self, bib, sortingMode=None, max=None):
         """sort bibliography"""
         if not sortingMode:
             sortingMode= "priority"
@@ -1227,7 +1231,7 @@
             l.sort(key=lambda x: getInt(x.priority))
         
         if max:
-            return l[0:min(len(l),max)]
+            return l[0:max]
         else:
             return l
 
@@ -1603,11 +1607,9 @@
         #TODO: How to invalidate the varnish cache from the member object
         pass;
         
-        
-    def getStaffURL(self):
-        ident = self.content.e_mail;
-        splitted = ident.split("@");
-        return splitted[0]
+    
+    # TODO: compat, is this used?
+    getStaffURL = getUsername
         
     def getPublicationsFromPubman(self,limit=None,publicationType=None):
         
--- a/css/mpiwg.css	Wed May 08 10:33:39 2013 +0200
+++ b/css/mpiwg.css	Wed May 08 17:03:50 2013 +0200
@@ -537,7 +537,9 @@
 
 div.tool.box div.atoz {
     color: #887163;
+    font-family: Verdana, Arial, sans-serif;
     font-size: 14px;
+    font-style: normal;
     margin-top: 10px;
 }
 
@@ -774,24 +776,32 @@
 }
 
 /*
- * table with articles
+ * pubman references
  */
-table.articles {
+.reference .Italic {
+    font-style: italic;
+}
+
+
+/*
+ * table with items (articles)
+ */
+table.items {
     /* no space between cells */
     border-collapse: collapse;
 }
 
-table.articles td {
+table.items td {
     vertical-align: top;
     text-align: left;
     line-height: 1.5;
     padding: 1em 1em 0.5em 0;
 }
-table.articles td:last-child {
+table.items td:last-child {
     padding-right: 0;
 }
 
-table.articles th {
+table.items th {
     font-family: Georgia, Times, serif;
     font-size: 16px;
     font-weight: normal;
@@ -801,26 +811,42 @@
     border-bottom: 3px solid #dccbae;
 }
 
-table.articles tr.abstract td {
-    /* abstract has no padding-top */
+table.items h2 {
+    border-bottom: 3px solid #dccbae;
+    margin-bottom: 0;
+}
+table.items h2 a {
+    color: inherit;
+    font-weight: inherit;
+    text-decoration: none;    
+}
+
+table.items img.thumb {
+    width: 55px;
+    height: 34px;
+}
+
+table.items td.line,
+table.items tr.line td {
+    border-bottom: 1px solid #dccbae;
+}
+
+table.items tr.last_item td {
+    /* last_item has no padding-top */
     padding: 0 0 0.5em 0;
 }
 
-table.articles td.line {
-    border-bottom: 1px solid #dccbae;
-}
-
-table.articles h3.fold_head {
+table.items h3.fold_head {
     font-size: 12px;
     background-color: #f6f2eb;
     padding: 3px;
 }
 
-table.articles h3.fold_head img {
+table.items h3.fold_head img {
     margin: 0 5px 0 3px;
 }
 
-table.articles div.fold_body {
+table.items div.fold_body {
     padding: 0.5em 0 0 20px;
 }