# HG changeset patch # User Matti Hamalainen # Date 1385249168 -7200 # Node ID bbe0d57d6ac90c136c6480d07dec950c1e04eeba # Parent 35ce3e5931952c28e9ceb83257821c3b72d6b101 Use a refresh function dispatcher. diff -r 35ce3e593195 -r bbe0d57d6ac9 admin.php --- 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); } } }