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
/
insert.php,v
< prev
next >
Wrap
Text File
|
2003-10-26
|
40KB
|
2,084 lines
head 1.13;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.13
date 2003.10.26.01.53.10; author bule; state Exp;
branches;
next 1.12;
1.12
date 2003.10.20.00.21.45; author bule; state Exp;
branches;
next 1.11;
1.11
date 2003.10.18.00.33.41; author bule; state Exp;
branches;
next 1.10;
1.10
date 2003.10.06.00.39.26; author bule; state Exp;
branches;
next 1.9;
1.9
date 2003.10.01.06.51.29; author bule; state Exp;
branches;
next 1.8;
1.8
date 2003.09.04.07.27.00; author bule; state Exp;
branches;
next 1.7;
1.7
date 2003.09.02.07.07.24; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.08.31.00.02.48; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.08.30.00.33.38; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.08.30.00.31.53; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.08.28.20.04.48; 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.13
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: insert.php
// Author(s): John L. Whiteman
// Created: June 23, 2003
// Modified: October 25, 2003
// Description: The purpose of this restricted access PHP web
// client page is allow an administrator to insert
// new entries into the dictionary table of the
// database. This page also works with misses.php
// and requests.php regarding new inserts.
//
// 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;
}
$title = "";
$insert_flag = -1;
if (isset($_GET['insert_missed_entry'])) {
$title = "Insert Missed Entry";
$insert_flag = 0;
} else if (isset($_GET['insert_requested_entry'])) {
$title = "Insert Requested Entry";
$insert_flag = 1;
} else if (
(isset($_POST['insert_new_entry'])) &&
(isset($_POST['language']))) {
$title = "Insert New $_POST[language] Entry";
$insert_flag = 2;
} else {
$title = "Insert New Entry";
$insert_flag = 3;
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: <? echo "$title"; ?></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() {
english = document.insert.english.value;
english = trim(english);
if (is_white_space(english)) {
alert(
"You must enter an English value!");
document.insert.english.focus();
return(false);
}
if (english.length > 255) {
alert(
"The English value must be 255 characters or less!");
document.insert.english.focus();
return(false);
}
indonesian = document.insert.indonesian.value;
indonesian = trim(indonesian);
if (is_white_space(indonesian)) {
alert(
"You must enter an Indonesian value!");
document.insert.indonesian.focus();
return(false);
}
if (indonesian.length > 255) {
alert(
"The Indonesian value must be 255 characters or less!");
document.insert.indonesian.focus();
return(false);
}
if (document.insert.pos.value == "") {
alert(
"You must select a Part of Speech Category!");
document.insert.pos.focus();
return(false);
}
pronunciation = document.insert.pronunciation.value;
if (pronunciation.length > 255) {
alert(
"The Pronunciation value must be 255 characters or less!");
document.insert.pronunciation.focus();
return(false);
}
ipa = document.insert.pronunciation_ipa.value;
if (ipa.length > 255) {
alert(
"The International Phonetic Alphabet (IPA) value " +
"must be 255 characters or less!");
document.insert.pronunciation_ipa.focus();
return(false);
}
password = document.insert.password.value;
if (is_white_space(password)) {
alert(
"You must enter a password value!");
document.insert.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<body>
<?
$web->show_logo("$title");
?>
<a href="admin.php">Administration</a>
|
<a href="editor.php">Search</a>
<?
if ($insert_flag == 0) {
print
"<form name=\"misses\" method=\"post\" " .
"action=\"misses.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Missed Search Entries!\">\n" .
"</form>\n";
} else if ($insert_flag == 1) {
print
"<form name=\"requests\" method=\"post\" " .
"action=\"requests.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Requested New Entries!\">\n" .
"</form>\n";
} else if ($insert_flag == 2) {
print
"<form name=\"requests\" method=\"post\" " .
"action=\"editor.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Dictionary Editor!\">\n" .
"</form>\n";
}
if (
($_SESSION['NODUP_INSERT_ENTRY']) &&
(isset($_POST['id'])) &&
($_SESSION['NODUP_INSERT_ENTRY'] == $_POST['id'])) {
show_insert_new_form($web, $indonesia);
//HERE WE DO A NEW INSERT FROM A WORD SUBMITTED BY EITHER misses.php or
//requests.php
} else if (
(isset($_POST['english'])) &&
(isset($_POST['indonesian'])) &&
(isset($_POST['pos'])) &&
(isset($_POST['id'])) &&
(isset($_POST['spelling_flag'])) &&
(isset($_POST['new_insert']))) {
$rc = insert($web, $indonesia,
$_POST['english'], $_POST['indonesian'],
$_POST['pos'], $_POST['spelling_flag'],
$_POST['pronunciation'], $_POST['pronunciation_ipa'],
$_POST['comments']);
if (!$rc) {
$_SESSION['NODUP_INSERT_ENTRY'] = $_POST['id'];
}
show_insert_new_form($web, $indonesia);
//HERE WE DO AN UPDATE OF EXISTING WORD
} else if (
(isset($_POST['english'])) &&
(isset($_POST['indonesian'])) &&
(isset($_POST['pos'])) &&
(isset($_POST['id'])) &&
(isset($_POST['spelling_flag'])) &&
(isset($_POST['replace_insert']))) {
$pkey = $_POST['replace_insert'];
$rc =
replace(
$web, $indonesia, $pkey,
$_POST['english'], $_POST['indonesian'],
$_POST['pos'], $_POST['spelling_flag'],
$_POST['pronunciation'], $_POST['pronunciation_ipa'],
$_POST['comments']);
if (!$rc) {
$_SESSION['NODUP_INSERT_ENTRY'] = $_POST['id'];
}
show_insert_new_form($web, $indonesia);
//HERE WE DO A NEW INSERT
} else if (
(isset($_POST['english'])) &&
(isset($_POST['indonesian'])) &&
(isset($_POST['pos'])) &&
(isset($_POST['id'])) &&
(isset($_POST['spelling_flag'])) &&
(isset($_POST['password']))) {
$errstr = $indonesia->login($_SESSION['ADMIN'], $_POST['password']);
if ($errstr != "") {
print "<hr><b>Permission denied!</b><hr>\n";
} else {
$delete_flag = "";
if (isset($_POST['delete_miss'])) {
$delete_flag =
"<input type=\"hidden\" " .
"name=\"delete_miss\" " .
"value=\"" . $_POST['delete_miss'] .
"\">";
} else if (isset($_POST['delete_request'])) {
$delete_flag =
"<input type=\"hidden\" " .
"name=\"delete_request\" " .
"value=\"" . $_POST['delete_request'] .
"\">";
}
$dups =
check_for_duplicates(
$web, $indonesia, $_POST['english'], $_POST['indonesian'],
$_POST['pos'], $_POST['spelling_flag'],
$_POST['pronunciation'], $_POST['pronunciation_ipa'],
$_POST['comments'], $_POST['id'], $delete_flag);
if ($dups == 0) {
$rc = insert($web, $indonesia,
$_POST['english'], $_POST['indonesian'],
$_POST['pos'], $_POST['spelling_flag'],
$_POST['pronunciation'], $_POST['pronunciation_ipa'],
$_POST['comments']);
if (!$rc) {
$_SESSION['NODUP_INSERT_ENTRY'] = $_POST['id'];
show_insert_new_form($web, $indonesia);
}
}
}
} else {
if ($insert_flag == 0) {
show_insert_missed_form(
$web, $indonesia, $_GET['insert_missed_entry']);
} else if ($insert_flag == 1) {
show_insert_request_form(
$web, $indonesia, $_GET['insert_requested_entry']);
} else if ($insert_flag == 2) {
show_dictionary_editor_form(
$web, $indonesia, $_POST['insert_new_entry'],
$_POST['language']);
} else {
show_insert_new_form($web, $indonesia);
}
}
?>
</body>
</html>
<?
//////////////////////////////////////////////////////////////////////////////
function check_for_duplicates(
$web, $indonesia, $english, $indonesian, $pos, $spelling_flag,
$pronunciation, $pronunciation_ipa, $comments, $id, $delete_flag="") {
$duplicates = array();
$english = $web->strip($english);
$indonesian = $web->strip($indonesian);
$pos = $web->strip($pos);
$spelling_flag = $web->strip($spelling_flag);
$pronunciation = $web->strip($pronunciation);
$pronunciation_ipa = $web->strip($pronunciation_ipa);
$comments = $web->strip($comments);
$id = $web->strip($id);
$hidden =
"<input type=\"hidden\" name=\"english\" " .
"value=\"${english}\">\n" .
"<input type=\"hidden\" name=\"indonesian\" " .
"value=\"${indonesian}\">\n" .
"<input type=\"hidden\" name=\"pos\" " .
"value=\"${pos}\">\n" .
"<input type=\"hidden\" name=\"spelling_flag\" " .
"value=\"${spelling_flag}\">\n" .
"<input type=\"hidden\" name=\"pronunciation\" " .
"value=\"${pronunciation}\">\n" .
"<input type=\"hidden\" name=\"pronunciation_ipa\" " .
"value=\"${pronunciation_ipa}\">\n" .
"<input type=\"hidden\" name=\"comments\" " .
"value=\"${comments}\">\n" .
"<input type=\"hidden\" name=\"id\" " .
"value=\"${id}\">\n" .
"${delete_flag}\n";
$errstr =
$indonesia->check_for_duplicate_entries(
$duplicates, $english, $indonesian, $pos, $spelling_flag);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return(0);
}
$dup_count = count($duplicates);
if ($dup_count == 0) {
return(0);
}
$english = $web->tohtml($english);
$indonesian = $web->tohtml($indonesian);
$pos = $web->tohtml($pos);
$spelling_flag = $web->tohtml($spelling_flag);
$pronunciation = $web->tohtml($pronunciation);
$pronunciation_ipa = $web->tohtml($pronunciation_ipa);
$comments = $web->tohtml($comments);
$parts_of_speech = array();
$errstr = $indonesia->get_pos($parts_of_speech, 0);
$poss = $parts_of_speech[$pos];
$spelling = "Modern";
if ($spelling_flag == 1) {
$spelling = "Pre 1972";
}
$commentss = $comments;
if ($commentss == "") {
$commentss = "N/A";
}
print
"<hr><b>Found ${dup_count} exact and/or similar " .
"existing entries in the dictionary database!</b><hr>\n";
print
"<form name=\"abort_insert\" method=\"post\" " .
"action=\"insert.php\">\n" .
"<input type=\"submit\" " .
"value=\"I've changed my mind and want to cancel this insert!\">\n" .
"</form>\n";
print
"<form name=\"insert_new\" method=\"post\">\n" .
"<table cellpadding=\"3\" cellspacing=\"3\" border=\"1\">\n" .
"<tr>\n" .
"<th>English</th>\n" .
"<th>Indonesian</th>\n" .
"<th>Part of Speech</th>\n" .
"<th>Spelling</th>\n" .
"<th>Pronounce</th>\n" .
"<th>IPA</th>\n" .
"<th>Comments</th>\n" .
"<th>Action</th>\n" .
"</tr><tr>\n" .
"<td>${english} </td>\n" .
"<td>${indonesian} </td>\n" .
"<td>${poss} </td>\n" .
"<td>${spelling} </td>\n" .
"<td>${pronunciation} </td>\n" .
"<td>${pronunciation_ipa} </td>\n" .
"<td>${commentss} </td>\n" .
"<td><input type=\"submit\" value=\"Insert as a new entry!\"></td>\n" .
"</tr></table>\n" .
"<input type=\"hidden\" name=\"new_insert\" value=\"1\">\n" .
"${hidden}" .
"</form>\n";
print
"<table cellpadding=\"3\" cellspacing=\"3\" border=\"1\">\n";
for ($i = 0; $i < $dup_count; $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>Created</th>\n" .
"<th>Modified</th>\n" .
"<th>Spelling Flag</th>\n" .
"<th>Pronunciation</th>\n" .
"<th>IPA</th>\n" .
"<th>Comments</th>\n" .
"<th>Action</th>\n" .
"</tr>\n";
}
$pkey = $web->tohtml($duplicates[$i]["pkey"]);
$eng= $web->tohtml($duplicates[$i]["english"]);
$indo = $web->tohtml($duplicates[$i]["indonesian"]);
$posx= $web->tohtml($duplicates[$i]["pos"]);
$created = $web->tohtml($duplicates[$i]["created"]);
$modified = $web->tohtml($duplicates[$i]["modified"]);
$spflg = $web->tohtml($duplicates[$i]["spelling"]);
$p = $web->tohtml($duplicates[$i]["pronunciation"]);
$pipa = $web->tohtml($duplicates[$i]["pronunciation_ipa"]);
$comments = $web->tohtml($duplicates[$i]["comments"]);
print
"<tr>\n" .
"<td>${pkey} </td>\n" .
"<td>${eng} </td>\n" .
"<td>${indo} </td>\n" .
"<td>${posx} </td>\n" .
"<td>${created} </td>\n" .
"<td>${modified} </td>\n" .
"<td>${spflg} </td>\n" .
"<td>${p} </td>\n" .
"<td>${pipa} </td>\n" .
"<td>${comments} </td>\n" .
"<td><form name=\"replace\" method=\"post\">\n" .
"<input type=\"submit\" value=\"Replace!\">\n" .
"<input type=\"hidden\" name=\"replace_insert\" " .
"value=\"${pkey}\">\n" .
"${hidden}</form></td></tr>\n";
}
print "</table>\n";
return(1);
}
//////////////////////////////////////////////////////////////////////////////
function insert($web, $indonesia,
$english, $indonesian, $pos, $spelling_flag,
$pronunciation, $pronunciation_ipa, $comments) {
$errstr =
$indonesia->insert_entry(
$english, $indonesian, $spelling_flag,
$pos, $pronunciation,
$pronunciation_ipa, $comments);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return(1);
} else {
print
"<br><hr><b>Successful Insertion!</b><hr><br>\n";
}
return(0);
}
//////////////////////////////////////////////////////////////////////////////
function replace($web, $indonesia, $pkey,
$english, $indonesian, $pos, $spelling_flag,
$pronunciation, $pronunciation_ipa, $comments) {
$errstr =
$indonesia->update_entry($pkey,
$english, $indonesian, $spelling_flag,
$pos, $pronunciation,
$pronunciation_ipa, $comments);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return(1);
}
print "<br><hr><b>Successful Replacement!</b><hr><br>\n";
return(0);
}
//////////////////////////////////////////////////////////////////////////////
function show_dictionary_editor_form($web, $indonesia, $token, $language) {
$pos = array();
$id = uniqid(rand(), true);
$pos_select =
"<select name=\"pos\">\n" .
"<option value=\"\">\n";
$errstr = $indonesia->get_parts_of_speech($pos);
$total_pos = count($pos);
for($i = 0; $i < $total_pos; $i++) {
$pos_pkey = $web->tohtml($pos[$i]["pkey"]);
$pos_pos = $web->tohtml($pos[$i]["part_of_speech"]);
$pos_select .= "<option value=\"${pos_pkey}\">${pos_pos}\n";
}
$pos_select .= "</select>\n";
$token = $web->tohtml($token);
$language = $web->tohtml($language);
$english = "";
$indonesian = "";
$focus = "english";
if ($language == "English") {
$english = $token;
$focus = "indonesian";
} else {
$indonesian = $token;
$focus = "english";
}
print <<<EOFDEF
<form name="insert" method="post" onSubmit='return verify()'>
<table cellpadding="3" cellspacing="5" border="0">
<tr>
<td>English (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="english" value="${english}"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Indonesian (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="indonesian" value="${indonesian}"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Spelling Convention:</td>
</tr><tr>
<td>
<input type="radio" name="spelling_flag" value="1">Before 1972
<input type="radio" name="spelling_flag" value="0" checked>Modern
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Part of Speech:</td>
</tr><tr>
<td>
$pos_select
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Pronunciation (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>International Phonetic Alphabet (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation_ipa"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Comments:</td>
</tr><tr>
<td>
<textarea name="comments" wrap="soft" rows="5" cols="55"></textarea>
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Password:</td>
</tr><tr>
<td>
<input type="password" name="password" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td align="right">
<input type="reset" value="Clear Form">
<input type="submit" value="Insert into Dictionary">
</td>
</tr>
</table>
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
document.insert.${focus}.focus();
</script>
EOFDEF;
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_insert_missed_form($web, $indonesia, $pkey) {
$miss = array();
$id = uniqid(rand(), true);
$errstr =
$indonesia->get_miss($miss, $pkey);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$miss_count = count($miss);
if ($miss_count != 1) {
return;
}
$entry = $web->tohtml($miss[0]->entry);
$language = $web->tohtml($miss[0]->language);
$english_word = "";
$indonesian_word = "";
$focus = "english";
if ($language == 0) {
$english_word = $entry;
$focus = "indonesian";
} else {
$indonesian_word = $entry;
$focus = "english";
}
$pos = array();
$pos_select =
"\n<select name=\"pos\">\n" .
"<option value=\"\">\n";
$errstr = $indonesia->get_parts_of_speech($pos);
$total_pos = count($pos);
for($i = 0; $i < $total_pos; $i++) {
$pos_pkey = $web->tohtml($pos[$i]["pkey"]);
$pos_pos = $web->tohtml($pos[$i]["part_of_speech"]);
$pos_select .= "<option value=\"${pos_pkey}\">${pos_pos}\n";
}
$pos_select .= "</select>\n";
print <<<EOFSIMF
<form name="insert" method="post" onSubmit='return verify()'>
<table cellpadding="3" cellspacing="5" border="0">
<tr>
<td>English (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="english"
maxlength="255" size="50" value="${english_word}">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Indonesian (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="indonesian"
maxlength="255" size="50" value="${indonesian_word}">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Spelling Convention:</td>
</tr><tr>
<td>
<input type="radio" name="spelling_flag" value="1">Before 1972
<input type="radio" name="spelling_flag" value="0" checked>Modern
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Part of Speech:</td>
</tr><tr>
<td>
$pos_select
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Pronunciation (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>International Phonetic Alphabet (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation_ipa"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Comments:</td>
</tr><tr>
<td>
<textarea name="comments" wrap="soft" rows="5" cols="55"></textarea>
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Password:</td>
</tr><tr>
<td>
<input type="password" name="password" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td align="right">
<input type="reset" value="Clear Form">
<input type="submit" value="Insert Entry!">
</td></tr>
</table>
<input type="hidden" name="delete_miss" value="$pkey">
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
document.insert.${focus}.focus();
</script>
EOFSIMF;
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_insert_request_form($web, $indonesia, $pkey) {
$request = array();
$id = uniqid(rand(), true);
$errstr =
$indonesia->get_request($request, $pkey);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$request_count = count($request);
if ($request_count != 1) {
return;
}
$english = $web->tohtml($request[0]->english);
$indonesian = $web->tohtml($request[0]->indonesian);
$part_of_speech = $web->tohtml($request[0]->part_of_speech);
$spelling_flag = $web->tohtml($request[0]->spelling_flag);
$comments = $web->tohtml($request[0]->comments);
$spelling_html = "";
if ($spelling_flag == 0) {
$spelling_html =
"<input type=\"radio\" name=\"spelling_flag\" value=\"1\">" .
"Before 1972" .
" " .
"<input type=\"radio\" name=\"spelling_flag\" value=\"0\" " .
"checked>Modern\n";
} else {
$spelling_html =
"<input type=\"radio\" name=\"spelling_flag\" value=\"1\" " .
"checked>Before 1972" .
" " .
"<input type=\"radio\" name=\"spelling_flag\" value=\"0\">" .
"Modern\n";
}
$pos = array();
$pos_select =
"\n<select name=\"pos\">\n" .
"<option value=\"\">\n";
$errstr = $indonesia->get_parts_of_speech($pos);
$total_pos = count($pos);
for($i = 0; $i < $total_pos; $i++) {
$pos_pkey = $web->tohtml($pos[$i]["pkey"]);
$pos_pos = $web->tohtml($pos[$i]["part_of_speech"]);
if ($pos_pkey != $part_of_speech) {
$pos_select .=
"<option value=\"${pos_pkey}\">${pos_pos}\n";
} else {
$pos_select .=
"<option value=\"${pos_pkey}\" selected>" .
"${pos_pos}\n";
}
}
$pos_select .= "</select>\n";
print <<<EOFSIRF
<form name="insert" method="post" onSubmit='return verify()'>
<table cellpadding="3" cellspacing="5" border="0">
<tr>
<td>English (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="english"
maxlength="255" size="50" value="${english}">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Indonesian (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="indonesian"
maxlength="255" size="50" value="${indonesian}">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Spelling Convention:</td>
</tr><tr>
<td>${spelling_html}</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Part of Speech:</td>
</tr><tr>
<td>
$pos_select
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Pronunciation (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>International Phonetic Alphabet (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation_ipa"
maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Comments:</td>
</tr><tr>
<td>
<textarea name="comments" wrap="soft"
rows="5" cols="55">${comments}</textarea>
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Password:</td>
</tr><tr>
<td>
<input type="password" name="password" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td align="right">
<input type="reset" value="Clear Form">
<input type="submit" value="Insert Entry!">
</td></tr>
</table>
<input type="hidden" name="delete_request" value="$pkey">
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
document.insert.english.focus();
</script>
EOFSIRF;
return;
}
//////////////////////////////////////////////////////////////////////////////
function show_insert_new_form($web, $indonesia) {
$pos = array();
$id = uniqid(rand(), true);
$pos_select =
"<select name=\"pos\">\n" .
"<option value=\"\">\n";
$errstr = $indonesia->get_parts_of_speech($pos);
$total_pos = count($pos);
for($i = 0; $i < $total_pos; $i++) {
$pos_pkey = $web->tohtml($pos[$i]["pkey"]);
$pos_pos = $web->tohtml($pos[$i]["part_of_speech"]);
$pos_select .= "<option value=\"${pos_pkey}\">${pos_pos}\n";
}
$pos_select .= "</select>\n";
print <<<EOFSINF
<form name="insert" method="post" onSubmit='return verify()'>
<table cellpadding="3" cellspacing="5" border="0">
<tr>
<td>English (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="english" maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Indonesian (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="indonesian" maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Spelling Convention:</td>
</tr><tr>
<td>
<input type="radio" name="spelling_flag" value="1">Before 1972
<input type="radio" name="spelling_flag" value="0" checked>Modern
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Part of Speech:</td>
</tr><tr>
<td>
$pos_select
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Pronunciation (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation" maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>International Phonetic Alphabet (1 to 255 characters):</td>
</tr><tr>
<td>
<input type="text" name="pronunciation_ipa" maxlength="255" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Comments:</td>
</tr><tr>
<td>
<textarea name="comments" wrap="soft" rows="5" cols="55"></textarea>
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td>Password:</td>
</tr><tr>
<td>
<input type="password" name="password" size="50">
</td>
</tr><tr>
<td><hr></td>
</tr><tr>
<td align="right">
<input type="reset" value="Clear Form">
<input type="submit" value="Insert into Dictionary">
</td>
</tr>
</table>
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
document.insert.english.focus();
</script>
EOFSINF;
return;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
?>
@
1.12
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 19, 2003
d425 1
a425 1
$duplicates, $english, $indonesia, $pos, $spelling_flag);
@
1.11
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d94 2
@
1.10
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d93 3
a95 3
<title>
Bahasa Indonesia Dictionary: <? echo "$title"; ?>
</title>
d98 1
a98 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);
}
d199 2
a200 2
@
1.9
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d228 3
a230 1
<h2>Bahasa Indonesia Dictionary: <? echo "$title"; ?></h2>
@
1.8
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 03, 2003
d43 1
a43 1
if (!session_is_registered("ADMIN")) {
d264 1
a264 1
(session_is_registered("NODUP_INSERT_ENTRY")) &&
d288 1
a288 3
$NODUP_INSERT_ENTRY = $_POST['id'];
session_register("NODUP_INSERT_ENTRY");
d314 1
a314 3
$NODUP_INSERT_ENTRY = $_POST['id'];
session_register("NODUP_INSERT_ENTRY");
d373 1
a373 3
$NODUP_INSERT_ENTRY = $_POST['id'];
session_register("NODUP_INSERT_ENTRY");
@
1.7
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 01, 2003
d70 1
a70 1
} else if (isset($_POST['insert_request_entry'])) {
d72 1
a72 1
$title = "Insert Request Entry";
d196 1
a196 1
ipa = document.insert.ipa.value;
d204 1
a204 1
document.insert.ipa.focus();
d268 1
a268 1
show_insert_new_form($indonesia);
d293 1
a293 1
show_insert_new_form($indonesia);
d321 1
a321 1
show_insert_new_form($indonesia);
d336 1
a336 1
print "<br><hr><b>Permission denied!</b><hr><br>\n";
d381 1
a381 1
show_insert_new_form($indonesia);
d396 1
a396 1
$web, $indonesia, $_POST['insert_request_entry']);
d406 1
a406 1
show_insert_new_form($indonesia);
a638 2
$id = uniqid(rand(), true);
d649 5
a653 1
foreach($pos as $p) {
d655 3
a657 2
$pos_select .=
"<option value=\"$p->pkey\">$p->part_of_speech\n";
d690 1
a690 1
<td>English (255 characters maximum):</td>
d693 2
a694 2
<textarea name="english" wrap="soft"
rows="2" cols="55">${english}</textarea>
d701 1
a701 1
<td>Indonesian (255 characters maximum):</td>
d704 2
a705 2
<textarea name="indonesian" wrap="soft"
rows="2" cols="55">${indonesian}</textarea>
d734 1
a734 1
<td>Pronunciation (255 characters maximum):</td>
d737 2
a738 1
<textarea name="pronunciation" wrap="soft" rows="2" cols="55"></textarea>
d745 1
a745 1
<td>International Phonetic Alphabet (255 characters maximum):</td>
d748 2
a749 1
<textarea name="ipa" wrap="soft" rows="2" cols="55"></textarea>
d769 1
a769 1
<input type="password" name="password">
d848 5
a852 1
foreach($pos as $p) {
d854 3
a856 2
$pos_select .=
"<option value=\"$p->pkey\">$p->part_of_speech\n";
d866 1
a866 1
<td>English (255 characters maximum):</td>
d869 2
a870 2
<textarea name="english" wrap="soft" rows="2"
cols="55">${english_word}</textarea>
d877 1
a877 1
<td>Indonesian (255 characters maximum):</td>
d880 2
a881 2
<textarea name="indonesian" wrap="soft" rows="2"
cols="55">${indonesian_word}</textarea>
d910 1
a910 1
<td>Pronunciation (255 characters maximum):</td>
d913 2
a914 1
<textarea name="pronunciation" wrap="soft" rows="2" cols="55"></textarea>
d921 1
a921 1
<td>International Phonetic Alphabet (255 characters maximum):</td>
d924 2
a925 1
<textarea name="ipa" wrap="soft" rows="2" cols="55"></textarea>
d945 1
a945 1
<input type="password" name="password">
d1031 7
a1037 1
foreach($pos as $p) {
d1039 1
a1039 1
if ($p->pkey != $part_of_speech) {
d1042 1
a1042 1
"<option value=\"$p->pkey\">$p->part_of_speech\n";
d1047 2
a1048 2
"<option value=\"$p->pkey\" selected>" .
"$p->part_of_speech\n";
d1059 1
a1059 1
<td>English (255 characters maximum):</td>
d1062 2
a1063 2
<textarea name="english" wrap="soft" rows="2"
cols="55">${english}</textarea>
d1070 1
a1070 1
<td>Indonesian (255 characters maximum):</td>
d1073 2
a1074 2
<textarea name="indonesian" wrap="soft" rows="2"
cols="55">${indonesian}</textarea>
d1099 1
a1099 1
<td>Pronunciation (255 characters maximum):</td>
d1102 2
a1103 1
<textarea name="pronunciation" wrap="soft" rows="2" cols="55"></textarea>
d1110 1
a1110 1
<td>International Phonetic Alphabet (255 characters maximum):</td>
d1113 2
a1114 1
<textarea name="ipa" wrap="soft" rows="2" cols="55"></textarea>
d1135 1
a1135 1
<input type="password" name="password">
d1159 1
a1159 1
function show_insert_new_form($indonesia) {
d1171 7
a1177 1
foreach($pos as $p) {
d1179 1
a1179 2
$pos_select .=
"<option value=\"$p->pkey\">$p->part_of_speech\n";
d1189 1
a1189 1
<td>English (255 characters maximum):</td>
d1192 1
a1192 1
<textarea name="english" wrap="soft" rows="2" cols="55"></textarea>
d1199 1
a1199 1
<td>Indonesian (255 characters maximum):</td>
d1202 1
a1202 1
<textarea name="indonesian" wrap="soft" rows="2" cols="55"></textarea>
d1231 1
a1231 1
<td>Pronunciation (255 characters maximum):</td>
d1234 1
a1234 1
<textarea name="pronunciation" wrap="soft" rows="2" cols="55"></textarea>
d1241 1
a1241 1
<td>International Phonetic Alphabet (255 characters maximum):</td>
d1244 1
a1244 1
<textarea name="ipa" wrap="soft" rows="2" cols="55"></textarea>
d1264 1
a1264 1
<input type="password" name="password">
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 30, 2003
d76 8
d88 1
a88 1
$insert_flag = 2;
d231 2
d252 9
d366 1
d398 6
d455 3
a457 1
print "ERROR: $errstr <br>";
d548 1
a548 1
"<th>Pronounce</th>\n" .
d637 152
a793 1
d820 1
a820 1
$focus;
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 29, 2003
d225 19
a268 34
if (isset($_POST['delete_miss'])) {
$errstr =
$indonesia->delete_miss(
$_POST['delete_miss']);
if ($errstr != "") {
print
"<br><hr><b>WARNING: ${errstr}" .
"</b><hr><br>\n";
}
} else if (isset($_POST['delete_request'])) {
$errstr =
$indonesia->delete_request(
$_POST['delete_request']);
if ($errstr != "") {
print
"<br><hr><b>WARNING: ${errstr}" .
"</b><hr><br>\n";
}
print
"<form name=\"requests\" method=\"post\" " .
"action=\"requests.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Requested New Entries!\">\n" .
"</form>\n";
}
a273 19
if ($insert_flag == 0) {
print
"<form name=\"misses\" method=\"post\" " .
"action=\"misses.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Missed Search Entries!\">\n" .
"</form>\n";
} else if ($insert_flag == 1) {
print
"<form name=\"requests\" method=\"post\" " .
"action=\"requests.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Requested New Entries!\">\n" .
"</form>\n";
}
a296 27
if (isset($_POST['delete_miss'])) {
$errstr =
$indonesia->delete_miss(
$_POST['delete_miss']);
if ($errstr != "") {
print
"<br><hr><b>WARNING: ${errstr}" .
"</b><hr><br>\n";
}
} else if (isset($_POST['delete_request'])) {
$errstr =
$indonesia->delete_request(
$_POST['delete_request']);
if ($errstr != "") {
print
"<br><hr><b>WARNING: ${errstr}" .
"</b><hr><br>\n";
}
}
a301 19
if ($insert_flag == 0) {
print
"<form name=\"misses\" method=\"post\" " .
"action=\"misses.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Missed Search Entries!\">\n" .
"</form>\n";
} else if ($insert_flag == 1) {
print
"<form name=\"requests\" method=\"post\" " .
"action=\"requests.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Requested New Entries!\">\n" .
"</form>\n";
}
a356 28
if (isset($_POST['delete_miss'])) {
$errstr =
$indonesia->delete_miss(
$_POST['delete_miss']);
if ($errstr != "") {
print
"<br><hr><b>WARNING: ${errstr}" .
"</b><hr><br>\n";
}
} else if (isset($_POST['delete_request'])) {
$errstr =
$indonesia->delete_request(
$_POST['delete_request']);
if ($errstr != "") {
print
"<br><hr><b>" .
"WARNING: ${errstr}" .
"</b><hr><br>\n";
}
}
a363 23
if ($insert_flag == 0) {
print
"<form name=\"misses\" " .
"method=\"post\" " .
"action=\"misses.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Missed " .
"Search Entries!\">\n" .
"</form>\n";
} else if ($insert_flag == 1) {
print
"<form name=\"requests\" " .
"method=\"post\" " .
"action=\"requests.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Requested " .
"New Entries!\">\n" .
"</form>\n";
}
d395 9
d439 28
d468 1
a468 1
"<br><hr><b>Found ${dup_count} exact and/or similar " .
d471 6
a476 2
//WE NEED TO DO PARTS OF SPEECH TRANSLATION HERE!
d485 1
a485 1
"<th>Spelling Flag</th>\n" .
d487 1
a487 1
"<th>IPA Pronounce</th>\n" .
d493 2
a494 2
"<td>${pos} </td>\n" .
"<td>${spelling_flag} </td>\n" .
d497 2
a498 2
"<td>${comments} </td>\n" .
"<td><input type=\"submit\" value=\"Insert as New\"></td>\n" .
d521 1
a521 1
"<th>IPA Pronounce</th>\n" .
d527 10
a536 10
$pkey = $web->tohtml($duplicates[$i]->pkey);
$eng= $web->tohtml($duplicates[$i]->english);
$indo = $web->tohtml($duplicates[$i]->indonesian);
$posx= $web->tohtml($duplicates[$i]->part_of_speech);
$created = $web->tohtml($duplicates[$i]->created);
$modiified = $web->tohtml($duplicates[$i]->modified);
$spflg = $web->tohtml($duplicates[$i]->spelling_flag);
$p = $web->tohtml($duplicates[$i]->pronunciation);
$pipa = $web->tohtml($duplicates[$i]->pronunciation_ipa);
$comments = $web->tohtml($duplicates[$i]->comments);
a671 9
print
"<form name=\"misses\" " .
"method=\"post\" " .
"action=\"misses.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Missed " .
"Search Entries!\">\n" .
"</form>\n";
a855 9
print
"<form name=\"requests\" " .
"method=\"post\" " .
"action=\"requests.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Requested " .
"New Entries!\">\n" .
"</form>\n";
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 28, 2003
d232 2
d275 7
d289 19
d310 1
d363 19
d384 1
d468 2
d471 3
d475 10
a484 7
//print
//"<form name=\"misses\" method=\"post\" " .
//"action=\"misses.php\">\n" .
//"<input type=\"submit\" " .
//"value=\"Go Back to Missed Search Entries!\">\n" .
//"</form>\n";
}
d486 9
a494 1
show_insert_new_form($indonesia);
d562 4
a565 2
"<h3>Found ${dup_count} similar " .
"existing entries in the dictionary!</h3>\n";
a566 6
print
"You can do one of two things:<br>\n" .
"<ul>\n" .
"<li>Insert as a new entry\n" .
"<li>Overwrite an existing entry displayed below\n" .
"</ul>\n";
d595 1
a595 2
"<table cellpadding=\"3\" cellspacing=\"3\" border=\"1\" " .
"width=\"25%\">\n";
d704 1
d762 9
d955 9
@
1.3
log
@*** empty log message ***
@
text
@d16 2
a17 1
// database.
a49 9
if (session_is_registered("NODUP_INSERT_ENTRY")) {
session_unregister("NODUP_INSERT_ENTRY");
$web->redirect("admin.php");
exit;
}
d225 6
d232 1
a232 1
if (
d236 1
d275 1
a275 1
$NODUP_INSERT_ENTRY = 1;
d280 2
d286 1
d329 1
a329 1
$NODUP_INSERT_ENTRY = 1;
d334 2
d340 1
d376 1
a376 1
$_POST['comments'], $delete_flag);
d416 1
a416 1
$NODUP_INSERT_ENTRY = 1;
d421 6
a426 6
print
"<form name=\"misses\" method=\"post\" " .
"action=\"misses.php\">\n" .
"<input type=\"submit\" " .
"value=\"Go Back to Missed Search Entries!\">\n" .
"</form>\n";
d428 2
d457 1
a457 1
$pronunciation, $pronunciation_ipa, $comments, $delete_flag="") {
d476 2
d643 2
d797 1
d811 2
d979 1
d993 2
d1104 1
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 19, 2003
a39 1
d72 1
a72 1
if (isset($_POST['insert_missed_entry'])) {
d343 1
a343 1
print "<br><br><b>Permission denied!</b>";
d415 7
d430 1
a430 1
$web, $indonesia, $_POST['insert_missed_entry']);
d602 1
a602 1
"<hr><br><b>Successful Insertion!</b><hr><br>\n";
@
1.1
log
@Initial revision
@
text
@d5 35
a1091 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@