<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<?php

include ("../navigation/header.php");
$page_name = "AD-pre defined";
include ("../navigation/access.php");

$edit = $_GET['edit'];

if ($edit==1) {
	$value = $_GET['editText'];
	$preset_id = $_GET['preset_id'];
	$table_name = $_SESSION['db_prefix']."_presets";
	$update_query = "UPDATE $table_name SET preset_value = '".trim($value)."' WHERE preset_id = '".$preset_id."' ";
	$update_result = mySQL_query($update_query);
}

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  *  FROM $table_name  ";
$preset_result = mySQL_query($preset_query);
$preset_num = mysql_num_rows($preset_result);

?>


<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
</head>

<?php 
if ($permission_num==1) {
	include ("../navigation/admin_sidebar.php");
?>

<body>
<div class="main_frame">
<div class="page_head_frame">
    <table width="809" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="385"><label class="label_page_head">Presets</label></td>
        <td align="right">&nbsp;</td>
      </tr>
    </table>
  </div>
  <div class="page_middle_frame">
  <label class="label_std">Click on the value to edit the preset.</label><br />
<br />
<form action="presets.php" method="get">
  <table width="553" align="left"  id="table_list">
   <?php
      $i=0;
      while ($i<$preset_num) {
		  $a0 = mysql_result($preset_result, $i, "preset_id");
          $a1 = mysql_result($preset_result, $i, "preset_name");
		  $a2 = mysql_result($preset_result, $i, "preset_value");
		  ?>
    <tr>
      <td width="203" align="left"><?php echo $a1; ?></td>
      <td width="193"><a href="" onclick="editwindow=dhtmlmodal.open('editBox', 'iframe', '../edit_windows/preset_edit_line.php?preset_id=<?php echo $a0?>&field=<?php echo 'preset_value' ?>&type=F', 'Edit preset value', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php if ($a2=='') { echo "----"; } else { echo $a2; } ?></a></td>
      <td width="141"><input type="hidden" name="edit" id="edit" value="1" /></td>
    </tr>
    <?php
	$i++;
	  }
	?>
  </table>
 </form>
</div>  
</div>
</body>

<?php include ('../navigation/side_bar.php'); ?>

<?php } else {
$_SESSION['denied_return'] = "admin_module/user_list.php";	
include ("../navigation/admin_sidebar.php");?>
	<body onload="accessdenied(); return false">
	</body>
<?php }
?>
</html>