From 0077cb99704fe863cf731fc5cab792af2ede96c2 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 17 Apr 2011 20:13:07 -0400 Subject: Backporting retarded amount of changes outside of version control --- admin/newsreel/functions.php | 318 +++++++++++++++++++++---------------------- 1 file changed, 159 insertions(+), 159 deletions(-) (limited to 'admin/newsreel/functions.php') diff --git a/admin/newsreel/functions.php b/admin/newsreel/functions.php index 6bde17c..f8cb759 100644 --- a/admin/newsreel/functions.php +++ b/admin/newsreel/functions.php @@ -1,160 +1,160 @@ - - - -. - */ - - define(MAX_SLIDES, 6); - - function EditOrder(){ - - global $db; - ?> -
- - - - - -
News Reel Order
- - Click and drag on a slide to change the order. Wait for confirmation indicating the changes have been saved. -
-= MAX_SLIDES){ - ReportError("There are already 6 active slides. You must disable one in order to enable another."); - PageRedirect(3,"?op=newsreel"); - return; - } - $weight = $lastspot+1; - $db->Query("UPDATE `bayonet_newsreel` SET `visible` = 1, `weight` = '$weight' WHERE `slide_id` = '$slide_id' LIMIT 1"); - PageRedirect(0,"?op=newsreel"); - } - - function DisableSlide($slide_id){ - - global $db; - $result = $db->Query("SELECT `weight` FROM `bayonet_newsreel` WHERE `slide_id` = '$slide_id' LIMIT 1"); - $slide = $db->FetchRow($result); - - $oldWeight = $slide['weight']; - - if($oldWeight < MAX_SLIDES){ - $total = getNumOfActive(); - for($i=$oldWeight+1; $i<=$total; $i++){ - //echo "Change Weight:".$i." to ".($i-1)."
"; - $new = $i-1; - $db->Query("UPDATE `bayonet_newsreel` SET `weight` = '$new' WHERE `weight` = '$i' LIMIT 1"); - } - } - - $db->Query("UPDATE `bayonet_newsreel` SET `visible` = 0, `weight` = 0 WHERE `slide_id` = '$slide_id' LIMIT 1"); - PageRedirect(0,"?op=newsreel"); - } - - function ListInactive(){ - - global $db; - echo "

Disabled Slides

"; - $result = $db->Query("SELECT `slide_id`, `title`, `src` FROM `bayonet_newsreel` WHERE `visible` = 0 ORDER BY `slide_id` DESC"); - $row = $db->Fetch($result); - - foreach($row as $slide){ - echo PrintSlide($slide); - echo "


"; - } - } - - function PrintSlide($slide){ - echo "{$slide['title']}"; - if(file_exists("../modules/newsreel/slides/{$slide['src']}") && $slide['src'] != ""){ - echo "
"; - } - } - - function GetLastPosition(){ - - global $db; - $result = $db->Query("SELECT `weight` FROM `bayonet_newsreel` WHERE `visible` = 1 ORDER BY `weight` DESC LIMIT 1"); - $row = $db->FetchRow($result); - - return $row['weight']; - } - - function getNumOfActive(){ - global $db; - $result = $db->Query("SELECT `slide_id` FROM `bayonet_newsreel` WHERE `visible` = 1"); - return $db->Rows($result); - } - - + + + +. + */ + + define(MAX_SLIDES, 6); + + function EditOrder(){ + + global $db; + ?> +
+ + + + + +
News Reel Order
+ + Click and drag on a slide to change the order. Wait for confirmation indicating the changes have been saved. +
+= MAX_SLIDES){ + ReportError("There are already 6 active slides. You must disable one in order to enable another."); + PageRedirect(3,"?op=newsreel"); + return; + } + $weight = $lastspot+1; + $db->Query("UPDATE `bayonet_newsreel` SET `visible` = 1, `weight` = '$weight' WHERE `slide_id` = '$slide_id' LIMIT 1"); + PageRedirect(0,"?op=newsreel"); + } + + function DisableSlide($slide_id){ + + global $db; + $result = $db->Query("SELECT `weight` FROM `bayonet_newsreel` WHERE `slide_id` = '$slide_id' LIMIT 1"); + $slide = $db->FetchRow($result); + + $oldWeight = $slide['weight']; + + if($oldWeight < MAX_SLIDES){ + $total = getNumOfActive(); + for($i=$oldWeight+1; $i<=$total; $i++){ + //echo "Change Weight:".$i." to ".($i-1)."
"; + $new = $i-1; + $db->Query("UPDATE `bayonet_newsreel` SET `weight` = '$new' WHERE `weight` = '$i' LIMIT 1"); + } + } + + $db->Query("UPDATE `bayonet_newsreel` SET `visible` = 0, `weight` = 0 WHERE `slide_id` = '$slide_id' LIMIT 1"); + PageRedirect(0,"?op=newsreel"); + } + + function ListInactive(){ + + global $db; + echo "

Disabled Slides

"; + $result = $db->Query("SELECT `slide_id`, `title`, `src` FROM `bayonet_newsreel` WHERE `visible` = 0 ORDER BY `slide_id` DESC"); + $row = $db->Fetch($result); + + foreach($row as $slide){ + echo PrintSlide($slide); + echo "


"; + } + } + + function PrintSlide($slide){ + echo "{$slide['title']}"; + if(file_exists("../modules/newsreel/slides/{$slide['src']}") && $slide['src'] != ""){ + echo "
"; + } + } + + function GetLastPosition(){ + + global $db; + $result = $db->Query("SELECT `weight` FROM `bayonet_newsreel` WHERE `visible` = 1 ORDER BY `weight` DESC LIMIT 1"); + $row = $db->FetchRow($result); + + return $row['weight']; + } + + function getNumOfActive(){ + global $db; + $result = $db->Query("SELECT `slide_id` FROM `bayonet_newsreel` WHERE `visible` = 1"); + return $db->Rows($result); + } + + ?> \ No newline at end of file -- cgit