home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
oss
/
cvs-2004
/
bahasa
/
web
/
requests.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
15KB
|
795 lines
head 1.9;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.9
date 2003.10.20.00.21.46; author bule; state Exp;
branches;
next 1.8;
1.8
date 2003.10.18.00.33.42; author bule; state Exp;
branches;
next 1.7;
1.7
date 2003.10.06.00.39.27; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.10.04.18.22.57; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.10.01.06.51.30; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.09.04.07.27.00; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.09.02.07.07.24; author bule; state Exp;
branches;
next 1.2;
1.2
date 2003.08.19.19.24.21; author bule; state Exp;
branches;
next 1.1;
1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches;
next ;
desc
@@
1.9
log
@*** empty log message ***
@
text
@<?
session_start();
require_once("../php/Indonesia.php");
require_once("../php/Web.php");
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Project Name: Bahasa Indonesia Dictionary
// Directory: bahasa/web
// File Name: requests.php
// Author(s): John L. Whiteman
// Created: June 23, 2003
// Modified: October 19, 2003
// Description: The purpose of this restricted access PHP web
// client page is an administrator to handle new
// dictionary requests submitted by a client.
//
// Copyright (c) 2003 John L. Whiteman
//
// Permission is herby granted, free of charge, to any person obtaining a
// copy of this software, data, and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
$web = new Web();
if (!$_SESSION['ADMIN']) {
$web->redirect("login.php");
exit;
}
$indonesia = new Indonesia();
$status = $indonesia->get_dictionary_status();
if ($status["status"] == 1 || $status["status"] == 2) {
$web->redirect("admin.php");
exit;
}
if (
(isset($_POST['requested_entries'])) &&
(isset($_POST['id']))) {
foreach($_POST as $name => $value) {
if ($value == "Insert!") {
$pkey = $name;
$web->redirect(
"insert.php?insert_requested_entry=${pkey}");
exit;
}
}
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: Requested Entries</title>
<link href="bahasa.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bahasa.js"></script>
<script language="Javascript" type="text/javascript">
<!--
var no_send_flag = 0;
//////////////////////////////////////////////////////////////////////////////
function verify() {
if (no_send_flag) {
no_send_flag = 0;
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
function verify_delete_all() {
password = document.delete_all.password.value;
if (is_white_space(password)) {
alert(
"You must enter a password value!");
document.delete_all.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
function verify_delete_selected() {
password = document.requested_entries.password.value;
if (is_white_space(password)) {
alert(
"You must enter a password value!");
document.requested_entries.password.focus();
no_send_flag = 1;
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<body>
<?
$web->show_logo("Requested Entries");
?>
<a href="admin.php">Administration</a>
<?
if (
($_SESSION['NODUP_REQUESTS']) &&
(isset($_POST['id'])) &&
(isset($_POST['requested_entries'])) &&
($_SESSION['NODUP_REQUESTS'] == $_POST['id'])) {
//Do nothing...prevents refresh duplication of last action
} else if (
(isset($_POST['requested_entries'])) &&
(isset($_POST['id'])) &&
(isset($_POST['password']))) {
if ($_SESSION['NODUP_REQUESTS']) {
unset($_SESSION['NODUP_REQUESTS']);
}
$errstr =
$indonesia->login($_SESSION['ADMIN'], $_POST['password']);
if ($errstr != "") {
print "<br><hr><b>Permission denied!</b><hr>\n";
} else {
$delete_count = 0;
$error_flag = 0;
$selected = 0;
foreach($_POST as $name => $pkey) {
if (
($name != "id") && ($name != "requested_entries") &&
($name != "password")) {
$pkey = trim($pkey);
$pkey = $web->tohtml($pkey);
$selected++;
$errstr =
$indonesia->delete_request($pkey);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr>\n";
$error_flag = 1;
break;
} else {
$delete_count++;
}
}
}
if (!$selected) {
print
"<hr><b>You must select at least one " .
"requested entries to delete!</b><hr>\n";
} else {
$_SESSION['NODUP_REQUESTS'] = $_POST['id'];
if (!$error_flag) {
if ($delete_count > 1) {
print
"<hr><b>Successfully deleted " .
"${delete_count} " .
"requested entries!</b><hr>\n";
} else if ($delete_count == 1) {
print
"<hr><b>Successfully deleted " .
"${delete_count} " .
"requested entry!</b><hr>\n";
} else {
print
"<hr><b>No requested " .
"entries deleted!" .
"</b><hr>\n";
}
}
}
}
} else if (
(isset($_POST['delete_all'])) &&
(isset($_POST['id'])) &&
(isset($_POST['password']))) {
if (
(!$_SESSION['NODUP_REQUESTS']) ||
(($_SESSION['NODUP_REQUESTS']) &&
($_SESSION['NODUP_REQUESTS'] != $_POST['id']))) {
if ($_SESSION['NODUP_REQUESTS']) {
unset($_SESSION['NODUP_REQUESTS']);
}
$errstr =
$indonesia->login($_SESSION['ADMIN'], $_POST['password']);
if ($errstr != "") {
print "<br><hr><b>Permission denied!</b><hr>\n";
} else {
$errstr = $indonesia->delete_requests();
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr>\n";
} else {
print
"<hr><b>All requested entries " .
"successfully " .
"deleted!</b><hr>\n";
$_SESSION['NODUP_REQUESTS'] = $_POST['id'];
}
}
}
}
show_requests($web, $indonesia);
?>
</body>
</html>
<?
//////////////////////////////////////////////////////////////////////////////
function show_requests($web, $indonesia) {
$requests = array();
$id = uniqid(rand(), true);
$errstr = $indonesia->get_requests($requests);
if ($errstr != "") {
print "<hr><br><b>${errstr}</b><hr><br>\n";
} else {
$total_requests = count($requests);
print
"<hr><b>Found ${total_requests} requested " .
"entries!</b><hr><br>\n";
if ($total_requests == 0) {
return;
}
if ($total_requests > 1) {
print
"<form name=\"delete_all\" method=\"post\" " .
"onSubmit='return verify_delete_all()'>\n" .
"<table cellpadding=\"3\" cellspacing=\"3\" " .
"border=\"0\">\n" .
"<tr>\n" .
"<td>Password:</td>\n" .
"<td><input type=\"password\" " .
"name=\"password\"></td>\n" .
"<td>\n " .
"<input type=\"submit\" " .
"value=\"Delete All Entries!\">\n" .
"</td></tr></table>\n" .
"<input type=\"hidden\" name=\"delete_all\" " .
"value=\"1\">\n" .
"<input type=\"hidden\" name=\"id\" " .
"value=\"${id}\">\n" .
"</form><hr>\n";
}
print
"<form name=\"requested_entries\" method=\"post\" " .
"onSubmit='return verify()'>\n" .
"<table cellpadding=\"3\" cellspacing=\"3\" " .
"border=\"1\">\n";
for($i = 0; $i < $total_requests; $i++) {
if ($i == 0) {
print
"<tr>\n" .
"<th>PKEY</th>\n" .
"<th>English</th>\n" .
"<th>Indonesian</th>\n" .
"<th>Part of Speech</th>\n" .
"<th>Spelling</th>\n" .
"<th>Comments</th>\n" .
"<th>Created</th>\n" .
"<th>Insert</th>\n" .
"<th>\n" .
"<input type=\"submit\" " .
"value=\"Delete Selected Entries!\" " .
"onClick='return verify_delete_selected()'>" .
"<br>\n" .
"Password:<br>\n" .
"<input type=\"password\" " .
"name=\"password\">\n" .
"</th>\n" .
"</tr>\n";
}
$pkey =
$web->tohtml($requests[$i]["pkey"]);
$english =
$web->tohtml($requests[$i]["english"]);
$indonesian =
$web->tohtml($requests[$i]["indonesian"]);
$pos =
$web->tohtml($requests[$i]["pos"]);
$spl =
$web->tohtml($requests[$i]["spelling"]);
$comments =
$web->tohtml($requests[$i]["comments"]);
$created =
$web->tohtml($requests[$i]["created"]);
print
"<tr>\n" .
"<td>${pkey} </td>\n" .
"<td>${english} </td>\n" .
"<td>${indonesian} </td>\n" .
"<td>${pos} </td>\n" .
"<td>${spl} </td>\n" .
"<td>${comments} </td>\n" .
"<td>${created} </td>\n" .
"<td>\n" .
"<input type=\"submit\" value=\"Insert!\" " .
"name=\"${pkey}\">\n" .
"</td>\n" .
"<td>Delete: \n" .
"<input type=\"checkbox\" name=\"${pkey}\" " .
"value=\"${pkey}\"></td>\n" .
"</tr>\n";
}
print
"</table>\n" .
"<input type=\"hidden\" name=\"id\" value=\"${id}\">\n" .
"<input type=\"hidden\" name=\"requested_entries\" " .
"value=\"1\">\n" .
"</form>\n";
}
return;
}
?>
@
1.8
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d79 2
@
1.7
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d78 3
a80 3
<title>
Bahasa Indonesia Dictionary: Requested Entries
</title>
d83 1
d87 1
a87 26
///////////////////////////////////////////////////////////////////////////////
function is_white_space(stoken) {
if (stoken == null) return(true);
if (stoken == '') return(true);
if (stoken == "") return(true);
return(false);
}
///////////////////////////////////////////////////////////////////////////////
function trim(stoken) {
if (is_white_space(stoken)) {
return(stoken);
}
stoken = stoken.replace(/^\s*/, "");
stoken = stoken.replace(/\s*$/, "");
return(stoken);
}
///////////////////////////////////////////////////////////////////////////////
d99 1
a99 1
///////////////////////////////////////////////////////////////////////////////
d116 1
a116 1
///////////////////////////////////////////////////////////////////////////////
d135 2
a136 2
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 04, 2003
d164 3
a166 1
<h2>Bahasa Indonesia Dictionary: Requested Entries</h2>
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d275 1
a275 1
($_SESSION['NODUP_REQUESTS'] != $_POST['id'])))) {
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 03, 2003
d40 1
a40 1
if (!session_is_registered("ADMIN")) {
d168 1
a168 1
(session_is_registered("NODUP_REQUESTS")) &&
d180 1
a180 1
if (session_is_registered("NODUP_REQUESTS")) {
d182 1
a182 1
session_unregister("NODUP_REQUESTS");
d238 1
a238 3
$NODUP_REQUESTS = $_POST['id'];
session_register("NODUP_REQUESTS");
d273 2
a274 2
(!session_is_registered("NODUP_REQUESTS") ||
((session_is_registered("NODUP_REQUESTS")) &&
d277 1
a277 1
if (session_is_registered("NODUP_REQUESTS")) {
d279 1
a279 1
session_unregister("NODUP_REQUESTS");
d304 1
a304 3
$NODUP_REQUESTS = $_POST['id'];
session_register("NODUP_REQUESTS");
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 01, 2003
d47 1
a47 1
if (session_is_registered("NODUP_DELETE_REQUEST")) {
d49 1
a49 1
session_unregister("NODUP_DELETE_REQUEST");
d51 3
a53 1
$web->redirect("admin.php");
d56 5
a60 1
}
d62 3
a64 1
$indonesia = new Indonesia();
d66 1
a66 1
$status = $indonesia->get_dictionary_status();
d68 2
a69 1
if ($status["status"] == 1 || $status["status"] == 2) {
d71 3
a73 1
$web->redirect("admin.php");
a74 1
d79 1
a79 1
Bahasa Indonesia Dictionary: Request Entries
d81 81
d164 1
a164 1
<h2>Bahasa Indonesia Dictionary: Request Entries</h2>
d167 17
a183 1
if (isset($_POST['delete_entry'])) {
d186 1
a186 1
$indonesia->delete_request($_POST['delete_entry']);
d190 1
a190 1
print "<br><hr><b>${errstr}</b><hr><br>\n";
d194 3
a196 1
print "<br><hr><b>Successful deletion!</b><hr><br>\n";
d198 1
a198 1
$NODUP_DELETE_REQUEST = 1;
d200 67
a266 1
session_register("NODUP_DELETE_REQUEST");
d269 9
a277 1
} else {
d279 33
a311 1
show_requests($web, $indonesia);
d313 3
d325 2
d338 1
a338 1
"<br><hr><b>Found ${total_requests} requested " .
d346 25
a370 1
print
d372 1
a372 1
"border=\"1\" width=\"50%\">\n";
d383 2
a384 2
"<th>POS</th>\n" .
"<th>Spelling Flag</th>\n" .
d388 9
a396 1
"<th>Delete</th>\n" .
d401 1
a401 1
$web->tohtml($requests[$i]->pkey);
d404 1
a404 1
$web->tohtml($requests[$i]->english);
d407 1
a407 1
$web->tohtml($requests[$i]->indonesian);
d410 1
a410 1
$web->tohtml($requests[$i]->part_of_speech);
d413 1
a413 1
$web->tohtml($requests[$i]->spelling_flag);
d416 1
a416 1
$web->tohtml($requests[$i]->comments);
d419 1
a419 1
$web->tohtml($requests[$i]->created);
d431 2
a432 6
"<form name=\"insert\" action=\"insert.php\" " .
"method=\"post\">\n" .
"<input type=\"submit\" value=\"Insert!\">\n" .
"<input type=\"hidden\" " .
"name=\"insert_request_entry\" " .
"value=\"${pkey}\"></form>\n" .
d434 3
a436 5
"<td>\n" .
"<form name=\"delete\" method=\"post\">\n" .
"<input type=\"submit\" value=\"Delete!\">\n" .
"<input type=\"hidden\" name=\"delete_entry\" " .
"value=\"${pkey}\"></form>\n" .
d440 6
a445 1
print "</table>\n";
d451 1
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 19, 2003
d117 3
a119 1
print "<h3>Found ${total_requests} requests</h3>\n";
@
1.1
log
@Initial revision
@
text
@d5 33
a37 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@