[Mpuls-commits] r1065 - wasko/branches/2.0/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 1 14:35:48 CET 2010


Author: torsten
Date: 2010-02-01 14:35:47 +0100 (Mon, 01 Feb 2010)
New Revision: 1065

Modified:
   wasko/branches/2.0/waskaweb/controllers/logbook.py
Log:
* waskaweb/controllers/logbook.py (LogbookController.delete): Moved to
logbook controller


Modified: wasko/branches/2.0/waskaweb/controllers/logbook.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/logbook.py	2010-02-01 13:33:00 UTC (rev 1064)
+++ wasko/branches/2.0/waskaweb/controllers/logbook.py	2010-02-01 13:35:47 UTC (rev 1065)
@@ -229,6 +229,30 @@
             c.url_ok = "/logbook/index/%s" % str(session['case'].id)
             return render('/logbook/dialogs/failed_save_logbook_entry.mako')
 
+    @checkRole('cm_ka')
+    def delete(self, id, confirmed=False):
+        id = self._checkInt(id)
+        confirmed = self._checkBool(confirmed)
+        if confirmed == 1:
+            try:
+                Logbook().deleteEntryById(int(id))
+                c.success_for = LOGBOOK_ENTRY_DELETE_SUCCESS
+                c.success_text = LOGBOOK_ENTRY_DELETE_SUCCESS_TEXT
+                c.url_ok = "/case/logbook/%s" % str(session['case'].id)
+                return render('/logbook/dialogs/success_delete_logbook_entry.mako')
+            except Exception, e:
+                log.exception(e)
+                c.failed_for = LOGBOOK_ENTRY_DELETE_FAILED
+                c.failed_text = LOGBOOK_ENTRY_DELETE_FAILED_TEXT
+                c.url_ok = "/logbook/index/%s" % str(session['case'].id)
+                return render('/logbook/dialogs/failed_delete_logbook_entry.mako')
+        else:
+            c.confirm_for = DELETE_LOGBOOK_ENTRY_CONFIRM
+            c.question = DELETE_LOGBOOK_ENTRY_CONFIRM_TEXT
+            c.url_yes = "/logbook/delete/%s/1" % id
+            c.url_no = "/logbook/index/%s" % session['case'].id
+            return render('/logbook/dialogs/confirm_delete_logbook_entry.mako')
+
     @checkRole(('cm_ka'))
     def printout(self, id):
         id = self._checkInt(id)



More information about the Mpuls-commits mailing list