Mercurial > hg > fapweb
changeset 453:f2a0da566e30
Moar work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 06 Dec 2013 17:09:06 +0200 |
parents | 6b0802a8e07c |
children | ea7fc4e9f602 |
files | admajax.php admin.php |
diffstat | 2 files changed, 38 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Fri Dec 06 17:08:45 2013 +0200 +++ b/admajax.php Fri Dec 06 17:09:06 2013 +0200 @@ -266,6 +266,7 @@ "ORDER BY id DESC"; $str = stGetOptionListStart("ctrlRotationLists", $indent, $outer); + $currListID = stGetDisplayVar("rotateList"); if (($res = stExecSQL($sql)) !== false) { @@ -308,8 +309,8 @@ $str = ($outer ? $indent."<div class=\"ctrlBox\" id=\"ctrlRotationListEdit\">\n" : ""). $indent." <div class=\"ctrlTitle\">Edit rotation list</div>\n". - $indent." ".stGetFormTextInput(30, SET_LEN_ROT_LIST_NAME, "ctrlEDRotationListName", "", "", $data["name"])."\n". - $indent." ".stGetFormButtonInput("updname", "", "", "Save", "updateRotationListName()")."\n". + $indent." ".stGetFormTextInput(30, SET_LEN_ROT_LIST_NAME, "", "ctrlEDRotationListName", "", $data["name"])."\n". + $indent." ".stGetFormButtonInput("updname", "", "", "Save", "updateRotationList(".$list_id.")")."\n". "<div>Available slides:</div>\n". stGetOptionListStart("ctrlEDDisplaySlides", $indent." ", TRUE); @@ -325,10 +326,10 @@ "<div>List content:</div>\n". stGetInfoRotationListEditData($indent." ", TRUE, $list_id). $indent." <div class=\"ctrlButtons\">\n". - $indent." ".stGetFormButtonInput("moveslideup", "", "", "Move Up", "moveRotationListSlide(-1)")."\n". - $indent." ".stGetFormButtonInput("moveslidedn", "", "", "Move Down", "moveRotationListSlide(1)")."\n". - $indent." ".stGetFormButtonInput("addslide", "", "", "Add slide", "addRotationListSlide()")."\n". - $indent." ".stGetFormButtonInput("delslide", "", "", "Remove slide", "removeRotationListSlide()")."\n". + $indent." ".stGetFormButtonInput("moveslideup", "", "", "Move Up", "moveRotationListSlide(".$list_id.", -1)")."\n". + $indent." ".stGetFormButtonInput("moveslidedn", "", "", "Move Down", "moveRotationListSlide(".$list_id.", 1)")."\n". + $indent." ".stGetFormButtonInput("addslide", "", "", "Add slide", "addRotationListSlide(".$list_id.")")."\n". + $indent." ".stGetFormButtonInput("delslide", "", "", "Remove slide", "removeRotationListSlide(".$list_id.")")."\n". $indent." ".stGetFormButtonInput("closeedit", "", "", "Close", "jsCloseAdminPopup()")."\n". $indent." </div>\n". ($outer ? $indent."</div>\n" : ""); @@ -713,6 +714,20 @@ break; case "updateRotationList": + if (stChkRequestItem("id", $list_id, array(CHK_TYPE, VT_INT, "Invalid data.")) && + stChkRequestItem("name", $fake, + array(CHK_GTEQ, VT_STR, 3, "Rotation list name too short."), + array(CHK_LTEQ, VT_STR, SET_LEN_ROT_LIST_NAME, "Rotation list name too long."))) + { + $sql = stPrepareSQLUpdate("rotationListData", + "WHERE id=".$list_id, + array( + "name" => "S", + )); + + stExecSQLCond($sql, "OK, list updated."); + stDisplayUpdated(); + } stDisplayUpdated(); break;
--- a/admin.php Fri Dec 06 17:08:45 2013 +0200 +++ b/admin.php Fri Dec 06 17:09:06 2013 +0200 @@ -575,6 +575,23 @@ } +function activateRotationList() +{ + var id = jsGetValue("ctrlRotationListsSel", 4); + if (id > 0) + jsSendPOSTRequest("action=ctrl&type=activateRotationList&id="+id); + else + jsMessageBox("No rotation list selected?"); +} + + +function updateRotationList(id) +{ + var name = jsGetValue("ctrlEDRotationListName", 1); + jsSendPOSTRequest("action=ctrl&type=updateRotationList&id="+id+"&name="+name, refreshRotationListSel); +} + + function moveRotationListSlide(list_id, dir) { /*