Author: mike
Date: 2007-04-11 14:29:31 -0400 (Wed, 11 Apr 2007)
New Revision: 445
Log:
Add field searches and bookmarking of STR and article searches.


Modified:
   trunk/links.php
   trunk/phplib/base-articles.php
   trunk/phplib/base-str.php
   trunk/phplib/common.php
   trunk/phplib/html.php

Modified: trunk/links.php
===================================================================
--- trunk/links.php     2007-04-11 17:09:49 UTC (rev 444)
+++ trunk/links.php     2007-04-11 18:29:31 UTC (rev 445)
@@ -200,12 +200,12 @@
 
       print("<form method='POST' action='$PHP_SELF?L$listtype'>\n"
           ."<p align='center'>Search:&nbsp;"
-          ."<input type='text' name='SEARCH' size='40' value='$search'/>"
-          ."<input type='submit' value='Search Links'/>"
+          ."<input type='text' name='SEARCH' size='40' value='$search'>"
+          ."<input type='submit' value='Search Links'>"
           ."<br><i>Search supports 'and', 'or', 'not', and parenthesis. "
-           ."<a href='${path}search-help.php'>More info...</a></i></p>\n"
+           ."<a href='search-help.php'>More info...</a></i></p>\n"
           ."</form>\n"
-          ."<hr noshade/>\n");
+          ."<hr noshade>\n");
 
       if ($search != "")
       {
@@ -303,7 +303,7 @@
 
         if (!$link->is_published)
          print(" <img src='images/private.gif' width='16' height='16' "
-              ."align='middle' alt='private'/>");
+              ."align='middle' alt='private'>");
 
         if ($LOGIN_LEVEL >= AUTH_DEVEL || $LOGIN_USER == $link->create_user)
        {
@@ -374,7 +374,7 @@
 
           if (!$link->is_published)
            print(" <img src='images/private.gif' width='16' height='16' "
-                ."align='middle' alt='private'/>");
+                ."align='middle' alt='private'>");
 
           if ($age == 1)
             print(", <i>Updated 1 day ago</i>");
@@ -645,7 +645,7 @@
 
          print("<p><b>Error:</b> Please fill in the fields marked in "
               ."<b><font color='red'>bold red</font></b> below and resubmit "
-              ."your $what.</p><hr noshade/>\n");
+              ."your $what.</p><hr noshade>\n");
 
          $hstart = "<font color='red'>";
          $hend   = "</font>";
@@ -750,10 +750,10 @@
               ."<tt>SUP</tt>, <tt>TT</tt>, <tt>U</tt>, 
<tt>UL</tt></p></td></tr>\n");
 
          print("<tr><th></th>"
-              ."<td><input type='submit' value='$opname $typename'/></td>"
+              ."<td><input type='submit' value='$opname $typename'></td>"
               ."</tr>\n");
 
-         print("<tr><td></td><td><hr noshade/>\n"
+         print("<tr><td></td><td><hr noshade>\n"
               ."<h3>News Announcement (leave blank for no 
announcement)</h3></td>"
               ."</tr>\n");
 
@@ -773,7 +773,7 @@
        }
 
        print("<tr><th></th>"
-            ."<td><input type='submit' value='$opname $typename'/></td>"
+            ."<td><input type='submit' value='$opname $typename'></td>"
             ."</tr>\n");
        print("</table></center>\n");
        print("</form>");
@@ -904,7 +904,7 @@
           ."</tr>\n");
       print("</table>\n");
 
-      print("<hr noshade/>\n"
+      print("<hr noshade>\n"
            ."<h2><a name='_ARTICLES'>Articles</a></h2>\n");
       html_start_links();
       html_link("Submit Article", "articles.php?U+P$id");
@@ -936,7 +936,7 @@
           $temp = htmlspecialchars($article->title);
           if ($article->is_published == 0)
            $temp .= " <img src='${path}images/private.gif' width='16' 
height='16' "
-                   ."border='0' align='middle' alt='Private'/>";
+                   ."border='0' align='middle' alt='Private'>";
 
           print("<td width='67%'>$link$temp</a></td>");
 
@@ -957,7 +957,7 @@
         html_end_table();
       }
 
-      print("<hr noshade/>\n"
+      print("<hr noshade>\n"
            ."<h2><a name='_USER_COMMENTS'>Comments</a></h2>\n");
       html_start_links();
       html_link("Submit Comment", "comment.php?U+Plinks.php_V$id");

Modified: trunk/phplib/base-articles.php
===================================================================
--- trunk/phplib/base-articles.php      2007-04-11 17:09:49 UTC (rev 444)
+++ trunk/phplib/base-articles.php      2007-04-11 18:29:31 UTC (rev 445)
@@ -57,7 +57,7 @@
              $links = "")              // I - Tab links
 {
   global $argc, $argv, $_GET, $_POST, $_COOKIE, $LOGIN_LEVEL, $LOGIN_USER,
-         $PAGE_MAX, $PHP_SELF, $REQUEST_METHOD, $PROJECT_NAME,
+         $PAGE_MAX, $PHP_SELF, $PHP_URL, $REQUEST_METHOD, $PROJECT_NAME,
         $PROJECT_MODULE, $ARTICLE_TYPES;
 
 
@@ -78,6 +78,7 @@
   // Options:
   //
   // I#        = Set first article
+  // M#        = Set articles per page
   // P         = Parent link ID
   // Qtext     = Set search text (must be last option!)
   // Ttype     = Set search type
@@ -146,6 +147,9 @@
            if ($index < 0)
              $index = 0;
            break;
+       case 'M' : // Set max STRs per page
+            $PAGE_MAX = (int)$option;
+           break;
        case 'P' : // Set link ID
            $link_id = (int)$option;
            break;
@@ -182,9 +186,15 @@
       $search = $_POST["SEARCH"];
     if (array_key_exists("STYPE", $_POST))
       $stype = $_POST["STYPE"];
+    if (array_key_exists("FPAGEMAX", $_POST))
+    {
+      $PAGE_MAX = (int)$_POST["FPAGEMAX"];
+      setcookie("PAGE_MAX", $PAGE_MAX, time() + 365 * 86400);
+    }
   }
 
-  $options = "+I$index+T" . urlencode($stype) . "+P$link_id+Q" . 
urlencode($search);
+  $options = "+I$index+T" . urlencode($stype) . "+M$PAGE_MAX+P$link_id+Q" .
+             urlencode($search);
 
   switch ($op)
   {
@@ -309,17 +319,37 @@
        }
        else
        {
-          html_header("Articles", $path, "", $links);
+          $bookmark  = "$PHP_URL?L+T" . urlencode($stype) .
+                      "+M$PAGE_MAX+P$link_id+Q" . urlencode($search);
+          $bookstr   = str_replace(array("\\", "\""), array("\\\\", "\\\""),
+                                  $bookmark);
+          $searchstr = "$PROJECT_NAME Articles: " .
+                      str_replace(array("\\", "\""), array("\\\\", "\\\""),
+                                  $search);
+          html_header("Articles", $path, "", $links,
+             "function add_bookmark()\n"
+            ."{\n"
+            ."  if (navigator.appName == \"Microsoft Internet Explorer\")\n"
+            ."    window.external.AddFavorite(\"$bookstr\", \"$searchstr\");\n"
+            ."  else if (navigator.appName == \"Netscape\")\n"
+            ."    window.sidebar.addPanel(\"$searchstr\", \"$bookstr\", 
\"\");\n"
+            ."  else\n"
+            ."    alert(\"Bookmark this page to return to your search.\");\n"
+            ."}");
 
          html_start_links(1);
          html_link("Submit Article", "$PHP_SELF?U$options");
+         html_link("Bookmark Search", $bookmark, "add_bookmark();");
          if ($LOGIN_LEVEL >= AUTH_DEVEL)
            html_link("Update RSS File", "$PHP_SELF?G$options");
          html_end_links();
 
           print("<form method='POST' action='$PHP_SELF?L'><p align='center'>"
               ."Search:&nbsp;"
-              ."<select name='STYPE'>"
+              ."<input type='text' size='60' name='SEARCH' value='$search'>"
+              ."<input type='submit' value='Search Articles'><br>\n");
+
+         print("Which Articles:&nbsp;<select name='STYPE'>"
               ."<option value=''>All</option>");
 
          reset($ARTICLE_TYPES);
@@ -339,10 +369,20 @@
            print(">Mine</option>");
          }
 
-         print("</select>"
-              ."<input type='text' size='60' name='SEARCH' value='$search'>"
-              ."<input type='submit' value='Search Articles'><br>"
-               ."<i>Search supports 'and', 'or', 'not', and parenthesis. "
+         print("</select>\n");
+
+          $values = array(10, 20, 50, 100, 1000);
+         print("Articles/Page:&nbsp;<select name='FPAGEMAX'>");
+         for ($i = 0; $i < sizeof($values); $i ++)
+         {
+           if ($values[$i] == $PAGE_MAX)
+             print("<option value='$values[$i]' 
selected>$values[$i]</option>");
+           else
+             print("<option value='$values[$i]'>$values[$i]</option>");
+          }
+         print("</select>\n");
+
+         print("<br><i>Search supports 'and', 'or', 'not', and parenthesis. "
                ."<a href='${path}search-help.php'>More info...</a></i>"
                ."</p></form>\n");
 
@@ -384,7 +424,7 @@
           if ($count > $PAGE_MAX)
          {
             print("<table border='0' cellspacing='0' cellpadding='0' "
-                ."width='100%'>\n");
+                ."width='100%' summary=''>\n");
 
             print("<tr><td>");
            if ($index > 0)
@@ -452,7 +492,7 @@
           if ($count > $PAGE_MAX)
          {
             print("<table border='0' cellspacing='0' cellpadding='0' "
-                ."width='100%'>\n");
+                ."width='100%' summary=''>\n");
 
             print("<tr><td>");
            if ($index > 0)

Modified: trunk/phplib/base-str.php
===================================================================
--- trunk/phplib/base-str.php   2007-04-11 17:09:49 UTC (rev 444)
+++ trunk/phplib/base-str.php   2007-04-11 18:29:31 UTC (rev 445)
@@ -754,7 +754,7 @@
             ."  else if (navigator.appName == \"Netscape\")\n"
             ."    window.sidebar.addPanel(\"$searchstr\", \"$bookstr\", 
\"\");\n"
             ."  else\n"
-            ."    alert(navigator.appName);\n"
+            ."    alert(\"Bookmark this page to return to your search.\");\n"
             ."}");
 
           html_start_links(1);
@@ -768,17 +768,6 @@
               ."Search&nbsp;Words: &nbsp;<input type='text' size='60' 
name='SEARCH' value='$search'>"
               ."<input type='submit' value='Search Requests'><br>\n");
 
-          $values = array(10, 20, 50, 100, 1000);
-         print("STRs Per Page:&nbsp;<select name='FPAGEMAX'>");
-         for ($i = 0; $i < sizeof($values); $i ++)
-         {
-           if ($values[$i] == $PAGE_MAX)
-             print("<option value='$values[$i]' 
selected>$values[$i]</option>");
-           else
-             print("<option value='$values[$i]'>$values[$i]</option>");
-          }
-         print("</select>\n");
-
          print("Priority:&nbsp;<select name='FPRIORITY'>");
          print("<option value='0'>Don't Care</option>");
           for ($i = 1; $i <= 5; $i ++)
@@ -834,6 +823,17 @@
             print("</select>\n");
           }
 
+          $values = array(10, 20, 50, 100, 1000);
+         print("STRs/Page:&nbsp;<select name='FPAGEMAX'>");
+         for ($i = 0; $i < sizeof($values); $i ++)
+         {
+           if ($values[$i] == $PAGE_MAX)
+             print("<option value='$values[$i]' 
selected>$values[$i]</option>");
+           else
+             print("<option value='$values[$i]'>$values[$i]</option>");
+          }
+         print("</select>\n");
+
           print("<br><i>Search supports 'and', 'or', 'not', and parenthesis. "
                ."<a href='${path}search-help.php'>More info...</a></i>"
               ."</p></form>\n");

Modified: trunk/phplib/common.php
===================================================================
--- trunk/phplib/common.php     2007-04-11 17:09:49 UTC (rev 444)
+++ trunk/phplib/common.php     2007-04-11 18:29:31 UTC (rev 445)
@@ -160,7 +160,7 @@
              strtolower(substr($text, $i, 13)) == "</blockquote>" ||
              strtolower(substr($text, $i, 4)) == "<br>" ||
              strtolower(substr($text, $i, 5)) == "<br/>" ||
-             strtolower(substr($text, $i, 6)) == "<br />" ||
+             strtolower(substr($text, $i, 6)) == "<br>" ||
              strtolower(substr($text, $i, 6)) == "<code>" ||
              strtolower(substr($text, $i, 7)) == "</code>" ||
              strtolower(substr($text, $i, 4)) == "<em>" ||
@@ -279,7 +279,7 @@
              $pre = 0;
            }
            else if (!$inpre)
-             $ftext .= "<br />\n";
+             $ftext .= "<br>\n";
          }
          else
            $ftext .= "\n";
@@ -460,7 +460,7 @@
           if ($quote)
             $qtext .= "\n&gt; ";
          else
-            $qtext .= "<br />";
+            $qtext .= "<br>";
 
           $col = 0;
          $word = 0;
@@ -526,7 +526,7 @@
             if ($quote)
               $qtext .= "\n&gt; ";
            else
-              $qtext .= "<br />";
+              $qtext .= "<br>";
 
             $col  = 0;
            $word = 0;
@@ -611,7 +611,7 @@
          else
             $qtext .= quote_text($word);
 
-          $qtext .= "<br />";
+          $qtext .= "<br>";
          $word  = "";
          break;
 

Modified: trunk/phplib/html.php
===================================================================
--- trunk/phplib/html.php       2007-04-11 17:09:49 UTC (rev 444)
+++ trunk/phplib/html.php       2007-04-11 18:29:31 UTC (rev 445)
@@ -490,12 +490,14 @@
 
 
   if ($html_show_all)
-    print("<br><table border='0' cellpadding='0' cellspacing='0' width='100%'>"
+    print("<br><table border='0' cellpadding='0' cellspacing='0' width='100%' "
+         ."summary=''>"
         ."<tr class='header'><th align='left' valign='top'>"
         ."<img src='${html_path}images/hdr-top-left.gif' width='4' height='4' "
         ."alt=''/></th>");
   else
-    print("<br><table border='1' cellpadding='5' cellspacing='0' width='100%'>"
+    print("<br><table border='1' cellpadding='5' cellspacing='0' width='100%' "
+         ."summary=''>"
         ."<tr bgcolor='#cccccc'>");
 
   $html_row  = 0;

_______________________________________________
fltk-commit mailing list
fltk-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to