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 / pronunciations.php,v < prev    next >
Text File  |  2003-10-20  |  23KB  |  1,108 lines

  1. head    1.6;
  2. access;
  3. symbols;
  4. locks; strict;
  5. comment    @# @;
  6.  
  7.  
  8. 1.6
  9. date    2003.10.20.00.21.46;    author bule;    state Exp;
  10. branches;
  11. next    1.5;
  12.  
  13. 1.5
  14. date    2003.10.18.00.33.42;    author bule;    state Exp;
  15. branches;
  16. next    1.4;
  17.  
  18. 1.4
  19. date    2003.10.06.00.39.27;    author bule;    state Exp;
  20. branches;
  21. next    1.3;
  22.  
  23. 1.3
  24. date    2003.10.01.06.51.29;    author bule;    state Exp;
  25. branches;
  26. next    1.2;
  27.  
  28. 1.2
  29. date    2003.09.11.05.28.22;    author bule;    state Exp;
  30. branches;
  31. next    1.1;
  32.  
  33. 1.1
  34. date    2003.09.05.06.42.53;    author bule;    state Exp;
  35. branches;
  36. next    ;
  37.  
  38.  
  39. desc
  40. @@
  41.  
  42.  
  43. 1.6
  44. log
  45. @*** empty log message ***
  46. @
  47. text
  48. @<?
  49. session_start();
  50. require_once("../php/Indonesia.php");
  51. require_once("../php/Web.php");
  52. //////////////////////////////////////////////////////////////////////////////
  53. //////////////////////////////////////////////////////////////////////////////
  54. // Project Name: Bahasa Indonesia Dictionary
  55. // Directory:    bahasa/web
  56. // File Name:    pronunciations.php
  57. // Author(s):    John L. Whiteman
  58. // Created:      September 04, 2003  
  59. // Modified:     October 19, 2003
  60. // Description:  The purpose of this restricted access PHP web 
  61. //               client page is to allow the administrator view, 
  62. //               edit, and add pronunciation entries. 
  63. // 
  64. // Copyright (c) 2003 John L. Whiteman
  65. //
  66. // Permission is herby granted, free of charge, to any person obtaining a 
  67. // copy of this software, data, and associated documentation files 
  68. // (the "Software"), to deal in the Software without restriction, 
  69. // including without limitation the rights to use, copy, modify, merge, 
  70. // publish, distribute, sublicense, and/or sell copies of Software, and to
  71. // permit persons to whom the Software is furnished to do so, subject to 
  72. // the following conditions:
  73. //
  74. // The above copyright notice and this permission notice shall be 
  75. // included in all copies or substantial portions of the Software.
  76. //
  77. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
  78. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
  79. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  80. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 
  81. // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
  82. // TORT OR OTHERWISE, ARISING IN THE SOFTWARE.  
  83. //////////////////////////////////////////////////////////////////////////////
  84. //////////////////////////////////////////////////////////////////////////////
  85. $web = new Web();
  86.  
  87. if (!$_SESSION['ADMIN']) {
  88.  
  89.     $web->redirect("login.php");
  90.  
  91.     exit;
  92. }
  93.  
  94. $indonesia = new Indonesia(); 
  95.  
  96. $status = $indonesia->get_dictionary_status();
  97.  
  98. if ($status["status"] == 1 || $status["status"] == 2) {
  99.  
  100.     $web-redirect("admin.php");
  101.  
  102.     exit;
  103. }
  104.  
  105. ?>
  106. <html>
  107. <head>
  108. <title>Bahasa Indonesia Dictionary: Pronunciations</title>
  109.  
  110. <link href="bahasa.css" rel="stylesheet" type="text/css">
  111.  
  112. <script type="text/javascript" src="bahasa.js"></script>
  113.  
  114. <script language="Javascript" type="text/javascript">
  115. <!--
  116. //////////////////////////////////////////////////////////////////////////////
  117. function verify() {
  118.  
  119.     symbol = document.pronunciations.symbol.value;
  120.  
  121.     symbol = trim(symbol);
  122.  
  123.     if (is_white_space(symbol)) {
  124.  
  125.         alert(
  126.         "You must enter a symbol value!");
  127.  
  128.         document.pronunciations.symbol.focus();
  129.  
  130.         return(false);
  131.     }
  132.  
  133.     if (symbol.length > 20) {
  134.  
  135.         alert(
  136.         "The symbol value must be 20 characters or less!");
  137.  
  138.         document.pronunciations.symbol.focus();
  139.  
  140.         return(false);
  141.     }
  142.  
  143.     category = document.pronunciations.category.value;
  144.  
  145.     category = trim(category);
  146.  
  147.     if (is_white_space(category)) {
  148.  
  149.         alert(
  150.         "You must enter a category value!");
  151.  
  152.         document.pronunciations.category.focus();
  153.  
  154.         return(false);
  155.     }
  156.  
  157.     if (category.length > 20) {
  158.  
  159.         alert(
  160.         "The category value must be 20 characters or less!");
  161.  
  162.         document.pronunciations.category.focus();
  163.  
  164.         return(false);
  165.     }
  166.  
  167.     pronunciation = document.pronunciations.pronunciation.value;
  168.  
  169.     pronunciation = trim(pronunciation);
  170.  
  171.     if (is_white_space(pronunciation)) {
  172.  
  173.         alert(
  174.         "You must enter a pronunciation value!");
  175.  
  176.         document.pronunciations.pronunciation.focus();
  177.  
  178.         return(false);
  179.     }
  180.  
  181.     if (pronunciation.length > 20) {
  182.  
  183.         alert(
  184.         "The pronunciation value must be 20 characters or less!");
  185.  
  186.         document.pronunciations.pronunciation.focus();
  187.  
  188.         return(false);
  189.     }
  190.  
  191.     ipa = document.pronunciations.ipa.value;
  192.  
  193.     ipa = trim(ipa);
  194.  
  195.     if (is_white_space(ipa)) {
  196.  
  197.         alert(
  198.         "You must enter an International Phonetic Alphabet value!");
  199.  
  200.         document.pronunciations.ipa.focus();
  201.  
  202.         return(false);
  203.     }
  204.  
  205.     if (ipa.length > 20) {
  206.  
  207.         alert(
  208.         "The International Phonetic Alphabet value " + 
  209.         "must be 20 characters or less!");
  210.  
  211.         document.pronunciations.ipa.focus();
  212.  
  213.         return(false);
  214.     }
  215.  
  216.     description = document.pronunciations.description.value;
  217.  
  218.     description= trim(description);
  219.  
  220.     if (is_white_space(description)) {
  221.  
  222.         alert(
  223.         "You must enter a description value.");
  224.  
  225.         document.pronunciations.description.focus();
  226.  
  227.         return(false);
  228.     }
  229.  
  230.     password = document.pronunciations.password.value;
  231.  
  232.     if (is_white_space(password)) {
  233.  
  234.         alert(
  235.         "You must enter a password value.");
  236.  
  237.         document.pronunciations.password.focus();
  238.  
  239.         return(false);
  240.     }
  241.  
  242.     return(true);
  243. }
  244. //////////////////////////////////////////////////////////////////////////////
  245. function verify_delete() {
  246.  
  247.     password = document.delete_pronunciation.password.value;
  248.  
  249.     if (is_white_space(password)) {
  250.  
  251.         alert(
  252.         "You must enter a password value.");
  253.  
  254.         document.delete_pronunciation.password.focus();
  255.  
  256.         return(false);
  257.     }
  258. }
  259. //////////////////////////////////////////////////////////////////////////////
  260. // -->
  261. </script>
  262.  
  263. </head>
  264. <body>
  265. <?
  266. $web->show_logo("Pronunciations");
  267. ?>
  268. <a href="admin.php">Administration</a>
  269. <?
  270.  
  271. if (
  272. ($_SESSION['NODUP_PRONUNCIATIONS']) &&
  273. (isset($_POST['id'])) &&
  274. ($_SESSION['NODUP_PRONUNCIATIONS'] == $_POST['id'])) {
  275.  
  276.     show_pronunciations_form($web, $indonesia);
  277.  
  278. } else if (
  279. (isset($_POST['action'])) &&
  280. (isset($_POST['symbol'])) &&
  281. (isset($_POST['category'])) &&
  282. (isset($_POST['pronunciation'])) &&
  283. (isset($_POST['ipa'])) &&
  284. (isset($_POST['description'])) &&
  285. (isset($_POST['id'])) &&
  286. (isset($_POST['password']))) {
  287.  
  288.     show_pronunciations_form($web, $indonesia);
  289.  
  290.     if ($_SESSION['NODUP_PRONUNCIATIONS']) {
  291.  
  292.         unset($_SESSION['NODUP_PRONUNCIATIONS']);
  293.     }
  294.  
  295.     $errstr = $indonesia->login($_SESSION['ADMIN'], $_POST['password']);
  296.  
  297.     if ($errstr != "") {
  298.  
  299.         print "<hr><b>Permission denied!</b><hr>\n";
  300.  
  301.     } else {
  302.  
  303.         if ($_POST['action'] == "insert") {
  304.  
  305.             $errstr = 
  306.             $indonesia->insert_pronunciation(
  307.             $_POST['symbol'], $_POST['category'],
  308.             $_POST['pronunciation'], $_POST['ipa'],
  309.             $_POST['description']);
  310.  
  311.             if ($errstr != "") {
  312.  
  313.                 print "<hr><b>${errstr}</b><hr>\n";
  314.  
  315.             } else {
  316.  
  317.                 print "<hr><b>Successful insert!</b><hr>\n";
  318.  
  319.                 $_SESSION['NODUP_PRONUNCIATIONS'] = 
  320.                     $_POST['id'];
  321.             }
  322.  
  323.         } else if (
  324.         ($_POST['action'] == "update") && 
  325.         (isset($_POST['pkey']))) {
  326.  
  327.             $errstr = 
  328.             $indonesia->update_pronunciation(
  329.             $_POST['pkey'],
  330.             $_POST['symbol'], $_POST['category'],
  331.             $_POST['pronunciation'], $_POST['ipa'],
  332.             $_POST['description']);
  333.  
  334.             if ($errstr != "") {
  335.  
  336.                 print "<hr><b>${errstr}</b><hr>\n";
  337.  
  338.             } else {
  339.  
  340.                 print "<hr><b>Successful update!</b><hr>\n";
  341.  
  342.                 $_SESSION['NODUP_PRONUNCIATIONS'] = 
  343.                     $_POST['id'];
  344.             }
  345.  
  346.         } else if (
  347.         ($_POST['action'] == "delete") && 
  348.         (isset($_POST['pkey']))) {
  349.  
  350.             $errstr = 
  351.             $indonesia->delete_pronunciation($_POST['pkey']);
  352.  
  353.             if ($errstr != "") {
  354.  
  355.                 print "<hr><b>${errstr}</b><hr>\n";
  356.  
  357.             } else {
  358.  
  359.                 print "<hr><b>Successful delete!</b><hr>\n";
  360.  
  361.                 $_SESSION['NODUP_PRONUNCIATIONS'] =
  362.                     $_POST['id'];
  363.             }
  364.         } 
  365.     }
  366.  
  367. } else if (isset($_POST['pronunciation_pkey'])) {
  368.  
  369.     if ($_POST['pronunciation_pkey'] == 0) {
  370.  
  371.         show_insert_new_pronunciation_form($web, $indonesia);
  372.  
  373.     } else {
  374.  
  375.         show_update_pronunciations_form(
  376.         $web, $indonesia, $_POST['pos_pkey']);
  377.     }
  378.  
  379. } else if (isset($_POST['delete_pronunciation_pkey'])) {
  380.  
  381.     show_delete_pronunciation_form(
  382.     $web, $indonesia, $_POST['delete_pronunciation_pkey']);
  383.  
  384. } else if (isset($_POST['update_pronunciation_pkey'])) {
  385.  
  386.     show_update_pronunciation_form(
  387.     $web, $indonesia, $_POST['update_pronunciation_pkey']);
  388.  
  389. } else {
  390.  
  391.     show_pronunciations_form($web, $indonesia);
  392. }
  393. ?>
  394. </body>
  395. </html>
  396.  
  397. <?
  398. //////////////////////////////////////////////////////////////////////////////
  399. function show_delete_pronunciation_form($web, $indonesia, $spkey) {
  400.  
  401.     $id = uniqid(rand(), true);
  402.  
  403.     $rpronunciation = array();
  404.  
  405.     $spkey = $web->strip($spkey);
  406.  
  407.     $errstr = 
  408.     $indonesia->get_pronunciation($rpronunciation, $spkey);
  409.  
  410.     if ($errstr != "") {
  411.  
  412.         print "<hr><b>${errstr}</b><hr>\n"; 
  413.  
  414.         return;
  415.     }
  416.  
  417.     $pkey = $web->tohtml($rpronunciation[0]["pkey"]);
  418.     $symbol = $web->tohtml($rpronunciation[0]["symbol"]);
  419.     $category = $web->tohtml($rpronunciation[0]["category"]);
  420.     $pronunciation = $web->tohtml($rpronunciation[0]["pronunciation"]);
  421.     $ipa = $web->tohtml($rpronunciation[0]["ipa"]);
  422.     $description = $web->tohtml($rpronunciation[0]["description"]);
  423.     $created = $web->tohtml($rpronunciation[0]["created"]);
  424.     $modified = $web->tohtml($rpronunciation[0]["modified"]);
  425.  
  426.     print <<<EOFSDPF
  427. <form name="delete_pronunciation" method="post" 
  428. onSubmit='return verify_delete()'> 
  429. <hr>
  430. <table cellpadding="3" cellspacing="3" border="1">
  431. <tr>
  432. <th>PKEY</th>
  433. <th>Symbol</th>
  434. <th>Category</th>
  435. <th>Pronunciation</th>
  436. <th>IPA</th>
  437. <th>Description</th>
  438. <th>Created</th>
  439. <th>Modified</th>
  440. </tr><tr>
  441. <td>${pkey}</td>
  442. <td>${symbol}</td>
  443. <td>${category}</td>
  444. <td>${pronunciation}</td>
  445. <td>${ipa}</td>
  446. <td>${description}</td>
  447. <td>${created}</td>
  448. <td>${modified}</td>
  449. </tr>
  450. </table>
  451. <hr>
  452. <table cellpadding="3" cellspacing="3" border="0">
  453. <tr>
  454. <td>Password:</td>
  455. <td><input type="password" name="password" size="50"></td>
  456. <td><input type="submit" value="Delete Pronunciation!"></td>
  457. </tr>
  458. </table>
  459. <input type="hidden" name="id" value="${id}"> 
  460. <input type="hidden" name="action" value="delete">
  461. <input type="hidden" name="pkey" value="${pkey}">
  462. <input type="hidden" name="symbol" value="${symbol}">
  463. <input type="hidden" name="category" value="${category}">
  464. <input type="hidden" name="pronunciation" value="${pronunciation}">
  465. <input type="hidden" name="ipa" value="${ipa}">
  466. <input type="hidden" name="description" value="${description}">
  467. </form>
  468. <script language="Javascript" type="text/javascript">
  469. document.delete_pronunciation.password.focus();
  470. </script>
  471. EOFSDPF;
  472.  
  473. }
  474. //////////////////////////////////////////////////////////////////////////////
  475. function show_insert_new_pronunciation_form($web, $indonesia) {
  476.  
  477.     $id = uniqid(rand(), true);
  478.  
  479.     print <<<EOFINPF
  480. <form name="pronunciations" method="post" onsubmit='return verify()'>
  481. <table cellpadding="3" cellspacing="3" border="0">
  482. <tr>
  483. <td>Symbol (1 to 20 characters):</td>
  484. </tr><tr>
  485. <td> 
  486. <input type="text" name="symbol" size="25" maxlength="20">
  487. </td>
  488. </tr><tr>
  489. <td>Category (1 to 20 characters):</td>
  490. </tr><tr>
  491. <td>
  492. <input type="text" name="category" size="25" maxlength="20">
  493. </td>
  494. </tr><tr>
  495. <td>Pronunciation (1 to 20 characters):</td>
  496. </tr><tr>
  497. <td>
  498. <input type="text" name="pronunciation" size="25" maxlength="20">
  499. </td>
  500. </tr><tr>
  501. <td>International Phonetic Alphabet (1 to 20 characters):</td>
  502. </tr><tr>
  503. <td>
  504. <input type="text" name="ipa" size="25" maxlength="20">
  505. </td>
  506. </tr><tr>
  507. <td>Description:</td>
  508. </tr><tr>
  509. <td>
  510. <textarea name="description" rows="7" 
  511. cols="55" wrap="soft"></textarea> 
  512. </td>
  513. </tr><tr>
  514. <td>Password:</td>
  515. </tr><tr>
  516. <td>
  517. <input type="password" name="password" size="50">
  518. </td>
  519. </tr><tr>
  520. <td align="right">
  521. <input type="reset" value="Reset">
  522.    
  523. <input type="submit" value="Insert Pronunciation!">
  524. </td>
  525. </tr><tr>
  526. <td> </td>
  527. </tr>
  528. </table>
  529. <input type="hidden" name="action" value="insert">
  530. <input type="hidden" name="id" value="${id}">
  531. </form>
  532. <script language="Javascript" type="text/javascript">
  533. document.pronunciations.symbol.focus();
  534. </script>
  535. EOFINPF;
  536.  
  537.     return;
  538. }
  539. //////////////////////////////////////////////////////////////////////////////
  540. function show_pronunciations_form($web, $indonesia) {
  541.  
  542.     $pronunciations = array();
  543.  
  544.     $errstr = $indonesia->get_pronunciations($pronunciations);
  545.  
  546.     if ($errstr != "") {
  547.  
  548.         print "<hr><b>${errstr}</b><hr><br>\n";
  549.  
  550.         return;
  551.     }
  552.  
  553.     $total_pronunciations = count($pronunciations);
  554.  
  555.     if ($total_pronunciations == 0) {
  556.  
  557.         print 
  558.         "<br><br>\n" .
  559.         "Insert a new pronunciation entry." .
  560.         "<form method=\"post\"><input type=\"submit\" " .
  561.         "value=\"Insert a New Pronunciation Entry!\">\n" .
  562.         "<input type=\"hidden\" name=\"pronunciation_pkey\" " .
  563.         "value=\"0\"> " .
  564.         "</form>\n";
  565.  
  566.         return;
  567.     }
  568.  
  569.     print 
  570.     "<br><br>\n" .
  571.     "Insert a new pronunciation entry or " .
  572.     "update or delete an existing ones below:" .
  573.     "<form method=\"post\"><input type=\"submit\" " .
  574.     "value=\"Insert a New Pronunciation Entry!\">\n" .
  575.     "<input type=\"hidden\" name=\"pronunciation_pkey\" value=\"0\"> " .
  576.     "</form>\n";
  577.  
  578.     $pronunciation_table = 
  579.     "<br>\n" .
  580.     "<table cellpadding=\"3\" \n" . 
  581.     "cellspacing=\"3\" border=\"1\">\n" .
  582.     "<tr>\n" .
  583.     "<th>PKEY</th>\n" .
  584.     "<th>Symbol</th>\n" .
  585.     "<th>Category</th>\n" .
  586.     "<th>Pronunciation</th>\n" .
  587.     "<th>IPA</th>\n" .
  588.     "<th>Description</th>\n" .
  589.     "<th>Created</th>\n" .
  590.     "<th>Modified</th>\n" .
  591.     "<th>Update</th>\n" .
  592.     "<th>Delete</th></tr>\n";
  593.  
  594.     for($i = 0; $i < $total_pronunciations; $i++) {
  595.  
  596.         $pkey = $web->tohtml($pronunciations[$i]["pkey"]);
  597.         $symbol = $web->tohtml($pronunciations[$i]["symbol"]);
  598.         $category = $web->tohtml($pronunciations[$i]["category"]);
  599.         $pronunciation = 
  600.         $web->tohtml($pronunciations[$i]["pronunciation"]);
  601.         $ipa = $web->tohtml($pronunciations[$i]["ipa"]);
  602.         $description = $web->tohtml($pronunciations[$i]["description"]);
  603.         $created = $web->tohtml($pronunciations[$i]["created"]);
  604.         $modified = $web->tohtml($pronunciations[$i]["modified"]);
  605.  
  606.         $pronunciation_table .=
  607.         "<tr>\n" .
  608.         "<td>${pkey}</td>\n" .
  609.         "<td>${symbol}</td>\n" .
  610.         "<td>${category}</td>\n" .
  611.         "<td>${pronunciation} </td>\n" .
  612.         "<td>${ipa} </td>\n" .
  613.         "<td>${description} </td>\n" .
  614.         "<td>${created}</td>\n" .
  615.         "<td>${modified}</td>\n" .
  616.         "<td>\n" .
  617.         "<form name=${pkey} method=\"post\">\n" .
  618.         "<input type=\"submit\" value=\"Update!\">\n" .
  619.         "<input type=\"hidden\" name=\"update_pronunciation_pkey\" " .
  620.         "value=\"${pkey}\">\n" .
  621.         "</form>\n" .
  622.         "</td>\n" .
  623.         "<td>\n" .
  624.         "<form name=${pkey} method=\"post\">\n" .
  625.         "<input type=\"submit\" value=\"Delete!\">\n" .
  626.         "<input type=\"hidden\" name=\"delete_pronunciation_pkey\" " .
  627.         "value=\"${pkey}\">\n" .
  628.         "</form>\n" .
  629.         "</td></tr>\n";
  630.     }
  631.  
  632.     $pronunciation_table .= "</table>\n";
  633.  
  634.     print "$pronunciation_table";
  635.  
  636.     return;
  637. }
  638. //////////////////////////////////////////////////////////////////////////////
  639. function show_update_pronunciation_form($web, $indonesia, $spkey) { 
  640.  
  641.     $id = uniqid(rand(), true);
  642.  
  643.     $rpronunciation = array();
  644.  
  645.     $spkey = $web->strip($spkey);
  646.  
  647.     $errstr = 
  648.     $indonesia->get_pronunciation($rpronunciation, $spkey);
  649.  
  650.     if ($errstr != "") {
  651.  
  652.         print "<hr><b>${errstr}</b><hr>\n"; 
  653.  
  654.         return;
  655.     }
  656.  
  657.     $pkey = $web->tohtml($rpronunciation[0]["pkey"]);
  658.     $symbol = $web->tohtml($rpronunciation[0]["symbol"]);
  659.     $category = $web->tohtml($rpronunciation[0]["category"]);
  660.     $pronunciation = $web->tohtml($rpronunciation[0]["pronunciation"]);
  661.     $ipa = $web->tohtml($rpronunciation[0]["ipa"]);
  662.     $description = $web->tohtml($rpronunciation[0]["description"]);
  663.     $created = $web->tohtml($rpronunciation[0]["created"]);
  664.     $modified = $web->tohtml($rpronunciation[0]["modified"]);
  665.  
  666.     print <<<EOFSUPF
  667. <form name="pronunciations" method="post" onsubmit='return verify()'>
  668. <table cellpadding="3" cellspacing="3" border="0">
  669. <tr>
  670. <td>Symbol (1 to 20 characters):</td>
  671. </tr><tr>
  672. <td> 
  673. <input type="text" name="symbol" size="25" maxlength="20" 
  674. value="${symbol}">
  675. </td>
  676. </tr><tr>
  677. <td>Category (1 to 20 characters):</td>
  678. </tr><tr>
  679. <td>
  680. <input type="text" name="category" size="25" maxlength="20" 
  681. value="${category}">
  682. </td>
  683. </tr><tr>
  684. <td>Pronunciation (1 to 20 characters):</td>
  685. </tr><tr>
  686. <td>
  687. <input type="text" name="pronunciation" size="25" maxlength="20" 
  688. value="${pronunciation}">
  689. </td>
  690. </tr><tr>
  691. <td>International Phonetic Alphabet (1 to 20 characters):</td>
  692. </tr><tr>
  693. <td>
  694. <input type="text" name="ipa" size="25" maxlength="20" 
  695. value="${ipa}">
  696. </td>
  697. </tr><tr>
  698. <td>Description:</td>
  699. </tr><tr>
  700. <td>
  701. <textarea name="description" rows="7" 
  702. cols="55" wrap="soft">${description}</textarea> 
  703. </td>
  704. </tr><tr>
  705. <td>Password:</td>
  706. </tr><tr>
  707. <td>
  708. <input type="password" name="password" size="50">
  709. </td>
  710. </tr><tr>
  711. <td align="right">
  712. <input type="reset" value="Reset">
  713.    
  714. <input type="submit" value="Update Pronunciation!">
  715. </td>
  716. </tr><tr>
  717. <td> </td>
  718. </tr>
  719. </table>
  720. <input type="hidden" name="action" value="update">
  721. <input type="hidden" name="id" value="${id}">
  722. <input type="hidden" name="pkey" value="${pkey}">
  723. </form>
  724. <script language="Javascript" type="text/javascript">
  725. document.pronunciations.symbol.focus();
  726. </script>
  727. EOFSUPF;
  728.  
  729.     return;
  730. }
  731. //////////////////////////////////////////////////////////////////////////////
  732. //////////////////////////////////////////////////////////////////////////////
  733. ?>
  734. @
  735.  
  736.  
  737. 1.5
  738. log
  739. @*** empty log message ***
  740. @
  741. text
  742. @d12 1
  743. a12 1
  744. // Modified:     October 17, 2003
  745. d62 2
  746. @
  747.  
  748.  
  749. 1.4
  750. log
  751. @*** empty log message ***
  752. @
  753. text
  754. @d12 1
  755. a12 1
  756. // Modified:     October 05, 2003
  757. d61 3
  758. a63 2
  759. <title>Bahasa Indonesia Dictionary: Pronunciations 
  760. </title>
  761. d66 1
  762. a66 25
  763. //////////////////////////////////////////////////////////////////////////////
  764. function is_white_space(stoken) {
  765.  
  766.     if (stoken == null) return(true);
  767.  
  768.     if (stoken == '') return(true);
  769.  
  770.     if (stoken == "") return(true);
  771.  
  772.     return(false);
  773. }
  774. //////////////////////////////////////////////////////////////////////////////
  775. function trim(stoken) {
  776.  
  777.     if (is_white_space(stoken)) {
  778.  
  779.         return(stoken);
  780.     }
  781.  
  782.     stoken = stoken.replace(/^\s*/, "");
  783.  
  784.     stoken = stoken.replace(/\s*$/, "");
  785.  
  786.     return(stoken);
  787. }
  788. d211 1
  789. a211 1
  790. //////////////////////////////////////////////////////////////////////////////
  791. @
  792.  
  793.  
  794. 1.3
  795. log
  796. @*** empty log message ***
  797. @
  798. text
  799. @d12 1
  800. a12 1
  801. // Modified:     September 30, 2003
  802. d239 3
  803. a241 1
  804. <h2>Bahasa Indonesia Dictionary: Pronunciations</h2>
  805. @
  806.  
  807.  
  808. 1.2
  809. log
  810. @*** empty log message ***
  811. @
  812. text
  813. @d12 1
  814. a12 1
  815. // Modified:     September 05, 2003
  816. d40 1
  817. a40 1
  818. if (!session_is_registered("ADMIN")) {
  819. d244 1
  820. a244 1
  821. (session_is_registered("NODUP_PRONUNCIATIONS")) &&
  822. d262 1
  823. a262 1
  824.     if (session_is_registered("NODUP_PRONUNCIATIONS")) {
  825. d264 1
  826. a264 1
  827.         session_unregister("NODUP_PRONUNCIATIONS");
  828. d291 2
  829. a292 3
  830.                 $NODUP_PRONUNCIATIONS = $_POST['id']; 
  831.  
  832.                 session_register("NODUP_PRONUNCIATIONS");
  833. d314 2
  834. a315 3
  835.                 $NODUP_PRONUNCIATIONS = $_POST['id']; 
  836.  
  837.                 session_register("NODUP_PRONUNCIATIONS");
  838. d333 2
  839. a334 3
  840.                 $NODUP_PRONUNCIATIONS = $_POST['id']; 
  841.  
  842.                 session_register("NODUP_PRONUNCIATIONS");
  843. @
  844.  
  845.  
  846. 1.1
  847. log
  848. @*** empty log message ***
  849. @
  850. text
  851. @d12 1
  852. a12 1
  853. // Modified:     September 04, 2003
  854. d93 1
  855. a93 1
  856.     symbol = document.pronunciation_form.symbol.value;
  857. d100 1
  858. a100 1
  859.         "You must enter a symbol value.");
  860. d102 1
  861. a102 1
  862.         document.pronunciation_form.symbol.focus();
  863. d110 1
  864. a110 1
  865.         "The symbol value must be 255 characters or less!");
  866. d112 1
  867. a112 1
  868.         document.pronunciation_form.symbol.focus();
  869. d117 1
  870. a117 1
  871.     category = document.pronunciation_form.category.value;
  872. d124 1
  873. a124 1
  874.         "You must enter a category value.");
  875. d126 1
  876. a126 1
  877.         document.pronunciation_form.category.focus();
  878. d134 1
  879. a134 1
  880.         "The category value must be 255 characters or less!");
  881. d136 1
  882. a136 1
  883.         document.pronunciation_form.category.focus();
  884. d141 1
  885. a141 1
  886.     pronunciation = document.pronunciation_form.category.value;
  887. d143 1
  888. a143 1
  889.     category = trim(category);
  890. d145 1
  891. a145 1
  892.     if (is_white_space(category)) {
  893. d148 1
  894. a148 1
  895.         "You must enter a category value.");
  896. d150 1
  897. a150 1
  898.         document.pronunciation_form.category.focus();
  899. d155 1
  900. a155 1
  901.     if (category.length > 20) {
  902. d158 1
  903. a158 1
  904.         "The category value must be 255 characters or less!");
  905. d160 1
  906. a160 1
  907.         document.pronunciation_form.category.focus();
  908. d165 1
  909. d167 1
  910. d169 1
  911. d171 2
  912. d174 1
  913. d176 2
  914. d179 1
  915. d181 3
  916. d185 1
  917. d187 2
  918. d190 1
  919. d192 1
  920. d194 1
  921. d196 2
  922. d199 1
  923. d201 2
  924. a202 1
  925.     description = document.parts_of_speech.description.value;
  926. d204 1
  927. a204 1
  928.     description= trim(description);
  929. d206 1
  930. a206 1
  931.     if (is_white_space(description)) {
  932. d209 1
  933. a209 1
  934.         "You must enter a description value.");
  935. d211 1
  936. a211 1
  937.         document.parts_of_speech.description.focus();
  938. d216 6
  939. a221 1
  940.     password = document.parts_of_speech.password.value;
  941. d228 1
  942. a228 1
  943.         document.parts_of_speech.password.focus();
  944. a231 2
  945.  
  946.     return(true);
  947. d233 2
  948. d246 1
  949. a246 1
  950. ($_SESSION['NODUP_PRONUNCIATONS'] == $_POST['id'])) {
  951. d248 1
  952. a248 1
  953.     show_pronunciation_form($web, $indonesia);
  954. d252 4
  955. a255 1
  956. (isset($_POST['part_of_speech'])) &&
  957. d260 2
  958. d271 1
  959. a271 1
  960.         print "<hr><b>Permission denied!</b><hr><br>\n";
  961. a274 1
  962.  
  963. d278 4
  964. a281 2
  965.             $indonesia->insert_parts_of_speech(
  966.             $_POST['part_of_speech'], $_POST['description']);
  967. d285 1
  968. a285 2
  969.                 print 
  970.                 "<hr><b>${errstr}</b><hr>\n";
  971. d289 1
  972. a289 2
  973.                 print 
  974.                 "<hr><b>Insert successful!</b><hr>\n";
  975. d293 1
  976. a293 3
  977.                 session_register("NODUP_PRONUNCIATONS");
  978.  
  979.                 show_pos_form($web, $indonesia);
  980. d296 3
  981. a298 2
  982.  
  983.         } else if ($_POST['action'] == "update") {
  984. d301 5
  985. a305 2
  986.             $indonesia->update_parts_of_speech($_POST['pkey'], 
  987.             $_POST['part_of_speech'], $_POST['description']);
  988. d309 1
  989. a309 2
  990.                 print 
  991.                 "<hr><b>${errstr}</b><hr><br>\n";
  992. d313 1
  993. a313 2
  994.                 print 
  995.                 "<hr><b>Update successful!</b><hr>\n";
  996. d318 14
  997. d333 1
  998. a333 2
  999.                 show_pos_form($web, $indonesia);
  1000.             }
  1001. d335 1
  1002. a335 1
  1003.         } else {
  1004. d337 3
  1005. a339 2
  1006.             show_pos_form($web, $indonesia);
  1007.         }
  1008. d350 1
  1009. a350 1
  1010.         show_update_pronunciation_form(
  1011. d354 10
  1012. d366 1
  1013. a366 1
  1014.     show_pronunciation_form($web, $indonesia);
  1015. d374 76
  1016. d455 1
  1017. a455 1
  1018. <form name="pronunciation_form" method="post" onsubmit='return verify()'>
  1019. d479 1
  1020. a479 1
  1021. <input type="text" name="pronunciation_ipa" size="25" maxlength="20">
  1022. d482 1
  1023. a482 1
  1024. <td>Comments:</td>
  1025. d485 1
  1026. a485 1
  1027. <textarea name="comments" rows="7" 
  1028. d508 1
  1029. a508 1
  1030. document.pronunciation_form.symbol.focus();
  1031. d515 1
  1032. a515 1
  1033. function show_pronunciation_form($web, $indonesia) {
  1034. d561 1
  1035. a561 1
  1036.     "<th>Non-IPA</th>\n" .
  1037. d563 1
  1038. a563 1
  1039.     "<th>Comments</th>\n" .
  1040. d577 1
  1041. a577 1
  1042.         $comments = $web->tohtml($pronunciations[$i]["comments"]);
  1043. d588 1
  1044. a588 1
  1045.         "<td>${comments} </td>\n" .
  1046. d595 2
  1047. a596 1
  1048.         "value=\"${pkey}\"></form>\n" .
  1049. d602 2
  1050. a603 1
  1051.         "value=\"${pkey}\"></form>\n" .
  1052. d614 1
  1053. a614 1
  1054. function show_update_pronunciation_form($web, $indonesia, $pkey) {
  1055. d616 3
  1056. a618 1
  1057.     $pos = array();
  1058. d620 1
  1059. a620 1
  1060.     $id = uniqid(rand(), true);
  1061. d622 2
  1062. a623 1
  1063.     $errstr = $indonesia->get_part_of_speech($pos, $pkey);
  1064. d627 1
  1065. a627 1
  1066.         print "<hr><b>${errstr}</b><hr>\n";
  1067. d632 8
  1068. a639 1
  1069.     $pkey = $web->tohtml($pos->pkey);
  1070. d641 2
  1071. a642 6
  1072.     $part_of_speech = $web->tohtml($pos->part_of_speech);
  1073.  
  1074.     $description = $web->tohtml($pos->description);
  1075.  
  1076.     print <<<EOFUPF
  1077. <form name="parts_of_speech" method="post" onsubmit='return verify()'>
  1078. d645 2
  1079. a646 1
  1080. <td>Part of Speech<br>(255 characters maximum):</td>
  1081. d648 23
  1082. a670 2
  1083. <input type="text" name="part_of_speech" 
  1084. value="${part_of_speech}" maxlength="255">
  1085. d674 1
  1086. d681 1
  1087. d683 1
  1088. a683 1
  1089. <input type="password" name="password">
  1090. d686 1
  1091. a686 1
  1092. <td colspan="2" align="right">
  1093. d689 1
  1094. a689 1
  1095. <input type="submit" value="Update Part of Speech!">
  1096. d691 2
  1097. d696 1
  1098. a697 1
  1099. <input type="hidden" name="id" value="${id}">
  1100. d700 1
  1101. a700 1
  1102. document.parts_of_speech.part_of_speech.focus();
  1103. d702 1
  1104. a702 1
  1105. EOFUPF;
  1106. @
  1107.  
  1108.