[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.384,1.385

blaine at iowaoutdoors.org blaine at iowaoutdoors.org
Wed Oct 6 21:50:33 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv19113/public_html

Modified Files:
	lib-common.php 
Log Message:
Added support for COM_optionsList to handle an array of selected items (if being used for a Mult-Select Selectbox) or a single selected option.

Index: lib-common.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.384
retrieving revision 1.385
diff -C2 -d -r1.384 -r1.385
*** lib-common.php	5 Oct 2004 19:59:33 -0000	1.384
--- lib-common.php	7 Oct 2004 01:50:31 -0000	1.385
***************
*** 1196,1200 ****
  * @param        string      $table      Database Table to get data from
  * @param        string      $selection  Comma delimited string of fields to pull The first field is the value of the option and the second is the label to be displayed.  This is used in a SQL statement and can include DISTINCT to start.
! * @param        string      $selected   Value (from $selection) to set to SELECTED or default
  * @param        int         $sortcol    Which field to sort option list by 0 (value) or 1 (label)
  * @param        string      $where      Optional WHERE clause to use in the SQL Selection
--- 1196,1200 ----
  * @param        string      $table      Database Table to get data from
  * @param        string      $selection  Comma delimited string of fields to pull The first field is the value of the option and the second is the label to be displayed.  This is used in a SQL statement and can include DISTINCT to start.
! * @param        string/array      $selected   Value (from $selection) to set to SELECTED or default
  * @param        int         $sortcol    Which field to sort option list by 0 (value) or 1 (label)
  * @param        string      $where      Optional WHERE clause to use in the SQL Selection
***************
*** 1223,1228 ****
          $retval .= '<option value="' . $A[0] . '"';
  
!         if( $A[0] == $selected )
!         {
              $retval .= ' selected="selected"';
          }
--- 1223,1236 ----
          $retval .= '<option value="' . $A[0] . '"';
  
!         if ( is_array($selected) AND count($selected) > 0 ) {
!             foreach ($selected as $selected_item)
!             {
!                 if( $A[0] == $selected_item )
!                 {
!                     $retval .= ' selected="selected"';
!                 }
!             }
!         } elseif (!is_array($selected) AND $A[0] == $selected) {
! 
              $retval .= ' selected="selected"';
          }




More information about the geeklog-cvs mailing list