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
/
pos.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
14KB
|
698 lines
head 1.8;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.8
date 2003.10.20.00.21.45; author bule; state Exp;
branches;
next 1.7;
1.7
date 2003.10.18.00.33.42; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.10.06.00.39.27; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.10.01.06.51.29; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.09.05.06.42.30; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.09.04.07.27.00; author bule; state Exp;
branches;
next 1.2;
1.2
date 2003.08.19.19.05.16; 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.8
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: pos.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 to allow the administrator view,
// edit, and add parts of speech entries.
//
// 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;
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: Parts of Speech</title>
<link href="bahasa.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bahasa.js"></script>
<script language="Javascript" type="text/javascript">
<!--
//////////////////////////////////////////////////////////////////////////////
function verify() {
part_of_speech = document.parts_of_speech.part_of_speech.value;
part_of_speech = trim(part_of_speech);
if (is_white_space(part_of_speech)) {
alert(
"You must enter a part of speech value.");
document.parts_of_speech.part_of_speech.focus();
return(false);
}
if (part_of_speech.length > 255) {
alert(
"The part of speech value must be 255 characters or less!");
document.parts_of_speech.part_of_speech.focus();
return(false);
}
description = document.parts_of_speech.description.value;
description= trim(description);
if (is_white_space(description)) {
alert(
"You must enter a description value.");
document.parts_of_speech.description.focus();
return(false);
}
password = document.parts_of_speech.password.value;
if (is_white_space(password)) {
alert(
"You must enter a password value.");
document.parts_of_speech.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<body>
<?
$web->show_logo("Parts of Speech");
?>
<a href="admin.php">Administration</a>
<?
if (
($_SESSION['NODUP_POS']) &&
(isset($_POST['id'])) &&
($_SESSION['NODUP_POS'] == $_POST['id'])) {
show_pos_form($web, $indonesia);
} else if (
(isset($_POST['action'])) &&
(isset($_POST['part_of_speech'])) &&
(isset($_POST['description'])) &&
(isset($_POST['id'])) &&
(isset($_POST['password']))) {
if ($_SESSION['NODUP_POS']) {
unset($_SESSION['NODUP_POS']);
}
$errstr = $indonesia->login($_SESSION['ADMIN'], $_POST['password']);
if ($errstr != "") {
print "<hr><b>Permission denied!</b><hr><br>\n";
} else {
if ($_POST['action'] == "insert") {
$errstr =
$indonesia->insert_parts_of_speech(
$_POST['part_of_speech'], $_POST['description']);
if ($errstr != "") {
print
"<hr><b>${errstr}</b><hr>\n";
} else {
print
"<hr><b>Insert successful!</b><hr>\n";
$_SESSION['NODUP_POS'] = $_POST['id'];
show_pos_form($web, $indonesia);
}
} else if ($_POST['action'] == "update") {
$errstr =
$indonesia->update_parts_of_speech($_POST['pkey'],
$_POST['part_of_speech'], $_POST['description']);
if ($errstr != "") {
print
"<hr><b>${errstr}</b><hr><br>\n";
} else {
print
"<hr><b>Update successful!</b><hr>\n";
$_SESSION['NODUP_POS'] = $_POST['id'];
show_pos_form($web, $indonesia);
}
} else {
show_pos_form($web, $indonesia);
}
}
} else if (isset($_POST['pos_pkey'])) {
if ($_POST['pos_pkey'] == 0) {
show_insert_new_pos_form($web, $indonesia);
} else {
show_update_pos_form($web, $indonesia, $_POST['pos_pkey']);
}
} else {
show_pos_form($web, $indonesia);
}
?>
</body>
</html>
<?
//////////////////////////////////////////////////////////////////////////////
function show_insert_new_pos_form($web, $indonesia) {
$id = uniqid(rand(), true);
print <<<EOFINPF
<form name="parts_of_speech" method="post" onsubmit='return verify()'>
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>Part of Speech<br>(1 to 255 characters):</td>
<td>
<input type="text" name="part_of_speech" size="50" maxlength="255">
</td>
</tr><tr>
<td>Description:</td>
<td>
<textarea name="description" rows="7"
cols="55" wrap="soft"></textarea>
</td>
</tr><tr>
<td>Password:</td>
<td>
<input type="password" name="password" size="50">
</td>
</tr><tr>
<td colspan="2" align="right">
<input type="reset" value="Reset">
<input type="submit" value="Insert Part of Speech!">
</td>
</tr>
</table>
<input type="hidden" name="action" value="insert">
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
document.parts_of_speech.part_of_speech.focus();
</script>
EOFINPF;
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_pos_form($web, $indonesia) {
$pos = array();
$errstr = $indonesia->get_parts_of_speech($pos);
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr><br>\n";
return;
}
print
"<br><br>\n" .
"Insert a new parts of speech category or " .
"update an existing one below:" .
"<form method=\"post\"><input type=\"submit\" " .
"value=\"Insert a New Parts of Speech Category!\">\n" .
"<input type=\"hidden\" name=\"pos_pkey\" value=\"0\"> " .
"</form>\n";
$pos_table =
"<br>\n" .
"<table cellpadding=\"3\" \n" .
"cellspacing=\"3\" border=\"1\">\n" .
"<tr>\n" .
"<th>PKEY</th>\n" .
"<th>Part of Speech</th>\n" .
"<th>Description</th>\n" .
"<th>Created</th>\n" .
"<th>Modified</th>\n" .
"<th>Action</th></tr>\n";
$total_pos = count($pos);
for($i = 0; $i < $total_pos; $i++) {
$pkey = $web->tohtml($pos[$i]["pkey"]);
$part_of_speech = $web->tohtml($pos[$i]["part_of_speech"]);
$description = $web->tohtml($pos[$i]["description"]);
$created = $web->tohtml($pos[$i]["created"]);
$modified = $web->tohtml($pos[$i]["modified"]);
$pos_table .=
"<tr>\n" .
"<td>${pkey}</td>\n" .
"<td>${part_of_speech}</td>\n" .
"<td>${description}</td>\n" .
"<td>${created}</td>\n" .
"<td>${modified}</td>\n" .
"<td>\n" .
"<form name=${pkey} method=\"post\">\n" .
"<input type=\"submit\" value=\"Update!\">\n" .
"<input type=\"hidden\" name=\"pos_pkey\" " .
"value=\"${pkey}\"></form>\n" .
"</td></tr>\n";
}
$pos_table .= "</table>\n";
print "$pos_table";
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_update_pos_form($web, $indonesia, $pkey) {
$pos = array();
$id = uniqid(rand(), true);
$errstr = $indonesia->get_part_of_speech($pos, $pkey);
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr>\n";
return;
}
$pkey = $web->tohtml($pos->pkey);
$part_of_speech = $web->tohtml($pos->part_of_speech);
$description = $web->tohtml($pos->description);
print <<<EOFUPF
<form name="parts_of_speech" method="post" onsubmit='return verify()'>
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>Part of Speech<br>(255 characters maximum):</td>
<td>
<input type="text" name="part_of_speech"
value="${part_of_speech}" maxlength="255">
</td>
</tr><tr>
<td>Description:</td>
<td>
<textarea name="description" rows="7"
cols="55" wrap="soft">${description}</textarea>
</td>
</tr><tr>
<td>Password:</td>
<td>
<input type="password" name="password">
</td>
</tr><tr>
<td colspan="2" align="right">
<input type="reset" value="Reset">
<input type="submit" value="Update Part of Speech!">
</td>
</tr>
</table>
<input type="hidden" name="action" value="update">
<input type="hidden" name="pkey" value="${pkey}">
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
document.parts_of_speech.part_of_speech.focus();
</script>
EOFUPF;
return;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
?>
@
1.7
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d62 2
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d61 3
a63 2
<title>Bahasa Indonesia Dictionary: Parts of Speech
</title>
d66 1
a66 25
//////////////////////////////////////////////////////////////////////////////
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);
}
d122 2
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d149 3
a151 1
<h2>Bahasa Indonesia Dictionary: Parts of Speech</h2>
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 04, 2003
d40 1
a40 1
if (!session_is_registered("ADMIN")) {
d154 1
a154 1
(session_is_registered("NODUP_POS")) &&
d167 1
a167 1
if (session_is_registered("NODUP_POS")) {
d169 1
a169 1
session_unregister("NODUP_POS");
d197 1
a197 3
$NODUP_POS = $_POST['id'];
session_register("NODUP_POS");
a201 1
d218 1
a218 3
$NODUP_POS = $_POST['id'];
session_register("NODUP_POS");
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 03, 2003
d263 1
a263 1
<td>Part of Speech<br>(255 characters maximum):</td>
d265 1
a265 1
<input type="text" name="part_of_speech" maxlength="255">
d276 1
a276 1
<input type="password" name="password">
d313 1
a313 1
"update one of the existing ones below:" .
@
1.2
log
@*** empty log message ***
@
text
@d9 1
a9 1
// File Name: .php
d12 1
a12 1
// Modified: August 19, 2003
d14 2
a15 2
// client page is to allow the administrator edit
// and add parts of speech entries.
a57 8
if (session_is_registered("NODUP_POS_ENTRY")) {
session_unregister("NODUP_POS_ENTRY");
$web->redirect("admin.php");
exit;
}
d154 7
d164 1
d167 5
d176 1
a176 2
print "<br><hr><b>Permission denied!</b><hr><br>\n";
d190 1
a190 1
"<br><hr><b>${errstr}</b><hr><br>\n";
d195 3
a197 1
"<br><hr><b>Insert successful!</b><hr><br>\n";
d199 1
a199 1
$NODUP_POS_ENTRY = 1;
d201 1
a201 1
session_register("NODUP_POS_ENTRY");
d214 1
a214 1
"<br><hr><b>${errstr}</b><hr><br>\n";
d219 1
a219 1
"<br><hr><b>Update successful!</b><hr><br>\n";
d221 1
a221 1
$NODUP_POS_ENTRY = 1;
d223 3
a225 1
session_register("NODUP_POS_ENTRY");
d257 2
d287 1
d305 1
a305 1
print "<br><hr><b>${errstr}</b><hr><br>\n";
d331 1
a331 1
foreach($pos as $p) {
d333 7
a339 5
$pkey = $web->tohtml($p->pkey);
$part_of_speech = $web->tohtml($p->part_of_speech);
$description = $web->tohtml($p->description);
$created = $web->tohtml($p->created);
$modified = $web->tohtml($p->modified);
d352 1
a352 1
"value=\"$p->pkey\"></form>\n" .
d367 2
d373 1
a373 1
print "<br><hr><b>${errstr}</b><hr><br>\n";
d414 1
@
1.1
log
@Initial revision
@
text
@d5 33
a37 1
a409 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@