define('MAX_DISPLAY_SEARCH_RESULTS', 15);
define('MAX_DISPLAY_PAGE_LINKS', 10);
define('TEXT_RESULT_PAGE', 'Result Pages:');
define('TEXT_DISPLAY_NUMBER_OF_TERMS', 'Displaying %d to %d (of %d terms)');
define('PREVNEXT_TITLE_FIRST_PAGE', 'First Page');
define('PREVNEXT_TITLE_PREVIOUS_PAGE', 'Previous Page');
define('PREVNEXT_TITLE_NEXT_PAGE', 'Next Page');
define('PREVNEXT_TITLE_LAST_PAGE', 'Last Page');
define('PREVNEXT_TITLE_PAGE_NO', 'Page %d');
define('PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE', 'Previous Set of %d Pages');
define('PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE', 'Next Set of %d Pages');
define('PREVNEXT_BUTTON_FIRST', '<<First');
define('PREVNEXT_BUTTON_PREV', '
');
define('PREVNEXT_BUTTON_NEXT', '
');
define('PREVNEXT_BUTTON_LAST', 'Last>>');
include_once("_global.php");
$__gTabIndex = -1;
$_action_error = '';
$_active_action = 'list';
$_error_no = 0;
if ($_isAdmin) {
if ($_GET['action'] == 'add') {
$_active_action = 'add';
} elseif ($_GET['action'] == 'edit') {
if (!strlen(trim($_GET['id']))) {
$_error_no = 1;
$_action_error = 'id is required';
}
if (!$_error_no) {
$chk_query = nsDB_Query("select * from nsDictionary where id='" . trim($_GET['id']) . "'");
$chk_values = nsDB_FetchArray($chk_query);
if (!$chk_values['id']) {
$_error_no = 1;
$_action_error = 'Terms not found';
} else {
$_POST = $chk_values;
}
}
$_active_action = 'edit';
}
if ($_POST['action'] == 'insert') {
if (!strlen(trim($_POST['term'])) || !strlen(trim($_POST['description']))) {
$_error_no = 1;
$_action_error = 'Term & Description are required
';
}
// check term
$chk_query = nsDB_Query("select count(*) as check_count from nsDictionary where term like '" . trim($_POST['term']) . "'");
$chk_values = nsDB_FetchArray($chk_query);
if (intval($chk_values['check_count'])) {
$_error_no = 2;
$_action_error = "Term '" . trim($_POST['term']) . "' is already in use.";
}
if (!$_error_no) {
nsDB_Query("insert into nsDictionary (" .
"id, " .
"term, " .
"category, " .
"related, " .
"description" .
") values (" .
"NULL, " .
"'" . trim($_POST['term']) . "'," .
"'" . trim($_POST['category']) . "'," .
"'" . trim($_POST['related']) . "'," .
"'" . trim($_POST['description']) . "'" .
")");
if (nsDB_Error()) {
$_error_no = 3;
$action_error = nsDB_Error();
} else {
$_action_error = "Term '" . trim($_POST['term']) . "' has been inserted successfully.";
if ($_POST['keep_data'] != 'y') {
unset($_POST);
}
}
}
$_active_action = 'add';
$_GET['action'] = 'add';
} elseif ($_POST['action'] == 'update') {
if (!strlen(trim($_GET['id']))) {
$_error_no = 1;
$_action_error = 'id is required';
}
if (!$_error_no && (!strlen(trim($_POST['term'])) || !strlen(trim($_POST['description'])))) {
$_error_no = 1;
$_action_error = 'Term & Description are required
';
}
if (!$_error_no) {
// check term
$chk_query = nsDB_Query("select count(*) as check_count from nsDictionary where id != '" . $_GET['id'] . "' and term like '" . trim($_POST['term']) . "'");
$chk_values = nsDB_FetchArray($chk_query);
if (intval($chk_values['check_count'])) {
$_error_no = 2;
$_action_error = "Term '" . trim($_POST['term']) . "' is already in use.";
}
}
if (!$_error_no) {
nsDB_Query("update nsDictionary set " .
"term = '" . trim($_POST['term']) . "', " .
"description = '" . trim($_POST['description']) . "' " .
"where id = '" . $_GET['id'] . "'");
if (nsDB_Error()) {
$_error_no = 3;
$action_error = nsDB_Error();
} else {
$_action_error = "Term '" . trim($_POST['term']) . "' has been updated successfully.";
}
}
$_active_action = 'edit';
$_GET['action'] = 'edit';
} elseif ($_GET['action'] == 'delete') {
if (!strlen(trim($_GET['id']))) {
$_error_no = 1;
$_action_error = 'id is required';
}
if (!$_error_no) {
$chk_query = nsDB_Query("select * from nsDictionary where id='" . trim($_GET['id']) . "'");
$chk_values = nsDB_FetchArray($chk_query);
if (nsDB_Query("delete from nsDictionary where id='" . $_GET['id'] . "'")) {
$_action_error = "Term '" . $chk_values['term'] . "' has been deleted.";
}
}
$_active_action = 'list';
unset($_GET['action']);
unset($_GET['page']);
unset($_GET['type']);
unset($_GET['id']);
}
}
if ($_GET['action'] == 'view') {
if (!strlen(trim($_GET['id']))) {
$_error_no = 1;
$_action_error = 'id is not specified';
}
if (!$_error_no) {
$term_query = nsDB_Query("select * from nsDictionary where id='" . trim($_GET['id']) . "'");
$term_values = nsDB_FetchArray($term_query);
if (!$term_values['id']) {
$_error_no = 1;
$_action_error = 'Terms not found';
} else {
$_active_action = 'view';
}
} else {
$_active_action = 'list';
unset($_GET['id']);
}
}
if ($_GET['search']) $_search_string = trim($_GET['search']);
if ($_POST['search']) $_search_string = trim($_POST['search']);
if ($_search_string) $_search_args = '&search=' . $_search_string;
if ($_GET['search']) $_search_type = trim($_GET['type']);
if ($_POST['search']) $_search_type = trim($_POST['type']);
?>
HF Dictionary
include "_header.htm";
?>
|

|
|
if ($_active_action == 'add' || $_active_action == 'edit') {
include_once('dictionary/dic_form.php');
} elseif ($_active_action == 'view') {
include_once('dictionary/dic_view.php');
} else {
include_once('dictionary/dic_search.php');
}
?> |
|
include "_footer.htm";
?>
|
// echo '';
// print_r($_SESSION);
// print_r($_POST);
// echo '
';
?>