changeset 253:bbe0d57d6ac9

Use a refresh function dispatcher.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 24 Nov 2013 01:26:08 +0200
parents 35ce3e593195
children c26167a096bf
files admin.php
diffstat 1 files changed, 18 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/admin.php	Sun Nov 24 01:24:10 2013 +0200
+++ b/admin.php	Sun Nov 24 01:26:08 2013 +0200
@@ -133,21 +133,17 @@
 }
 
 
-function refreshCCSettings()
-{
-  refreshItems("tabContCCSettings", "settings", "General settings", "");
-}
-
-
-function refreshCCNews()
+function refreshDispatchCC(id)
 {
-  refreshItems("tabContCCNews", "news", "News list", "");
-}
-
-
-function refreshCCAttendees()
-{
-  refreshItems("tabContCCAttendees", "attendees", "Attendees list", "");
+  switch (id)
+  {
+    case "Settings": refreshItems("tabContCCSettings", "settings", "General settings", ""); break;
+    case "News": refreshItems("tabContCCNews", "news", "News list", ""); break;
+    case "Attendees": refreshItems("tabContCCAttendees", "attendees", "Attendees list", ""); break;
+    case "Voters": refreshItems("tabContCCVoters", "voters", "Voters list", ""); break;
+    case "Compos": refreshItems("tabContCCCompos", "compos", "Compo list", ""); break;
+    case "Entries": refreshCCEntries(); break;
+  }
 }
 
 
@@ -163,18 +159,6 @@
 }
 
 
-function refreshCCVoters()
-{
-  refreshItems("tabContCCVoters", "voters", "Voters list", "");
-}
-
-
-function refreshCCCompos()
-{
-  refreshItems("tabContCCCompos", "compos", "Compo list", "");
-}
-
-
 function refreshCCEntries()
 {
   var msuccess1 = function(txt)
@@ -199,9 +183,9 @@
 }
 
 
-function refreshCCInfo()
+function refreshDispatchCM(id)
 {
-//  refreshItems("tabContCCInfo", "info", "Info system", "");
+  refreshItems("tabContCM"+ id, "entries", "Compo entries", "&id="+ id);
 }
 
 
@@ -211,7 +195,7 @@
 
   var msuccess = function(txt)
   {
-    setTimeout("refreshCCNews();", 50);
+    setTimeout("refreshDispatchCC('News');", 50);
   }
 
   if (args != "")
@@ -223,7 +207,7 @@
 
 function deleteNews(id)
 {
-  deleteItem(id, "news", "news", "refreshCCNews();", "news item");
+  deleteItem(id, "news", "news", "refreshDispatchCC('News');", "news item");
 }
 
 
@@ -248,7 +232,7 @@
 
   var msuccess = function(txt)
   {
-    setTimeout("refreshCCAttendees();", 50);
+    setTimeout("refreshDispatchCC('Attendees');", 50);
   }
 
   if (args != "")
@@ -260,7 +244,7 @@
 
 function deleteAttendee(id)
 {
-  deleteItem(id, "attendee", "attendees", "refreshCCAttendees();", "attendee");
+  deleteItem(id, "attendee", "attendees", "refreshDispatchCC('Attendees');", "attendee");
 }
 
 
@@ -324,7 +308,7 @@
 
   var msuccess = function(txt)
   {
-    setTimeout("refreshCCCompos();", 50);
+    setTimeout("refreshDispatchCC('Compos');", 50);
   }
 
   if (args != "")
@@ -429,7 +413,7 @@
       tabHead.style.borderTop = (tab == id) ? "4px solid white" : "none";
       if (tab == id)
       {
-        setTimeout("refresh"+ tabset + id +"();", 10);
+        setTimeout("refreshDispatch"+ tabset +"('"+ id +"');", 10);
       }
     }
   }