fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13783] Booking: Add custom fields per top-level acti


From: Sigurd Nes
Subject: [Fmsystem-commits] [13783] Booking: Add custom fields per top-level activity
Date: Wed, 26 Aug 2015 13:35:50 +0000

Revision: 13783
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13783
Author:   sigurdne
Date:     2015-08-26 13:35:49 +0000 (Wed, 26 Aug 2015)
Log Message:
-----------
Booking: Add custom fields per top-level activity

Modified Paths:
--------------
    branches/dev-syncromind/admin/inc/class.ui_custom.inc.php
    branches/dev-syncromind/booking/inc/class.menu.inc.php
    branches/dev-syncromind/booking/inc/class.uiactivity.inc.php
    branches/dev-syncromind/booking/setup/setup.inc.php
    branches/dev-syncromind/booking/setup/tables_update.inc.php
    branches/dev-syncromind/phpgwapi/setup/phpgw_no.lang

Added Paths:
-----------
    branches/dev-syncromind/booking/inc/class.hook_helper.inc.php

Modified: branches/dev-syncromind/admin/inc/class.ui_custom.inc.php
===================================================================
--- branches/dev-syncromind/admin/inc/class.ui_custom.inc.php   2015-08-26 
13:32:58 UTC (rev 13782)
+++ branches/dev-syncromind/admin/inc/class.ui_custom.inc.php   2015-08-26 
13:35:49 UTC (rev 13783)
@@ -249,7 +249,7 @@
                                }
 
                                $values['appname']= $appname;
-                               $values['location'] = $location;
+                               $values['location'] = $location ? $location : 
$values['location'];
 
                                if (!$values['location'])
                                {

Added: branches/dev-syncromind/booking/inc/class.hook_helper.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.hook_helper.inc.php               
                (rev 0)
+++ branches/dev-syncromind/booking/inc/class.hook_helper.inc.php       
2015-08-26 13:35:49 UTC (rev 13783)
@@ -0,0 +1,72 @@
+<?php
+       /**
+        * property - Hook helper
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2015 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package booking
+        * @version $Id: class.hook_helper.inc.php 13774 2015-08-25 13:29:40Z 
sigurdne $
+        */
+
+       /*
+          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 2 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');
+
+       /**
+        * Hook helper
+        *
+        * @package booking
+        */
+       class booking_hook_helper
+       {
+/*
+                       $args = array
+                       (
+                               'id'            => $category['id'],
+                               'location'      => $function_name,
+                       );
+
+                       $GLOBALS['phpgw']->hooks->single($args, 'booking');
+*/
+
+               /**
+                * Handle a new activity being added, create location to hold 
ACL-data
+                */
+               function activity_add($data)
+               {
+                       
$GLOBALS['phpgw']->locations->add(".application.{$data['id']}",$data['name'],'booking',false,
   null,false,true);
+                       
$GLOBALS['phpgw']->locations->add(".resource.{$data['id']}",$data['name'],'booking',false,
      null,false,true);
+               }
+
+               /**
+                * Handle a activity being deleted, remove the location
+                */
+               function activity_delete($data)
+               {
+                       $GLOBALS['phpgw']->locations->delete('booking', 
".application.{$data['id']}", false);
+                       $GLOBALS['phpgw']->locations->delete('booking', 
".resource.{$data['id']}", false);
+               }
+
+               /**
+                * Handle a activity being edited, update the location info
+                */
+               function activity_edit($data)
+               {
+                       
$GLOBALS['phpgw']->locations->update_description(".application.{$data['id']}", 
$data['name'], 'booking');
+                       
$GLOBALS['phpgw']->locations->update_description(".resource.{$data['id']}", 
$data['name'], 'booking');
+               }
+       }

Modified: branches/dev-syncromind/booking/inc/class.menu.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.menu.inc.php      2015-08-26 
13:32:58 UTC (rev 13782)
+++ branches/dev-syncromind/booking/inc/class.menu.inc.php      2015-08-26 
13:35:49 UTC (rev 13783)
@@ -241,6 +241,11 @@
                                                                'text'  => 
lang('Activity'),
                                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uiactivity.index', 'appname' => 'booking') )
                                                        ),
+                                                       'custom_fields' => array
+                                                       (
+                                                               'text'  => 
lang('custom fields'),
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute', 'appname' => 'booking', 'menu_selection' => 
'booking::settings::custom_fields') )
+                                                       ),
                                                        'audience'      => array
                                                        (
                                                                'text'  => 
lang('Audience'),

Modified: branches/dev-syncromind/booking/inc/class.uiactivity.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiactivity.inc.php        
2015-08-26 13:32:58 UTC (rev 13782)
+++ branches/dev-syncromind/booking/inc/class.uiactivity.inc.php        
2015-08-26 13:35:49 UTC (rev 13783)
@@ -100,6 +100,8 @@
                                if(!$errors)
                                {
                                        $receipt = $this->bo->add($activity);
+                                       //Add locations for application and 
resources
+                                       
$GLOBALS['phpgw']->hooks->single(array('id'     => $receipt['id'], 'name'=> 
$activity['name'], 'location'=> 'activity_add'), 'booking');
                                        $this->redirect(array('menuaction' => 
'booking.uiactivity.index'));
                                }
                        }
@@ -139,6 +141,8 @@
                                if(!$errors)
                                {
                                        $receipt = $this->bo->update($activity);
+                                       //Edit locations for application and 
resources
+                                       
$GLOBALS['phpgw']->hooks->single(array('id'     => $id, 'name'=> 
$activity['name'], 'location'=> 'activity_edit'), 'booking');
                                        $this->redirect(array('menuaction' => 
'booking.uiactivity.index'));
                                }
                        }

Modified: branches/dev-syncromind/booking/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/setup.inc.php 2015-08-26 13:32:58 UTC 
(rev 13782)
+++ branches/dev-syncromind/booking/setup/setup.inc.php 2015-08-26 13:35:49 UTC 
(rev 13783)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.20';
+       $setup_info['booking']['version'] = '0.2.21';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';
@@ -80,5 +80,8 @@
        /* The hooks this app includes, needed for hooks registration */
        $setup_info['booking']['hooks'] = array
        (
-               'menu'  => 'booking.menu.get_menu'
+               'menu'                  => 'booking.menu.get_menu',
+               'activity_add'          => 'booking.hook_helper.activity_add',
+               'activity_delete'       => 
'booking.hook_helper.activity_delete',
+               'activity_edit'         => 'booking.hook_helper.activity_edit'
        );

Modified: branches/dev-syncromind/booking/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/booking/setup/tables_update.inc.php 2015-08-26 
13:32:58 UTC (rev 13782)
+++ branches/dev-syncromind/booking/setup/tables_update.inc.php 2015-08-26 
13:35:49 UTC (rev 13783)
@@ -2986,7 +2986,6 @@
        $test[] = '0.2.19';
        /**
         * Update booking version from 0.2.19 to 0.2.20
-        * add another tilsynsvakt to buidling
         *
         */
        function booking_upgrade0_2_19()
@@ -2998,4 +2997,66 @@
                        $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.20';
                        return $GLOBALS['setup_info']['booking']['currentver'];
                }
+       }
+
+       $test[] = '0.2.20';
+       /**
+        * Update booking version from 0.2.20 to 0.2.21
+        * add another tilsynsvakt to buidling
+        *
+        */
+       function booking_upgrade0_2_20()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+//- vi registrerer en systemlokasjon pr toppnivå av aktivitet som 
"resource.<activity_id>"
+//- vi registrerer en systemlokasjon pr toppnivå av aktivitet som 
"application.<activity_id>"
+               $boactivity = CreateObject('booking.boactivity');
+               $activities = $boactivity->fetch_activities();
+               $activities = $boactivity->so->read(array('sort'=>'name', 
'dir'=>'ASC'));
+
+               $top_level = array();
+               foreach($activities['results'] as $activity)
+               {
+                       if(!$activity['parent_id'])
+                       {
+                               $top_level[] = $activity;
+                       }
+               }
+               unset($activity);
+
+               foreach($top_level as $activity)
+               {
+                       $location       = ".application.{$activity['id']}";
+                       $descr          = $activity['name'];
+
+                       $GLOBALS['phpgw']->locations->add(
+                               $location,
+                               $descr,
+                               $appname = 'booking',
+                               false, //$allow_grant
+                               null,//$custom_tbl
+                               false,//$c_function
+                               true//$c_attrib
+                       );
+
+                       $location       = ".resource.{$activity['id']}";
+                       $descr          = $activity['name'];
+
+                       $GLOBALS['phpgw']->locations->add(
+                               $location,
+                               $descr,
+                               $appname = 'booking',
+                               false, //$allow_grant
+                               null,//$custom_tbl
+                               false,//$c_function
+                               true//$c_attrib
+                       );
+
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.21';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
        }
\ No newline at end of file

Modified: branches/dev-syncromind/phpgwapi/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind/phpgwapi/setup/phpgw_no.lang        2015-08-26 
13:32:58 UTC (rev 13782)
+++ branches/dev-syncromind/phpgwapi/setup/phpgw_no.lang        2015-08-26 
13:35:49 UTC (rev 13783)
@@ -148,4 +148,10 @@
 Password must contain at least 1 number        common  no      Passord må 
inneholde minst 1 tall
 Password must contain at least 1 non alphanumeric character    common  no      
Passord må inneholde minst 1 spesialtegn
 The passwords don't match      common  no      Passordene er ikke like
-browser not supported  common  no      Nettleseren ser ikke ut til å støtte 
HTML5
\ No newline at end of file
+browser not supported  common  no      Nettleseren ser ikke ut til å støtte 
HTML5
+custom fields  common  no      Egendefinerte felt
+descr  common  no      beskrivelse
+datatype       common  no      Datatype
+sorting        common  no      Sortering
+up     common  no      opp
+down   common  no      ned
\ No newline at end of file




reply via email to

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