aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-21 23:12:44 -0500
committerjhunkeler <jhunkeler@c5b2fb0a-d05d-0410-98c8-828840a80ff6>2009-12-21 23:12:44 -0500
commitb06638761f326c7f53f157137b119008c2ff7b35 (patch)
tree89e3487179ff24cd55debdb0819ef1bee1c058f9
parent75dddd70a7f004601e0ad4aff214d94be793cd4b (diff)
downloadbayonetcms-b06638761f326c7f53f157137b119008c2ff7b35.tar.gz
(OC) newsreel admin is working smoothly now
git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@391 c5b2fb0a-d05d-0410-98c8-828840a80ff6
-rw-r--r--admin/newsreel/functions.php51
-rw-r--r--admin/newsreel/index.php14
-rw-r--r--admin/pages/functions.php13
3 files changed, 70 insertions, 8 deletions
diff --git a/admin/newsreel/functions.php b/admin/newsreel/functions.php
index b3c2d5f..583e719 100644
--- a/admin/newsreel/functions.php
+++ b/admin/newsreel/functions.php
@@ -69,7 +69,9 @@ $(document).ready(function(){
$result = $db->Query("SELECT `title`, `slide_id`, `src` FROM `bayonet_newsreel` WHERE `visible` = 1 ORDER BY `weight` ASC");
while(($row = $db->fetch($result))!= false){
- echo "<li id=\"recordsArray_{$row['slide_id']}\">{$row['title']}<br /><img src=\"../modules/newsreel/slides/{$row['src']}\" width=\"100px\" /></li>";
+ echo "<li id=\"recordsArray_{$row['slide_id']}\">";
+ PrintSlide($row);
+ echo "<br /><a href=\"?op=newsreel&disable={$row['slide_id']}\"><input type=\"button\" value=\"Disable\" /></a></li>";
}
?>
</ul>
@@ -78,6 +80,53 @@ $(document).ready(function(){
<?php
}
+ function EnableSlide($slide_id){
+
+ global $db;
+ $lastspot = GetLastPosition();
+ if($lastspot >= 6){
+ 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;
+ echo "Disable: ".$slide_id;
+ $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;
+ $result = $db->query("SELECT `slide_id`, `title`, `src` FROM `bayonet_newsreel` WHERE `visible` = 0 ORDER BY `slide_id` DESC");
+ while(($row = $db->fetch($result))!= false){
+
+ echo PrintSlide($row);
+ echo "<br /><a href=\"?op=newsreel&enable={$row['slide_id']}\"><input type=\"button\" value=\"Enable\" /></a><br /><br />";
+ }
+ }
+
+ function PrintSlide($slide){
+ echo "{$slide['title']}";
+ if(file_exists("../modules/newsreel/slides/{$slide['src']}") && $slide['src'] != ""){
+ echo "<br /><img src=\"../modules/newsreel/slides/{$slide['src']}\" width=\"100px\" />";
+ }
+ }
+
+ function GetLastPosition(){
+
+ global $db;
+ $result = $db->query("SELECT `weight` FROM `bayonet_newsreel` ORDER BY `weight` DESC LIMIT 1");
+ $row = $db->Fetch($result);
+ return $row['weight'];
+ }
?> \ No newline at end of file
diff --git a/admin/newsreel/index.php b/admin/newsreel/index.php
index cd3f0e1..a12eed2 100644
--- a/admin/newsreel/index.php
+++ b/admin/newsreel/index.php
@@ -27,6 +27,18 @@ include $basedir.'newsreel/functions.php';
<table class="panel" width="100%">
<tr>
<td class="panel"><?php EditOrder(); ?></td>
- <td class="panel-box" width="50%"></td>
+ <td class="panel-box" width="50%">
+ <?php
+ if(isset($_GET['enable'])){
+ $slide_id = $_GET['enable'];
+ EnableSlide($slide_id);
+ }else if(isset($_GET['disable'])){
+ $slide_id = $_GET['disable'];
+ DisableSlide($slide_id);
+ }else{
+ ListInactive();
+ }
+ ?>
+ </td>
</tr>
</table>
diff --git a/admin/pages/functions.php b/admin/pages/functions.php
index 9d39618..3f8f59f 100644
--- a/admin/pages/functions.php
+++ b/admin/pages/functions.php
@@ -231,8 +231,7 @@ function ListPages($pid = NULL)
</tr>
<?php
- }
-
+ }
?>
<!--
<tr style="vertical-align:bottom; background-color:green; text-overflow:ellipsis; overflow:hidden;">
@@ -240,17 +239,19 @@ function ListPages($pid = NULL)
<table class="panelitems">
<tr><td>
<?php echo LinkInternal('<img src="images/add.png" />&nbsp;Create New Page','?op=pages&create=true'); ?> <br />
- <?php echo LinkInternal('<img src="images/view.gif" />&nbsp;View this Page','../index.php?load=page&id='.$page_id); ?> <br />
+ <?php echo LinkInternal('<img src="images/view.png" />&nbsp;View this Page','../index.php?load=page&id='.$page_id); ?> <br />
<?php echo LinkInternal('<img src="images/cancel.png" />&nbsp;Delete this Page','?op=pages&delete='.$page_id); ?> <br />
</td></tr>
</table>
<td>
</tr> -->
-
+<?php
+ if(isset($_GET['edit'])){
+ ?>
<tr>
<td style="text-align:center; text-overflow:ellipsis; overflow:hidden;">
- <?php echo LinkInternal('<img src="images/view.gif" />&nbsp;View this Page','../index.php?load=page&id='.$pid); ?>
+ <?php echo LinkInternal('<img src="images/view.png" />&nbsp;View this Page','../index.php?load=page&id='.$pid.'" target=\"blank'); ?>
</td>
</tr>
<tr>
@@ -259,7 +260,7 @@ function ListPages($pid = NULL)
</td>
</tr>
<?php
-
+ }
echo "</table>";
}