103 lines
2.7 KiB
PHP
103 lines
2.7 KiB
PHP
<?php
|
|
//
|
|
// Display requested help document
|
|
//
|
|
$ValidAccess = 2010;
|
|
require_once("include/globals.php");
|
|
|
|
|
|
$message = "";
|
|
|
|
if (array_key_exists('form_action',$_POST) && $_POST['form_action'] == 'update') {
|
|
extract($_POST);
|
|
$script_name = $name;
|
|
|
|
if ($naction == 'add') $naction = 'edit';
|
|
|
|
// Delete existing record
|
|
db_query("delete from help_onscreen where script_name = '$name' and action = '$action' and naction = '$naction'");
|
|
|
|
// Insert new record
|
|
$table = new Table("help_onscreen");
|
|
$query = $table->BuildInsert();
|
|
db_query($query);
|
|
|
|
$message = "Help Text Updated";
|
|
}
|
|
|
|
|
|
?>
|
|
<html>
|
|
<head>
|
|
<title>Help Documents</title>
|
|
<link rel="stylesheet" href="css/master.css" type="text/css">
|
|
</head>
|
|
<body>
|
|
<?php
|
|
|
|
if (array_key_exists('name',$_GET)) $name = $_GET['name'];
|
|
if (array_key_exists('action',$_GET)) $action = $_GET['action'];
|
|
if (array_key_exists('naction',$_GET)) $naction = $_GET['naction'];
|
|
$search_naction = $naction;
|
|
|
|
if ($naction == 'add') $search_naction = 'edit';
|
|
|
|
|
|
// Get the help record
|
|
$results = db_query("select * from help_onscreen where script_name = '$name' and action = '$action' and naction = '$search_naction'");
|
|
|
|
|
|
// If there is not a help entry defined get the default message
|
|
if ($_SESSION['UserInfo']['type'] != 'SuperUser' && db_num_rows($results) == 0) {
|
|
$results = db_query("select * from help_onscreen where script_name = 'none' and action = 'none' and naction = 'none'");
|
|
}
|
|
|
|
if (db_num_rows($results) == 1) {
|
|
$row = db_fetch_array($results);
|
|
$title = $row['title'];
|
|
$content = $row['content'];
|
|
}
|
|
|
|
|
|
if ($_SESSION['UserInfo']['type'] != 'SuperUser') {
|
|
?>
|
|
<h2><?php echo($title) ?></h2>
|
|
<p><?php echo(nl2br($content)) ?></p>
|
|
<hr>
|
|
<p>Script: <?php echo($name) ?><br>
|
|
Action: <?php echo("$action / $naction") ?></p>
|
|
<?php
|
|
}
|
|
else {
|
|
if (strlen($message) > 0) echo("<p class='success'>$message</p>\n");
|
|
|
|
?>
|
|
<form method='post'>
|
|
<table width='95%' cellpadding='2' cellspacing='1' border='0'>
|
|
<tr>
|
|
<td align='left'>
|
|
Title:<br>
|
|
<input type='text' name='title' value="<?php echo($title) ?>" size='80'>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='left'>
|
|
Content:<br>
|
|
<textarea name='content' rows='12' cols='100'><?php echo($content) ?></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<input type='hidden' name='name' value="<?php echo($name) ?>">
|
|
<input type='hidden' name='action' value='<?php echo($action) ?>'>
|
|
<input type='hidden' name='naction' value='<?php echo($naction) ?>'>
|
|
<input type='hidden' name='form_action' value='update'>
|
|
<input type='submit' class='btn btn--primary' value="Update">
|
|
</form>
|
|
<p>Script: <?php echo($name) ?><br>
|
|
Action: <?php echo("$action / $naction") ?></p>
|
|
<?php
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|