phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18959] code clean up and update to GPLv3 - as per pr


From: Dave Hall
Subject: [Phpgroupware-cvs] [18959] code clean up and update to GPLv3 - as per project policy
Date: Sun, 05 Oct 2008 12:42:06 +0000

Revision: 18959
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18959
Author:   skwashd
Date:     2008-10-05 12:42:05 +0000 (Sun, 05 Oct 2008)

Log Message:
-----------
code clean up and update to GPLv3 - as per project policy

Modified Paths:
--------------
    core/trunk/todo/inc/class.bopreferences.inc.php
    core/trunk/todo/inc/class.botodo.inc.php
    core/trunk/todo/inc/class.ipc_todo.inc.php
    core/trunk/todo/inc/class.menu.inc.php
    core/trunk/todo/inc/class.sotodo.inc.php
    core/trunk/todo/inc/class.uipreferences.inc.php
    core/trunk/todo/inc/class.uitodo.inc.php

Modified: core/trunk/todo/inc/class.bopreferences.inc.php
===================================================================
--- core/trunk/todo/inc/class.bopreferences.inc.php     2008-09-28 14:33:00 UTC 
(rev 18958)
+++ core/trunk/todo/inc/class.bopreferences.inc.php     2008-10-05 12:42:05 UTC 
(rev 18959)
@@ -2,17 +2,32 @@
        /**
        * Todo preferences
        *
+       * @author Dave Hall <address@hidden>
        * @author Craig Knudsen <address@hidden>
        * @author Mark Peters <address@hidden>
        * @copyright Copyright (C) Craig Knudsen <address@hidden>
-       * @copyright Copyright (C) 2002,2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2002-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package todo
        * @version $Id$
        * @internal Based on Webcalendar by Craig Knudsen 
http://www.radix.net/~cknudsen
        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
 
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
        /**
        * Todo preferences
        *  
@@ -20,41 +35,55 @@
        */
        class todo_bopreferences
        {
-               var $public_functions = Array(
-                       'preferences'  => True
+               /**
+                * @var array $public_functions the publicly callable methods 
of the class
+                */
+               public $public_functions = array
+               (
+                       'preferences'   => true
                );
 
-               var $prefs;
-               var $debug = False;
+               /**
+                * @var array $prefs Preference values for todo
+                */
+               protected $prefs;
 
-               function __construct()
+               /**
+                * Constructor
+                *
+                * @return void
+                */
+               public function __construct()
                {
                        $GLOBALS['phpgw']->nextmatchs = 
CreateObject('phpgwapi.nextmatchs');
-                       $this->prefs['todo']    = 
$GLOBALS['phpgw_info']['user']['preferences']['todo'];
+                       $this->prefs['todo']  = 
$GLOBALS['phpgw_info']['user']['preferences']['todo'];
                }
 
-               function preferences()
+               /**
+                * Handle the updated preferences
+                *
+                * @return void
+                */
+               public function preferences()
                {
-                       $submit = get_var('submit',Array('POST'));
-                       if($submit)
+                       if ( !phpgw::get_var('submit', 'string', 'POST') )
                        {
-                               
$GLOBALS['phpgw']->preferences->read_repository();
-                               $prefs = get_var('prefs',Array('POST'));
-                               if($prefs['mainscreen_showevents'] == True)
-                               {
-                                       
$GLOBALS['phpgw']->preferences->add('todo','mainscreen_showevents',$prefs['mainscreen_showevents']);
-                               }
-                               else
-                               {
-                                       
$GLOBALS['phpgw']->preferences->delete('todo','mainscreen_showevents');
-                               }
+                               return;
+                       }
 
-                               
$GLOBALS['phpgw']->preferences->save_repository(True);
+                       $GLOBALS['phpgw']->preferences->read_repository();
+                       $prefs = phpgw::get_var('prefs', 'string', 'POST');
+                       if ( $prefs['mainscreen_showevents'] )
+                       {
+                               $GLOBALS['phpgw']->preferences->add('todo', 
'mainscreen_showevents', $prefs['mainscreen_showevents']);
+                       }
+                       else
+                       {
+                               $GLOBALS['phpgw']->preferences->delete('todo', 
'mainscreen_showevents');
+                       }
 
-                               Header('Location: 
'.$GLOBALS['phpgw']->link('/preferences/index.php'));
-                               $GLOBALS['phpgw_info']['flags']['nodisplay'] = 
True;
-                               exit;
-                       }
+                       $GLOBALS['phpgw']->preferences->save_repository(true);
+
+                       
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                }
        }
-

Modified: core/trunk/todo/inc/class.botodo.inc.php
===================================================================
--- core/trunk/todo/inc/class.botodo.inc.php    2008-09-28 14:33:00 UTC (rev 
18958)
+++ core/trunk/todo/inc/class.botodo.inc.php    2008-10-05 12:42:05 UTC (rev 
18959)
@@ -1,23 +1,38 @@
 <?php
        /**
-       * Todo business
+       * Todo business logic
        *
        * @author Joseph Engo <address@hidden>
        * @author Bettina Gille <address@hidden>
-       * @copyright Copyright (C) 2000-2003,2005 Free Software Foundation, 
Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package todo
        * @version $Id$
        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
        phpgw::import_class('phpgwapi.datetime');
 
        /**
-       * Todo business
+       * Todo business logic
        *
        * @package todo
        */
-       class botodo
+       class todo_botodo
        {
                var $start;
                var $query;
@@ -31,7 +46,7 @@
                */
                var $debug = false;
 
-               var $public_functions = array
+               public $public_functions = array
                (
                        'cached_accounts'  => True,
                        '_list'            => True,
@@ -45,7 +60,12 @@
                        'list_methods'     => True
                );
 
-               function botodo($session=False)
+               /**
+                * Constructor
+                *
+                * @return void
+                */
+               public function __construct($session=False)
                {
                        $this->sotodo   = CreateObject('todo.sotodo');
 
@@ -454,4 +474,3 @@
                        return True;
                }
        }
-?>

Modified: core/trunk/todo/inc/class.ipc_todo.inc.php
===================================================================
--- core/trunk/todo/inc/class.ipc_todo.inc.php  2008-09-28 14:33:00 UTC (rev 
18958)
+++ core/trunk/todo/inc/class.ipc_todo.inc.php  2008-10-05 12:42:05 UTC (rev 
18959)
@@ -4,12 +4,28 @@
         * Todo module
         *
         * @author    Johan Gunnarsson <address@hidden>
-        * @copyright Copyright (c) 2007 Free Software Foundation, Inc.
-        * @license   GNU General Public License 3 or later
+        * @author    Dave Hall <address@hidden>
+        * @copyright Copyright (c) 2007-2008 Free Software Foundation, Inc.
+        * @license   GNU General Public License version 3 or later
         * @package   todo
         * @version   $id$
         */
-       
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
        phpgw::import_class('phpgwapi.ipc_');
        
        /**
@@ -18,16 +34,16 @@
        class ipc_todo extends ipc_
        {
                /**
-                * @access private
+                * @var todo_botodo $botodo todo business logic layer
                 */
-               var $botodo;
+               protected $botodo;
 
                /**
                 * Constructor.
                 *
-                * @access public
+                * @return void
                 */
-               function ipc_todo()
+               public function __construct()
                {
                        $this->botodo = CreateObject('todo.botodo');
                }
@@ -52,7 +68,7 @@
                                return $this->botodo->save($data_internal);
                        }
                        
-                       return FALSE;
+                       return false;
                }
 
                /**
@@ -74,7 +90,7 @@
                                        'application/x-phpgw-todo', $type);
                        }
                        
-                       return FALSE;
+                       return false;
                }
 
                /**
@@ -132,7 +148,7 @@
                                return $this->botodo->save($internal_data);
                        }
                        
-                       return FALSE;
+                       return false;
                }
 
                /**
@@ -186,12 +202,12 @@
                                                }
                                                else
                                                {
-                                                       return FALSE;
+                                                       return false;
                                                }
                                        }
                                        else
                                        {
-                                               return FALSE;
+                                               return false;
                                        }
                                        
                                        // Parse dates
@@ -226,7 +242,7 @@
                                        $internal_data = $data;
                                        break;
                                default:
-                                       return FALSE;
+                                       return false;
                        }
                        
                        // convert from internal to $to_type
@@ -259,10 +275,9 @@
                                        $converted_data = $internal_data;
                                        break;
                                default:
-                                       return FALSE;
+                                       return false;
                        }
                        
                        return $converted_data;
                }
        }
-?>

Modified: core/trunk/todo/inc/class.menu.inc.php
===================================================================
--- core/trunk/todo/inc/class.menu.inc.php      2008-09-28 14:33:00 UTC (rev 
18958)
+++ core/trunk/todo/inc/class.menu.inc.php      2008-10-05 12:42:05 UTC (rev 
18959)
@@ -24,7 +24,6 @@
           along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
 
-
        /**
         * Menus
         *

Modified: core/trunk/todo/inc/class.sotodo.inc.php
===================================================================
--- core/trunk/todo/inc/class.sotodo.inc.php    2008-09-28 14:33:00 UTC (rev 
18958)
+++ core/trunk/todo/inc/class.sotodo.inc.php    2008-10-05 12:42:05 UTC (rev 
18959)
@@ -2,28 +2,68 @@
        /**
        * Todo storage
        *
+       * @author Dave Hall <address@hidden>
        * @author Joseph Engo <address@hidden>
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2003,2005 Free Software Foundation, 
Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package todo
        * @version $Id$
        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
 
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
        /**
        * Todo storage
        *  
        * @package todo
        */
-       class sotodo
+       class todo_sotodo
        {
-               var $db;
-               var $grants;
-               var $historylog;
-               var $owner;
+               /**
+                * @var integer $account the current user
+                */
+               protected $account;
 
-               function sotodo()
+               /**
+                * @var phpgwapi_db $db reference to global database object
+                */
+               protected $db;
+
+               /**
+                * @var array $grants list of available grants for todo
+                */
+               protected $grants;
+
+               /**
+                * @var phpgwapi_historylog $historylog record history handler
+                */
+               protected $historylog;
+
+               /**
+                * @var array $user_groups groups the current user is a member 
of
+                */
+               protected $user_groups;
+
+               /**
+                * Constructor
+                *
+                * @return void
+                */
+               public function __construct()
                {
                        $this->db          =& $GLOBALS['phpgw']->db;
                        $this->grants      = 
$GLOBALS['phpgw']->acl->get_grants('todo');
@@ -33,8 +73,6 @@
 
                        // This is so our transactions follow across classes
                        $this->historylog->db =& $this->db;
-
-                       $this->owner = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
                function type($tree)
@@ -43,13 +81,13 @@
                        {
                                case 'mains':
                                        return ' AND todo_id_parent = 0'; 
-                                       break;
+
                                case 'subs':
                                        return ' AND todo_id_parent != 0';
-                                       break;
+
                                default:
+                                       return '';
                        }
-                       return '';
                }
 
                function read_todos($start = 0, $limit = True, $query = '', 
$filter = '', $order = '', $sort = '', $cat_id = '', $tree = '', $parent = '')
@@ -286,7 +324,7 @@
                        }
 
                        $this->db->query('DELETE from phpgw_todo where 
todo_id=' . intval($todo_id) . $subdelete . " AND ((todo_access='public' "
-                                                       . 'AND todo_owner != ' 
. $this->owner . ') OR (todo_owner=' . $this->owner . '))',__LINE__,__FILE__);
+                                                       . 'AND todo_owner != ' 
. $this->account . ') OR (todo_owner=' . $this->account . 
'))',__LINE__,__FILE__);
 
                        if (!$sub && $sub_todos)
                        {
@@ -403,4 +441,3 @@
                        }
                }
        }
-?>

Modified: core/trunk/todo/inc/class.uipreferences.inc.php
===================================================================
--- core/trunk/todo/inc/class.uipreferences.inc.php     2008-09-28 14:33:00 UTC 
(rev 18958)
+++ core/trunk/todo/inc/class.uipreferences.inc.php     2008-10-05 12:42:05 UTC 
(rev 18959)
@@ -2,52 +2,80 @@
        /**
        * Todo preferences
        *
+       * @author Dave Hall <address@hidden>
        * @author Craig Knudsen <address@hidden>
        * @author Mark Peters <address@hidden>
        * @copyright Copyright (C) Craig Knudsen <address@hidden>
-       * @copyright Copyright (C) 2002,2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2002-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package todo
        * @version $Id$
        * @internal Based on Webcalendar by Craig Knudsen 
http://www.radix.net/~cknudsen
        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
 
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
        /**
        * Todo preferences
        *  
        * @package todo
        */
-       class uipreferences
+       class todo_uipreferences
        {
-//             var $template_dir;
-               var $template;
+               /**
+                * @var array $public_methods the publicly callable methods of 
the class
+                */
+               public $public_functions = array
+               (
+                       'preferences' => true
+               );
 
-               var $bo;
+               /**
+                * @var todo_bopreferences $bo reference to todo preferences 
logic
+                */
+               protected $bo;
                
-               var $debug = False;
-//             var $debug = True;
+               /**
+                * @var boolean $debug enable crude debugging mode?
+                */
+               protected $debug = false;
 
-               var $theme;
+               /**
+                * @var phpgwapi_Template $template reference to global 
template object
+                */
+               protected $template;
 
-               var $public_functions = array(
-                       'preferences' => True
-               );
-
-               function uipreferences()
+               /**
+                * Constructor
+                *
+                * @return void
+                */
+               public function __construct()
                {
                        $GLOBALS['phpgw']->nextmatchs = 
CreateObject('phpgwapi.nextmatchs');
                        $this->template = $GLOBALS['phpgw']->template;
-                       $this->theme = $GLOBALS['phpgw_info']['theme'];
                        $this->bo = CreateObject('todo.bopreferences');
                }
 
-               function preferences()
+               public function preferences()
                {
                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
-                       $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
-                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+                       $GLOBALS['phpgw_info']['flags']['noappheader'] = true;
+                       $GLOBALS['phpgw_info']['flags']['noappfooter'] = true;
                        $GLOBALS['phpgw']->common->phpgw_header();
 
                        $this->template->set_file(
@@ -63,7 +91,6 @@
                        $var = Array(
                                'title'         =>      lang('ToDo 
Preferences'),
                                'action_url'    =>      
$GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'todo.bopreferences.preferences')),
-                               'bg_color   '   =>      $this->theme['th_bg'],
                                'submit_lang'   =>      lang('submit'),
                                'text'                  => '&nbsp;'
                        );
@@ -75,14 +102,8 @@
                        $this->template->pparse('out','pref');
                }
 
-               function output_template_array($row,$list,$var)
+               protected function display_item($field,$data)
                {
-                       $this->template->set_var($var);
-                       $this->template->parse($row,$list,True);
-               }
-
-               function display_item($field,$data)
-               {
                        static $tr_color;
                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
                        $var = Array(
@@ -92,4 +113,10 @@
                        );
                        $this->output_template_array('row','pref_list',$var);
                }
+
+               protected function output_template_array($row,$list,$var)
+               {
+                       $this->template->set_var($var);
+                       $this->template->parse($row,$list,True);
+               }
        }

Modified: core/trunk/todo/inc/class.uitodo.inc.php
===================================================================
--- core/trunk/todo/inc/class.uitodo.inc.php    2008-09-28 14:33:00 UTC (rev 
18958)
+++ core/trunk/todo/inc/class.uitodo.inc.php    2008-10-05 12:42:05 UTC (rev 
18959)
@@ -2,15 +2,31 @@
        /**
        * Todo user interface
        *
+       * @author Dave Hall <address@hidden>
        * @author Joseph Engo <address@hidden>
        * @author Bettina Gille address@hidden
-       * @copyright Copyright (C) 2000-2003,2005 Free Software Foundation, 
Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package todo
        * @version $Id$
        */
 
        /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /*
        * Import required classes
        */
        phpgw::import_class('phpgwapi.sbox');
@@ -21,22 +37,42 @@
        *  
        * @package todo
        */
-       class uitodo
+       class todo_uitodo
        {
-               var $grants;
-               var $historylog;
-               var $t;
-               var $public_functions = array
+               /**
+                * @var array $public_functions the callable methods of the 
class
+                */
+               public $public_functions = array
                (
-                       'show_list'     => True,
-                       'view'      => True,
-                       'add'       => True,
-                       'edit'      => True,
-                       'delete'        => True,
-                       'matrix'        => True
+                       'show_list'     => true,
+                       'view'      => true,
+                       'add'       => true,
+                       'edit'      => true,
+                       'delete'        => true,
+                       'matrix'        => true
                );
 
-               function uitodo()
+               /**
+                * @var array $grants list of rights available to the user
+                */
+               protected $grants;
+
+               /**
+                * @var phpgwapi_historylog $historylog reference to history 
log object
+                */
+               protected $historylog;
+
+               /**
+                * @var phpgwapi_Template $t Reference to global template object
+                */
+               protected $t;
+
+               /**
+                * Constructor
+                *
+                * @return void
+                */
+               function __construct()
                {
                        $this->botodo           = 
CreateObject('todo.botodo',True);
                        $this->nextmatchs       = 
CreateObject('phpgwapi.nextmatchs');
@@ -855,4 +891,3 @@
                        
$this->matrix->out($GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'todo.uitodo.matrix') ) );
                }
        }
-?>






reply via email to

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