changeset 24:6a4996805505

more work on projects.
author casties
date Tue, 09 Apr 2013 16:50:29 +0200
parents 3825a9e17409
children 5a4b22fa726c
files MPIWGDepartment.py MPIWGProjects.py css/mpiwg.css
diffstat 3 files changed, 62 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGDepartment.py	Mon Apr 08 20:47:39 2013 +0200
+++ b/MPIWGDepartment.py	Tue Apr 09 16:50:29 2013 +0200
@@ -136,6 +136,26 @@
         img = getattr(self, 'img-thumb.jpg')
         return img.absolute_url()
 
+    def getProjects(self, onlyActive=0, onlyArchived=0):
+        """returns a list of projects of this department.
+        
+        onlyActive = 0 : all projects
+        onlyActive = 1 : active projects
+        onlyActive = 2 : inactive projects
+        
+        onlyArchived = 0 : all projects
+        onlyArchived = 1 : current projects
+        onlyArchived = 2 : archived projects
+        """
+        # getTree: jeder Eintrag ist ein Tupel (Tiefe, ProjektNummer,Titel,ProjektObject)
+        tree = self.getTree(dep=self.getProjectId(), date=None, onlyActive=onlyActive, onlyArchived=onlyArchived)
+        # re-pack into simple list
+        projects = []
+        for item in tree:
+            projects.append(item[3])
+            
+        return projects
+    
     def changeWeight(self,weight,RESPONSE=None):
         """change weight"""
         self.weight=weight
--- a/MPIWGProjects.py	Mon Apr 08 20:47:39 2013 +0200
+++ b/MPIWGProjects.py	Tue Apr 09 16:50:29 2013 +0200
@@ -253,6 +253,7 @@
         if RESPONSE:
             self.redirect(RESPONSE,"../manageImages")
 
+
 class MPIWGProject(CatalogAware,Folder,Cacheable):
     """Class for Projects"""
     
@@ -712,6 +713,25 @@
         
                 self.redirect(RESPONSE,'manageRelatedProjects')
               
+    def getThumbUrl(self):
+        """returns the URL of the project thumbnail image"""
+        # TODO: improve this
+        imgs = self.getImageList()
+        url = 'http://defaultthumb.jpg'
+        if len(imgs) > 0:
+            img = imgs[0]
+            url = img.absolute_url()
+            
+        return url
+              
+    def getImageList(self):
+        """returns the sorted list of images for this project"""
+        items = self.objectValues(spec='MPIWGProject_image')[:]
+        # sort by place
+        items.sort(key=lambda x:int(getattr(x,'place',0)))
+        return items          
+
+              
     def getImages(self):
         """get all Images"""
 
--- a/css/mpiwg.css	Mon Apr 08 20:47:39 2013 +0200
+++ b/css/mpiwg.css	Tue Apr 09 16:50:29 2013 +0200
@@ -515,28 +515,39 @@
 	margin-top: 0;
 }
 
+div.tool.block ul {
+	margin: 0;
+	padding: 0;
+}
+
+div.tool.block div.options li {
+	font-family: Georgia, Times, serif;
+	font-style: italic;
+	font-size: 16px;
+    color: #887163;
+	list-style-type: none;
+    margin: 0.5em 0;
+}
+
+div.tool.block div.options {
+	margin-top: 20px;
+}
+
 div.tool.block div.atoz {
     color: #887163;
     font-size: 14px;
 }
 
-div.tool.block div.checkbox {
-	margin-top: 20px;
-}
-
-div.tool.block div.checkbox input.checkbox {
+div.tool.block input.checkbox,
+div.tool.block input.radio {
 	/* checkbox uses border-box. don't ask */
-	width: 24px;
-	height: 24px;
+	width: 20px;
+	height: 20px;
 	margin: 0;
 	/* TODO: this should be an image */
 	background-color: white;
 }
 
-div.tool.block div.checkbox h3 {
-	display: inline;
-}
-
 /*
  * sources and websites
  */