# HG changeset patch # User Matti Hamalainen # Date 1432976919 -10800 # Node ID dec931d9e860cea02d3072f19ad6b3d9350c3149 # Parent 405a02586fc24a76818616a0cb09bd162778993f Implement configurable navigation controls. diff -r 405a02586fc2 -r dec931d9e860 mgallery.inc.php --- a/mgallery.inc.php Sat May 30 11:49:32 2015 +0300 +++ b/mgallery.inc.php Sat May 30 12:08:39 2015 +0300 @@ -70,6 +70,10 @@ "image_navigation" => array(MG_INT, GNAV_TOP | GNAV_BOTTOM | GNAV_SIDE_IMG | GNAV_TEXT | GNAV_JAVASCRIPT | GNAV_BREADCRUMBS), "album_navigation" => array(MG_INT, GNAV_BREADCRUMBS), + "navi_ctrl_up" => array(MG_STR, "^^"), + "navi_ctrl_prev" => array(MG_STR, "<<"), + "navi_ctrl_next" => array(MG_STR, ">>"), + "album_row_limit" => array(MG_INT, 5), "album_page_limit" => array(MG_INT, 100), diff -r 405a02586fc2 -r dec931d9e860 mgallery.php --- a/mgallery.php Sat May 30 11:49:32 2015 +0300 +++ b/mgallery.php Sat May 30 12:08:39 2015 +0300 @@ -78,23 +78,35 @@ } -function mgGetControl($str, $class, &$galIndex, $index, $delta, $naviFlags) +function mgGetControlText($id, $active, $url, $naviFlags) +{ + if ($naviFlags & GNAV_TEXT) + { + $str = chentities(mgGetSetting("navi_ctrl_".$id)); + return + "[". + ($active ? "".$str."" : $str). + "]"; + } + else + return ""; +} + + +function mgGetControl($id, &$galIndex, $index, $delta, $naviFlags) { $active = mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE); if ($active && ($naviFlags & GNAV_IMG)) - $img = mgGetNaviControlImage($galIndex, $res, $class, $url); + $img = mgGetNaviControlImage($galIndex, $res, $id, $url); else $img = ""; - if ($naviFlags & GNAV_TEXT) - $str = "[".($active ? "".$str."" : $str)."]"; - else - $str = ""; + $text = mgGetControlText($id, $active, $url, $naviFlags); if ($delta < 0) - return $img.$str; + return $img.$text; else - return $str.$img; + return $text.$img; } @@ -104,9 +116,9 @@ return "
". - mgGetControl("<<", "prev", $galIndex, $index, -1, $naviFlags). - "[^^]". - mgGetControl(">>", "next", $galIndex, $index, 1, $naviFlags). + mgGetControl("prev", $galIndex, $index, -1, $naviFlags). + mgGetControlText("up", TRUE, mgGetURL($galPath, FALSE), $naviFlags). + mgGetControl("next", $galIndex, $index, 1, $naviFlags). "
\n"; }