phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] preferences inc/class.bocategories.inc.php inc/...


From: Dave Hall
Subject: [Phpgroupware-cvs] preferences inc/class.bocategories.inc.php inc/...
Date: Thu, 28 Dec 2006 13:23:14 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    preferences
Changes by:     Dave Hall <skwashd>     06/12/28 13:23:14

Modified files:
        inc            : class.bocategories.inc.php 
                         class.uicategories.inc.php 
        templates/base : category_form.tpl listcats.tpl 

Log message:
        get this working properly again, notices, globals and tpl fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/preferences/inc/class.bocategories.inc.php?cvsroot=phpgroupware&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/preferences/inc/class.uicategories.inc.php?cvsroot=phpgroupware&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/preferences/templates/base/category_form.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/preferences/templates/base/listcats.tpl?cvsroot=phpgroupware&r1=1.1&r2=1.2

Patches:
Index: inc/class.bocategories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/inc/class.bocategories.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- inc/class.bocategories.inc.php      17 Apr 2005 15:14:31 -0000      1.15
+++ inc/class.bocategories.inc.php      28 Dec 2006 13:23:14 -0000      1.16
@@ -5,7 +5,7 @@
        * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package preferences
-       * @version $Id: class.bocategories.inc.php,v 1.15 2005/04/17 15:14:31 
powerstat Exp $
+       * @version $Id: class.bocategories.inc.php,v 1.16 2006/12/28 13:23:14 
skwashd Exp $
        */
 
        /**
@@ -54,10 +54,10 @@
 
                        $this->read_sessiondata($cats_app);
 
-                       $start  = $GLOBALS['HTTP_POST_VARS']['start']  ? 
$GLOBALS['HTTP_POST_VARS']['start']  : $GLOBALS['HTTP_GET_VARS']['start'];
-                       $query  = $GLOBALS['HTTP_POST_VARS']['query']  ? 
$GLOBALS['HTTP_POST_VARS']['query']  : $GLOBALS['HTTP_GET_VARS']['query'];
-                       $sort   = $GLOBALS['HTTP_POST_VARS']['sort']   ? 
$GLOBALS['HTTP_POST_VARS']['sort']   : $GLOBALS['HTTP_GET_VARS']['sort'];
-                       $order  = $GLOBALS['HTTP_POST_VARS']['order']  ? 
$GLOBALS['HTTP_POST_VARS']['order']  : $GLOBALS['HTTP_GET_VARS']['order'];
+                       $start  = isset($_REQUEST['start'])     ? 
$_REQUEST['start']    : 0;
+                       $query  = isset($_REQUEST['query'])     ? 
$_REQUEST['query']    : '';
+                       $sort   = isset($_REQUEST['sort'])      ? 
$_REQUEST['sort']             : '';
+                       $order  = isset($_REQUEST['order'])     ? 
$_REQUEST['order']    : '';
 
                        if(!empty($start) || $start == '0' || $start == 0)
                        {
@@ -86,7 +86,7 @@
                 */
                function save_sessiondata($data, $cats_app)
                {
-                       $colum = $cats_app . '_cats';
+                       $column = $cats_app . '_cats';
                        
$GLOBALS['phpgw']->session->appsession('session_data',$column,$data);
                }
 
@@ -97,7 +97,7 @@
                 */
                function read_sessiondata($cats_app)
                {
-                       $colum = $cats_app . '_cats';
+                       $column = $cats_app . '_cats';
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data',$column);
 
                        $this->start  = $data['start'];
@@ -134,7 +134,7 @@
                                $values['access'] = 'public';
                        }
 
-                       if ($values['id'] && $values['id'] != 0)
+                       if ( isset($values['id']) && $values['id'] != 0)
                        {
                                return $this->cats->edit($values);
                        }
@@ -208,7 +208,7 @@
                                        (
                                                'type'     => 'appandmains',
                                                'cat_name' => $values['name'],
-                                               'cat_id'   => $values['id']
+                                               'cat_id'   => 
isset($values['id']) ? $values['id'] : 0
                                        ));
                                }
                                else
@@ -217,7 +217,7 @@
                                        (
                                                'type'     => 'appandsubs',
                                                'cat_name' => $values['name'],
-                                               'cat_id'   => $values['id']
+                                               'cat_id'   => 
isset($values['id']) ? $values['id'] : 0
                                        ));
                                }
 

Index: inc/class.uicategories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/inc/class.uicategories.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- inc/class.uicategories.inc.php      25 Jul 2006 01:13:38 -0000      1.30
+++ inc/class.uicategories.inc.php      28 Dec 2006 13:23:14 -0000      1.31
@@ -6,7 +6,7 @@
        * @copyright Copyright (C) 2000-2003,2005 Free Software Foundation, 
Inc. http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package preferences
-       * @version $Id: class.uicategories.inc.php,v 1.30 2006/07/25 01:13:38 
skwashd Exp $
+       * @version $Id: class.uicategories.inc.php,v 1.31 2006/12/28 13:23:14 
skwashd Exp $
        */
 
        /**
@@ -110,9 +110,6 @@
                 */
                function set_langs()
                {
-                       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
-                       
$GLOBALS['phpgw']->template->set_var('row_on',$GLOBALS['phpgw_info']['theme']['row_on']);
-                       
$GLOBALS['phpgw']->template->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
                        
$GLOBALS['phpgw']->template->set_var('lang_access',lang('Private'));
                        
$GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
                        
$GLOBALS['phpgw']->template->set_var('user_name',$this->user);
@@ -139,6 +136,7 @@
                 */
                function cat_data($edata,$data)
                {
+                       $td_data = '';
                        for ($j=0; $j < count($edata); ++$j)
                        {
                                $td_data .= '<td>' . $data[$edata[$j]] . 
'</td>' . "\n";
@@ -165,17 +163,15 @@
                                'cats_level'  => $cats_level
                        );
 
+                       $edata = array();
                        if($extra)
                        {
                                $edata = explode(',',$extra);
                        }
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
$GLOBALS['phpgw_info']['apps'][$cats_app]['title'].
                                '&nbsp;'.lang('categories 
for').':&nbsp;'.$this->user;
-                       $GLOBALS['phpgw']->common->phpgw_header();
-                       echo parse_navbar();
-                       die('PHPGW_APP_TPL == ' . PHPGW_APP_TPL);
-                       
$GLOBALS['phpgw']->template->set_file(array('cat_list_t'  => 'listcats.tpl',
-                                                                               
                                'data_column' => 'listcats.tpl'));
+                       $GLOBALS['phpgw']->common->phpgw_header(true);
+                       $GLOBALS['phpgw']->template->set_file('cat_list_t', 
'listcats.tpl');
                        
$GLOBALS['phpgw']->template->set_block('cat_list_t','data_column','column');
                        
$GLOBALS['phpgw']->template->set_block('cat_list_t','cat_list','list');
 
@@ -183,7 +179,7 @@
 
                        
$GLOBALS['phpgw']->template->set_var('title_categories',lang('categories for'));
                        
$GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
-                       
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',
 $link_data));
                        
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/preferences/index.php'));
 
                        if(!$this->start)
@@ -214,11 +210,11 @@
                        
$GLOBALS['phpgw']->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),$link_data));
                        
$GLOBALS['phpgw']->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),$link_data));
 
-                       if (is_array($edata))
+                       if ( count($edata) )
                        {
-                               for($i=0; $i < count($edata); ++$i)
+                               foreach ( $edata as $data )
                                {
-                                       
$GLOBALS['phpgw']->template->set_var('th_data','<td bgcolor="' . 
$GLOBALS['phpgw_info']['theme']['th_bg'] . '">' . lang($edata[$i]) . '</td>');
+                                       
$GLOBALS['phpgw']->template->set_var('sort_data','<th>' . lang($data) . 
'</th>', true);
                                        
$GLOBALS['phpgw']->template->fp('column','data_column',True);
                                }
                        }
@@ -231,7 +227,7 @@
 
                        for ($i=0; $i < count($cats); ++$i)
                        {
-                               
$this->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template); 
// pass-by-reference DEPRECATED
+                               
$GLOBALS['phpgw']->template->set_var('tr_class', 
$this->nextmatchs->alternate_row_class($i) );
 
                                if ($cats[$i]['app_name'] == 'phpgw')
                                {
@@ -284,7 +280,7 @@
                                        'descr' => $descr
                                ));
 
-                               
$GLOBALS['phpgw']->template->set_var('app_url',$GLOBALS['phpgw']->link('/' . 
$cats_app . '/index.php','cat_id=' . $cats[$i]['id']));
+                               $GLOBALS['phpgw']->template->set_var('app_url', 
$GLOBALS['phpgw']->link("/{$cats_app}/index.php", array('cat_id' => 
(int)$cats[$i]['id'] ) ) );
 
                                if ($cats_level || ($level == 0))
                                {
@@ -327,7 +323,7 @@
                        
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        $this->save_sessiondata($cats_app);
 
-                       
$GLOBALS['phpgw']->template->pfp('out','cat_list_t',True);
+                       $GLOBALS['phpgw']->template->pfp('out','cat_list_t');
                }
 
                /**
@@ -354,12 +350,12 @@
                        $GLOBALS['phpgw']->common->phpgw_header();
                        echo parse_navbar();
 
-                       $new_parent      = $_POST['new_parent'];
-                       $cat_parent      = 
get_var('cat_parent',array('POST','GET'));
-                       $cat_name        = $_POST['cat_name'];
-                       $cat_description = $_POST['cat_description'];
-                       $cat_data        = $_POST['cat_data'];
-                       $cat_access      = $_POST['cat_access'];
+                       $new_parent      = isset($_POST['new_parent']) ? 
$_POST['new_parent'] : 0;
+                       $cat_parent      = isset($_GET['cat_parent']) ? 
$_GET['cat_parent'] : 0;
+                       $cat_name        = isset($_POST['cat_name']) ? 
$_POST['cat_name'] : '';
+                       $cat_description = isset($_POST['cat_description']) ? 
$_POST['cat_description'] : '';
+                       $cat_data        = isset($_POST['cat_data']) ? 
$_POST['cat_data'] : array();
+                       $cat_access      = isset($_POST['cat_access']) ? 
$_POST['cat_access'] : 'private';
 
                        $GLOBALS['phpgw']->template->set_file(array('form' => 
'category_form.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('form','data_row','row');
@@ -378,7 +374,7 @@
                                $global_cats = False;
                        }
 
-                       if ($_POST['save'])
+                       if ( isset($_POST['save']) && $_POST['save'])
                        {
                                $data = serialize($cat_data);
 
@@ -426,8 +422,8 @@
                                $edata = explode(',',$extra);
                                for($i=0; $i < count($edata); ++$i)
                                {
-                                       
$GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color());
-                                       
$GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . 
$edata[$i] . ']" size="50" value="' . $cat_data[$edata[$i]] . '" />');
+                                       
$GLOBALS['phpgw']->template->set_var('tr_class', 
$this->nextmatchs->alternate_row_class($i));
+                                       
$GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . 
$edata[$i] . ']" size="50" value="' . (isset($cat_data[$edata[$i]]) ? 
$cat_data[$edata[$i]] : '') . '" />');
                                        
$GLOBALS['phpgw']->template->set_var('lang_data',lang($edata[$i]));
                                        
$GLOBALS['phpgw']->template->fp('row','data_row',True);
                                }

Index: templates/base/category_form.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/templates/base/category_form.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/category_form.tpl    30 Dec 2004 11:22:15 -0000      1.1
+++ templates/base/category_form.tpl    28 Dec 2006 13:23:14 -0000      1.2
@@ -1,29 +1,29 @@
-<!-- $Id: category_form.tpl,v 1.1 2004/12/30 11:22:15 skwashd Exp $ -->
+<!-- $Id: category_form.tpl,v 1.2 2006/12/28 13:23:14 skwashd Exp $ -->
 
 <!-- BEGIN form -->
 <br>
 <center>
 {message}<br>
-<table border="0" width="80%" cellspacing="2" cellpadding="2"> 
 <form name="form" action="{actionurl}" method="POST">
-       <tr bgcolor="{th_bg}">
+<table border="0" width="80%" cellspacing="2" cellpadding="2"> 
+       <tr class="row_off">
                <td colspan="2">{lang_parent}</td>
                <td><select name="new_parent"><option 
value="">{lang_none}</option>{category_list}</select></td>
        </tr>
-       <tr bgcolor="{row_on}">
+       <tr class="row_on">
                <td colspan="2">{lang_name}</font></td>
                <td><input name="cat_name" size="50" value="{cat_name}"></td>
        </tr>
-       <tr bgcolor="{row_off}">
+       <tr class="row_off">
                <td colspan="2">{lang_descr}</td>
                <td colspan="2"><textarea name="cat_description" rows="4" 
cols="50" wrap="virtual">{cat_description}</textarea></td>
        </tr>
-       <tr bgcolor="{row_on}">
+       <tr class="row_on">
                <td colspan="2">{lang_access}</td>
                <td colspan="2">{access}</td>
        </tr>
-<!-- BEGINN data_row -->
-       <tr bgcolor="{tr_color}">
+<!-- BEGIN data_row -->
+       <tr class="{tr_class}">
                <td colspan="2">{lang_data}</td>
                <td>{td_data}</td>
        </tr>

Index: templates/base/listcats.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/templates/base/listcats.tpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/listcats.tpl 30 Dec 2004 11:22:15 -0000      1.1
+++ templates/base/listcats.tpl 28 Dec 2006 13:23:14 -0000      1.2
@@ -1,6 +1,4 @@
-<!-- $Id: listcats.tpl,v 1.1 2004/12/30 11:22:15 skwashd Exp $ -->
-<br>
-<center>
+<!-- $Id: listcats.tpl,v 1.2 2006/12/28 13:23:14 skwashd Exp $ -->
 <table border="0" cellspacing="2" cellpadding="2" width="80%">
                <tr>
                        <td colspan="3" align=left>
@@ -22,19 +20,21 @@
                </tr>
 </table>
 <table border="0" cellspacing="2" cellpadding="2" width="80%">
-       <tr bgcolor="{th_bg}">
-               <td bgcolor="{th_bg}">{sort_name}</td>
-               <td bgcolor="{th_bg}">{sort_description}</td>
+       <thead>
+               <tr>
+                       <th>{sort_name}</td>
+                       <th>{sort_description}</td>
                {sort_data}
-               <td bgcolor="{th_bg}" align="center">{lang_app}</td>
-               <td bgcolor="{th_bg}" align=center>{lang_sub}</td>
-               <td bgcolor="{th_bg}" align=center>{lang_edit}</td>
-               <td bgcolor="{th_bg}" align=center>{lang_delete}</td>
+                       <th align="center">{lang_app}</th>
+                       <th align=center>{lang_sub}</th>
+                       <th align=center>{lang_edit}</th>
+                       <th align=center>{lang_delete}</th>
        </tr>
+       </thead>
+       <tbody>
 
 <!-- BEGIN cat_list -->
-
-       <tr bgcolor="{tr_color}">
+       <tr class="{tr_class}">
                <td>{name}</td>
                <td>{descr}</td>
                {td_data}
@@ -43,27 +43,22 @@
                <td align="center"><a href="{edit}">{lang_edit_entry}</a></td>
                <td align="center"><a 
href="{delete}">{lang_delete_entry}</a></td>
        </tr>
-
 <!-- END cat_list -->  
 
-<!-- BEGINN add   -->
-
+       </tbody>
 </table>
-<table border="0" cellspacing="2" cellpadding="2" width="80%">
-       <tr valign="bottom" height="50">
-               <td>
+
+<!-- BEGIN add   -->
+<div class="button_group">
                        <form method="POST" action="{add_action}">
                                <input type="submit" value="{lang_add}">
                        </form>
-               </td>
-               <td align="right">
                        <form method="POST" action="{doneurl}">
                                <input type="submit" name="done" 
value="{lang_done}">
                        </form>
-               </td>
-       </tr>
-</table>
-
+</div>
 <!-- END add -->
 
-</center>
+<!-- BEGIN data_column -->
+       <td>{data}</td>
+<!-- END data_column -->




reply via email to

[Prev in Thread] Current Thread [Next in Thread]