[cig-commits] r11751 - in cs/portal/trunk/seismo/SeismoWebPortal: . templates/SeismoWebPortal

leif at geodynamics.org leif at geodynamics.org
Thu Apr 3 20:06:30 PDT 2008


Author: leif
Date: 2008-04-03 20:06:30 -0700 (Thu, 03 Apr 2008)
New Revision: 11751

Added:
   cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/trashed_item.html
Modified:
   cs/portal/trunk/seismo/SeismoWebPortal/gui.py
   cs/portal/trunk/seismo/SeismoWebPortal/views.py
Log:
Enable items to be removed from the Trash.  Fixed some icon 404's.


Modified: cs/portal/trunk/seismo/SeismoWebPortal/gui.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/gui.py	2008-04-04 02:20:05 UTC (rev 11750)
+++ cs/portal/trunk/seismo/SeismoWebPortal/gui.py	2008-04-04 03:06:30 UTC (rev 11751)
@@ -41,7 +41,7 @@
 
     def icon(self):
         if hasattr(self, 'iconURL'):
-            return '<img class="icon" src="%s">' % self.iconURL
+            return '<img class="icon" src="%s">' % self.iconURL()
         return ''
 
 
@@ -211,11 +211,13 @@
 
 
 class FileBrowser(TreeBrowser):
-    iconURL = "%s/icons/folder.gif" % config.root
+    def iconURL(self):
+        return "%s/icons/folder.gif" % config.root
 
 
 class EventFinder(Navigator):
-    iconURL = "%s/icons/eventfinder.gif" % config.root
+    def iconURL(self):
+        return "%s/icons/eventfinder.gif" % config.root
 
 
 class EventViewer(Navigator):

Added: cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/trashed_item.html
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/trashed_item.html	                        (rev 0)
+++ cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/trashed_item.html	2008-04-04 03:06:30 UTC (rev 11751)
@@ -0,0 +1,10 @@
+
+<h2>{{ object.icon }} {{ object.name }}</h2>
+
+<form method="post" action="{{ action }}">
+
+    <p>This item is in the Trash.</p>
+
+    <p><input class=submit type="submit" value="Remove from Trash" /></p>
+
+</form>

Modified: cs/portal/trunk/seismo/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/views.py	2008-04-04 02:20:05 UTC (rev 11750)
+++ cs/portal/trunk/seismo/SeismoWebPortal/views.py	2008-04-04 03:06:30 UTC (rev 11751)
@@ -79,6 +79,11 @@
         openFileBrowser(desktop)
         return httpResponse(desktopFolder(request, desktop))
 
+    # Plone expand/collapse icon redirect hack
+    last = path[-1]
+    if last in ["fullscreenexpand_icon.gif", "fullscreencollapse_icon.gif"]:
+        return HttpResponseRedirect("http://www.geodynamics.org/cig/" + last)
+
     name = path.pop(0)
 
     static = lambda request, path, desktop: staticServe(request, pathname, document_root = static_media_root)
@@ -325,6 +330,9 @@
     item = gui.File(name, fsNode.name, url = url)
     folder.appendNode(item)
     fileBrowser.path.append(item)
+
+    if fsNode.inTrash:
+        return configTrashedItem(fsNode, url, request, path, desktop)
     
     objId = fsNode.objectId
     obj = fsNode.contents
@@ -378,6 +386,21 @@
     raise Http404
 
 
+def configTrashedItem(fsNode, url, request, path, desktop):
+    if request.method == 'POST':
+        fsNode.inTrash = False
+        fsNode.parent = fsNode.oldParent
+        fsNode.oldParent = None
+        fsNode.save()
+        return HttpResponseRedirect(url)
+    view = gui.ChildWindow(url, "View")
+    view.content = gui.StaticContent(loader.render_to_string('SeismoWebPortal/trashed_item.html',
+                                                             { 'object': fsNode, 'action': url }))
+    desktop.activeWindow.insertWindow(view)
+    desktop.activeWindow.selectWindow(view)
+    return desktop
+
+
 def homeFolder(request, path, desktop):
     if path: raise Http404
     



More information about the cig-commits mailing list