[geeklog-cvs] Geeklog-1.x/system/classes config.class.php, 1.23, 1.24

Dirk Haun dhaun at qs1489.pair.com
Sun Feb 10 12:09:39 EST 2008


Update of /cvsroot/geeklog/Geeklog-1.x/system/classes
In directory qs1489.pair.com:/tmp/cvs-serv85353/system/classes

Modified Files:
	config.class.php 
Log Message:
Decoupled config subgroup and fieldset order from the language files. Now we can reorder / regroup options simply by database updates.


Index: config.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/classes/config.class.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** config.class.php	9 Feb 2008 12:22:28 -0000	1.23
--- config.class.php	10 Feb 2008 17:09:37 -0000	1.24
***************
*** 312,317 ****
          $q_string = "SELECT name, type, selectionArray, "
              . "fieldset, value FROM {$_TABLES['conf_values']}" .
!             " WHERE group_name='{$group}' and subgroup='{$subgroup}' " .
!             " ORDER BY sort_order ASC";
          $Qresult = DB_query($q_string);
          $res = array();
--- 312,318 ----
          $q_string = "SELECT name, type, selectionArray, "
              . "fieldset, value FROM {$_TABLES['conf_values']}" .
!             " WHERE group_name='{$group}' AND subgroup='{$subgroup}' " .
!             " AND (type <> 'fieldset' AND type <> 'subgroup') " .
!             " ORDER BY fieldset,sort_order ASC";
          $Qresult = DB_query($q_string);
          $res = array();
***************
*** 357,374 ****
      }
  
!     function get_sgroups($group)
      {
          global $_TABLES;
  
!         $q_string = "SELECT subgroup FROM {$_TABLES['conf_values']} WHERE " .
!             "group_name='{$group}' " .
!             "GROUP BY subgroup";
          $res = DB_query($q_string);
-         $return = array();
          while ($row = DB_fetchArray($res)) {
!             $return[] = $row[0];
          }
  
!         return $return;
      }
  
--- 358,375 ----
      }
  
!     function _get_sgroups($group)
      {
          global $_TABLES;
  
!         $q_string = "SELECT name,subgroup FROM {$_TABLES['conf_values']} WHERE "
!                   . "type = 'subgroup' AND group_name = '$group' "
!                   . "ORDER BY subgroup";
!         $retval = array();
          $res = DB_query($q_string);
          while ($row = DB_fetchArray($res)) {
!             $retval[$row['name']] = $row['subgroup'];
          }
  
!         return $retval;
      }
  
***************
*** 418,427 ****
                  $t->set_var("group_select_value", $group);
                  $t->set_var("group_display", ucwords($group));
!                 $subgroups = $this->get_sgroups($group);
!                 $innerloopcntr=1;
!                 foreach ($subgroups as $sgroup) {
                      if ($grp == $group AND $sg == $sgroup) {
!                         $t->set_var('group_active_name',ucwords($group));
!                         $t->set_var('subgroup_active_name',$LANG_configsubgroups[$group][$sgroup]);
                          $t->set_var('select_id', 'id="current"');
                      } else {
--- 419,434 ----
                  $t->set_var("group_select_value", $group);
                  $t->set_var("group_display", ucwords($group));
!                 $subgroups = $this->_get_sgroups($group);
!                 $innerloopcntr = 1;
!                 foreach ($subgroups as $sgname => $sgroup) {
                      if ($grp == $group AND $sg == $sgroup) {
!                         $t->set_var('group_active_name', ucwords($group));
!                         if (isset($LANG_configsubgroups[$group][$sgname])) {
!                             $t->set_var('subgroup_active_name',
!                                     $LANG_configsubgroups[$group][$sgname]);
!                         } else {
!                             $t->set_var('subgroup_active_name',
!                                     $LANG_configsubgroups[$group][$sgroup]);
!                         }
                          $t->set_var('select_id', 'id="current"');
                      } else {
***************
*** 451,457 ****
  
          $ext_info = $this->_get_extended($sg, $grp);
!         foreach ($ext_info as $fset=>$params) {
              $fs_contents = '';
!             foreach ($params as $name=>$e) {
                  $fs_contents .=
                      $this->_UI_get_conf_element($name,
--- 458,464 ----
  
          $ext_info = $this->_get_extended($sg, $grp);
!         foreach ($ext_info as $fset => $params) {
              $fs_contents = '';
!             foreach ($params as $name => $e) {
                  $fs_contents .=
                      $this->_UI_get_conf_element($name,
***************
*** 493,497 ****
      function _UI_get_fs($group, $contents, $fs_id, &$t)
      {
!         global $LANG_fs;
  
          if (!array_key_exists($group, $LANG_fs)) {
--- 500,504 ----
      function _UI_get_fs($group, $contents, $fs_id, &$t)
      {
!         global $_TABLES, $LANG_fs;
  
          if (!array_key_exists($group, $LANG_fs)) {
***************
*** 499,503 ****
          }
          $t->set_var('fs_contents', $contents);
!         $t->set_var('fs_display', $LANG_fs[$group][$fs_id]);
          $t->set_var('fs_notes', '');
          $t->parse('sg_contents', 'fieldset', true);
--- 506,516 ----
          }
          $t->set_var('fs_contents', $contents);
!         $fs_index = DB_getItem($_TABLES['conf_values'], 'name',
!                         "type = 'fieldset' AND fieldset = $fs_id AND group_name = '$group'");
!         if (empty($fs_index)) {
!             $t->set_var('fs_display', $LANG_fs[$group][$fs_id]);
!         } else {
!             $t->set_var('fs_display', $LANG_fs[$group][$fs_index]);
!         }
          $t->set_var('fs_notes', '');
          $t->parse('sg_contents', 'fieldset', true);
***************
*** 543,547 ****
          if ($deletable) {
              $t->set_var('delete', $t->parse('output', 'delete-button'));
!         } elseif ($this->ref == 'Core' ) {
              $t->set_var('unset_link',
                          "(<a href='#' onClick='unset(\"{$name}\");'>X</a>)");
--- 556,560 ----
          if ($deletable) {
              $t->set_var('delete', $t->parse('output', 'delete-button'));
!         } elseif (false) { // ??? } elseif ($this->ref == 'Core' ) {
              $t->set_var('unset_link',
                          "(<a href='#' onClick='unset(\"{$name}\");'>X</a>)");
***************
*** 729,739 ****
          }
          $retval .= COM_startBlock($subgroup_title, '',
!                         COM_getBlockTemplate('configmanager_subblock', 'header'));
  
!         $sgroups = $this->get_sgroups($conf_group);
          if (count($sgroups) > 0) {
!             $i =0;
!             foreach ($sgroups as $sgroup) {
!                 $group_display =  $LANG_configsubgroups[$conf_group][$sgroup];
                  // Create a menu item for each sub config group - disable the link for the current selected one
                  if ($i == $sg) {
--- 742,756 ----
          }
          $retval .= COM_startBlock($subgroup_title, '',
!                     COM_getBlockTemplate('configmanager_subblock', 'header'));
  
!         $sgroups = $this->_get_sgroups($conf_group);
          if (count($sgroups) > 0) {
!             $i = 0;
!             foreach ($sgroups as $sgname => $sgroup) {
!                 if (isset($LANG_configsubgroups[$conf_group][$sgname])) {
!                     $group_display = $LANG_configsubgroups[$conf_group][$sgname];
!                 } else {
!                     $group_display = $LANG_configsubgroups[$conf_group][$sgroup];
!                 }
                  // Create a menu item for each sub config group - disable the link for the current selected one
                  if ($i == $sg) {
***************
*** 752,754 ****
  }
  
! ?>
\ No newline at end of file
--- 769,771 ----
  }
  
! ?>




More information about the geeklog-cvs mailing list