diff MPIWGProjects.py @ 97:7b96a85552aa

fix bugs in project editing. only show images with captions in project description.
author casties
date Tue, 21 May 2013 15:51:32 +0200
parents 2dd8e3be4a8e
children 84fa3f62ed85
line wrap: on
line diff
--- a/MPIWGProjects.py	Thu May 16 15:58:28 2013 +0200
+++ b/MPIWGProjects.py	Tue May 21 15:51:32 2013 +0200
@@ -371,12 +371,6 @@
         # {'label':'Edit Themes & Disciplines','action':'editMPIWGDisciplinesThemesForm'},
         # {'label':'Versionmanager','action':'versionManageForm'},
 
-    # list of responsible scientists. entries are dicts with name, key, and username.
-    responsibleScientistsList = []
-    
-    # thumbnail image
-    projectThumb = None
-
     #
     # templates
     #
@@ -421,6 +415,7 @@
         self.title = id
         self.isActiveFlag = True  # Flag is true is the project is still active, False if accomplished
         self.responsibleScientistsList = []  # enthaelt die Lister der verantwortlichen Wissenschaftler in der Form (NAME, KEY), key ist "" flass Wissenschaftler nicht an unserem Haus
+        self.projectThumb = None
         
         if argv:
             for arg in definedFields:
@@ -512,7 +507,7 @@
     
     def getResponsibleScientistsList(self):
         """returns a list with the responsible scientists as dicts with name, key, and shortname"""
-        return self.responsibleScientistsList
+        return getattr(self, 'responsibleScientistsList', [])
 
     
     def setResponsibleScientistsList(self, nameDict):
@@ -574,7 +569,7 @@
               
     def getThumbUrl(self, default=None):
         """returns the URL of the project thumbnail image"""
-        thumb = self.projectThumb
+        thumb = getattr(self, 'projectThumb', None)
         if thumb is None:
             # get thumb from list (thumb is last image)
             imgs = self.getImageList()
@@ -1254,18 +1249,21 @@
             return self.REQUEST['URL1'] + "/no_project"
                     
             
-    def saveFromPreview(self):
+    def saveFromPreview(self, RESPONSE=None):
         """save content aus preview"""
         self.WEB_project_description = self.previewTemplate.WEB_project_description[0:]
-        self.REQUEST.RESPONSE.redirect("./index.html")
+        #self.REQUEST.RESPONSE.redirect("./index.html")
+        if RESPONSE is not None:
+            return self.editDescription()
 
         
-    def saveEditedContent(self, kupu=None, preview=None):
+    def saveEditedContent(self, kupu=None, preview=None, RESPONSE=None):
         """save Edited content"""
         # logging.debug("saveEditedContent kupu=%s preview=%s"%(kupu,preview))
 
         if preview:
             kupu = preview
+            
         # find content of body tags
         start = kupu.find("<body>")
         end = kupu.find("</body>")
@@ -1277,10 +1275,11 @@
         self.copyObjectToArchive()
         self.WEB_project_description = newcontent[0:]
        
-        self.REQUEST.RESPONSE.redirect("./index.html")
+        #self.REQUEST.RESPONSE.redirect("./index.html")
         
-        return True
-
+        if RESPONSE is not None:
+            return self.editDescription()
+            
 
     def getBreadcrumbs(self):
         """return list of breadcrumbs from here to the root"""
@@ -1322,7 +1321,7 @@
             setattr(tmpPro, field, getattr(self, field))
         tmpPro.WEB_project_description = description[0:]
         tmpPro.invisible = True
-        pt = PageTemplateFile('zpt/previewFrame.zpt', globals()).__of__(self)
+        pt = PageTemplateFile('zpt/project/edit_preview_frame', globals()).__of__(self)
         return pt()