phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api class.account_mgr.php,1.1.2.2,1.1.2.3


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] api class.account_mgr.php,1.1.2.2,1.1.2.3
Date: Sun, 26 Oct 2003 05:49:34 +0000

Update of /cvsroot/phpgroupware/api
In directory subversions:/tmp/cvs-serv20032/api

Modified Files:
      Tag: proposal-branch
        class.account_mgr.php 
Log Message:
Working on the user delete part


Index: class.account_mgr.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.account_mgr.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** class.account_mgr.php       26 Oct 2003 04:57:27 -0000      1.1.2.2
--- class.account_mgr.php       26 Oct 2003 05:49:32 -0000      1.1.2.3
***************
*** 21,30 ****
                        );
                        
$GLOBALS['phpgw_xml_apinode']->add_node($appmenu,'appmenu');
                }
  
                function show()
                {
-                       $GLOBALS['phpgw']->add_xsl('api.account_mgr');
- 
                        $result['accounts'] = 
$GLOBALS['phpgw']->accounts->list_repository();
  
--- 21,29 ----
                        );
                        
$GLOBALS['phpgw_xml_apinode']->add_node($appmenu,'appmenu');
+                       $GLOBALS['phpgw']->add_xsl('api.account_mgr');
                }
  
                function show()
                {
                        $result['accounts'] = 
$GLOBALS['phpgw']->accounts->list_repository();
  
***************
*** 122,130 ****
                        $args->set('account_id', '##NOTSET##', 'int');
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
-                       $GLOBALS['phpgw']->add_xsl('api.account_mgr');
  
                        $args['account']        = $args['account_id'];
                        $accounts               = 
CreateObject('api_accounts',$args);
                        $result['view_account'] = $accounts->data;
  
                        return $result;
--- 121,174 ----
                        $args->set('account_id', '##NOTSET##', 'int');
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
  
                        $args['account']        = $args['account_id'];
                        $accounts               = 
CreateObject('api_accounts',$args);
                        $result['view_account'] = $accounts->data;
+ 
+                       return $result;
+               }
+ 
+               function delete()
+               {
+                       $args = new safe_args();
+                       $args->set('answer', '##NOVAR##', 'any');
+                       $args->set('account_id', '##REQUIRED##', 'int');
+                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ 
+                       $account_lid = 
$GLOBALS['phpgw']->accounts->cross_reference((int)$args['account_id']);
+ 
+                       if ($args['account_id'] == 
$GLOBALS['phpgw_data']['user']['id'])
+                       {
+                               $GLOBALS['msgbox']->add(lang('You can not 
delete your own account'),__LINE__,__FILE__, 'warning');
+                               return;
+                       }
+ 
+                       if ($account_lid == 'anonymous')
+                       {
+                               $GLOBALS['msgbox']->add(lang('You can not 
delete the anonymous account'),__LINE__,__FILE__, 'warning');
+                               return;
+                       }
+ 
+                       if ($args['answer'] == '##NOVAR##')
+                       {
+                               $GLOBALS['phpgw']->add_xsl('api.widgets');
+                               $result['dialog'] = array(
+                                       'question' => lang('Are you sure you 
want to delete the user %1 ?',$account_lid),
+                                       'yes_op'   => 'api.account_mgr.delete',
+                                       'no_op'    => 'api.account_mgr.show',
+                                       'current_inputs' => array(
+                                               0 => array(
+                                                       'name'  => 'account_id',
+                                                       'value' => 
$args['account_id']
+                                               )
+                                       )
+                               );
+ 
+                               $result['delete_account'] = True;
+                       }
+                       else if ($args['answer'] == 'Yes')
+                       {
+                               $GLOBALS['msgbox']->add(lang('Account has been 
deleted successfully'),__LINE__,__FILE__, 'notice');
+                       }
  
                        return $result;





reply via email to

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