licom.cgi: Replace HTML-entities in textboxen. Also, remove the CSS data from the...
authorFlorian Forster <octo@verplant.org>
Tue, 12 Sep 2006 14:58:50 +0000 (16:58 +0200)
committerFlorian Forster <octo@verplant.org>
Tue, 12 Sep 2006 14:58:50 +0000 (16:58 +0200)
licom.cgi

index 26c13a8..d00ab66 100755 (executable)
--- a/licom.cgi
+++ b/licom.cgi
@@ -509,7 +509,13 @@ sub action_edit
 EOF
        if ($UserID)
        {
-               print qq(\t\t\t\t<td><input type="text" name="lastname" value="$lastname_html" /></td>\n);
+               print <<HTML;
+                               <td><input type="text" name="lastname" value="$lastname_html"
+                                       onChange="updateTextbox ('lastname');"
+                                       onKeyUp="updateTextbox ('lastname');"
+                                       onBlur="updateTextbox ('lastname');"
+                               /></td>
+HTML
        }
        else
        {
@@ -522,7 +528,13 @@ EOF
 EOF
        if ($UserID)
        {
-               print qq(\t\t\t\t<td><input type="text" name="firstname" value="$firstname_html" /></td>\n);
+               print <<HTML;
+                               <td><input type="text" name="firstname" value="$firstname_html"
+                                       onChange="updateTextbox ('firstname');"
+                                       onKeyUp="updateTextbox ('firstname');"
+                                       onBlur="updateTextbox ('firstname');"
+                               /></td>
+HTML
        }
        else
        {
@@ -551,7 +563,11 @@ EOF
                        print <<EOF;
                        <tr>
                                <th>$print</th>
-                               <td><input type="text" name="$field" value="$value" /></td>
+                               <td><input type="text" name="$field" value="$value"
+                                       onChange="updateTextbox ('$field');"
+                                       onKeyUp="updateTextbox ('$field');"
+                                       onBlur="updateTextbox ('$field');"
+                               /></td>
                        </tr>
 EOF
                }
@@ -584,10 +600,16 @@ EOF
                        "\t\t\t</tr>\n";
                }
                        
-               print "\t\t\t<tr>\n",
-               "\t\t\t\t<th>New Group</th>\n",
-               qq(\t\t\t\t<td><input type="text" name="newgroup" value="" /></td>\n),
-               "\t\t\t</tr>\n";
+               print <<HTML;
+                       <tr>
+                               <th>New Group</th>
+                               <td><input type="text" name="newgroup" value=""
+                                       onChange="updateTextbox ('newgroup');"
+                                       onKeyUp="updateTextbox ('newgroup');"
+                                       onBlur="updateTextbox ('newgroup');"
+                               /></td>
+                       </tr>
+HTML
        }
 
        print <<EOF;
@@ -1061,7 +1083,11 @@ sub action_edit_group
            </tr>
            <tr>
              <th>Description</th>
-             <td><input type="text" name="description" value="$desc_html" /></td>
+             <td><input type="text" name="description" value="$desc_html"
+                     onChange="updateTextbox ('description');"
+                     onKeyUp="updateTextbox ('description');"
+                     onBlur="updateTextbox ('description');"
+             /></td>
            </tr>
            <tr>
              <th colspan="2"><input type="submit" name="button" value="Save" /></th>
@@ -1105,213 +1131,32 @@ Content-Type: text/html; charset=UTF-8
 <html>
        <head>
                <title>$title</title>
-               <style type="text/css">
-               <!--
-               \@media screen
-               {
-                       a
-                       {
-                               color: blue;
-                               background-color: inherit;
-                               text-decoration: none;
-                       }
-
-                       a:hover
-                       {
-                               text-decoration: underline;
-                       }
-
-                       a:visited
-                       {
-                               color: navy;
-                               background-color: inherit;
-                       }
-
-                       body
-                       {
-                               color: black;
-                               background-color: white;
-                       }
-
-                       div.error
-                       {
-                               color: red;
-                               background-color: yellow;
-
-                               font-weight: bold;
-                               padding: 1ex;
-                               border: 2px solid red;
-                       }
-
-                       div.foot
-                       {
-                               color: gray;
-                               background-color: white;
-
-                               position: fixed;
-                               top: auto;
-                               right: 0px;
-                               bottom: 0px;
-                               left: 0px;
-
-                               font-size: x-small;
-                               text-align: right;
-                               border-top: 1px solid black;
-                               width: 100%;
-                       }
-
-                       div.foot a
-                       {
-                               color: black;
-                               background-color: inherit;
-                               text-decoration: none;
-                       }
-
-                       div.foot a:hover
-                       {
-                               text-decoration: underline;
-                       }
-
-                       div.menu
-                       {
-                               border-top: 1px solid black;
-                               margin-top: 1ex;
-                               font-weight: bold;
-                       }
-
-                       div.menu a
-                       {
-                               color: blue;
-                               background-color: transparent;
-                       }
-
-                       div.topmenu
-                       {
-                               margin-bottom: 1ex;
-                               padding-bottom: 1ex;
-                               border-bottom: 1px solid black;
-                       }
-
-                       div.topmenu form
-                       {
-                               display: inline;
-                               margin-right: 5ex;
-                       }
-
-                       h1
-                       {
-                               position: absolute;
-                               top: 1ex;
-                               right: 1ex;
-                               bottom: auto;
-                               left: auto;
-
-                               font-size: 100%;
-                               font-weight: bold;
-                       }
-
-                       img
-                       {
-                               border: none;
-                       }
-
-                       table.list
-                       {
-                               width: 100%;
-                               border: 2px solid #d0d0d0;
-                       }
-
-                       table.list td
-                       {
-                               empty-cells: show;
-                       }
-
-                       td
-                       {
-                               color: black;
-                               background-color: #e8e8e8;
-                               vertical-align: top;
-                       }
-
-                       th
-                       {
-                               color: black;
-                               background-color: #d0d0d0;
-                               padding: 0.3ex;
-                               text-align: left;
-                               vertical-align: top;
-                       }
+               <link rel="stylesheet" type="text/css" href="style.screen.css" media="screen" />
+               <link rel="stylesheet" type="text/css" href="style.print.css" media="print" />
+               <script type="text/javascript" src="html_entities.js"></script>
+               <script type="text/javascript">
+function updateTextbox (name)
+{
+       var arrTb = document.getElementsByName (name);
+       var objTb;
+       var objStr;
 
-                       ul.groups li
-                       {
-                               margin-top: 0.5ex;
-                       }
-               }
+       if (!arrTb || (arrTb.length < 1))
+                return (true);
 
-               \@media print
+       for (var i = 0; i < arrTb.length; i++)
+       {
+               objStr = decode_entities (arrTb[i].value);
+               if (arrTb[i].value != objStr)
                {
-                       a
-                       {
-                               color: inherit;
-                               background-color: inherit;
-                               text-decoration: underline;
-                       }
-                       
-                       div.topmenu, div.menu
-                       {
-                               display: none;
-                       }
-
-                       div.foot
-                       {
-                               font-size: 50%;
-                               text-align: right;
-                       }
-
-                       h1
-                       {
-                               display: none;
-                       }
-
-                       h2
-                       {
-                               font-size: 100%;
-                       }
-
-                       table
-                       {
-                               border-collapse: collapse;
-                       }
-
-                       table.list
-                       {
-                               width: 100%;
-                       }
-
-                       table.list td
-                       {
-                               empty-cells: show;
-                       }
-
-                       table.list th
-                       {
-                               border-bottom-width: 2px;
-                       }
-
-                       td, th
-                       {
-                               border: 1px solid black;
-                               vertical-align: top;
-                       }
-
-                       th
-                       {
-                               font-weight: bold;
-                               text-align: center;
-                       }
+                       arrTb[i].value = objStr;
+                       arrTb[i].focus ();
                }
-               //-->
-               </style>
+       }
+
+       return (true); 
+}
+               </script>
        </head>
 
        <body>
@@ -1329,7 +1174,11 @@ EOF
                        </form>
                        <form action="$MySelf" method="post" accept-charset="UTF-8">
                                <input type="hidden" name="action" value="search" />
-                               <input type="text" name="search" value="$search" />
+                               <input type="text" name="search" value="$search"
+                                       onChange="updateTextbox ('search');"
+                                       onKeyUp="updateTextbox ('search');"
+                                       onBlur="updateTextbox ('search');"
+                               />
                                <input type="submit" name="button" value="Search" />
                        </form>
                        <form action="$MySelf" method="post" accept-charset="UTF-8">