[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12534]
From: |
Nelson Guerra |
Subject: |
[Fmsystem-commits] [12534] |
Date: |
Mon, 05 Jan 2015 23:34:07 +0000 |
Revision: 12534
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12534
Author: nelson224
Date: 2015-01-05 23:34:06 +0000 (Mon, 05 Jan 2015)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind/property/inc/class.uilookup.inc.php
Modified: branches/dev-syncromind/property/inc/class.uilookup.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uilookup.inc.php 2015-01-05
13:15:10 UTC (rev 12533)
+++ branches/dev-syncromind/property/inc/class.uilookup.inc.php 2015-01-05
23:34:06 UTC (rev 12534)
@@ -786,8 +786,7 @@
)),
'allrows' => true,
'editor_action' => '',
- 'field' => array(),
- 'actions' => ''
+ 'field' => array()
)
);
@@ -2206,124 +2205,37 @@
{
$column = phpgw::get_var('column');
- if( phpgw::get_var('phpgw_return_as') != 'json' )
+ if( phpgw::get_var('phpgw_return_as') == 'json' )
{
+ $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'
=> 'property.uilookup.phpgw_user',
- 'second_display' => true,
- 'cat_id'
=> $this->cat_id,
- 'query'
=> $this->query,
- 'filter'
=> $this->filter,
- 'column'
=> $column
- ));
+ $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'],
+ 'dir' => $order[0]['dir'],
+ 'cat_id' => phpgw::get_var('cat_id',
'int', 'REQUEST', 0),
+ 'allrows' => phpgw::get_var('length',
'int') == -1
+ );
- $datatable['config']['allow_allrows'] = true;
+ $values = $this->bo->read_phpgw_user($params);
- $datatable['config']['base_java_url'] =
"menuaction:'property.uilookup.phpgw_user',"
- ."second_display:true,"
- ."cat_id:'{$this->cat_id}',"
- ."query:'{$this->query}',"
- ."filter:'{$this->filter}',"
- ."column:'{$column}'";
+ $result_data = array('results' => $values);
- $datatable['actions']['form'] = array
- (
- array
- (
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',
- array
- (
- 'menuaction'
=> 'property.uilookup.phpgw_user',
-
'second_display' => true,
- 'cat_id'
=> $this->cat_id,
- 'query'
=> $this->query,
- 'filter'
=> $this->filter,
- 'column'
=> $column
- )
- ),
- 'fields' => array
- (
- 'field' => array
- (
- array
- ( //boton
SEARCH
- 'id' =>
'btn_search',
- 'name'
=> 'search',
- 'value'
=> lang('search'),
- 'type'
=> 'button',
-
'tab_index' => 2
- ),
- array
- ( // TEXT IMPUT
- 'name'
=> 'query',
- 'id'
=> 'txt_query',
- 'value'
=> '',//'',//$query,
- 'type'
=> 'text',
- 'size'
=> 28,
-
'onkeypress' => 'return pulsar(event)',
-
'tab_index' => 1
- )
- ),
- 'hidden_value' => array
- (
- )
- )
- )
- );
- }
+ $result_data['total_records'] =
$this->bo->total_records;
+ $result_data['draw'] = $draw;
- $uicols = array (
- 'input_type' =>
array('text','hidden','text','text'),
- 'name' =>
array('id','account_lid','first_name','last_name'),
- 'sort_field' =>
array('account_id','account_lid','account_firstname','account_lastname'),
- 'formatter' =>
array('','','',''),
- 'descr' =>
array(lang('ID'),'',lang('first name'),lang('last name'))
- );
-
- $phpgw_user_list = array();
- $phpgw_user_list = $this->bo->read_phpgw_user();
-
- $content = array();
- $j=0;
- if (isset($phpgw_user_list) &&
is_array($phpgw_user_list))
- {
- foreach($phpgw_user_list as $phpgw_user_entry)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
$datatable['rows']['row'][$j]['column'][$i]['value'] =
$phpgw_user_entry[$uicols['name'][$i]];
-
$datatable['rows']['row'][$j]['column'][$i]['name'] = $uicols['name'][$i];
- }
- $j++;
- }
+ return $this->jquery_results($result_data);
}
- $uicols_count = count($uicols['descr']);
- $datatable['rowactions']['action'] = array();
- for ($i=0;$i<$uicols_count;$i++)
- {
- //all colums should be have formatter
-
$datatable['headers']['header'][$i]['formatter'] =
($uicols['formatter'][$i]==''? '""' : $uicols['formatter'][$i]);
- 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]['sortable'] = true;
-
$datatable['headers']['header'][$i]['sort_field'] =
$uicols['sort_field'][$i];
- }
- 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';
- }
- }
-
+ self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.jeditable.js');
+ self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.dataTables.editable.js');
+
if($column)
{
$user_id =$column;
@@ -2335,117 +2247,66 @@
$user_name ='user_name';
}
- $function_exchange_values = '';
+ $action = '';
+ $action .=
'window.parent.document.getElementById("'.$user_id.'").value = "";'."\r";
+ $action .=
'window.parent.document.getElementById("'.$user_name.'").value = "";'."\r";
+ $action .=
'window.parent.document.getElementById("'.$user_id.'").value =
aData["id"];'."\r";
+ $action .=
'window.parent.document.getElementById("'.$user_name.'").value =
aData["first_name"];'."\r";
+ $action .=
'window.parent.JqueryPortico.onPopupClose("close");'."\r";
+
+ $data = array(
+ 'left_click_action' => $action,
+ 'datatable_name' => '',
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array()
+ )
+ ),
+ 'datatable' => array(
+ 'source' => self::link(array(
+ 'menuaction' =>
'property.uilookup.phpgw_user',
+ 'second_display'
=> true,
+ 'cat_id'
=> $this->cat_id,
+ 'query'
=> $this->query,
+ 'filter'
=> $this->filter,
+ 'column'
=> $column,
+ 'phpgw_return_as' =>
'json'
+ )),
+ 'allrows' => true,
+ 'editor_action' => '',
+ 'field' => array()
+ )
+ );
- $function_exchange_values .=
'opener.document.getElementsByName("'.$user_id.'")[0].value = "";' ."\r\n";
- $function_exchange_values .=
'opener.document.getElementsByName("'.$user_name.'")[0].value = "";' ."\r\n";
+ $uicols = array (
+ 'input_type' =>
array('text','hidden','text','text'),
+ 'name' =>
array('id','account_lid','first_name','last_name'),
+ 'sort_field' =>
array('account_id','account_lid','account_firstname','account_lastname'),
+ 'descr' =>
array(lang('ID'),'',lang('first name'),lang('last name'))
+ );
- $function_exchange_values .=
'opener.document.getElementsByName("'.$user_id.'")[0].value =
data.getData("id");' ."\r\n";
- $function_exchange_values .=
'opener.document.getElementsByName("'.$user_name.'")[0].value =
data.getData("first_name") + " " + data.getData("last_name");' ."\r\n";
-
- $function_exchange_values .= 'window.close()';
-
- $datatable['exchange_values'] =
$function_exchange_values;
- $datatable['valida'] = '';
-
- // path for property.js
- $property_js = "/property/js/yahoo/property.js";
-
- if
(!isset($GLOBALS['phpgw_info']['server']['no_jscombine']) ||
!$GLOBALS['phpgw_info']['server']['no_jscombine'])
- {
- $cachedir =
urlencode($GLOBALS['phpgw_info']['server']['temp_dir']);
- $property_js =
"/phpgwapi/inc/combine.php?cachedir={$cachedir}&type=javascript&files=" .
str_replace('/', '--', ltrim($property_js,'/'));
+ $count_uicols_name = count($uicols['name']);
+
+ for($k=0;$k<$count_uicols_name;$k++)
+ {
+ $params = array(
+ 'key' =>
$uicols['name'][$k],
+ 'label' =>
$uicols['descr'][$k],
+ 'sortable' =>
false,
+ 'hidden' =>
false
+ );
+
+ array_push ($data['datatable']['field'],
$params);
}
- $datatable['property_js'] =
$GLOBALS['phpgw_info']['server']['webserver_url'] . $property_js;
-
- // Pagination and sort values
- $datatable['pagination']['records_start'] =
(int)$this->start;
- $datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $datatable['pagination']['records_returned']=
count($phpgw_user_list);
- $datatable['pagination']['records_total'] =
$this->bo->total_records;
-
- if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
- {
- $datatable['sorting']['order']
= 'id'; // name key Column in myColumnDef
- $datatable['sorting']['sort']
= 'asc'; // ASC / DESC
- }
- else
- {
- $datatable['sorting']['order']
= phpgw::get_var('order', 'string'); // name of column of Database
- $datatable['sorting']['sort']
= phpgw::get_var('sort', 'string'); // ASC / DESC
- }
-
$appname
= lang('standard description');
$function_msg =
lang('list standard description');
-
- //-- BEGIN----------------------------- JSON CODE
------------------------------
-
- //values for Pagination
- $json = 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()
- );
-
- // values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
- foreach( $datatable['rows']['row'] as $row )
- {
- $json_row = array();
- foreach( $row['column'] as $column)
- {
- 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
- {
-
$json_row[$column['name']] = $column['value'];
- }
- }
- $json['records'][] = $json_row;
- }
- }
-
- // right in datatable
- if(isset($datatable['rowactions']['action']) &&
is_array($datatable['rowactions']['action']))
- {
- $json ['rights'] =
$datatable['rowactions']['action'];
- }
-
- if( phpgw::get_var('phpgw_return_as') == 'json' )
- {
- return $json;
- }
-
-
- $datatable['json_data'] = json_encode($json);
- //-------------------- 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);
-
- //Title of Page
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
- // Prepare YUI Library
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'lookup.tenant.index', 'property' );
-
- $this->save_sessiondata();
+
+ self::render_template_xsl('datatable_jquery', $data);
}
+
function project_group()
{
@@ -3390,8 +3251,7 @@
)),
'allrows' => true,
'editor_action' => '',
- 'field' => array(),
- 'actions' => ''
+ 'field' => array()
)
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12534],
Nelson Guerra <=