[WWW] r402 - trunk/phplib

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[WWW] r402 - trunk/phplib fltk-dev Aug 16, 2005 top right image
 
Author: mike
Date: 2005-08-17 00:55:11 -0400 (Wed, 17 Aug 2005)
New Revision: 402

Modified:
   trunk/phplib/base-str.php
Log:
Re-add hide/show text/file records in STRs.


Modified: trunk/phplib/base-str.php
===================================================================
--- trunk/phplib/base-str.php	2005-08-15 17:31:00 UTC (rev 401)
+++ trunk/phplib/base-str.php	2005-08-17 04:55:11 UTC (rev 402)
@@ -359,7 +359,7 @@
             $allowpost = FALSE,		// I - Show "post text/file" links
             $options = "")		// I - Options to pass along
 {
-  global $PHP_SELF;
+  global $PHP_SELF, $LOGIN_LEVEL;
 
 
   print("<hr noshade/><p><b>Trouble Report Files:</b></p>\n");
@@ -389,8 +389,25 @@
       $filename = htmlspecialchars($strfile->filename, ENT_QUOTES);
 
       html_start_row();
-      print("<td align='center' valign='top'>$email<br />$time $date</td>"
-	   ."<td align='center' valign='top'>"
+      print("<td align='center' valign='top'>$email<br />$time $date");
+
+      if ($LOGIN_LEVEL >= AUTH_DEVEL)
+      {
+        print("<form method='POST' action='$PHP_SELF?U$str->id$options'>"
+	     ."<input type='hidden' name='FILE_ID' value='$strfile->id'/>");
+
+        if ($strfile->is_published)
+	  print("<input type='hidden' name='IS_PUBLISHED' value='0'/>"
+	       ."<input type='submit' value='Hide'/>");
+        else
+	  print("<input type='hidden' name='IS_PUBLISHED' value='1'/>"
+	       ."<input type='submit' value='Show'/>");
+
+	print("</form>");
+      }
+
+      print("</td>"
+           ."<td align='center' valign='top' width='100%'>"
 	   ."<a href='strfiles/$str->id/$filename'>$filename</a></td>");
       html_end_row();
     }
@@ -425,8 +442,24 @@
       $contents = quote_text($strtext->contents);
 
       html_start_row();
-      print("<td align='center' valign='top'>$email<br />$time $date</td>"
-	   ."<td valign='top'><tt>$contents</tt></td>");
+      print("<td align='center' valign='top'>$email<br />$time $date");
+
+      if ($LOGIN_LEVEL >= AUTH_DEVEL)
+      {
+        print("<form method='POST' action='$PHP_SELF?U$str->id$options'>"
+	     ."<input type='hidden' name='TEXT_ID' value='$strtext->id'/>");
+
+        if ($strtext->is_published)
+	  print("<input type='hidden' name='IS_PUBLISHED' value='0'/>"
+	       ."<input type='submit' value='Hide'/>");
+        else
+	  print("<input type='hidden' name='IS_PUBLISHED' value='1'/>"
+	       ."<input type='submit' value='Show'/>");
+
+	print("</form>");
+      }
+
+      print("</td><td valign='top'><tt>$contents</tt></td>");
       html_end_row();
     }
 
@@ -1194,6 +1227,40 @@
 
 	if ($REQUEST_METHOD == "POST")
 	{
+          if (array_key_exists("FILE_ID", $_POST) &&
+	      (int)$_POST["FILE_ID"] > 0 &&
+	      array_key_exists("IS_PUBLISHED", $_POST))
+	  {
+	    $file_id = (int)$_POST["FILE_ID"];
+	    $strfile = new strfile($file_id);
+
+	    if ($strfile->id == $file_id)
+	    {
+	      $strfile->is_published = (int)$_POST["IS_PUBLISHED"];
+	      $strfile->save();
+	    }
+
+	    header("Location: $PHP_SELF?L$str->id$options");
+	    exit();
+	  }
+
+          if (array_key_exists("TEXT_ID", $_POST) &&
+	      (int)$_POST["TEXT_ID"] > 0 &&
+	      array_key_exists("IS_PUBLISHED", $_POST))
+	  {
+	    $text_id = (int)$_POST["TEXT_ID"];
+	    $strtext = new strtext($text_id);
+
+	    if ($strtext->id == $text_id)
+	    {
+	      $strtext->is_published = (int)$_POST["IS_PUBLISHED"];
+	      $strtext->save();
+	    }
+
+	    header("Location: $PHP_SELF?L$str->id$options");
+	    exit();
+	  }
+
           $havedata = $str->loadform();
 
 	  if ($id == 0 && !array_key_exists("contents", $_POST))

Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2023 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.