[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7405] property: custom columns
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7405] property: custom columns |
Date: |
Mon, 20 Jun 2011 13:21:29 +0000 |
Revision: 7405
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7405
Author: sigurdne
Date: 2011-06-20 13:21:29 +0000 (Mon, 20 Jun 2011)
Log Message:
-----------
property: custom columns
Modified Paths:
--------------
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.soentity.inc.php
trunk/property/inc/class.uientity.inc.php
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2011-06-20 13:19:25 UTC (rev
7404)
+++ trunk/property/inc/class.boentity.inc.php 2011-06-20 13:21:29 UTC (rev
7405)
@@ -52,10 +52,10 @@
var $public_functions = array
(
'read' => true,
- 'read_single' => true,
+ 'read_single' => true,
'save' => true,
'delete' => true,
- 'check_perms' => true
+ 'check_perms' => true
);
var $type_app = array();
@@ -211,10 +211,32 @@
}
$filter = array('list' => ''); // translates to "list
IS NULL"
$columns =
$this->custom->find($this->type_app[$this->type],".{$this->type}.{$entity_id}.{$cat_id}",
0, '','','',true, false, $filter);
+ $columns = array_merge( $columns,
$this->get_column_list() );
$column_list=$this->bocommon->select_multi_list($selected,$columns);
return $column_list;
}
+ function get_column_list()
+ {
+ $columns = array();
+ $columns['user_id'] = array
+ (
+ 'id' => 'user_id',
+ 'input_type' => 'text',
+ 'name' => 'user_id',
+ 'descr' => lang('User'),
+ 'statustext' => lang('User'),
+ 'align' => '',
+ 'datatype' => 'user',
+ 'sortable' => false,
+ 'exchange' => false,
+ 'formatter' => '',
+ 'classname' => ''
+ );
+
+ return $columns;
+ }
+
function select_category_list($format='',$selected='',
$required = '')
{
switch($format)
@@ -316,10 +338,28 @@
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
+
+ $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]["{$this->type}_columns_{$this->entity_id}_{$this->cat_id}"])?$GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]["{$this->type}_columns_{$this->entity_id}_{$this->cat_id}"]:array();
+ $custom_cols = $this->get_column_list();
+//_debug_array($user_columns);
+//_debug_array($column_list);
+/*
+ foreach ($custom_cols as $col_id => $col_info)
+ {
+ if( in_array( $col_id, $user_columns ) )
+ {
+ $cols_extra[] = array
+ (
+ 'name' => $col_id,
+ 'datatype' =>
$column_list[$col_id]['datatype']
+ );
+ }
+ }
+*/
$cols_extra = $this->so->cols_extra;
$cols_return_lookup =
$this->so->cols_return_lookup;
//_debug_array($entity);
- //_debug_array($cols_extra);
+// _debug_array($cols_extra);
//_debug_array($cols_return_lookup);
// if(isset($data['lookup']) && $data['lookup'])
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2011-06-20 13:19:25 UTC (rev
7404)
+++ trunk/property/inc/class.soentity.inc.php 2011-06-20 13:21:29 UTC (rev
7405)
@@ -210,16 +210,6 @@
$cols .= ", {$entity_table}.user_id";
$cols_return[] =
'user_id';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'user_id';
- $uicols['descr'][] =
lang('User');
- $uicols['statustext'][] = lang('User');
- $uicols['align'][] = '';
- $uicols['datatype'][] = 'user';
- $uicols['sortable'][] = false;
- $uicols['exchange'][] = false;
- $uicols['formatter'][] = '';
- $uicols['classname'][] = '';
$cols_return_extra[]= array
(
@@ -259,11 +249,20 @@
{
//-------------------
- $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]['entity_columns_'.$entity_id.'_'.$cat_id])?$GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]['entity_columns_'.$entity_id.'_'.$cat_id]:'';
+ $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]['entity_columns_'.$entity_id.'_'.$cat_id])?$GLOBALS['phpgw_info']['user']['preferences'][$this->type_app[$this->type]]['entity_columns_'.$entity_id.'_'.$cat_id]:array();
+
+ $_user_columns = array();
+ foreach ($user_columns as $user_column_id)
+ {
+ if(ctype_digit($user_column_id))
+ {
+ $_user_columns[] =
$user_column_id;
+ }
+ }
$user_column_filter = '';
if (isset($user_columns) AND
is_array($user_columns) AND $user_columns[0])
{
- $user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$user_columns) .'))';
+ $user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$_user_columns) .'))';
}
$this->db->query("SELECT * FROM
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER
BY group_id, attrib_sort ASC");
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2011-06-20 13:19:25 UTC (rev
7404)
+++ trunk/property/inc/class.uientity.inc.php 2011-06-20 13:21:29 UTC (rev
7405)
@@ -1118,7 +1118,7 @@
{
$id = phpgw::get_var('id', 'int');
- if(!$this->acl_add && !$this->acl_edit)
+ if($mode == 'edit' && (!$this->acl_add &&
!$this->acl_edit))
{
$GLOBALS['phpgw']->redirect_link('/index.php',array
(
@@ -1797,7 +1797,14 @@
for($z=0; $z<count($values['files']); $z++)
{
$content_files[$z]['file_name'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&file_name='.$values['files'][$z]['name'].'"
target="_blank" title="'.lang('click to view
file').'">'.$values['files'][$z]['name'].'</a>';
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]"
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete
file').'">';
+ if($mode == 'edit')
+ {
+ $content_files[$z]['delete_file'] =
'<input type="checkbox" name="values[file_action][]"
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete
file').'">';
+ }
+ else
+ {
+ $content_files[$z]['delete_file'] = '';
+ }
}
$datavalues[0] = array
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7405] property: custom columns,
Sigurd Nes <=