ruạṛ
<?php /** * List management page * @version 0.10 * @author Robert Urquhart <programmer@activatedesign.co.nz> * @package WEP-CMS */ session_start(); require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/universal.php'; require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/display.php'; $connID = connect_to_db(); /** * define variables to be passed to header function * @var string $current section of site for navigation menu highlighting * @var string $title page title for browser * @var string $keywords meta keywords * @var string $keywords meta description */ $current = 'lists'; $title = 'Administration Panel'; $keywords = ''; $description = ''; /** * buffer then output page */ ob_start(); head($current,$title,$keywords,$description); this_page(); footer(); ob_end_flush(); /** * clean up and exit script */ exit; /** * function to display content specific to this page */ function this_page() { $list_id = is_numeric_id($_GET['list'],0); $l = new options_list($list_id); if(!$l->list_id) { ?> <p class="center">No list found</p> <?php return; } //else ?> <h1><?php echo ucfirst($l->name); ?></h1> <form name="add_list" id="add_list" action="processes/process-list-edit.php" method="post" enctype="multipart/form-data" class="add"> <input type="hidden" name="list_id" value="<?php echo $list_id; ?>" /> <p class="center"><label for="list_name">Rename list:</label> <input name="list_name" id="list_name" type="text" size="30" placeholder="Name" value="<?php echo $l->name; ?>" /> <input name="list_description" id="list_description" type="text" size="30" placeholder="Description" value="<?php echo $l->description; ?>" /> <input type="submit" name="add" value="Update list" /> </p> </form> <p> </p> <hr /> <h2>List options</h2> <form action="processes/process-list-option-add.php" method="post" enctype="multipart/form-data" class="add"> <input type="hidden" name="list_id" value="<?php echo $list_id; ?>" /> <p>New option <input name="option_text" type="text" size="30" maxlength="60" /> at position <input name="position" type="text" size="3" maxlength="3" value="<?php echo select_one('list_options','max(position)','list_id',$list_id) + 10; ?>" /> <input name="add" type="submit" value="Add option" /></p> </form> <p> </p> <?php if($l->count_options(true)==0) { ?> <p class="center">No list options found.</p> <p> </p> <?php return; } //end if //else ?> <form action="processes/process-list-options-update.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="list_id" value="<?php echo $list_id; ?>" /> <table class="control_panel" style="width: 75%; margin: 0;"> <thead> <tr> <th class="pad"> </th> <th class="left">Text</</th> <th class="control">Active</th> <th class="control">Position</th> <th class="control">Delete</th> <th class="pad"><input type="submit" value="Update" class="update" /></th> </tr> </thead> <tfoot><tr><td> </td><td colspan="4" class="left">Click text or position to edit then click update button to save.<br /> Click Active icon to toggle option visibility in lists. Existing items with this option will continue to display it.<br /> Click Delete icon then confirm to delete an option permanently. Existing items with this option will not be affected.</td><td> </td></tfoot> <tbody> <?php foreach($l->options as $o) { $id = $o->option_id; ?> <tr> <td class="pad"> </td> <td><input type="text" name="option_texts[<?php echo $id; ?>]" id="option_texts_<?php echo $id; ?>" value="<?php echo $o->text; ?>" class="inline-editing" size="60" /></td> <td><a href="processes/process-list-option-toggle.php?list=<?php echo $list_id;?>&option=<?php echo $id; ; ?>" class="toggle"><?php echo onOrOff($o->active); ?></a></td> <td><input type="text" name="option_positions[<?php echo $id; ?>]" id="option_positions_<?php echo $id; ?>" size="2" maxlength="3" class="inline-editing ordering" value="<?php echo $o->position; ?>" /> <td><a href="processes/process-list-option-delete.php?list=<?php echo $list_id; ?>&option=<?php echo $id; ?>" onClick="if(confirm('Delete <?php echo $o->text; ?>?')){return true}else{return false}" class="delete"><img src="images/img-del.png" alt="Delete" /></a></td> <td class="pad"> </td> </tr> <?php } // end foreach ?> </tbody> </table> </form> <p> </p> <?php } ?>
cải xoăn