[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11647] API: more on vfs filesystem
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11647] API: more on vfs filesystem |
Date: |
Fri, 31 Jan 2014 15:35:38 +0000 |
Revision: 11647
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11647
Author: sigurdne
Date: 2014-01-31 15:35:38 +0000 (Fri, 31 Jan 2014)
Log Message:
-----------
API: more on vfs filesystem
Modified Paths:
--------------
trunk/admin/setup/setup.inc.php
trunk/phpgwapi/inc/class.locations.inc.php
trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
trunk/phpgwapi/setup/default_records.inc.php
trunk/phpgwapi/setup/setup.inc.php
trunk/phpgwapi/setup/tables_current.inc.php
trunk/phpgwapi/setup/tables_update.inc.php
Added Paths:
-----------
trunk/admin/inc/class.cat_hooks.inc.php
Added: trunk/admin/inc/class.cat_hooks.inc.php
===================================================================
--- trunk/admin/inc/class.cat_hooks.inc.php (rev 0)
+++ trunk/admin/inc/class.cat_hooks.inc.php 2014-01-31 15:35:38 UTC (rev
11647)
@@ -0,0 +1,98 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2014 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/bbb_/ekstern/
+ * @package property
+ * @subpackage entity
+ * @version $Id: class.cat_hooks.inc.php 8281 2011-12-13 09:24:03Z
sigurdne $
+ */
+
+ /**
+ * hook management for categories
+ * @package admin
+ */
+ class admin_cat_hooks
+ {
+
+ /**
+ * Handle a new category being added, create location to hold
ACL-data
+ */
+ function cat_add($data)
+ {
+ if ( isset($data['cat_owner']) && $data['cat_owner'] !=
-1 )
+ {
+ return false; //nothing needed to be done, we
only care about global cats
+ }
+
+ if($data['location_id'])
+ {
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
+ $location = $location_info['location'];
+ if($location == 'vfs_filedata')
+ {
+
$GLOBALS['phpgw']->locations->add("vfs_filedata.{$data['cat_id']}",
$data['cat_name'], 'phpgwapi', false, false, false, true);
+ }
+ }
+ }
+
+ /**
+ * Handle a category being deleted, remove the location
+ */
+ function cat_delete($data)
+ {
+ if ( isset($data['cat_owner']) && $data['cat_owner'] !=
-1 )
+ {
+ return false; //nothing needed to be done, we
only care about global cats
+ }
+ if($data['location_id'])
+ {
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
+ if($location_info['location'] == 'vfs_filedata')
+ {
+ $location =
"{$location_info['location']}.{$data['cat_id']}";
+
$GLOBALS['phpgw']->locations->delete('phpgwapi', $location, false);
+ }
+ }
+ }
+
+ /**
+ * Handle a category being edited, update the location info
+ */
+ function cat_edit($data)
+ {
+ if ( isset($data['cat_owner']) && $data['cat_owner'] !=
-1 )
+ {
+ return false; //nothing needed to be done, we
only care about global cats
+ }
+
+ if($data['location_id'])
+ {
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($data['location_id']);
+ if($location_info['location'] == 'vfs_filedata')
+ {
+ $location =
"{$location_info['location']}.{$data['cat_id']}";
+
$GLOBALS['phpgw']->locations->update_description($location, $data['cat_name'],
'phpgwapi');
+ }
+ }
+ }
+ }
Modified: trunk/admin/setup/setup.inc.php
===================================================================
--- trunk/admin/setup/setup.inc.php 2014-01-31 13:20:33 UTC (rev 11646)
+++ trunk/admin/setup/setup.inc.php 2014-01-31 15:35:38 UTC (rev 11647)
@@ -44,14 +44,16 @@
'config',
'deleteaccount',
'manual',
- 'view_user'
+ 'view_user',
+ 'menu' =>
'admin.menu.get_menu',
+ 'cat_add' =>
'admin.cat_hooks.cat_add',
+ 'cat_delete' => 'admin.cat_hooks.cat_delete',
+ 'cat_edit' =>
'admin.cat_hooks.cat_edit'
);
- $setup_info['admin']['hooks']['menu'] = 'admin.menu.get_menu';
/* Dependencies for this app to work */
$setup_info['admin']['depends'][] = array
(
'appname' => 'phpgwapi',
- 'versions' => Array('0.9.17', '0.9.18')
+ 'versions' => array('0.9.17', '0.9.18')
);
-?>
Modified: trunk/phpgwapi/inc/class.locations.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.locations.inc.php 2014-01-31 13:20:33 UTC (rev
11646)
+++ trunk/phpgwapi/inc/class.locations.inc.php 2014-01-31 15:35:38 UTC (rev
11647)
@@ -82,10 +82,12 @@
* @param string $appname the name of the application for
the location
* @param boolean $allow_grant allow grants on the location
* @param string $custom_tbl table associated with location
+ * @param boolean $c_function allow custom funtion on the
location
+ * @param boolean $c_attrib allow custom attrib on the location
*
* @return int the new location id
*/
- public function add($location, $descr, $appname, $allow_grant =
true, $custom_tbl = null, $c_function = false)
+ public function add($location, $descr, $appname, $allow_grant =
true, $custom_tbl = null, $c_function = false, $c_attrib = false)
{
$app =
$GLOBALS['phpgw']->applications->name2id($appname);
@@ -102,19 +104,28 @@
return $this->_db->f('location_id'); // already
exists so just return the id
}
- if ( is_null($custom_tbl) )
- {
- $sql = 'INSERT INTO phpgw_locations (app_id,
name, descr, allow_grant,allow_c_function)'
- . " VALUES ({$app}, '{$location}',
'{$descr}', {$allow_grant}, {$c_function})";
- }
- else
- {
+ if($custom_tbl)
+ {
$custom_tbl =
$this->_db->db_addslashes($custom_tbl);
- $sql = 'INSERT INTO phpgw_locations (app_id,
name, descr, allow_grant, allow_c_attrib, c_attrib_table, allow_c_function)'
- . " VALUES ({$app}, '{$location}',
'{$descr}', {$allow_grant}, 1, '{$custom_tbl}', $c_function)";
+ $c_attrib = 1;
}
- $this->_db->query($sql, __LINE__, __FILE__);
+ $value_set = array
+ (
+ 'app_id' => $app,
+ 'name' => $location,
+ 'descr' => $descr,
+ 'allow_grant' => $allow_grant,
+ 'allow_c_attrib' => $c_attrib ? 1 :
false,
+ 'c_attrib_table' => $custom_tbl,
+ 'allow_c_function' => $c_function
+ );
+
+ $cols = implode(',', array_keys($value_set));
+ $values =
$this->_db->validate_insert(array_values($value_set));
+
+ $this->_db->query("INSERT INTO phpgw_locations
({$cols}) VALUES ({$values})",__LINE__,__FILE__);
+
return
$this->_db->get_last_insert_id('phpgw_locations', 'location_id');
}
Modified: trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php 2014-01-31
13:20:33 UTC (rev 11646)
+++ trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php 2014-01-31
15:35:38 UTC (rev 11647)
@@ -34,11 +34,11 @@
public function __construct()
{
$this->db = & $GLOBALS['phpgw']->db;
- $location_id =
$GLOBALS['phpgw']->locations->get_id('phpgwapi', 'vfs_braArkiv');
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('phpgwapi', 'vfs_filedata');
$c = CreateObject('admin.soconfig',$location_id);
- $section = 'webservice';
+ $section = 'braArkiv';
$location_url =
$c->config_data[$section]['location_url'];//'http://braarkiv.adm.bgo/service/services.asmx';
$braarkiv_user =
$c->config_data[$section]['braarkiv_user'];
$braarkiv_pass =
$c->config_data[$section]['braarkiv_pass'];
@@ -77,8 +77,8 @@
{
$receipt_section = $this->config->add_section(array
(
- 'name' => 'webservice',
- 'descr' => 'Webservice'
+ 'name' => 'braArkiv',
+ 'descr' => 'braArkiv'
)
);
Modified: trunk/phpgwapi/setup/default_records.inc.php
===================================================================
--- trunk/phpgwapi/setup/default_records.inc.php 2014-01-31 13:20:33 UTC
(rev 11646)
+++ trunk/phpgwapi/setup/default_records.inc.php 2014-01-31 15:35:38 UTC
(rev 11647)
@@ -367,3 +367,4 @@
$GLOBALS['phpgw']->locations->add('changepassword', 'allow user to
change password', 'preferences', false);
$GLOBALS['phpgw']->locations->add('anonymous', 'allow anonymous
sessions for public modules', 'phpgwapi', false);
+ $GLOBALS['phpgw']->locations->add('vfs_filedata', 'config section for
VFS filedata - file backend', 'phpgwapi', false);
Modified: trunk/phpgwapi/setup/setup.inc.php
===================================================================
--- trunk/phpgwapi/setup/setup.inc.php 2014-01-31 13:20:33 UTC (rev 11646)
+++ trunk/phpgwapi/setup/setup.inc.php 2014-01-31 15:35:38 UTC (rev 11647)
@@ -12,7 +12,7 @@
// Basic information about this app
$setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'phpgwapi';
- $setup_info['phpgwapi']['version'] = '0.9.17.543';
+ $setup_info['phpgwapi']['version'] = '0.9.17.544';
$setup_info['phpgwapi']['versions']['current_header'] = '1.31';
$setup_info['phpgwapi']['versions']['system'] = '1.0';
$setup_info['phpgwapi']['enable'] = 3;
@@ -63,6 +63,7 @@
'phpgw_preferences',
'phpgw_sessions',
'phpgw_vfs',
+ 'phpgw_vfs_filedata',
'phpgw_config2_section',
'phpgw_config2_attrib',
'phpgw_config2_choice',
Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2014-01-31 13:20:33 UTC (rev
11646)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2014-01-31 15:35:38 UTC (rev
11647)
@@ -297,6 +297,19 @@
'ix' => array(),
'uc' => array()
),
+
+ 'phpgw_vfs_filedata' => array(
+ 'fd' => array(
+ 'file_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'location_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'metadata' => array('type' => 'xml','nullable'
=> False),
+ ),
+ 'pk' => array('file_id'),
+ 'fk' => array(array('phpgw_vfs' => array('file_id' =>
'file_id')),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+
'phpgw_history_log' => array(
'fd' => array(
'history_id' => array('type' =>
'auto','precision' => 4,'nullable' => False),
Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php 2014-01-31 13:20:33 UTC (rev
11646)
+++ trunk/phpgwapi/setup/tables_update.inc.php 2014-01-31 15:35:38 UTC (rev
11647)
@@ -3178,3 +3178,35 @@
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
}
+
+ $test[] = '0.9.17.543';
+ /**
+ * Enable external integration with vfs
+ *
+ * @return string the new version number
+ */
+ function phpgwapi_upgrade0_9_17_543()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw']->locations->add('vfs_filedata', 'config
section for VFS filedata - file backend', 'phpgwapi', false);
+
+
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_vfs_filedata',array(
+ 'fd' => array(
+ 'file_id' => array('type' => 'int','precision'
=> '4','nullable' => False),
+ 'location_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'metadata' => array('type' => 'xml','nullable'
=> False),
+ ),
+ 'pk' => array('file_id'),
+ 'fk' => array(array('phpgw_vfs' => array('file_id' =>
'file_id'))),
+ 'ix' => array(),
+ 'uc' => array()
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['phpgwapi']['currentver'] =
'0.9.17.544';
+ return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+ }
+ }
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11647] API: more on vfs filesystem,
Sigurd Nes <=