# HG changeset patch # User Matti Hamalainen # Date 1386255458 -7200 # Node ID eaea1ae2bc3d6eea67f0ea23abe33fdb9b169aed # Parent 2bb206b4d35846aa4e1e82f59aa359f73e2f7d94 Moar work. diff -r 2bb206b4d358 -r eaea1ae2bc3d admajax.php --- a/admajax.php Thu Dec 05 16:28:13 2013 +0200 +++ b/admajax.php Thu Dec 05 16:57:38 2013 +0200 @@ -220,9 +220,9 @@ $strCompo = $strCurrEntry = $strPrevEntry = "-"; return - "
Current compo:
".$strCompo."
\n". - "
Current entry:
".$strCurrEntry."
\n". - "
Previous entry:
".$strPrevEntry."
\n"; + "
Current compo:
".$strCompo."
\n". + "
Current entry:
".$strCurrEntry."
\n". + "
Previous entry:
".$strPrevEntry."
\n"; } @@ -233,18 +233,19 @@ stGetDisplayVar("compoID")); $currShowID = stGetDisplayVar("compoCurrEntry"); - $str = ""; + $str = " ".stGetOptionListStart("ctrlEntryList"); + if (($res = stExecSQL($sql)) !== false) { foreach ($res as $item) { $str .= - " ".stGetOptionListItem($item["id"], + " ".stGetOptionListItem($item["show_id"], ($item["show_id"] == $currShowID), sprintf("%3d. %s by %s", $item["show_id"], $item["name"], $item["author"])); } } - return $str; + return $str." ".stGetOptionListEnd(); } @@ -257,7 +258,8 @@ function stGetOptionListStart($id, $onChange = "") { return - "\n"; } @@ -273,7 +275,7 @@ function stGetOptionListEnd() { - return "\n"; + return "\n"."\n"; } @@ -447,7 +449,7 @@ $prev = stGetDisplayVar("showMode"); if ($prev != $mode) { - stSetDisplayVar("lastUpdate", time()); + stDisplayUpdated(); stSetDisplayVar("showMode", $mode); } } @@ -463,9 +465,10 @@ $prev = stGetDisplayVar("compoID"); if ($prev != $compo_id) { - stSetDisplayVar("compoCurrEntry", 1); + stSetDisplayVar("compoCurrEntry", 0); stSetDisplayVar("compoPrevEntry", 0); stSetDisplayVar("compoID", $compo_id); + stDisplayUpdated(); } } } @@ -500,6 +503,7 @@ { stSetDisplayVar("compoCurrEntry", $curr); stSetDisplayVar("compoPrevEntry", $prev); + stDisplayUpdated(); } } else @@ -661,33 +665,31 @@ { foreach ($res as $item) { - echo " ".stGetOptionListItem($item["id"], + echo " ".stGetOptionListItem($item["id"], ($item["id"] == $currCompoID), sprintf("%s (%d entries)", $item["name"], $item["nentries"])); } } echo - " ".stGetOptionListEnd(). - "
\n". - " ".stGetFormButtonInput("setcompo", "", "", "Change compo", "activateCompo()")."\n". - "
\n". - "\n"; + " ".stGetOptionListEnd(). + "
\n". + " ".stGetFormButtonInput("setcompo", "", "", "Change compo", "activateCompo()")."\n". + "
\n". + " \n"; echo - "
\n". - " ".stGetOptionListStart("ctrlEntryList"). + "
\n". stGetInfoCurrEntryList(). - " ".stGetOptionListEnd(). - "
\n". - " ".stGetFormButtonInput("setentry", "", "", "Set selected entry", "setSelectedEntry()")."\n". - " ".stGetFormButtonInput("nextentry", "", "", "Prev entry", "gotoPrevEntry()")."\n". - " ".stGetFormButtonInput("preventry", "", "", "Next entry", "gotoNextEntry()")."\n". + "
\n". + " ".stGetFormButtonInput("setentry", "", "", "Set selected entry", "setSelectedEntry()")."\n". + " ".stGetFormButtonInput("preventry", "", "", "Prev entry", "switchEntry(-1)")."\n". + " ".stGetFormButtonInput("nextentry", "", "", "Next entry", "switchEntry(1)")."\n". + "
\n". "
\n". - "
\n". - "
\n". + "
\n". stGetInfoCurrEntryData(). - "
\n". + "
\n". "
\n"; break; diff -r 2bb206b4d358 -r eaea1ae2bc3d admin.php --- a/admin.php Thu Dec 05 16:28:13 2013 +0200 +++ b/admin.php Thu Dec 05 16:57:38 2013 +0200 @@ -505,13 +505,22 @@ } +function refreshCurrEntryData() +{ + jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", ""); +} + + +function refreshCurrEntryListData() +{ + jsRefreshItems("ctrlEntryList", "infoCurrEntryList", ""); + refreshCurrEntryData(); +} + + function activateCompo() { - var msuccess = function () - { - jsRefreshItems("ctrlEntryList", "infoCurrEntryList", ""); - jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", ""); - } + jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoListSel", 4), refreshCurrEntryListData); jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoList", 4), msuccess); } diff -r 2bb206b4d358 -r eaea1ae2bc3d msite.inc.php --- a/msite.inc.php Thu Dec 05 16:28:13 2013 +0200 +++ b/msite.inc.php Thu Dec 05 16:57:38 2013 +0200 @@ -87,6 +87,12 @@ } +function stDisplayUpdated() +{ + stSetDisplayVar("lastUpdate", time()); +} + + function stGetDisplayVar($name) { global $displayVars; diff -r 2bb206b4d358 -r eaea1ae2bc3d showajax.php --- a/showajax.php Thu Dec 05 16:28:13 2013 +0200 +++ b/showajax.php Thu Dec 05 16:57:38 2013 +0200 @@ -181,7 +181,7 @@ // Check if we need to update the "last updated" timestamp if ($updated) - stSetDisplayVar("lastUpdate", time()); + stDisplayUpdated(); //