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.12, 1.1.2.13 class.a


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] api class.account_mgr.php, 1.1.2.12, 1.1.2.13 class.admin.php, 1.1.2.6, 1.1.2.7 class.base.php, 1.1.1.1.2.13, 1.1.1.1.2.14 class.phpgw.php, 1.1.1.1.2.22, 1.1.1.1.2.23 class.prefs.php, 1.1.1.1.2.7, 1.1.1.1.2.8 starter.inc.php, 1.1.1.1.2.16, 1.1.1.1.2.17
Date: Mon, 03 Nov 2003 10:52:40 +0000

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

Modified Files:
      Tag: proposal-branch
        class.account_mgr.php class.admin.php class.base.php 
        class.phpgw.php class.prefs.php starter.inc.php 
Log Message:
- Working on the form_state_values (Not complete)
- op history is currently broken (Will fix soon)


Index: starter.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/starter.inc.php,v
retrieving revision 1.1.1.1.2.16
retrieving revision 1.1.1.1.2.17
diff -C2 -d -r1.1.1.1.2.16 -r1.1.1.1.2.17
*** starter.inc.php     1 Nov 2003 17:36:25 -0000       1.1.1.1.2.16
--- starter.inc.php     3 Nov 2003 10:52:38 -0000       1.1.1.1.2.17
***************
*** 215,224 ****
        {
                $GLOBALS['performance_timer']->start($methodname);              
        
!               $result = execmethod($methodname,$inputs);
  
                /* If the method doesnt exist, then we try and handle the 
situation nicely (and quietly). */
                if($result == '##NOMETHOD##')
                {
!                       if(isset($HTTP_SESSION_VARS['phpgw_session']['prevop']))
                        {
                                $methodname = 
$HTTP_SESSION_VARS['phpgw_session']['prevop'];
--- 215,228 ----
        {
                $GLOBALS['performance_timer']->start($methodname);              
        
!               $result = ExecMethod($methodname,$inputs);
!               if 
(isset($GLOBALS['phpgw_session']['form_state_vales'][$methodname]))
!               {
!                       $result['form_state_values'] = 
$GLOBALS['phpgw_session']['form_state_vales'][$methodname];
!               }
  
                /* If the method doesnt exist, then we try and handle the 
situation nicely (and quietly). */
                if($result == '##NOMETHOD##')
                {
!                       if 
(isset($HTTP_SESSION_VARS['phpgw_session']['prevop']))
                        {
                                $methodname = 
$HTTP_SESSION_VARS['phpgw_session']['prevop'];
***************
*** 230,240 ****
                        }
  
!                       $result = execmethod($methodname,$inputs, True);
  
                        /* If the method still doesnt exist, then we try and 
keep the user in the app they requested */
!                       if($result == '##NOMETHOD##')
                        {
                                $methodname = 
$GLOBALS['phpgw_data']['flags']['req_app'].'.base.start'; 
!                               $result = execmethod($methodname,$inputs, True);
                                if($result == '##NOMETHOD##')
                                {
--- 234,244 ----
                        }
  
!                       $result = ExecMethod($methodname,$inputs, True);
  
                        /* If the method still doesnt exist, then we try and 
keep the user in the app they requested */
!                       if ($result == '##NOMETHOD##')
                        {
                                $methodname = 
$GLOBALS['phpgw_data']['flags']['req_app'].'.base.start'; 
!                               $result = ExecMethod($methodname,$inputs, True);
                                if($result == '##NOMETHOD##')
                                {

Index: class.base.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.base.php,v
retrieving revision 1.1.1.1.2.13
retrieving revision 1.1.1.1.2.14
diff -C2 -d -r1.1.1.1.2.13 -r1.1.1.1.2.14
*** class.base.php      31 Oct 2003 08:42:33 -0000      1.1.1.1.2.13
--- class.base.php      3 Nov 2003 10:52:37 -0000       1.1.1.1.2.14
***************
*** 27,88 ****
        /* $Source$ */
  
!       $functions = array();
        $functions['api_base'] = array(
!               'type'=>'public',
!               'abstract'=>'Main page for everything',
!               'discussion'=>'Default main page'
        );
        
!       $functions['start'] = array(
!               'type'=>'public',
!               'title'=>'Home',
!               'abstract'=>'Main page for everything',
!               'discussion'=>'Default main page'
        );
  
!       $functions['about'] = array(
!               'type'=>'public',
!               'title'=>'About',
!               'abstract'=>'About data for the API.'
        );
  
!       $functions['login'] = array(
!               'type'=>'public',
!               'title'=>'Login',
!               'abstract'=>'Login to the system.'
        );
  
!       $functions['logout'] = array(
!               'type'=>'public',
!               'title'=>'Logout',
!               'abstract'=>'Logout from the system. Will revert user back into 
anonymous session.'
        );
        
!       $functions['prefs'] = array(
!               'type'=>'public',
!               'title'=>'Preferences',
!               'abstract'=>'Preferences section',
!               'discussion'=>'This is used by all apps to present preferences 
choices to users.',
!               'params'=>array(
!                       'appname'=>array('type'=>'string', 
'default'=>'##REQUIRD##', 'desc'=>'app to display prefs for'),
!                       'form_submit'=>array('type'=>'any', 
'default'=>'##NOTSET##', 'desc'=>'Set if the user is submitting'),
!                       'new_prefs'=>array('type'=>'any', 
'default'=>'##NOTSET##', 'desc'=>'not sure')
                )
        );
  
        $GLOBALS['docs']['classes']['api_base'] = array(
!               'abstract'=>'Default class for the api ops',
!               'functions'=>$functions
        );
!       
        class api_base
        {
!               var $method_titles = array();
  
                function api_base()
                {
!                       $this->method_titles['start'] = 'Home';
!                       $this->method_titles['about'] = 'About';
!                       $this->method_titles['prefs'] = 'Preferences';
                }
  
--- 27,90 ----
        /* $Source$ */
  
!       $functions             = array();
        $functions['api_base'] = array(
!               'type'         => 'public',
!               'abstract'     => 'Main page for everything',
!               'discussion'   => 'Default main page'
        );
        
!       $functions['start']    = array(
!               'type'         => 'public',
!               'title'        => 'Home',
!               'abstract'     => 'Main page for everything',
!               'discussion'   => 'Default main page'
        );
  
!       $functions['about']    = array(
!               'type'         => 'public',
!               'title'        => 'About',
!               'abstract'     => 'About data for the API.'
        );
  
!       $functions['login']    = array(
!               'type'         => 'public',
!               'title'        => 'Login',
!               'abstract'     => 'Login to the system.'
        );
  
!       $functions['logout']   = array(
!               'type'         => 'public',
!               'title'        => 'Logout',
!               'abstract'     => 'Logout from the system. Will revert user 
back into anonymous session.'
        );
        
!       $functions['prefs']    = array(
!               'type'         => 'public',
!               'title'        => 'Preferences',
!               'abstract'     => 'Preferences section',
!               'discussion'   => 'This is used by all apps to present 
preferences choices to users.',
!               'params'       => array(
!                       'appname'     => array('type'=>'string', 'default' => 
'##REQUIRD##', 'desc' => 'app to display prefs for'),
!                       'form_submit' => array('type'=>'any',    'default' => 
'##NOTSET##',  'desc' => 'Set if the user is submitting'),
!                       'new_prefs'   => array('type'=>'any',    'default' => 
'##NOTSET##',  'desc' => 'Values submitted from the form')
                )
        );
  
        $GLOBALS['docs']['classes']['api_base'] = array(
!               'abstract'     => 'Default class for the api ops',
!               'functions'    => $functions
        );
! 
        class api_base
        {
!               var $method_titles  = array();
!               var $history_params = array();
  
                function api_base()
                {
!                       $this->method_titles['start']  = 'Home';
!                       $this->method_titles['about']  = 'About';
!                       $this->method_titles['prefs']  = 'Preferences';
!                       $this->history_params['prefs'] = array('appname');
                }
  
***************
*** 93,97 ****
                function start()
                {
!                       $result['text'] = 'This is where the home page will get 
its data and be loaded.';
                        $result['inputs'] = func_get_args();
                        $GLOBALS['phpgw']->add_xsl('api.start');
--- 95,99 ----
                function start()
                {
!                       $result['text']   = 'This is where the home page will 
get its data and be loaded.';
                        $result['inputs'] = func_get_args();
                        $GLOBALS['phpgw']->add_xsl('api.start');
***************
*** 102,105 ****
--- 104,143 ----
                }
  
+               function form_pause()
+               {
+                       list($app,$class,$method) = 
explode('.',$GLOBALS['phpgw_data']['api']['prevop']);
+                       require_once(PHPGW_ROOT . SEP . $app . SEP . 'class.' . 
$class . '.php');
+                               if 
(isset($GLOBALS['phpgw_session']['form_state_vales'][$methodname]))
+                               {
+                                       
$GLOBALS['phpgw_xml_appnode']->add_node($GLOBALS['phpgw_session']['form_state_vales'][$methodname],'form_state_values');
+                               }
+ 
+                       if (! is_array($functions[$method]['params']))
+                       {
+                               $GLOBALS['msgbox']->add(lang('Could not store 
form state due to missing definition array'),__LINE__,__FILE__, 'warning');
+                               return;
+                       }
+ 
+                       foreach ($functions[$method]['params'] as $key => 
$values)
+                       {
+                               $params[$key] = 
get_var($key,'any','any','##NOTSET##');
+                       }
+ 
+                       
$GLOBALS['phpgw_session']['form_state_vales'][$GLOBALS['phpgw_data']['api']['prevop']]
 = $params;
+               }
+ 
+               // This will just call up the op WITHOUT adding the 
form_state_values node
+               function form_clear()
+               {
+                       // This generally shouldn't happen, but if an admin 
JUST changed there permissions ... welp :P
+                       if (! 
$GLOBALS['phpgw']->acl->check($GLOBALS['phpgw_data']['api']['prevop'],1))
+                       {
+                               $GLOBALS['msgbox']->add(lang('Could not clear 
form values due to ACL permission faliure'),__LINE__,__FILE__, 'warning');
+                               return;
+                       }
+ 
+                       return 
ExecMethod($GLOBALS['phpgw_data']['api']['prevop'],'',False);
+               }
+ 
                /*!
                @function login
***************
*** 132,135 ****
--- 170,196 ----
                }
  
+               function op_history_redirect()
+               {
+                       $args = new safe_args();
+                       $args->set('position_id','##REQUIRD##','int');
+                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+ 
+                       $loc_data = 
$GLOBALS['phpgw_session']['phpgw_data']['op_history'][$args['position_id']];
+                       if (! $loc_data['title'])
+                       {
+                               $GLOBALS['msgbox']->add(lang('History on this 
operation not valid or expired'),__LINE__,__FILE__, 'warning');
+                               return;
+                       }
+ 
+                       // Do ACL check to make sure they have rights to that 
location
+                       if (! $GLOBALS['phpgw']->acl->check($loc_data['op'],1))
+                       {
+                               
$GLOBALS['phpgw']->rpc->access_denied($loc_data['op'], $inputs);
+                               return;
+                       }
+ 
+                       return ExecMethod($loc_data['op'],$loc_data['data'], 
False);
+               }
+ 
                function prefs()
                {
***************
*** 137,140 ****
--- 198,205 ----
                        $args->set('appname','##REQUIRD##','string');
                        $args->set('form_submit','##NOTSET##','any');
+                               if 
(isset($GLOBALS['phpgw_session']['form_state_vales'][$methodname]))
+                               {
+                                       
$GLOBALS['phpgw_xml_appnode']->add_node($GLOBALS['phpgw_session']['form_state_vales'][$methodname],'form_state_values');
+                               }
                        $args->set('new_prefs','##NOTSET##','any');
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);

Index: class.phpgw.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.phpgw.php,v
retrieving revision 1.1.1.1.2.22
retrieving revision 1.1.1.1.2.23
diff -C2 -d -r1.1.1.1.2.22 -r1.1.1.1.2.23
*** class.phpgw.php     3 Nov 2003 10:07:51 -0000       1.1.1.1.2.22
--- class.phpgw.php     3 Nov 2003 10:52:38 -0000       1.1.1.1.2.23
***************
*** 193,196 ****
--- 193,201 ----
                }
  
+               function form_lock()
+               {
+                       
$GLOBALS['phpgw_xml_apinode']->add_node(True,'form_lock');
+               }
+ 
                /*!
                @function apimenu private
***************
*** 281,291 ****
                                }
  
!                               
$GLOBALS['phpgw_session']['phpgw_data']['op_history'][] = array(
!                                       'title' => $_title,
!                                       'op'    => 
$GLOBALS['phpgw_data']['api']['op'],
!                                       'data'  => array()
!                               );
  
!                               if 
(count($GLOBALS['phpgw_session']['phpgw_data']['op_history']) > 5)
                                {
                                        
array_shift($GLOBALS['phpgw_session']['phpgw_data']['op_history']);
--- 286,313 ----
                                }
  
!                               foreach ($obj->history_params[$method] as 
$param)
!                               {
!                                       $data[$param] = 
get_var($param,'any','any','##NOTSET##');
!                               }
  
!                               if ($GLOBALS['phpgw_data']['api']['op'] != 
'api.base.op_history_redirect')
!                               {
!                                       
$GLOBALS['phpgw_session']['phpgw_data']['op_history'][] = array(
!                                               'title' => $_title,
!                                               'op'    => 
$GLOBALS['phpgw_data']['api']['op'],
!                                               'data'  => $data
!                                       );
!                               }
! 
!                               // Remove the data element, we don't want this 
in the XML, it can get way too big (jengo)
!                               $xml_history = 
$GLOBALS['phpgw_session']['phpgw_data']['op_history'];
!                               $total       = count($xml_history);
!                               for ($i=0; $i<$total; $i++)
!                               {
!                                       unset($xml_history[$i]['data']);
!                               }
!                               
$GLOBALS['phpgw_xml_apinode']->add_node($xml_history,'op_history');
! 
!                               if 
(count($GLOBALS['phpgw_session']['phpgw_data']['op_history']) > 5 && 
$GLOBALS['phpgw_data']['api']['op'] != 'api.base.op_history_redirect')
                                {
                                        
array_shift($GLOBALS['phpgw_session']['phpgw_data']['op_history']);
***************
*** 293,297 ****
                        }
  
!                       if(!$GLOBALS['missing_critical'])
                        {
                                /* If any, add the hooks to the API XML node */
--- 315,319 ----
                        }
  
!                       if (! $GLOBALS['missing_critical'])
                        {
                                /* If any, add the hooks to the API XML node */
***************
*** 343,347 ****
                        
$GLOBALS['phpgw_xml_apinode']->add_node($GLOBALS['phpgw_data']['user'],'user');
                        
$GLOBALS['phpgw_xml_apinode']->add_node($GLOBALS['phpgw_data']['prefs'],'prefs');
-                       
$GLOBALS['phpgw_xml_apinode']->add_node($GLOBALS['phpgw_session']['phpgw_data']['op_history'],'op_history');
                        $GLOBALS['phpgw_xml_apinode']->add_node(strftime('%A, 
%B %e %Y',time()),'currentdate');
  
--- 365,368 ----

Index: class.account_mgr.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.account_mgr.php,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -C2 -d -r1.1.2.12 -r1.1.2.13
*** class.account_mgr.php       30 Oct 2003 21:18:14 -0000      1.1.2.12
--- class.account_mgr.php       3 Nov 2003 10:52:37 -0000       1.1.2.13
***************
*** 25,39 ****
        /* $Source$ */
  
        $GLOBALS['api_account_mgr_menus_loaded'] = False;
        class api_account_mgr
        {
!               var $method_titles = array();
  
                function api_account_mgr()
                {
!                       $this->method_titles['show']   = 'List users';
!                       $this->method_titles['create'] = 'Create user';
!                       $this->method_titles['view']   = 'View user';
!                       $this->method_titles['delete'] = 'Delete user';
  
                        if (! $GLOBALS['api_account_mgr_menus_loaded'])
--- 25,87 ----
        /* $Source$ */
  
+       $functions             = array();
+       $functions['api_account_mgr'] = array(
+               'type'         => 'public',
+               'abstract'     => 'Main page for everything',
+               'discussion'   => 'Default main page'
+       );
+       
+       $functions['show']    = array(
+               'type'         => 'public',
+               'title'        => 'Show users',
+               'abstract'     => 'List user accounts'
+       );
+ 
+       $functions['create']    = array(
+               'type'         => 'public',
+               'title'        => 'Create user',
+               'abstract'     => 'Create user account',
+               'params'       => array(
+                       'account_lid'               => array('type' => 'any', 
'default' => '##NOTSET##', 'desc' => 'Login ID'),
+                       'account_firstname'         => array('type' => 'any', 
'default' => '##NOTSET##', 'desc' => 'First Name'),
+                       'account_lastname'          => array('type' => 'any', 
'default' => '##NOTSET##', 'desc' => 'Last Name'),
+                       'account_password'          => array('type' => 'any', 
'default' => '##NOTSET##', 'desc' => 'Password'),
+                       'account_password_confirm'  => array('type' => 'any', 
'default' => '##NOTSET##', 'desc' => 'Password confirmation')
+               )
+       );
+ 
+       $functions['view']    = array(
+               'type'         => 'public',
+               'title'        => 'View user',
+               'abstract'     => 'View user account',
+               'params'       => array(
+                       'account_id'               => array('type' => 'int', 
'default' => '##REQUIRD##', 'desc' => 'Account ID number')
+               )
+       );
+ 
+       $functions['delete']    = array(
+               'type'         => 'public',
+               'title'        => 'Delete user',
+               'abstract'     => 'Delete user account',
+               'params'       => array(
+                       'account_id'               => array('type' => 'int', 
'default' => '##REQUIRD##', 'desc' => 'Account ID number'),
+                       'answer'                   => array('type' => 'any', 
'default' => '##NOTSET##',  'desc' => 'Answer to yes no dialog')
+               )
+       );
+ 
        $GLOBALS['api_account_mgr_menus_loaded'] = False;
        class api_account_mgr
        {
!               var $method_titles  = array();
!               var $history_params = array();
  
                function api_account_mgr()
                {
!                       $this->method_titles['show']     = 'List users';
!                       $this->method_titles['create']   = 'Create user';
!                       $this->method_titles['view']     = 'View user';
!                       $this->method_titles['delete']   = 'Delete user';
!                       $this->history_params['view']    = array('account_id');
!                       $this->history_params['create']  = 
array('account_lid','account_firstname','account_lastname','account_password','account_password_confirm');
  
                        if (! $GLOBALS['api_account_mgr_menus_loaded'])
***************
*** 79,82 ****
--- 127,131 ----
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
  
+                       $GLOBALS['phpgw']->form_lock();
                        $GLOBALS['phpgw']->add_xsl('api.account_mgr');
  
***************
*** 150,153 ****
--- 199,203 ----
  
                        }
+ 
                        return $result;
                }
***************
*** 162,166 ****
                        $accounts               = 
CreateObject('api_accounts',$args);
                        $data                   = $accounts->data;
!                       $data['expires']        = 
$GLOBALS['phpgw']->prefs->get_datetime($data['expires']);
  
                        $result['view_account'] = $data;
--- 212,216 ----
                        $accounts               = 
CreateObject('api_accounts',$args);
                        $data                   = $accounts->data;
!                       $data['expires']        = 
strftime('%x',$data['expires']) . date(' H:i:s a',$data['expires']);
  
                        $result['view_account'] = $data;

Index: class.admin.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.admin.php,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** class.admin.php     30 Oct 2003 21:18:14 -0000      1.1.2.6
--- class.admin.php     3 Nov 2003 10:52:37 -0000       1.1.2.7
***************
*** 17,21 ****
        class api_admin
        {
!               var $method_titles = array();
  
                function api_admin()
--- 17,22 ----
        class api_admin
        {
!               var $method_titles  = array();
!               var $history_params = array();
  
                function api_admin()

Index: class.prefs.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.prefs.php,v
retrieving revision 1.1.1.1.2.7
retrieving revision 1.1.1.1.2.8
diff -C2 -d -r1.1.1.1.2.7 -r1.1.1.1.2.8
*** class.prefs.php     3 Nov 2003 10:07:51 -0000       1.1.1.1.2.7
--- class.prefs.php     3 Nov 2003 10:52:38 -0000       1.1.1.1.2.8
***************
*** 197,226 ****
                }
  
-               // FIXME: These are hard coded for now, they are going to be 
replaced with the datetime classes from current phpGW (jengo)
-               function get_date()
-               {
-                       $args = new safe_args();
-                       $args->set('epoch','##REQUIRED##','int');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
- 
-                       return strftime('%x',$args['epoch']);
-               }
- 
-               function get_time()
-               {
-                       $args = new safe_args();
-                       $args->set('epoch','##REQUIRED##','int');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
- 
-                       return date('H:i:s a',$args['epoch']);
-               }
- 
-               function get_datetime()
-               {
-                       $args = new safe_args();
-                       $args->set('epoch','##REQUIRED##','int');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
- 
-                       return strftime('%x',$args['epoch']) . date(' H:i:s 
a',$args['epoch']);
-               }
        }
--- 197,199 ----





reply via email to

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