[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8275] property: more generic responsibilities
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8275] property: more generic responsibilities |
Date: |
Mon, 12 Dec 2011 15:13:21 +0000 |
Revision: 8275
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8275
Author: sigurdne
Date: 2011-12-12 15:13:21 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
property: more generic responsibilities
Modified Paths:
--------------
trunk/property/inc/class.boresponsible.inc.php
trunk/property/inc/class.soresponsible.inc.php
trunk/property/inc/class.uigeneric.inc.php
trunk/property/inc/class.uiresponsible.inc.php
Modified: trunk/property/inc/class.boresponsible.inc.php
===================================================================
--- trunk/property/inc/class.boresponsible.inc.php 2011-12-12 15:12:46 UTC
(rev 8274)
+++ trunk/property/inc/class.boresponsible.inc.php 2011-12-12 15:13:21 UTC
(rev 8275)
@@ -44,7 +44,7 @@
public $total_records = 0;
public $cat_id;
public $allrows;
- public $acl_location = '.admin';
+ protected $acl_location = '.admin';
/**
* Constructor
@@ -54,7 +54,10 @@
public function __construct($session = false)
{
+ $this->appname = phpgw::get_var('appname', 'string',
'REQUEST', 'property');
+
$this->so =
CreateObject('property.soresponsible');
+ $this->so->appname = $this->appname;
$this->so->acl_location = $this->acl_location;
if ($session)
@@ -94,17 +97,23 @@
switch ($this->location)
{
- case '.project.workorder':
- $location = '.project';
- break;
- default:
- $location = $this->location;
+ case '.project.workorder':
+ $location = '.project';
+ break;
+ default:
+ $location = $this->location;
}
- $this->cats =
CreateObject('phpgwapi.categories', -1,'property', $location);
- $this->dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $this->cats =
CreateObject('phpgwapi.categories', -1, $this->appname, $location);
+ $this->dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
}
+
+ public function get_acl_location()
+ {
+ return $this->acl_location;
+ }
+
/**
* Save sessiondata for later use
*
@@ -170,13 +179,13 @@
}
$values = $this->so->read_type(array('start' =>
$this->start, 'query' => $this->query, 'sort' => $this->sort,
- 'order' => $this->order, 'location' =>
$this->location, 'allrows'=>$this->allrows,
+ 'order' => $this->order, 'appname' =>
$this->appname,'location' => $this->location, 'allrows'=>$this->allrows,
'filter' => $filter));
$this->total_records = $this->so->total_records;
- if($value['cat_id'])
+ foreach($values as & $value)
{
- foreach($values as & $value)
+ if($value['cat_id'])
{
$category =
$this->cats->return_single($value['cat_id']);
$value['category'] =
$category[0]['name'];
Modified: trunk/property/inc/class.soresponsible.inc.php
===================================================================
--- trunk/property/inc/class.soresponsible.inc.php 2011-12-12 15:12:46 UTC
(rev 8274)
+++ trunk/property/inc/class.soresponsible.inc.php 2011-12-12 15:13:21 UTC
(rev 8275)
@@ -81,7 +81,7 @@
$allrows = isset($data['allrows']) ?
!!$data['allrows'] : '';
$filter = $data['filter'] ?
$data['filter'] : '';
$location = isset($data['location']) ?
$data['location'] : '';
-
+ $appname = isset($data['appname']) &&
$data['appname'] ? $data['appname'] : 'property';
}
if ($order)
@@ -93,7 +93,7 @@
$ordermethod = ' order by fm_responsibility.id
DESC';
}
- $where= 'WHERE';
+ $where= 'AND';
$filtermethod = '';
/*
@@ -115,7 +115,10 @@
$querymethod = "$where (fm_responsibility.name
$this->like '%$query%' OR fm_responsibility.descr $this->like '%$query%')";
}
- $sql = "SELECT fm_responsibility.*,
phpgw_locations.name as location FROM fm_responsibility $this->join
phpgw_locations ON fm_responsibility.location_id = phpgw_locations.location_id
$filtermethod $querymethod";
+ $sql = "SELECT fm_responsibility.*,
phpgw_locations.name as location FROM fm_responsibility"
+ . " {$this->join} phpgw_locations ON
fm_responsibility.location_id = phpgw_locations.location_id"
+ . " {$this->join} phpgw_applications ON
phpgw_locations.app_id = phpgw_applications.app_id"
+ . " WHERE app_name = '{$appname}' $filtermethod
$querymethod";
$this->db->query($sql, __LINE__, __FILE__);
$this->total_records = $this->db->num_rows();
@@ -164,15 +167,15 @@
$values['descr'] =
$this->db->db_addslashes($values['descr']);
$insert_values = array
- (
- $values['name'],
- $values['descr'],
-
$GLOBALS['phpgw']->locations->get_id($this->appname, $values['location']),
- (int) $values['cat_id'],
- isset($values['active']) ?
!!$values['active'] : '',
- $this->account,
- time()
- );
+ (
+ $values['name'],
+ $values['descr'],
+
$GLOBALS['phpgw']->locations->get_id($this->appname, $values['location']),
+ (int) $values['cat_id'],
+ isset($values['active']) ? !!$values['active']
: '',
+ $this->account,
+ time()
+ );
$insert_values =
$this->db->validate_insert($insert_values);
Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php 2011-12-12 15:12:46 UTC (rev
8274)
+++ trunk/property/inc/class.uigeneric.inc.php 2011-12-12 15:13:21 UTC (rev
8275)
@@ -35,6 +35,7 @@
class property_uigeneric
{
+ protected $appname = 'property';
var $grants;
var $start;
var $query;
@@ -81,6 +82,12 @@
$this->type = $this->bo->type;
$this->type_id = $this->bo->type_id;
+ $appname = phpgw::get_var('appname', 'string');
+ if($appname)
+ {
+
$GLOBALS['phpgw_info']['flags']['menu_selection'] = str_replace('property',
$appname, $GLOBALS['phpgw_info']['flags']['menu_selection']);
+ $this->appname = $appname;
+ }
}
function save_sessiondata()
@@ -172,18 +179,21 @@
$datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
(
'menuaction' =>
'property.uigeneric.index',
- 'type' => $this->type,
+ 'appname' =>
$this->appname,
+ 'type' =>
$this->type,
'type_id' =>
$this->type_id
));
$datatable['config']['base_java_url'] =
"menuaction:'property.uigeneric.index',"
+ ."appname:'{$this->appname}',"
."type:'{$this->type}',"
."type_id:'{$this->type_id}'";
$link_data = array
(
'menuaction' =>
'property.uigeneric.index',
- 'type' => $this->type,
+ 'appname' =>
$this->appname,
+ 'type' =>
$this->type,
'type_id' =>
$this->type_id
);
@@ -198,6 +208,7 @@
array
(
'menuaction'
=> 'property.uigeneric.index',
+ 'appname'
=> $this->appname,
'type'
=> $this->type,
'type_id'
=> $this->type_id
)
@@ -261,6 +272,7 @@
array
(
'menuaction' =>
'property.uigeneric.columns',
+ 'appname'
=> $this->appname,
'type'
=> $this->type,
'type_id'
=> $this->type_id
)
@@ -392,6 +404,7 @@
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction'
=> 'property.uigeneric.edit',
+ 'appname'
=> $this->appname,
'type'
=> $this->type,
'type_id'
=> $this->type_id
)),
@@ -404,6 +417,7 @@
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction'
=> 'property.uigeneric.edit',
+ 'appname'
=> $this->appname,
'type'
=> $this->type,
'type_id'
=> $this->type_id,
'target'
=> '_blank'
@@ -423,6 +437,7 @@
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction' =>
'property.uigeneric.delete',
+ 'appname'
=> $this->appname,
'type'
=> $this->type,
'type_id'
=> $this->type_id
)),
@@ -441,6 +456,7 @@
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction' =>
'property.uigeneric.edit',
+ 'appname'
=> $this->appname,
'type'
=> $this->type,
'type_id'
=> $this->type_id
))
@@ -677,7 +693,10 @@
if (isset($values['save']) &&
$values['save'])
{
$GLOBALS['phpgw']->session->appsession('session_data',
"general_receipt_{$this->type}_{$this->type_id}", $receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type'=> $this->type, 'type_id' =>
$this->type_id));
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uigeneric.index',
+
'appname' => $this->appname,
+
'type' => $this->type,
+
'type_id' => $this->type_id));
}
$id = $receipt['id'];
}
@@ -685,7 +704,10 @@
}
else
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type'=> $this->type, 'type_id' => $this->type_id));
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uigeneric.index',
+
'appname' => $this->appname,
+
'type' => $this->type,
+
'type_id' => $this->type_id));
}
}
@@ -720,6 +742,7 @@
(
'menuaction' =>
'property.uigeneric.edit',
'id' => $id,
+ 'appname' =>
$this->appname,
'type' => $this->type,
'type_id' =>
$this->type_id
);
@@ -735,6 +758,7 @@
$link_history_data = array
(
'menuaction'
=> 'property.uigeneric.attrib_history',
+ 'appname'
=> $this->appname,
'attrib_id'
=> $attribute['id'],
'actor_id'
=> $actor_id,
'role'
=> $this->role,
@@ -866,4 +890,3 @@
}
}
}
-
Modified: trunk/property/inc/class.uiresponsible.inc.php
===================================================================
--- trunk/property/inc/class.uiresponsible.inc.php 2011-12-12 15:12:46 UTC
(rev 8274)
+++ trunk/property/inc/class.uiresponsible.inc.php 2011-12-12 15:13:21 UTC
(rev 8275)
@@ -76,6 +76,11 @@
protected $acl_location;
/**
+ * @var string $appname the application name
+ */
+ protected $appname;
+
+ /**
* @var bool $acl_read does the current user have read access
to the current location
*/
protected $acl_read;
@@ -115,17 +120,18 @@
public function __construct()
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'admin::property::responsible_matrix';
+
$this->bo =
CreateObject('property.boresponsible', true);
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->acl = &
$GLOBALS['phpgw']->acl;
- $this->acl_location =
$this->bo->acl_location;
+ $this->acl_location =
$this->bo->get_acl_location();
$this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
$this->acl_add =
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
$this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
$this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
$this->bolocation =
CreateObject('preferences.boadmin_acl');
- $this->bolocation->acl_app = 'property';
+ $this->appname =
$this->bo->appname;
+ $this->bolocation->acl_app = $this->appname;
$this->location =
$this->bo->location;
$this->cats = &
$this->bo->cats;
$this->query =
$this->bo->query;
@@ -133,6 +139,8 @@
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$this->cat_id =
$this->bo->cat_id;
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::{$this->appname}::responsible_matrix";
}
/**
@@ -189,7 +197,8 @@
'menuaction'=>
'property.uiresponsible.index',
'query' => $this->query,
'location' =>
$this->location,
- 'lookup' => $lookup
+ 'lookup' => $lookup,
+ 'appname' =>
$this->appname
));
@@ -198,16 +207,24 @@
$datatable['config']['base_java_url'] =
"menuaction:'property.uiresponsible.index',"
."query:'{$this->query}',"
."location:'{$this->location}',"
- ."lookup:'{$lookup}'";
+ ."lookup:'{$lookup}',"
+ ."appname:'{$this->appname}'";
- $values_combo_box[0] =
$this->bolocation->select_location('filter', $this->location);
- $default_value = array
('id'=>'','descr'=>lang('No location'));
- array_unshift
($values_combo_box[0],$default_value);
- foreach($values_combo_box[0] as &$_location)
+ $values_combo_box = array();
+
+ $locations =
$GLOBALS['phpgw']->locations->get_locations(false, $this->appname, false,
false, true);
+ foreach ( $locations as $loc_id => $loc_descr )
{
- $_location['name'] =
$_location['descr'];
+ $values_combo_box[0][] = array
+ (
+ 'id' => $loc_id,
+ 'name' => "{$loc_id}
[{$loc_descr}]",
+ );
}
+ $default_value = array
('id'=>'','name'=>lang('No location'));
+ array_unshift
($values_combo_box[0],$default_value);
+
$datatable['actions']['form'] = array
(
array
@@ -218,7 +235,8 @@
'menuaction'
=> 'property.uiresponsible.index',
'query'
=> $this->query,
'location'
=> $this->location,
- 'lookup'
=> $lookup
+ 'lookup'
=> $lookup,
+ 'appname'
=> $this->appname
)
),
'fields' => array
@@ -267,7 +285,7 @@
array
( //div values
combo_box_0
'id' =>
'values_combo_box_0',
- 'value'
=> $bocommon->select2String($values_combo_box[0], 'id','descr') //i.e.
id,value/id,vale/
+ 'value'
=> $bocommon->select2String($values_combo_box[0], 'id','name') //i.e.
id,value/id,vale/
)
)
)
@@ -282,7 +300,7 @@
'input_type' =>
array('hidden','text','text','text','text','hidden','text','text','hidden','hidden'),
'name' =>
array('id','name','descr','category','created_by','created_on','app_name','active','loc','location'),
'formatter' =>
array('','','','','','','','','',''),
- 'descr' =>
array('',lang('name'),lang('descr'),lang('category'),lang('supervisor'),'',lang('location'),lang('active'),'','')
+ 'descr' =>
array('',lang('name'),lang('descr'),lang('category'),lang('user'),'',lang('application'),lang('active'),'','')
);
$j=0;
@@ -400,7 +418,8 @@
'action'
=> $GLOBALS['phpgw']->link('/index.php',array
(
'menuaction'
=> 'property.uiresponsible.edit_type',
- //
'location' => $this->location
+ 'appname'
=> $this->appname
+// 'location'
=> $this->location
)),
'parameters' =>
$parameters3
);
@@ -415,7 +434,8 @@
'confirm_msg' =>
lang('do you really want to delete this entry'),
'action'
=> $GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction'
=> 'property.uiresponsible.delete_type'
+ 'menuaction'
=> 'property.uiresponsible.delete_type',
+ 'appname'
=> $this->appname
)),
'parameters' =>
$parameters
);
@@ -427,7 +447,8 @@
'text' =>
lang('contacts'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
- 'menuaction' =>
'property.uiresponsible.contact'
+ 'menuaction' =>
'property.uiresponsible.contact',
+ 'appname' =>
$this->appname
)),
'parameters' => $parameters2
);
@@ -441,6 +462,7 @@
'action'
=> $GLOBALS['phpgw']->link('/index.php',array
(
'menuaction'
=> 'property.uiresponsible.edit_type',
+ 'appname'
=> $this->appname,
'location'
=> $this->location
))
);
@@ -596,7 +618,7 @@
return;
}
- if(!$GLOBALS['phpgw']->locations->get_id('property',
$this->location))
+
if(!$GLOBALS['phpgw']->locations->get_id($this->appname, $this->location))
{
$receipt['error'][]=array('msg'=>lang('not a
valid location!'));
}
@@ -642,6 +664,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array
(
'menuaction'=> 'property.uiresponsible.index',
+
'appname' => $this->appname,
'location' => $this->location
));
}
@@ -652,6 +675,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array
(
'menuaction'=>
'property.uiresponsible.index',
+ 'appname' =>
$this->appname,
'location' =>
$this->location
));
}
@@ -672,6 +696,7 @@
(
'menuaction' =>
'property.uiresponsible.edit_type',
'id' => $id,
+ 'appname' =>
$this->appname,
'location' =>
$this->location
);
@@ -747,7 +772,8 @@
(
'menuaction' =>
'property.uiresponsible.edit_contact',
'id'
=> $entry['id'],
- 'location'
=> str_replace('property', '', $entry['app_name']),
+ 'appname'
=> $this->appname,
+ 'location'
=> str_replace($this->appname, '', $entry['app_name']),
'type_id'
=> $type_id
));
$lang_edit_text =
lang('edit type');
@@ -800,6 +826,7 @@
(
'menuaction' =>
'property.uiresponsible.contact',
'allrows'
=> $this->allrows,
+ 'appname'
=> $this->appname,
'location'
=> $this->location,
'type_id'
=> $type_id
)
@@ -813,6 +840,7 @@
(
'menuaction' =>
'property.uiresponsible.contact',
'allrows'
=> $this->allrows,
+ 'appname'
=> $this->appname,
'location'
=> $this->location,
'type_id'
=> $type_id
)
@@ -826,6 +854,7 @@
(
'menuaction' =>
'property.uiresponsible.contact',
'allrows'
=> $this->allrows,
+ 'appname'
=> $this->appname,
'location'
=> $this->location,
'type_id'
=> $type_id
)
@@ -839,6 +868,7 @@
(
'menuaction' =>
'property.uiresponsible.contact',
'allrows'
=> $this->allrows,
+ 'appname'
=> $this->appname,
'location'
=> $this->location,
'type_id'
=> $type_id
)
@@ -871,6 +901,7 @@
'sort' => $this->sort,
'order' => $this->order,
'query' => $this->query,
+ 'appname' =>
$this->appname,
'location' =>
$this->location,
'type_id' => $type_id
@@ -879,6 +910,7 @@
$link_add_action = array
(
'menuaction' =>
'property.uiresponsible.edit_contact',
+ 'appname' =>
$this->appname,
'location' =>
$this->location,
'type_id' => $type_id
);
@@ -891,8 +923,11 @@
'lang_cancel'
=> lang('cancel'),
'lang_cancel_statustext' =>
lang('back to list type'),
'cancel_action'
=> $GLOBALS['phpgw']->link('/index.php', array
- ('menuaction' =>
'property.uiresponsible.index'
- ))
+ (
+ 'menuaction' =>
'property.uiresponsible.index',
+ 'appname'
=> $this->appname
+ )
+ )
);
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data',
'responsible_contact_receipt');
@@ -1044,6 +1079,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array
(
'menuaction'=> 'property.uiresponsible.contact',
+
'appname' => $this->appname,
'location' => $this->location,
'type_id' => $type_id
));
@@ -1053,6 +1089,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array
(
'menuaction'=> 'property.uiresponsible.edit_contact',
+
'appname' => $this->appname,
'location' => $this->location,
'type_id' => $type_id,
'id'
=> $id
@@ -1080,6 +1117,7 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array
(
'menuaction'=>
'property.uiresponsible.contact',
+ 'appname'
=> $this->appname,
'location' =>
$this->location,
'type_id' => $type_id
));
@@ -1119,6 +1157,7 @@
(
'menuaction' =>
'property.uiresponsible.edit_contact',
'id' => $id,
+ 'appname' =>
$this->appname,
'location' =>
$this->location,
'type_id' => $type_id
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8275] property: more generic responsibilities,
Sigurd Nes <=