[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14252]
From: |
Nelson Guerra |
Subject: |
[Fmsystem-commits] [14252] |
Date: |
Fri, 30 Oct 2015 00:10:29 +0000 |
Revision: 14252
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14252
Author: nelson224
Date: 2015-10-30 00:10:28 +0000 (Fri, 30 Oct 2015)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind/frontend/inc/class.uientity.inc.php
Modified: branches/dev-syncromind/frontend/inc/class.uientity.inc.php
===================================================================
--- branches/dev-syncromind/frontend/inc/class.uientity.inc.php 2015-10-29
22:17:16 UTC (rev 14251)
+++ branches/dev-syncromind/frontend/inc/class.uientity.inc.php 2015-10-30
00:10:28 UTC (rev 14252)
@@ -42,6 +42,7 @@
'download' => true,
'view' => true,
'edit' => true,
+ 'query' => true
);
public function __construct()
@@ -126,6 +127,51 @@
$this->bo->org_units = $org_units;
}
+ private function _get_filters($selected = 0)
+ {
+ $values_combo_box = array();
+ $combos = array();
+
+ $custom =
createObject('phpgwapi.custom_fields');
+ $attrib_data =
$custom->find($this->type_app[$this->type],
".{$this->type}.{$this->entity_id}.{$this->cat_id}", 0, '', '', '', true, true);
+
+ if($attrib_data)
+ {
+ $count = count($values_combo_box);
+ foreach($attrib_data as $attrib)
+ {
+ if(($attrib['datatype'] == 'LB' ||
$attrib['datatype'] == 'CH' || $attrib['datatype'] == 'R') && $attrib['choice'])
+ {
+ $values_combo_box[$count][] =
array
+ (
+ 'id' => '',
+ 'name' =>
$attrib['input_text']
+ );
+
+ foreach($attrib['choice'] as
$choice)
+ {
+
$values_combo_box[$count][] = array
+ (
+ 'id' =>
$choice['id'],
+ 'name' =>
htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
+ );
+ }
+
+ $combos[] = array('type'
=> 'filter',
+ 'name' =>
$attrib['column_name'],
+ 'extra' => '',
+ 'text' =>
lang($attrib['column_name']),
+ 'list' =>
$values_combo_box[$count]
+ );
+
+ $count++;
+ }
+ }
+ }
+
+ return $combos;
+ }
+
/**
* Get the sublevels of the org tree into one arry
*/
@@ -173,15 +219,16 @@
{
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
}
-
+
$start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
+ $end_date = urldecode($this->end_date);
$dry_run = false;
$second_display = phpgw::get_var('second_display',
'bool');
// $this->save_sessiondata();
//Preferencias sets
+ /*
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['group_filters']
== 'yes')
{
$group_filters = 'select';
@@ -191,7 +238,8 @@
{
$group_filters = 'filter';
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
- }
+ }*/
+
$default_district =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
if ($default_district && !$second_display &&
!$this->district_id)
@@ -200,466 +248,103 @@
$this->district_id =
$default_district;
}
- $datatable = array();
if($this->cat_id)
{
$category =
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
}
- // enters the first time
- if( phpgw::get_var('phpgw_return_as') != 'json' )
- {
+ $filters = $this->_get_filters();
+ krsort($filters);
+
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $columns = phpgw::get_var('columns');
- $datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
- (
- 'menuaction'
=> 'frontend.uientity.index',
- 'entity_id'
=> $this->entity_id,
- 'cat_id' =>
$this->cat_id,
- 'type'
=> $this->type,
- 'district_id'
=> $this->district_id,
- 'p_num'
=> $this->p_num,
- 'location_id' =>
$this->location_id
- ));
- $datatable['config']['allow_allrows'] = true;
+ $params = array(
+ 'start' => 0,
+ 'results' => 10,
+ 'query' => $search['value'],
+ 'order' => 'num',
+ 'sort' => 'asc',
+ 'allrows' => phpgw::get_var('length',
'int') == -1,
+ 'start_date' => $start_date,
+ 'end_date' => $end_date,
+ 'dry_run' => true
+ );
- $datatable['config']['base_java_url'] =
"menuaction:'frontend.uientity.index',".
- "second_display:1,".
- "entity_id:'{$this->entity_id}',".
- "cat_id:'{$this->cat_id}',".
- "type:'{$this->type}',".
- "district_id:'{$this->district_id}',".
- "p_num:'{$this->p_num}',".
- "location_id:'{$this->location_id}'";
+ $values = $this->bo->read($params);
- // this array "$arr_filter_hide" indicate what
filters are hidden or not
- $arr_filter_hide = array();
+ $uicols = $this->bo->uicols;
- $datatable['actions']['form'] = array
- (
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
- array
- (
- 'menuaction'
=> 'frontend.uientity.index',
-
'second_display' => $second_display,
- 'entity_id'
=> $this->entity_id,
- 'cat_id'
=> $this->cat_id,
- 'type'
=> $this->type,
- 'location_id'
=> $this->location_id
- )),
- 'fields' => array
- (
- 'field' => array
- (
- /* array
- (
//boton search criteria
-
'id' => 'btn_criteria_id',
-
'name' => 'criteria_id',
-
'value' => lang('search criteria'),
-
'type' => 'button',
-
'style' => 'filter',
-
'tab_index' => 4
- ),*/
- array
- (//for
link "columns", next to Export button
-
'type'=> 'link',
-
'id' => 'btn_columns',
-
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
-
array
-
(
-
'menuaction' => 'property.uientity.columns',
-
'entity_id' => $this->entity_id,
-
'cat_id' => $this->cat_id,
-
'type' => $this->type
-
))."','link','width=300,height=600,scrollbars=1')",
-
'value' => lang('columns'),
-
'tab_index' => 11
- ),
- array
- (
-
'type' => 'button',
-
'id' => 'btn_export',
-
'value'=> lang('download'),
-
'tab_index' => 10
- ),
- array
- (
-
'type' => 'button',
-
'id' => 'btn_new',
-
'value'=> lang('add'),
-
'tab_index' => 9
- ),
- array
- (
//boton SEARCH
-
'id' => 'btn_search',
-
'name' => 'search',
-
'value'=> lang('search'),
-
'type' => 'button',
-
'tab_index' => 8
- ),
- array
- ( //
TEXT IMPUT
-
'name' => 'query',
-
'id' => 'txt_query',
-
'value'=> $this->query,
-
'type' => 'text',
-
'size' => 28,
-
'onkeypress' => 'return pulsar(event)',
-
'tab_index' => 7
- ),
- array
- (//for
link "None",
-
'type'=> 'label_date'
- ),
- array
- (
//hidden end_date
-
'type' => 'hidden',
-
'id' => 'end_date',
-
'name' => 'end_date',
-
'value' => $end_date
- ),
- array
- (
//hidden start_date
-
'type' => 'hidden',
-
'id' => 'start_date',
-
'name' => 'start_date',
-
'value' => $start_date
- )),
- /* array
- (//for
link "Date search",
-
'type'=> 'link',
-
'id' => 'btn_data_search',
-
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
-
array
-
(
-
'menuaction' =>
'property.uiproject.date_search'))."','link','width=350,height=250')",
-
'value' => lang('Date search'),
-
'tab_index' => 6
-
)),*/
- /* 'hidden_value'
=> array
- (
- array
- (
-
'id' => 'values_combo_box_0',
-
'value'=> $this->bocommon->select2String($values_combo_box[0])
- )
- )*/
- )));
+ $uicols['name'][] = 'img_id';
+ $uicols['descr'][] = 'dummy';
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['input_type'][] = 'hidden';
- $custom =
createObject('phpgwapi.custom_fields');
- $attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+ $uicols['name'][] = 'directory';
+ $uicols['descr'][] = 'directory';
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['input_type'][] = 'hidden';
- $button_def = array();
- $code_inner = array();
+ $uicols['name'][] = 'file_name';
+ $uicols['descr'][] = lang('name');
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['input_type'][] = 'hidden';
- $values_combo_box = array();
-/*
- $values_combo_box[0] =
$this->bo->get_criteria_list($this->criteria_id);
- $default_value = array
('id'=>'','name'=>lang('no criteria'));
- array_unshift
($values_combo_box[0],$default_value);
+ $uicols['name'][] = 'picture';
+ $uicols['descr'][] = '';
+ $uicols['sortable'][] = false;
+ $uicols['sort_field'][] = '';
+ $uicols['format'][] = '';
+ $uicols['formatter'][] = 'JqueryPortico.showPicture';
+ $uicols['input_type'][] = '';
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'id' => 'btn_criteria_id',
- 'name' => 'criteria_id',
- 'value' => lang('search criteria'),
- 'type' => 'button',
- 'style' => 'filter',
- 'tab_index' => 0
+ $count_uicols_name = count($uicols['name']);
+
+ $uicols_entity = array();
+ for($k = 0; $k < $count_uicols_name; $k++)
+ {
+ $params = array(
+ 'key' => $uicols['name'][$k],
+ 'label' =>
$uicols['descr'][$k],
+ 'sortable' =>
($uicols['sortable'][$k]) ? true : false,
+ 'hidden' =>
($uicols['input_type'][$k] == 'hidden') ? true : false
);
-
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
- (
- 'id' => "values_combo_box_0",
- 'value' =>
$this->bocommon->select2String($values_combo_box[0])
- );
-
- $button_def[] = "oMenuButton_0";
- $code_inner[] = "{order:0,
var_URL:'criteria_id',name:'btn_criteria_id',style:'genericbutton',dependiente:[]}";
-*/
- if($attrib_data)
+ if(!empty($uicols['formatter'][$k]))
{
- $i = 0;
- foreach ( $attrib_data as $attrib )
- {
- if(($attrib['datatype'] == 'LB'
|| $attrib['datatype'] == 'CH' || $attrib['datatype'] == 'R') &&
$attrib['choice'])
- {
-
$datatable['actions']['form'][0]['fields']['field'][] = array
- (
- 'id' =>
"btn_{$attrib['column_name']}",
- 'name' =>
$attrib['column_name'],
- 'value' =>
$attrib['input_text'],
- 'type' =>
'button',
- 'style' =>
'filter',
- 'tab_index' =>
$i
- );
-
- $button_def[] =
"oMenuButton_{$i}";
- $code_inner[] =
"{order:{$i},
var_URL:'{$attrib['column_name']}',name:'btn_{$attrib['column_name']}',style:'genericbutton',dependiente:[]}";
-
- $values_combo_box[$i][]
= array
- (
- 'id' => '',
- 'name' =>
$attrib['input_text'],
- );
-
-
-
foreach($attrib['choice'] as $choice)
- {
-
$values_combo_box[$i][] = array
- (
- 'id'
=> $choice['id'],
- 'name'
=> htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
- );
- }
-
-
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
- (
- 'id' =>
"values_combo_box_{$i}",
- 'value' =>
$this->bocommon->select2String($values_combo_box[$i])
- );
- $i++;
- }
- }
+ $params['formatter'] =
$uicols['formatter'][$k];
}
- if($button_def)
+ if($uicols['name'][$k] == 'entry_date' ||
$uicols['name'][$k] == 'num')
{
- $code = 'var ' . implode(',',
$button_def) . ";\n";
- $code .= 'var selectsButtons = [' .
"\n" . implode(",\n",$code_inner) . "\n];";
+ $params['hidden'] = true;
}
- else
- {
- $code .= 'var selectsButtons = [];';
- }
- $GLOBALS['phpgw']->js->add_code('', $code);
-
- // eliminates those empty filters
- $eliminate = 0;
- foreach( $arr_filter_hide as $key => $value )
+ $denied = array('merknad');
+ if(in_array($uicols['name'][$k], $denied))
{
- if ($value)
- {
- //eliminates the respective
entry in $datatable..['field']
-
array_splice($datatable['actions']['form'][0]['fields']['field'],$eliminate, 1);
- }
- else
- {
- $eliminate++;
- }
+ $params['sortable'] = false;
}
-
- // sets for initial ordering
- $this->sort = "ASC";
- $this->order = "num";
-// $dry_run = true;
- }
-
- $entity_list = array();
-
- $entity_list =
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date,
'dry_run' => $dry_run));
-
- $uicols = $this->bo->uicols;
-
- $j = count($uicols['name']);
- for ($i=0;$i<$j;$i++)
- {
- switch ($uicols['name'][$i])
+ else if(isset($uicols['cols_return_extra'][$k])
&& ($uicols['cols_return_extra'][$k] != 'T' || $uicols['cols_return_extra'][$k]
!= 'CH'))
{
- case 'entry_date':
- $uicols['input_type'][$i] =
'hidden';
- break;
-
+ $params['sortable'] = true;
}
- }
-
-
- $uicols['name'][] = 'img_id';
- $uicols['descr'][] = 'dummy';
- $uicols['sortable'][] = false;
- $uicols['sort_field'][] = '';
- $uicols['format'][] = '';
- $uicols['formatter'][] = '';
- $uicols['input_type'][] = 'hidden';
-
- $uicols['name'][] = 'directory';
- $uicols['descr'][] = 'directory';
- $uicols['sortable'][] = false;
- $uicols['sort_field'][] = '';
- $uicols['format'][] = '';
- $uicols['formatter'][] = '';
- $uicols['input_type'][] = 'hidden';
-
- $uicols['name'][] = 'file_name';
- $uicols['descr'][] = lang('name');
- $uicols['sortable'][] = false;
- $uicols['sort_field'][] = '';
- $uicols['format'][] = '';
- $uicols['formatter'][] = '';
- $uicols['input_type'][] = 'hidden';
-
- $uicols['name'][] = 'picture';
- $uicols['descr'][] = '';
- $uicols['sortable'][] = false;
- $uicols['sort_field'][] = '';
- $uicols['format'][] = '';
- /**
- * def of next $uicols['formatter'][] is moved down
- *
- */
- $uicols['input_type'][] = '';
-
-
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
- $custom_config =
CreateObject('admin.soconfig',$location_id);
- $_config = isset($custom_config->config_data) &&
$custom_config->config_data ? $custom_config->config_data : array();
-
- $remote_image_in_table = false;
- foreach ($_config as $_config_section =>
$_config_section_data)
- {
-
- if($_config_section_data['image_in_table'])
- {
-
- $remote_image_in_table = true;
- $js = <<<JS
- var show_picture_remote = function(elCell, oRecord, oColumn, oData)
- {
- if(oRecord.getData('img_id'))
- {
- sUrl = '{$_config_section_data['url']}';
- sUrl += '&{$_config_section_data['img_key_remote']}=' +
oRecord.getData('img_id');
- elCell.innerHTML = "<a href=\""+sUrl+"\"
title=\""+oRecord.getData('file_name')+"\" id=\""+oRecord.getData('img_id')+"\"
rel=\"colorbox\" target=\"_blank\"><img
src=\""+sUrl+"&{$_config_section_data['thumbnail_flag']}\"
alt=\""+oRecord.getData('file_name')+"\" /></a>";
- }
- }
-JS;
- $GLOBALS['phpgw']->js->add_code('',
$js);
-
- break;
- }
+ array_push($uicols_entity, $params);
}
-
- if(!$remote_image_in_table)
- {
-
- $uicols['formatter'][] = 'show_picture';
-
- $vfs = CreateObject('phpgwapi.vfs');
- $vfs->override_acl = 1;
-
- $img_types = array
- (
- 'image/jpeg',
- 'image/png',
- 'image/gif'
- );
- }
- else
- {
- $uicols['formatter'][] = 'show_picture_remote';
- }
-
-
- $j = count($ticket['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$ticket['files'][$i]['file_name']=urlencode($ticket['files'][$i]['name']);
- }
-
-
- $j=0;
- if (isset($entity_list) && is_array($entity_list))
- {
- foreach($entity_list as &$entity_entry)
- {
- $_loc1 = isset($entity_entry['loc1'])
&& $entity_entry['loc1'] ? $entity_entry['loc1'] : 'dummy';
-
-
- if($remote_image_in_table)
- {
- $entity_entry['file_name']
= $entity_entry[$_config_section_data['img_key_local']];
- // $entity_entry['directory']
= urlencode('external_source');
- $entity_entry['img_id']
= $entity_entry[$_config_section_data['img_key_local']];
- }
- else
- {
- $_files = $vfs->ls(array(
- 'string' =>
"/property/{$this->category_dir}/{$_loc1}/{$entity_entry['id']}",
- 'relatives' =>
array(RELATIVE_NONE)));
-
- if(isset($_files[0]) &&
$_files[0] && in_array($_files[0]['mime_type'], $img_types))
- {
-
$entity_entry['file_name'] = urlencode($_files[0]['name']);
-
$entity_entry['directory'] = urlencode($_files[0]['directory']);
- $entity_entry['img_id']
= $_files[0]['file_id'];
- }
- }
-
- for
($i=0;$i<count($uicols['name']);$i++)
- {
- switch ($uicols['name'][$i])
- {
- case 'num':
- case 'loc1':
- case 'loc2':
- case 'loc1_name':
-
$uicols['input_type'][$i] = 'hidden';
- break;
- }
-
-
if($uicols['input_type'][$i]!='hidden')
- {
-
if(isset($entity_entry['query_location'][$uicols['name'][$i]]))
- {
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['rows']['row'][$j]['column'][$i]['statustext'] =
lang('search');
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$entity_entry[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['format'] =
'link';
-
$datatable['rows']['row'][$j]['column'][$i]['java_link'] = true;
-
$datatable['rows']['row'][$j]['column'][$i]['link']
= $entity_entry['query_location'][$uicols['name'][$i]];
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$entity_entry[$uicols['name'][$i]];
-
//$datatable['rows']['row'][$j]['column'][$i]['value'] = $i;
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
//$datatable['rows']['row'][$j]['column'][$i]['lookup'] =
$lookup;
-
$datatable['rows']['row'][$j]['column'][$i]['align'] =
isset($uicols['align'][$i])?$uicols['align'][$i]:'center';
-
-
if(isset($uicols['datatype']) && isset($uicols['datatype'][$i]) &&
$uicols['datatype'][$i]=='link' && $entity_entry[$uicols['name'][$i]])
- {
-
$datatable['rows']['row'][$j]['column'][$i]['format'] = 'link';
-
$datatable['rows']['row'][$j]['column'][$i]['value'] = lang('link');
-
$datatable['rows']['row'][$j]['column'][$i]['link'] =
$entity_entry[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
- }
- //override
action
-
if(isset($uicols['javascript_action']) &&
isset($uicols['javascript_action'][$uicols['name'][$i]]))
- {
-
$datatable['rows']['row'][$j]['column'][$i]['format']
= 'javascript_action';
-
$datatable['rows']['row'][$j]['column'][$i]['javascript_action'] =
$entity_entry[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['value']
= $uicols['descr'][$i];
- }
- }
- }
- else
- {
-
$datatable['rows']['row'][$j]['column'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$entity_entry[$uicols['name'][$i]];
- }
-
$datatable['rows']['row'][$j]['hidden'][$i]['value']
= $entity_entry[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['hidden'][$i]['name']
= $uicols['name'][$i];
- }
-
- $j++;
- }
- }
- $vfs->override_acl = 0;
//indica que de la fila seleccionada escogera de la
columna "id" el valor "id". Para agregarlo al URL
$parameters = array
(
@@ -694,51 +379,33 @@
),
)
);
-
- if($this->acl_read)
+
+ $tabletools = array();
+ if ($this->acl_read)
{
- $datatable['rowactions']['action'][] = array
+ $tabletools[] = array
(
'my_name' =>
'view',
'text' =>
lang('view'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction' =>
'frontend.uientity.view',
- 'location_id'
=>$location_id,
+ 'location_id' =>
$this->location_id,
)),
- 'parameters'
=> $parameters
+ 'parameters' =>
json_encode($parameters)
);
}
-/*
- if($this->acl_edit)
+ if ($category['start_ticket'])
{
- $datatable['rowactions']['action'][] = array
+ $tabletools[] = array
(
'my_name' =>
'edit',
- 'text' =>
lang('edit'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'frontend.uientity.edit',
- 'entity_id'
=> $this->entity_id,
- 'cat_id'
=> $this->cat_id,
- 'type'
=> $this->type
- )),
- 'parameters'
=> $parameters
- );
- }
-*/
- if( $category['start_ticket'])
- {
- $datatable['rowactions']['action'][] = array
- (
- 'my_name' =>
'edit',
'text' =>
lang('start ticket'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction' =>
'frontend.uihelpdesk.add_ticket',
'noframework' => 1,
-// 'target'
=> '_blank',
'target'
=> '_tinybox',
'p_entity_id' =>
$this->entity_id,
'p_cat_id'
=> $this->cat_id,
@@ -746,294 +413,198 @@
'bypass'
=> true,
'origin'
=> ".{$this->type}.{$this->entity_id}.{$this->cat_id}",
)),
- 'parameters'
=> $parameters2
+ 'parameters' =>
json_encode($parameters2)
);
}
- if($this->acl_add)
+ if ($this->acl_add)
{
- $datatable['rowactions']['action'][] = array
+ $tabletools[] = array
(
'my_name' =>
'add_tinybox',
'text' =>
lang('add'),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction' =>
'property.uientity.edit',
- 'location_id' =>
$location_id,
+ 'location_id' =>
$this->location_id,
'lean'
=> true,
'noframework' => true,
'target'
=> '_tinybox',
)),
- 'parameters'
=> array('parameter' => array(array('name'=> 'dummy','source' => 'id')))
+ 'parameters' =>
array('parameter' => array(array('name'=> 'dummy', 'source' => 'id')))
);
}
- $GLOBALS['phpgw']->js->validate_file('tinybox2',
'packed' , 'property');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
-
$jasper = execMethod('property.sojasper.read',
array('location_id' =>
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type],
$this->acl_location)));
foreach ($jasper as $report)
{
- $datatable['rowactions']['action'][] = array
+ $tabletools[] = array
(
'my_name' =>
'edit',
'text' =>
lang('open JasperReport %1 in new window', $report['title']),
'action' =>
$GLOBALS['phpgw']->link('/index.php',array
(
'menuaction' =>
'property.uijasper.view',
- 'jasper_id'
=> $report['id'],
+ 'jasper_id'
=> $report['id'],
'target'
=> '_blank'
)),
- 'parameters'
=> $parameters
+ 'parameters' =>
json_encode($parameters)
);
}
-/*
- if($this->acl_delete)
- {
- $datatable['rowactions']['action'][] = array
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_0',
+ 'requestUrl' => json_encode(self::link(array
(
- 'my_name' =>
'delete',
- 'text' =>
lang('delete'),
- 'confirm_msg' => lang('do you
really want to delete this entry'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'frontend.uientity.delete',
- 'entity_id'
=> $this->entity_id,
- 'cat_id'
=> $this->cat_id,
- 'type'
=> $this->type
- )),
- 'parameters' => $parameters
- );
- }
+ 'menuaction'
=> 'frontend.uientity.query',
+ 'entity_id'
=> $this->entity_id,
+ 'cat_id' =>
$this->cat_id,
+ 'type'
=> $this->type,
+ 'district_id'
=> $this->district_id,
+ 'p_num'
=> $this->p_num,
+ 'location_id'
=> $this->location_id,
+ 'phpgw_return_as'
=> 'json'))
+ ),
+ 'ColumnDefs' => $uicols_entity,
+ 'tabletools' => $tabletools
+ );
+ $appname = lang('entity');
- if($this->acl_add)
+ //Title of Page
+ if($this->entity_id && $this->cat_id)
{
- $datatable['rowactions']['action'][] = array
- (
- 'my_name' =>
'add',
- 'text' =>
lang('add'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'frontend.uientity.edit',
- 'entity_id'
=> $this->entity_id,
- 'cat_id'
=> $this->cat_id,
- 'type'
=> $this->type
- ))
- );
+ $entity =
$this->soadmin_entity->read_single($this->entity_id,false);
+ $appname = $entity['name'];
+ $category =
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $function_msg = 'list ' . $category['name'];
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
}
-*/
- unset($parameters);
- //$uicols_count indicates the number of columns to
display in actuall option-menu. this variable was set in $this->bo->read()
- if(!isset($uicols['javascript_action']) ||
!$uicols['javascript_action'])
- {
- $link = $GLOBALS['phpgw']->link(
- '/index.php',
- array('menuaction' =>
'frontend.uientity.view'));
- $datatable['exchange_values'] =
"document.location = '{$link}&id=' + data.getData().id +
'&location_id={$this->location_id}';";
- }
+ $msglog =
phpgwapi_cache::session_get('frontend','msgbox');
+ phpgwapi_cache::session_clear('frontend','msgbox');
+ $data = array(
+ 'header' =>
$this->header_state,
+ 'entity' =>
array('datatable_def' => $datatable_def, 'tabs' => $this->tabs, 'filters' =>
$filters, 'location_id' => $this->location_id, 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))),
+ 'lightbox_name' => lang('add ticket')
+ );
- $uicols_count = count($uicols['descr']);
+ self::render_template_xsl(array( 'entity',
'datatable_inline', 'frontend'), array('data' => $data));
+ }
- //Columns Order
- for ($i=0;$i<$uicols_count;$i++)
- {
- //all colums should be have formatter
-
$datatable['headers']['header'][$i]['formatter'] =
($uicols['formatter'][$i]==''? '""' : $uicols['formatter'][$i]);
+
+ public function query()
+ {
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
- if($uicols['input_type'][$i]!='hidden')
- {
-
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = true;
-
$datatable['headers']['header'][$i]['format'] =
$this->bocommon->translate_datatype_format($uicols['datatype'][$i]);
-
$datatable['headers']['header'][$i]['sortable'] =
$uicols['sortable'][$i];;
-
$datatable['headers']['header'][$i]['sort_field'] =
$uicols['name'][$i];
-
//$datatable['headers']['header'][$i]['formatter'] =
$uicols['formatter'][$i];
- //according to stable bruch this
columns is not SORTABLE'
- $denied = array('merknad');//$denied =
array('merknad','account_lid');
- //if not include
- if(in_array ($uicols['name'][$i],
$denied))
- {
-
$datatable['headers']['header'][$i]['sortable'] = false;
- }
- else
if(isset($uicols['cols_return_extra'][$i]) &&
($uicols['cols_return_extra'][$i]!='T' ||
$uicols['cols_return_extra'][$i]!='CH'))
- {
-
$datatable['headers']['header'][$i]['sortable'] = true;
- }
-
- }
- else
- {
-
$datatable['headers']['header'][$i]['name'] =
$uicols['name'][$i];
-
$datatable['headers']['header'][$i]['text'] =
$uicols['descr'][$i];
-
$datatable['headers']['header'][$i]['visible'] = false;
-
$datatable['headers']['header'][$i]['sortable'] = false;
-
$datatable['headers']['header'][$i]['format'] = 'hidden';
- }
+ if($start_date && empty($end_date))
+ {
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $end_date =
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), date("d"),
date("Y")), $dateformat);
}
- // path for property.js
- $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $draw = phpgw::get_var('draw', 'int');
+ $columns = phpgw::get_var('columns');
- // Pagination and sort values
- $datatable['pagination']['records_start'] =
(int)$this->bo->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $params = array(
+ 'start' => phpgw::get_var('start',
'int', 'REQUEST', 0),
+ 'results' => phpgw::get_var('length',
'int', 'REQUEST', 0),
+ 'query' => $search['value'],
+ 'order' =>
$columns[$order[0]['column']]['data'],
+ 'sort' => $order[0]['dir'],
+ 'allrows' => phpgw::get_var('length',
'int') == -1,
+ 'start_date' => $start_date,
+ 'end_date' => $end_date
+ );
- if($dry_run)
+ $values = $this->bo->read($params);
+ if(phpgw::get_var('export', 'bool'))
{
- $datatable['pagination']['records_returned'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ return $values;
}
- else
- {
- $datatable['pagination']['records_returned']=
count($entity_list);
- }
- $datatable['pagination']['records_total'] =
$this->bo->total_records;
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+ $custom_config = CreateObject('admin.soconfig',
$location_id);
+ $_config =
isset($custom_config->config_data) && $custom_config->config_data ?
$custom_config->config_data : array();
- $datatable['sorting']['order'] =
phpgw::get_var('order', 'string'); // Column
- $datatable['sorting']['sort'] =
phpgw::get_var('sort', 'string'); // ASC / DESC
-
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
+ $remote_image_in_table = false;
+ foreach($_config as $_config_section =>
$_config_section_data)
{
- $datatable['sorting']['order']
= 'id'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'desc'; // ASC / DESC
+ if($_config_section_data['image_in_table'])
+ {
+ $remote_image_in_table = true;
+ break;
+ }
}
- else
- {
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
- }
+ $vfs =
CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
- //-BEGIN----------------------------- JSON CODE
------------------------------
+ $img_types = array
+ (
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif'
+ );
- //values for Pagination
- $json = array
+ $link_data = array
(
- 'recordsReturned' =>
$datatable['pagination']['records_returned'],
- 'totalRecords' =>
(int)$datatable['pagination']['records_total'],
- 'startIndex' =>
$datatable['pagination']['records_start'],
- 'sort' =>
$datatable['sorting']['order'],
- 'dir' =>
$datatable['sorting']['sort'],
- 'records' =>
array()
- );
+ 'menuaction' => 'property.uientity.edit',
+ 'entity_id' => $this->entity_id,
+ 'cat_id' => $this->cat_id,
+ 'type' => $this->type
+ );
- // values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row']))
+ foreach($values as &$entity_entry)
{
- foreach( $datatable['rows']['row'] as $row )
+ $_loc1 = isset($entity_entry['loc1']) &&
$entity_entry['loc1'] ? $entity_entry['loc1'] : 'dummy';
+
+ if($remote_image_in_table)
{
- $json_row = array();
- foreach( $row['column'] as $column)
+ $entity_entry['file_name']
= $entity_entry[$_config_section_data['img_key_local']];
+ $entity_entry['img_id']
= $entity_entry[$_config_section_data['img_key_local']];
+ $entity_entry['img_url']
= $_config_section_data['url'] . '&' . $_config_section_data['img_key_remote']
. '=' . $entity_entry['img_id'];
+ $entity_entry['thumbnail_flag'] =
$_config_section_data['thumbnail_flag'];
+ }
+ else
+ {
+ $_files = $vfs->ls(array(
+ 'string' =>
"/property/{$this->category_dir}/{$_loc1}/{$entity_entry['id']}",
+ 'relatives' =>
array(RELATIVE_NONE)));
+
+ $mime_in_array =
in_array($_files[0]['mime_type'], $img_types);
+ if(!empty($_files[0]) && $mime_in_array)
{
- if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
- {
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
- }
- else
if(isset($column['format']) && $column['format']== "link")
- {
-
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>"
.$column['value']."</a>";
- }
- else
if(isset($column['format']) && $column['format']== "javascript_action")
- {
-
$json_row[$column['name']] = "<a href='#' title='{$column['statustext']}'
onclick='javascript:{$column['javascript_action']}'>{$column['value']}</a>";
- }
- else
- {
-
$json_row[$column['name']] = $column['value'];
- }
+ $entity_entry['file_name']
= $_files[0]['name'];
+ $entity_entry['img_id']
= $_files[0]['file_id'];
+ $entity_entry['directory']
= $_files[0]['directory'];
+ $entity_entry['img_url']
= self::link(array(
+ 'menuaction' =>
'property.uigallery.view_file',
+ 'file' =>
$entity_entry['directory'] . '/' . $entity_entry['file_name']
+ ));
+ $entity_entry['thumbnail_flag']
= 'thumb=1';
}
- $json['records'][] = $json_row;
}
- }
- //---no exits depended filters
- $json['hidden']['dependent'][] = array ( );
-
- // checks right in datatable
- if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
- {
- $json ['rights'] =
$datatable['rowactions']['action'];
+ $link_data['id'] =
$entity_entry['id'];
+ $entity_entry['link'] =
self::link($link_data);
}
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- return $json;
- }
+ $result_data = array('results' => $values);
+ $result_data['total_records'] =
$this->bo->total_records;
+ $result_data['draw'] = $draw;
- $datatable['json_data'] = json_encode($json);
- //-END------------------- JSON CODE
----------------------
-
- // Prepare template variables and process XSLT
- $template_vars = array();
- $template_vars['datatable'] = $datatable;
-//
$GLOBALS['phpgw']->xslttpl->add_file(array('datatable'));
-// $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
$template_vars);
-
- if ( !isset($GLOBALS['phpgw']->css) ||
!is_object($GLOBALS['phpgw']->css) )
- {
- $GLOBALS['phpgw']->css =
createObject('phpgwapi.css');
- }
-
-
- $appname = lang('entity');
-
- phpgwapi_yui::load_widget('dragdrop');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('menu');
- phpgwapi_yui::load_widget('connection');
- //// cramirez: necesary for include a partucular js
- phpgwapi_yui::load_widget('loader');
- //cramirez: necesary for use opener . Avoid error JS
- phpgwapi_yui::load_widget('tabview');
- phpgwapi_yui::load_widget('paginator');
- //FIXME this one is only needed when $lookup==true - so
there is probably an error
- phpgwapi_yui::load_widget('animation');
-
- // Prepare CSS Style
- $GLOBALS['phpgw']->css->validate_file('datatable');
- $GLOBALS['phpgw']->css->validate_file('property');
-
$GLOBALS['phpgw']->css->add_external_file('property/templates/base/css/property.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
-
- //Title of Page
- if($this->entity_id && $this->cat_id)
- {
- $entity =
$this->soadmin_entity->read_single($this->entity_id,false);
- $appname = $entity['name'];
- $category =
$this->soadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $function_msg = 'list ' . $category['name'];
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;
- }
-
- // Prepare YUI Library
-
-
- $GLOBALS['phpgw']->js->validate_file('yahoo',
'entity.list' , 'frontend');
-
- $msglog =
phpgwapi_cache::session_get('frontend','msgbox');
- phpgwapi_cache::session_clear('frontend','msgbox');
-
- $data = array(
- 'header' => $this->header_state,
- 'tabs' => $this->tabs,
- 'entity' => array('datatable' =>
$datatable, 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msglog))),
- 'lightbox_name' => lang('add ticket')
- );
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('frontend',
'entity', 'datatable'));
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('app_data' => $data));
+ return $this->jquery_results($result_data);
}
-
-
+
+
public function view()
{
if(!$this->acl_read)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14252],
Nelson Guerra <=