phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc/accounts class.accounts_.inc.php


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc/accounts class.accounts_.inc.php
Date: Thu, 28 Dec 2006 01:35:29 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/12/28 01:35:29

Modified files:
        inc/accounts   : class.accounts_.inc.php 

Log message:
        make the popup work properly again and fix the markup and css

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_.inc.php?cvsroot=phpgwapi&r1=1.13&r2=1.14

Patches:
Index: class.accounts_.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/accounts/class.accounts_.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- class.accounts_.inc.php     27 Dec 2006 12:24:55 -0000      1.13
+++ class.accounts_.inc.php     28 Dec 2006 01:35:29 -0000      1.14
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.accounts_.inc.php,v 1.13 2006/12/27 12:24:55 
skwashd Exp $
+       * @version $Id: class.accounts_.inc.php,v 1.14 2006/12/28 01:35:29 
skwashd Exp $
        */
        if (empty($GLOBALS['phpgw_info']['server']['account_repository']))
        {
@@ -539,48 +539,40 @@
 
                function accounts_popup($app)
                {
-                       $group_id = get_var('group_id',array('GET','POST'));
-
-                       /*if(isset($_GET['group_id']))
+                       $group_id = 0;
+                       if(isset($_REQUEST['group_id']))
                        {
-                               $group_id = $_GET['group_id'];
-                       }*/
+                               $group_id = $_REQUEST['group_id'];
+                       }
 
+                       //I don't know why we insist on using this global in 
nextmatch - skwashd Jan07
+                       $GLOBALS['query'] = '';
                        if(isset($_POST['query']))
                        {
                                $GLOBALS['query'] = $_POST['query'];
                        }
                        
+                       $start = 0;
                        if(isset($_POST['start']))
                        {
                                $start = intval($_POST['start']);
                        }
-                       else
-                       {
-                               $start = 0;
-                       }
 
+                       $order = 'account_lid';
                        if(isset($_GET['order']))
                        {
                                $order = $_GET['order'];
                        }
-                       else
-                       {
-                               $order = 'account_lid';
-                       }
                        
+                       $sort = 'ASC';
                        if(isset($_GET['sort']))
                        {
                                $sort = $_GET['sort'];
                        }
-                       else
-                       {
-                               $sort = 'ASC';
-                       }
 
                        $this->nextmatchs = createObject('phpgwapi.nextmatchs');
 
-                       
$GLOBALS['phpgw']->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi'));
+                       
$GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR);
 
                        
$GLOBALS['phpgw']->template->set_file(array('accounts_list_t' => 
'accounts_popup.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('accounts_list_t','group_select','select');
@@ -588,16 +580,15 @@
                        
$GLOBALS['phpgw']->template->set_block('accounts_list_t','group_all','all');
 
                        
$GLOBALS['phpgw']->template->set_block('accounts_list_t','withperm_intro','withperm');
-                       
$GLOBALS['phpgw']->template->set_block('accounts_list_t','other_intro','iother');
+                       
//$GLOBALS['phpgw']->template->set_block('accounts_list_t','other_intro','iother');
                        
$GLOBALS['phpgw']->template->set_block('accounts_list_t','withoutperm_intro','withoutperm');
 
 
                        
$GLOBALS['phpgw']->template->set_block('accounts_list_t','accounts_list','list');
 
 
-                       
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw_info']['site_title']);
-                       
$GLOBALS['phpgw']->template->set_var('charset',$GLOBALS['phpgw']->translation->translate('charset'));
-                       
$GLOBALS['phpgw']->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
+                       $GLOBALS['phpgw']->template->set_var('title', 
isset($GLOBALS['phpgw_info']['site_title']) ? 
$GLOBALS['phpgw_info']['site_title'] : '');
+                       $GLOBALS['phpgw']->template->set_var('charset', 
'urf-8');
                        
$GLOBALS['phpgw']->template->set_var('lang_search',lang('search'));
                        
$GLOBALS['phpgw']->template->set_var('lang_groups',lang('user groups'));
                        
$GLOBALS['phpgw']->template->set_var('lang_accounts',lang('user accounts'));
@@ -610,15 +601,6 @@
 
                        switch($app)
                        {
-                               case 'calendar':
-                                       $action = 
'calendar.uicalendar.accounts_popup';
-                                       
$GLOBALS['phpgw']->template->set_var('select_name',"participants[]'][0]");
-                                       
$GLOBALS['phpgw']->template->set_var('js_function','ExchangeAccountSelect');
-                                       
$GLOBALS['phpgw']->template->fp('withperm','withperm_intro',True);
-
-
-                                       
$GLOBALS['phpgw']->template->fp('withoutperm','withoutperm_intro',True);
-                                       break;
                                case 'admin':
                                        $action = 
'admin.uiaccounts.accounts_popup';
                                        
$GLOBALS['phpgw']->template->set_var('select_name',"account_user[]']");
@@ -664,11 +646,16 @@
 
                        if ($app != 'admin')
                        {
-                               $user_groups = 
$this->membership($this->account);
-                               $aclusers = 
$GLOBALS['phpgw']->acl->get_ids_for_location('run',1,$app);
+                               $user_groups = 
$this->membership($this->account_id);
+                               $aclusers = 
$GLOBALS['phpgw']->acl->get_ids_for_location('run', 1, $app);
                                $acl_users = $this->return_members($aclusers);
                                $app_user       = $acl_users['users'];
                                $app_groups     = $acl_users['groups'];
+                               /*
+                               $app_groups     = $this->get_list('groups');
+                               $app_user       = $this->get_list('accounts');
+                               */
+
                        }
                        else
                        {
@@ -684,56 +671,59 @@
                                        );
                                }
 
-                               for($j=0;$j<count($user_groups);$j++)
+                               $i = 0;
+                               for($j=0;$j<count($user_groups); ++$j)
                                {
                                        $app_groups[$i] = 
$user_groups[$j]['account_id'];
-                                       $i++;
+                                       ++$i;
                                }
 
                                for($j=0;$j<count($all_user);$j++)
                                {
                                        $app_user[$i] = 
$all_user[$j]['account_id'];
-                                       $i++;
+                                       ++$i;
                                }
                        }
 
-                       while (is_array($user_groups) && (list(,$group) = 
each($user_groups)))
+                       while ( isset($user_groups) && is_array($user_groups) 
&& (list(,$group) = each($user_groups)) )
                        {
-                               if (in_array($group['account_id'],$app_groups))
+                               $i = 0;
+                               if (in_array($group['account_id'], $app_groups))
                                {
-                                       
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color));
+                                       
$GLOBALS['phpgw']->template->set_var('tr_class', 
$this->nextmatchs->alternate_row_class(++$i%2));
                                        //$link_data['group_id'] = 
$group['account_id'];
-                                       
$GLOBALS['phpgw']->template->set_var('link_user_group',$GLOBALS['phpgw']->link('/index.php','menuaction='
 . $action . '&group_id=' . $group['account_id']));
-                                       
$GLOBALS['phpgw']->template->set_var('name_user_group',$group['account_name']);
-                                       
$GLOBALS['phpgw']->template->set_var('account_display',$GLOBALS['phpgw']->common->grab_owner_name($group['account_id']));
-                                       
$GLOBALS['phpgw']->template->set_var('accountid',$group['account_id']);
+                                       
$GLOBALS['phpgw']->template->set_var('link_user_group', 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $action, 'group_id' 
=> (int)$group['account_id']) ) );
+                                       
$GLOBALS['phpgw']->template->set_var('name_user_group', $group['account_name']);
+                                       
$GLOBALS['phpgw']->template->set_var('account_display', 
$GLOBALS['phpgw']->common->grab_owner_name($group['account_id']));
+                                       
$GLOBALS['phpgw']->template->set_var('accountid', $group['account_id']);
                                        switch($app)
                                        {
                                                case 'addressbook':
-                                               case 'calendar':        
$GLOBALS['phpgw']->template->fp('select','group_select',True); break;
-                                               default:                        
$GLOBALS['phpgw']->template->fp('other','group_other',True); break;
+                                               default:
+                                                       
$GLOBALS['phpgw']->template->fp('other','group_other',True);
                                        }
                                }
                                else
                                {
                                        if ($app != 'admin')
                                        {
-                                               
$GLOBALS['phpgw']->template->set_var('link_all_group',$GLOBALS['phpgw']->link('/index.php','menuaction='
 . $action . '&group_id=' . $group['account_id']));
-                                               
$GLOBALS['phpgw']->template->set_var('name_all_group',$group['account_name']);
-                                               
$GLOBALS['phpgw']->template->set_var('accountid',$group['account_id']);
-                                               
$GLOBALS['phpgw']->template->fp('all','group_all',True);
+                                               
$GLOBALS['phpgw']->template->set_var('link_all_group', 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $action, 'group_id' 
=> (int)$group['account_id']) ) );
+                                               
$GLOBALS['phpgw']->template->set_var('name_all_group', $group['account_name']);
+                                               
$GLOBALS['phpgw']->template->set_var('accountid', $group['account_id']);
+                                               
$GLOBALS['phpgw']->template->fp('all', 'group_all', true);
                                        }
                                }
                        }
 
                        if (!$GLOBALS['query'])
                        {
+                               $val_users = array();
                                if (isset($group_id) && !empty($group_id))
                                {
                                        //echo 'GROUP_ID: ' . $group_id;
                                        $users = 
$GLOBALS['phpgw']->acl->get_ids_for_location($group_id,1,'phpgw_group');
 
-                                       for ($i=0;$i<count($users);$i++)
+                                       for ($i=0;$i<count($users); ++$i)
                                        {
                                                if 
(in_array($users[$i],$app_user))
                                                {
@@ -760,7 +750,6 @@
                                                        $val_users[$id] = array
                                                        (
                                                                'account_id'    
        => $GLOBALS['phpgw']->accounts->data['account_id'],
-                                                               'account_lid'   
        => $GLOBALS['phpgw']->accounts->data['account_lid'],
                                                                
'account_firstname'     => $GLOBALS['phpgw']->accounts->data['firstname'],
                                                                
'account_lastname'      => $GLOBALS['phpgw']->accounts->data['lastname']
                                                        );
@@ -798,7 +787,6 @@
                                                $val_users[] = array
                                                (
                                                        'account_id'            
=> $entries[$i]['account_id'],
-                                                       'account_lid'           
=> $entries[$i]['account_lid'],
                                                        'account_firstname'     
=> $entries[$i]['account_firstname'],
                                                        'account_lastname'      
=> $entries[$i]['account_lastname']
                                                );
@@ -823,7 +811,6 @@
 // ---------------- list header variable template-declarations 
--------------------------
 
 // -------------- list header variable template-declaration 
------------------------
-                       
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
                        
$GLOBALS['phpgw']->template->set_var('sort_lid',$this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data));
                        
$GLOBALS['phpgw']->template->set_var('sort_firstname',$this->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('Firstname'),$link_data));
                        
$GLOBALS['phpgw']->template->set_var('sort_lastname',$this->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('Lastname'),$link_data));
@@ -832,17 +819,24 @@
                        $stop = $start + $this->nextmatchs->maxmatches;
                        for ($i=$start;$i<count($val_users)&&$i<$stop;$i++)
                        {
-                               
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color));
+                               
$GLOBALS['phpgw']->template->set_var('tr_class', 
$this->nextmatchs->alternate_row_class($i%2));
+                               
                                $firstname = 
$val_users[$i]['account_firstname'];
-                               if (!$firstname) { $firstname = '&nbsp;'; }
+                               if (!$firstname)
+                               {
+                                       $firstname = '&nbsp;';
+                               }
+                               
                                $lastname = $val_users[$i]['account_lastname'];
-                               if (!$lastname) { $lastname = '&nbsp;'; }
+                               if (!$lastname)
+                               {
+                                       $lastname = '&nbsp;';
+                               }
 
 // ---------------- template declaration for list records 
-------------------------- 
 
                                $GLOBALS['phpgw']->template->set_var(array
                                (
-                                       'lid'                           => 
$val_users[$i]['account_lid'],
                                        'firstname'                     => 
$firstname,
                                        'lastname'                      => 
$lastname,
                                        'accountid'                     => 
$val_users[$i]['account_id'],




reply via email to

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