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
/
editor.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
11KB
|
503 lines
head 1.8;
access;
symbols;
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.41; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.10.06.00.39.26; 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.04.07.26.59; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.09.03.07.11.10; author bule; state Exp;
branches;
next 1.2;
1.2
date 2003.09.02.07.07.24; author bule; state Exp;
branches;
next 1.1;
1.1
date 2003.08.31.18.48.47; 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: edit.php
// Author(s): John L. Whiteman
// Created: August 31, 2003
// Modified: October 19, 2003
// Description: The purpose of this restricted access PHP web
// client page is to act like a front end to
// the delete.php, update.php, and insert.php pages.
// It allows an an administrator to type
// in a word then if the word exists ask them if they
// want to delete or update the word. If the word
// does not exist then it asks them if they want to
// add the word. Redirection is made to the applicable
// PHP page.
//
// 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: Search Word(s)</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_search() {
stoken = document.search.stoken.value;
stoken = trim(stoken);
if (is_white_space(stoken)) {
alert("You need to specify a search word value!");
document.search.stoken.focus();
return(false);
}
if (stoken.length > 255) {
alert(
"You need to specify a search word 1 to 255 characters " +
"in length!");
document.search.stoken.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<body>
<?
$web->show_logo("Search Word(s)");
?>
<a href="admin.php">Administration</a>
<?
show_search_form($web, $indonesia);
if (isset($_POST['stoken'])) {
search_all($web, $indonesia, $_POST['stoken']);
}
?>
</body>
</html>
<?
///////////////////////////////////////////////////////////////////////////////
function search_all($web, $indonesia, $stoken) {
$results = array();
$stoken = $web->strip($stoken);
if ($stoken == "") {
print
"<br><hr><b>You must specify a search value!" .
"</b><hr><br>\n" .
"<script language=\"Javascript\" type=\"text/javascript\">\n" .
"document.search.stoken.focus();\n" .
"</script>\n";
return;
}
$errstr = $indonesia->search_all($results, $stoken);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$total_results = count($results);
print
"<hr><b>Found ${total_results} " .
"match(es) for search entry: '${stoken}'</b><hr>\n" .
"<form method=\"post\" action=\"insert.php\">\n ".
"<input type=\"submit\" " .
"value=\"Insert as New English Entry!\">\n" .
"<input type=\"hidden\" name=\"insert_new_entry\" " .
"value=\"${stoken}\">\n" .
"<input type=\"hidden\" name=\"language\" " .
"value=\"English\">\n" .
"</form>\n" .
"<form method=\"post\" action=\"insert.php\">\n ".
"<input type=\"submit\" " .
"value=\"Insert as New Indonesian Entry!\">\n" .
"<input type=\"hidden\" name=\"insert_new_entry\" " .
"value=\"${stoken}\">\n" .
"<input type=\"hidden\" name=\"language\" " .
"value=\"Indonesian\">\n" .
"</form>\n";
if ($total_results == 0) {
return;
}
print
"<table cellpadding=\"3\" cellspacing=\"3\" border=\"1\">\n";
for($i = 0; $i < $total_results; $i++) {
if ($i == 0) {
print
"<tr>\n" .
"<th>PKEY</th>\n" .
"<th>Language</th>\n" .
"<th>English</th>\n" .
"<th>Indonesian</th>\n" .
"<th>Part of Speech</th>\n" .
"<th>Pronunciation</th>\n" .
"<th>IPA</th>\n" .
"<th>Comments</th>\n" .
"<th>Created</th>\n" .
"<th>Modified</th>\n" .
"<th>Action</th>\n" .
"</tr>\n";
}
$pkey = $web->tohtml($results[$i]["pkey"]);
$language = $web->tohtml($results[$i]["language"]);
$english = $web->tohtml($results[$i]["english"]);
$indonesian = $web->tohtml($results[$i]["indonesian"]);
$pos = $web->tohtml($results[$i]["pos"]);
$pronunciation = $web->tohtml($results[$i]["pronunciation"]);
$ipa = $web->tohtml($results[$i]["ipa"]);
$comments = $web->tohtml($results[$i]["comments"]);
$created = $web->tohtml($results[$i]["created"]);
$modified = $web->tohtml($results[$i]["modified"]);
print
"<tr>\n" .
"<td>${pkey} </td>\n" .
"<td>${language} </td>\n" .
"<td>${english} </td>\n" .
"<td>${indonesian} </td>\n" .
"<td>${pos} </td>\n" .
"<td>${pronunciation} </td>\n" .
"<td>${ipa} </td>\n" .
"<td>${comments} </td>\n" .
"<td>${created} </td>\n" .
"<td>${modified} </td>\n" .
"<td wrap>\n" .
"<form name=\"delete_entry\" method=\"post\" " .
"action=\"delete.php\">\n" .
"<input type=\"submit\" value=\"Delete! \">\n" .
"<input type=\"hidden\" name=\"pkey\" " .
"value=\"${pkey}\">\n" .
"<input type=\"hidden\" name=\"editor\" " .
"value=\"1\">\n" .
"</form>\n" .
"<form name=\"update_entry\" method=\"post\" " .
"action=\"update.php\">\n" .
"<input type=\"submit\" value=\"Update!\">\n" .
"<input type=\"hidden\" name=\"pkey\" " .
"value=\"${pkey}\">\n" .
"<input type=\"hidden\" name=\"editor\" " .
"value=\"1\">\n" .
"</form>\n" .
"</td>\n" .
"</tr>\n";
}
print "</table>\n";
return;
}
///////////////////////////////////////////////////////////////////////////////
function show_search_form($web, $indonesia) {
print <<<EOFSSF
<form name="search" method="post" onSubmit='return verify_search()'>
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>Enter search entry:</td>
<td>
<input type="text" name="stoken" maxlength="255" size="30">
</td>
</tr><tr>
<td colspan="2" align="right">
<input type="submit" value="Search Dictionary!">
</td>
</tr>
</table>
</form>
<script language="Javascript" type="text/javascript">
document.search.stoken.focus();
</script>
EOFSSF;
return;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
?>
@
1.7
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d69 2
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d70 2
d73 1
a73 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);
}
d104 1
a104 1
//////////////////////////////////////////////////////////////////////////////
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d130 3
a132 2
<h2>Bahasa Indonesia Dictionary: Search Word(s)</h2>
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 03, 2003
d47 1
a47 1
if (!session_is_registered("ADMIN")) {
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 02, 2003
a53 9
if (session_is_registered("NODUP_UPDATE_ENTRY")) {
session_unregister("NODUP_UPDATE_ENTRY");
$web->redirect("admin.php");
exit;
}
d180 2
a181 1
"<hr><b>Found 0 matches for search entry: '${stoken}'</b><hr>\n" .
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 01, 2003
d77 1
a77 1
<title>Bahasa Indonesia Dictionary: Dictionary Editor</title>
d139 1
a139 1
<h2>Bahasa Indonesia Dictionary: Dictionary Editor</h2>
d189 1
a189 1
"<hr><b>Found 0 matches for: '${stoken}'</b><hr>\n" .
d192 1
a192 1
"value=\"Insert as new English entry!\">\n" .
d200 1
a200 1
"value=\"Insert as new Indonesian entry!\">\n" .
d231 1
d258 18
d290 1
a290 1
<td>Enter search word(s):</td>
@
1.1
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 31, 2003
d77 1
a77 1
<title>Bahasa Indonesia Dictionary: Editor</title>
d105 31
d139 1
a139 1
<h2>Bahasa Indonesia Dictionary: Editor</h2>
a142 1
<h3>This page is under construction!</h3>
d144 8
d158 133
@