fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16515] refactor some logic for generic dataset


From: sigurdne
Subject: [Fmsystem-commits] [16515] refactor some logic for generic dataset
Date: Sun, 2 Apr 2017 05:53:41 -0400 (EDT)

Revision: 16515
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16515
Author:   sigurdne
Date:     2017-04-02 05:53:40 -0400 (Sun, 02 Apr 2017)
Log Message:
-----------
refactor some logic for generic dataset

Modified Paths:
--------------
    trunk/booking/inc/class.menu.inc.php
    trunk/property/inc/class.sogeneric.inc.php

Added Paths:
-----------
    trunk/booking/inc/class.bogeneric.inc.php
    trunk/booking/inc/class.sogeneric.inc.php
    trunk/booking/inc/class.uigeneric.inc.php

Added: trunk/booking/inc/class.bogeneric.inc.php
===================================================================
--- trunk/booking/inc/class.bogeneric.inc.php                           (rev 0)
+++ trunk/booking/inc/class.bogeneric.inc.php   2017-04-02 09:53:40 UTC (rev 
16515)
@@ -0,0 +1,37 @@
+<?php
+/**
+        * phpGroupWare - booking: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare 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 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare 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 phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @package booking
+        * @subpackage generic
+        * @version $Id: $
+        */
+       phpgw::import_class('property.bogeneric');
+
+       class booking_bogeneric extends property_bogeneric
+       {
+               public function __construct()
+               {
+                       parent::__construct();
+               }
+       }
\ No newline at end of file

Modified: trunk/booking/inc/class.menu.inc.php
===================================================================
--- trunk/booking/inc/class.menu.inc.php        2017-04-01 16:50:07 UTC (rev 
16514)
+++ trunk/booking/inc/class.menu.inc.php        2017-04-02 09:53:40 UTC (rev 
16515)
@@ -317,7 +317,7 @@
                                                'office' => array
                                                        (
                                                        'text' => 
lang('office'),
-                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uigeneric.index',
                                                                'type' => 
'bb_office')),
                                                        'children' => array
                                                                (
@@ -324,7 +324,7 @@
                                                                'office_user' 
=> array
                                                                        (
                                                                        'text' 
=> lang('office user'),
-                                                                       'url' 
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                                       'url' 
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uigeneric.index',
                                                                                
'type' => 'bb_office_user'))
                                                                )
                                                        )

Added: trunk/booking/inc/class.sogeneric.inc.php
===================================================================
--- trunk/booking/inc/class.sogeneric.inc.php                           (rev 0)
+++ trunk/booking/inc/class.sogeneric.inc.php   2017-04-02 09:53:40 UTC (rev 
16515)
@@ -0,0 +1,141 @@
+<?php
+       /**
+        * phpGroupWare - booking: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare 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 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare 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 phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @package booking
+        * @subpackage generic
+        * @version $Id: $
+        */
+       phpgw::import_class('property.sogeneric_');
+
+       class booking_sogeneric extends property_sogeneric_
+       {
+
+               var $appname = 'booking';
+
+               function __construct( $type = '', $type_id = 0 )
+               {
+                       parent::__construct($type, $type_id);
+               }
+
+               public function get_location_info( $type, $type_id = 0 )
+               {
+
+                       $type_id = (int)$type_id;
+                       $this->type = $type;
+                       $this->type_id = $type_id;
+                       $info = array();
+
+                       if (!$type)
+                       {
+                               return $info;
+                       }
+
+                       switch ($type)
+                       {
+// START BOOKING TABLES
+                               case 'bb_office':
+                                       $info = array
+                                               (
+                                               'table' => 'bb_office',
+                                               'id' => array('name' => 'id', 
'type' => 'auto'),
+                                               'fields' => array
+                                                       (
+                                                       array
+                                                               (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'description',
+                                                               'descr' => 
lang('description'),
+                                                               'type' => 'text'
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => 
$GLOBALS['phpgw']->translation->translate('office', array(), false, 'booking'),
+                                               'acl_app' => 'booking',
+                                               'acl_location' => '.office',
+                                               'system_location' => '.office',
+                                               'menu_selection' => 
'booking::settings::office',
+                                               'default' => array
+                                                       (
+                                                       'user_id' => 
array('add' => '$this->account'),
+                                                       'entry_date' => 
array('add' => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant' => false
+                                       );
+
+                                       break;
+                               case 'bb_office_user':
+                                       $info = array
+                                               (
+                                               'table' => 'bb_office_user',
+                                               'id' => array('name' => 'id', 
'type' => 'auto'),
+                                               'fields' => array(
+                                                       array(
+                                                               'name' => 
'office',
+                                                               'descr' => 
$GLOBALS['phpgw']->translation->translate('office', array(), false, 'booking'),
+                                                               'type' => 
'select',
+                                                               'filter' => 
true,
+                                                               'values_def' => 
array(
+                                                                       
'valueset' => false,
+                                                                       
'method' => 'booking.bogeneric.get_list',
+                                                                       
'get_single_value' => 'booking.sogeneric.get_name',
+                                                                       
'method_input' => array('type' => 'bb_office', 'selected' => '##office##')
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => 
$GLOBALS['phpgw']->translation->translate('office user', array(), false, 
'booking'),
+                                               'acl_app' => 'booking',
+                                               'acl_location' => 
'.office.user',
+                                               'system_location' => 
'.office.user',
+                                               'menu_selection' => 
'booking::settings::office::office_user',
+                                               'default' => array
+                                                       (
+                                                       'user_id' => 
array('add' => '$this->account'),
+                                                       'entry_date' => 
array('add' => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant' => false
+                                       );
+
+                                       break;
+
+// END BOOKING TABLES
+                               default:
+                                       $message = lang('ERROR: illegal type 
%1', $type);
+                                       phpgwapi_cache::message_set($message, 
'error');
+//                             throw new Exception(lang('ERROR: illegal type 
%1', $type));
+                       }
+
+                       $this->location_info = $info;
+                       return $info;
+               }
+       }
\ No newline at end of file

Added: trunk/booking/inc/class.uigeneric.inc.php
===================================================================
--- trunk/booking/inc/class.uigeneric.inc.php                           (rev 0)
+++ trunk/booking/inc/class.uigeneric.inc.php   2017-04-02 09:53:40 UTC (rev 
16515)
@@ -0,0 +1,37 @@
+<?php
+/**
+        * phpGroupWare - booking: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare 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 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare 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 phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @package booking
+        * @subpackage generic
+        * @version $Id: $
+        */
+       phpgw::import_class('property.uigeneric');
+
+       class booking_uigeneric extends property_uigeneric
+       {
+               public function __construct()
+               {
+                       parent::__construct();
+               }
+       }
\ No newline at end of file

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2017-04-01 16:50:07 UTC (rev 
16514)
+++ trunk/property/inc/class.sogeneric.inc.php  2017-04-02 09:53:40 UTC (rev 
16515)
@@ -2441,82 +2441,6 @@
 
                                        break;
 
-// START BOOKING TABLES
-                               case 'bb_office':
-                                       $info = array
-                                               (
-                                               'table' => 'bb_office',
-                                               'id' => array('name' => 'id', 
'type' => 'auto'),
-                                               'fields' => array
-                                                       (
-                                                       array
-                                                               (
-                                                               'name' => 
'name',
-                                                               'descr' => 
lang('name'),
-                                                               'type' => 
'varchar'
-                                                       ),
-                                                       array
-                                                               (
-                                                               'name' => 
'description',
-                                                               'descr' => 
lang('description'),
-                                                               'type' => 'text'
-                                                       )
-                                               ),
-                                               'edit_msg' => lang('edit'),
-                                               'add_msg' => lang('add'),
-                                               'name' => 
$GLOBALS['phpgw']->translation->translate('office', array(), false, 'booking'),
-                                               'acl_app' => 'booking',
-                                               'acl_location' => '.office',
-                                               'system_location' => '.office',
-                                               'menu_selection' => 
'booking::settings::office',
-                                               'default' => array
-                                                       (
-                                                       'user_id' => 
array('add' => '$this->account'),
-                                                       'entry_date' => 
array('add' => 'time()'),
-                                                       'modified_date' => 
array('edit' => 'time()'),
-                                               ),
-                                               'check_grant' => false
-                                       );
-
-                                       break;
-                               case 'bb_office_user':
-                                       $info = array
-                                               (
-                                               'table' => 'bb_office_user',
-                                               'id' => array('name' => 'id', 
'type' => 'auto'),
-                                               'fields' => array(
-                                                       array(
-                                                               'name' => 
'office',
-                                                               'descr' => 
$GLOBALS['phpgw']->translation->translate('office', array(), false, 'booking'),
-                                                               'type' => 
'select',
-                                                               'filter' => 
true,
-                                                               'values_def' => 
array(
-                                                                       
'valueset' => false,
-                                                                       
'method' => 'property.bogeneric.get_list',
-                                                                       
'get_single_value' => 'property.sogeneric.get_name',
-                                                                       
'method_input' => array('type' => 'bb_office', 'selected' => '##office##')
-                                                               )
-                                                       )
-                                               ),
-                                               'edit_msg' => lang('edit'),
-                                               'add_msg' => lang('add'),
-                                               'name' => 
$GLOBALS['phpgw']->translation->translate('office user', array(), false, 
'booking'),
-                                               'acl_app' => 'booking',
-                                               'acl_location' => 
'.office.user',
-                                               'system_location' => 
'.office.user',
-                                               'menu_selection' => 
'booking::settings::office::office_user',
-                                               'default' => array
-                                                       (
-                                                       'user_id' => 
array('add' => '$this->account'),
-                                                       'entry_date' => 
array('add' => 'time()'),
-                                                       'modified_date' => 
array('edit' => 'time()'),
-                                               ),
-                                               'check_grant' => false
-                                       );
-
-                                       break;
-
-// END BOOKING TABLES
 // START CONTROLLER TABLES
                                case 'controller_check_item_status':
                                        $info = array




reply via email to

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