diff admin.js @ 608:7d676c77e3f8

Add functionality for deleting a compo.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 31 Oct 2014 23:13:44 +0200
parents 00fbc876f535
children 0508fb0c1304
line wrap: on
line diff
--- a/admin.js	Fri Oct 31 23:10:47 2014 +0200
+++ b/admin.js	Fri Oct 31 23:13:44 2014 +0200
@@ -42,7 +42,7 @@
 }
 
 
-function jsDeleteItem(id,prefix,type,func,dsc)
+function jsDeleteItem(id,prefix,type,func,dsc,dsc2)
 {
   var msuccess = function(txt)
   {
@@ -68,7 +68,10 @@
     item.style.background = tmp;
   }
   
-  jsConfirmBox("Are you sure you want to delete "+dsc+" #"+id+"?", mcb_ok, mcb_cancel, 0);
+  if (dsc)
+    jsConfirmBox("Are you sure you want to delete "+dsc+" #"+id+"?", mcb_ok, mcb_cancel, 0);
+  else
+    jsConfirmBox(dsc2, mcb_ok, mcb_cancel, 0);
 }
 
 
@@ -275,6 +278,14 @@
 }
 
 
+function deleteCompo(id)
+{
+  jsDeleteItem(id, "compo", "compo", "refreshDispatchCC('Compos');", 0, 
+    "Are you ABSOLUTELY sure you want to delete compo #"+id+"? "+
+    "This will delete all votes AND entries related to it!");
+}
+
+
 function addEntry(id)
 {
   var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1}, "ne", id);