changeset 747:330e6d79c5dc

Change stGetFormOptionList* function APIs a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 20 Nov 2014 07:57:53 +0200
parents 8fe56276fa4f
children e0431e12f3ea
files admajax.php msitegen.inc.php
diffstat 2 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Nov 20 07:56:18 2014 +0200
+++ b/admajax.php	Thu Nov 20 07:57:53 2014 +0200
@@ -335,8 +335,7 @@
   {
     foreach ($res as $item)
     {
-      $str .= $indent."  ".
-        stGetFormOptionListItem($item["show_id"],
+      $str .= stGetFormOptionListItem($indent."  ", $item["show_id"],
         ($item["show_id"] == $currShowID),
         sprintf("%3d. %-25s by %-15s",
           $item["show_id"],
@@ -364,8 +363,7 @@
   {
     foreach ($res as $item)
     {
-      $str .= $indent."  ".
-        stGetFormOptionListItem($item["id"],
+      $str .= stGetFormOptionListItem($indent."  ", $item["id"],
         ($currListID == $item["id"]),
         $item["name"]." (".$item["nslides"]." slides)");
     }
@@ -383,7 +381,7 @@
   if (($res = stExecSQL($sql)) !== false)
   {
     foreach ($res as $item)
-      $str .= $indent."  ".stGetFormOptionListItem($item["id"], FALSE, $item["title"]);
+      $str .= stGetFormOptionListItem($indent."  ", $item["id"], FALSE, $item["title"]);
   }
 
   return $str.stGetFormOptionListEnd($indent, $outer);
@@ -408,7 +406,7 @@
   if (($res = stExecSQL($sql)) !== false)
   {
     foreach ($res as $item)
-      $str .= $indent."    ".stGetFormOptionListItem($item["id"], FALSE, $item["title"]);
+      $str .= stGetFormOptionListItem($indent."    ", $item["id"], FALSE, $item["title"]);
   }
 
   $str .=
@@ -443,8 +441,7 @@
   {
     foreach ($res as $item)
     {
-      $str .= $indent."  ".
-        stGetFormOptionListItem($item["id"]."_".$item["order_num"], FALSE, $item["title"]);
+      $str .= stGetFormOptionListItem($indent."  ", $item["id"]."_".$item["order_num"], FALSE, $item["title"]);
     }
   }
 
@@ -1043,7 +1040,7 @@
         {
           foreach ($res as $item)
           {
-            echo "      ".stGetFormOptionListItem($item["id"],
+            echo stGetFormOptionListItem("     ", $item["id"],
               ($item["id"] == $currCompoID),
               sprintf("%-20s (%d entries)", substr($item["name"], 0, 20), $item["nentries"]));
           }
--- a/msitegen.inc.php	Thu Nov 20 07:56:18 2014 +0200
+++ b/msitegen.inc.php	Thu Nov 20 07:57:53 2014 +0200
@@ -219,6 +219,7 @@
     ($onclick != "" ? " onClick=\"".$onclick."\"" : "")."> ".chentities($label)." </button>";
 }
 
+
 function stGetFormTextArea($rows, $cols, $name, $id, $prefix, $value, $extra = "")
 {
   return
@@ -287,10 +288,10 @@
 }
 
 
-function stGetFormOptionListItem($value, $active, $name)
+function stGetFormOptionListItem($indent, $value, $active, $name)
 {
   return
-    "<option value=\"".$value."\"".
+    $indent."<option value=\"".$value."\"".
     ($active ? " selected=\"selected\"" : "").
     ">".str_replace(" ", "&nbsp;", chentities($name))."</option>\n";
 }
@@ -310,7 +311,7 @@
 
   foreach ($data as $key => $value)
   {
-    $str .= stGetFormOptionListItem($key,
+    $str .= stGetFormOptionListItem($indent." ", $key,
       ($key == $active),
       is_array($value) ? $value[0] : $value);
   }