[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11908] property: more on org_unit
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11908] property: more on org_unit |
Date: |
Sun, 13 Apr 2014 16:32:06 +0000 |
Revision: 11908
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11908
Author: sigurdne
Date: 2014-04-13 16:32:05 +0000 (Sun, 13 Apr 2014)
Log Message:
-----------
property: more on org_unit
Modified Paths:
--------------
trunk/phpgwapi/templates/base/datatable.xsl
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.soentity.inc.php
trunk/property/inc/class.uientity.inc.php
trunk/property/inc/class.uilookup.inc.php
trunk/property/js/yahoo/entity.index.js
trunk/property/js/yahoo/property.js
Added Paths:
-----------
trunk/property/js/yahoo/lookup.generic.index.js
Modified: trunk/phpgwapi/templates/base/datatable.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable.xsl 2014-04-12 13:57:37 UTC (rev
11907)
+++ trunk/phpgwapi/templates/base/datatable.xsl 2014-04-13 16:32:05 UTC (rev
11908)
@@ -307,6 +307,9 @@
<xsl:when test="type='link'">
<a id="{id}" href="#" onclick="{url}"
tabindex="{tab_index}"><xsl:value-of select="value"/></a>
</xsl:when>
+ <xsl:when test="type='label_org_unit'">
+ <table><tbody><tr><td><span
id="txt_org_unit"></span></td></tr></tbody></table>
+ </xsl:when>
<xsl:when test="type='label_date'">
<table><tbody><tr><td><span
id="txt_start_date"></span></td></tr><tr><td><span
id="txt_end_date"></span></td></tr></tbody></table>
</xsl:when>
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2014-04-12 13:57:37 UTC (rev
11907)
+++ trunk/property/inc/class.boentity.inc.php 2014-04-13 16:32:05 UTC (rev
11908)
@@ -46,6 +46,7 @@
var $results;
var $acl_location;
public $org_units = array();
+ public $org_unit;
protected $xsl_rootdir;
/**
@@ -96,6 +97,7 @@
$allrows
= phpgw::get_var('allrows', 'bool');
$criteria_id =
phpgw::get_var('criteria_id');
$p_num
= phpgw::get_var('p_num');
+ $org_unit_id =
phpgw::get_var('org_unit_id', 'int');
$this->criteria_id =
isset($criteria_id) && $criteria_id ? $criteria_id : '';
@@ -188,6 +190,10 @@
{
$this->allrows = $allrows;
}
+ if(isset($_POST['org_unit_id']) ||
isset($_GET['org_unit_id']))
+ {
+ $this->org_unit_id = $org_unit_id;
+ }
$this->xsl_rootdir = PHPGW_SERVER_ROOT .
'/property/templates/base';
}
@@ -343,8 +349,18 @@
function read($data= array())
{
+ if($this->org_unit_id && !$this->org_units)
+ {
+ $_org_unit_id = (int)$this->org_unit_id;
+ $_subs =
execMethod('property.sogeneric.read_tree',array('node_id' => $_org_unit_id,
'type' => 'org_unit'));
+ $this->org_units[]= $_org_unit_id;
+ foreach($_subs as $entry)
+ {
+ $this->org_units[]= $entry['id'];
+ }
+ }
static $location_data = array();
- static $org_units = array();
+ static $org_units_data = array();
if(isset($this->allrows) && $this->allrows)
{
@@ -479,12 +495,12 @@
}
if(isset($entry['org_unit_id']))
{
-
if(!isset($org_units[$entry['org_unit_id']]))
+
if(!isset($org_units_data[$entry['org_unit_id']]))
{
$org_unit =
$sogeneric->read_single(array('id' => $entry['org_unit_id']));
-
$org_units[$entry['org_unit_id']]['name'] = $org_unit['name'];
+
$org_units_data[$entry['org_unit_id']]['name'] = $org_unit['name'];
}
- $entry['org_unit'] =
$org_units[$entry['org_unit_id']]['name'];
+ $entry['org_unit'] =
$org_units_data[$entry['org_unit_id']]['name'];
}
}
//_debug_array($entity);die();
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2014-04-12 13:57:37 UTC (rev
11907)
+++ trunk/property/inc/class.soentity.inc.php 2014-04-13 16:32:05 UTC (rev
11908)
@@ -491,10 +491,6 @@
{
$filtermethod .= " $where (
$entity_table.org_unit_id IN(" . implode(',',$org_units) . "))";
}
- else
- {
- return array();
- }
}
$_config =
CreateObject('phpgwapi.config',$this->type_app[$this->type]);
@@ -1286,10 +1282,6 @@
$filtermethod .= " $where (
$entity_table.org_unit_id IN(" . implode(',',$org_units) . "))";
$where= 'AND';
}
- else
- {
- return array();
- }
}
if ($filter=='all')
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2014-04-12 13:57:37 UTC (rev
11907)
+++ trunk/property/inc/class.uientity.inc.php 2014-04-13 16:32:05 UTC (rev
11908)
@@ -690,6 +690,33 @@
),
array
(//for
link "None",
+
'type'=> 'label_org_unit'
+ ),
+ array
+ (
//hidden org_unit_id
+
'type' => 'hidden',
+
'id' => 'org_unit_id',
+
'name' => 'org_unit_id',
+
'value' => $org_unit_id
+ ),
+ array
+ (//for
link "Org unit",
+
'type'=> 'link',
+
'id' => 'btn_org_unit_search',
+
'url' => "Javascript:window.open('".$GLOBALS['phpgw']->link('/index.php',
+
array
+
(
+
'menuaction' =>
'property.uilookup.custom',
+
'column' => 'org_unit',
+
'type' => 'org_unit',
+
// 'get_list_function_input' =>
urlencode(serialize(array('type' => 'org_unit')))
+
)
+
)."','link','width=640,height=600')",
+
'value' => lang('department'),
+
'tab_index' => 6
+ ),
+ array
+ (//for
link "None",
'type'=> 'label_date'
),
array
@@ -715,7 +742,7 @@
(
'menuaction' =>
'property.uiproject.date_search'))."','link','width=350,height=250')",
'value' => lang('Date search'),
-
'tab_index' => 6
+
'tab_index' => 5
)),
'hidden_value'
=> array
(
Modified: trunk/property/inc/class.uilookup.inc.php
===================================================================
--- trunk/property/inc/class.uilookup.inc.php 2014-04-12 13:57:37 UTC (rev
11907)
+++ trunk/property/inc/class.uilookup.inc.php 2014-04-13 16:32:05 UTC (rev
11908)
@@ -3451,8 +3451,8 @@
function custom()
{
- $get_list_function =
phpgw::get_var('get_list_function');
- $get_list_function_input =
urlencode(phpgw::get_var('get_list_function_input'));
+ $type = phpgw::get_var('type');
+ // $get_list_function_input =
urlencode(phpgw::get_var('get_list_function_input'));
$column =
phpgw::get_var('column');
if( phpgw::get_var('phpgw_return_as') != 'json' )
@@ -3463,8 +3463,8 @@
'cat_id'
=> $this->cat_id,
'query'
=> $this->query,
'filter'
=> $this->filter,
- 'get_list_function' =>
$get_list_function,
- 'get_list_function_input' =>
$get_list_function_input
+ 'type'
=> $type,
+// 'get_list_function_input' =>
$get_list_function_input
));
$datatable['config']['allow_allrows'] = true;
@@ -3472,8 +3472,8 @@
."cat_id:'{$this->cat_id}',"
."query:'{$this->query}',"
."filter:'{$this->filter}',"
-
."get_list_function:'{$get_list_function}',"
-
."get_list_function_input:'{$get_list_function_input}'";
+ ."type:'{$type}'";
+//
."get_list_function_input:'{$get_list_function_input}'";
$datatable['actions']['form'] = array
(
@@ -3486,8 +3486,8 @@
'cat_id'
=> $this->cat_id,
'query'
=> $this->query,
'filter'
=> $this->filter,
-
'get_list_function' => $get_list_function,
-
'get_list_function_input' => $get_list_function_input
+ 'type' =>
$type,
+//
'get_list_function_input' => $get_list_function_input
)
),
'fields' => array
@@ -3521,30 +3521,13 @@
);
}
- $uicols = array (
- 'input_type' => array('text','text'),
- 'name' =>
array('id','name'),
- 'formatter' => array('',''),
- 'descr' =>
array(lang('ID'),lang('name'))
- );
+ $bogeneric = CreateObject('property.bogeneric');
+
$bogeneric->get_location_info(phpgw::get_var('type','string'));
+ $values = $bogeneric->read();
- $values = array();
- // $bo = CreateObject('property.bogeneric',true);
- // $template_list = $bo->read();
-
- $template_list = execMethod($get_list_function,
unserialize(urldecode($_GET['get_list_function_input'])));
- if(isset($template_list['ResultSet']['Result']) &&
is_array($template_list['ResultSet']['Result']))
- {
- $values = $template_list['ResultSet']['Result'];
- }
- else
- {
- $values = $template_list;
- }
+ $uicols = $bogeneric->uicols;
//_debug_array($values);die();
-//_debug_array(unserialize(urldecode($get_list_function_input)));
-//_debug_array(unserialize(urldecode($_GET['get_list_function_input'])));
$content = array();
$j=0;
if (is_array($values))
@@ -3560,7 +3543,7 @@
}
}
- $uicols_count = count($uicols['descr']);
+ $uicols_count = count($uicols['name']);
$datatable['rowactions']['action'] = array();
for ($i=0;$i<$uicols_count;$i++)
{
@@ -3574,16 +3557,16 @@
$datatable['headers']['header'][$i]['sort_field'] =
$uicols['name'][$i];
}
- $custom_id = $column;
- $custom_name = $column . '_name';
-
+ $custom_id = "{$column}_id";
+ $custom_name = "{$column}_name";
+// _debug_array($datatable);die();
$function_exchange_values = '';
$function_exchange_values .=
'opener.document.getElementsByName("'.$custom_id.'")[0].value = "";' ."\r\n";
- $function_exchange_values .=
'opener.document.getElementsByName("'.$custom_name.'")[0].value = "";' ."\r\n";
+ $function_exchange_values .=
"opener.document.getElementById('txt_{$column}').innerHTML = '';\r\n";
$function_exchange_values .=
'opener.document.getElementsByName("'.$custom_id.'")[0].value =
data.getData("id");' ."\r\n";
- $function_exchange_values .=
'opener.document.getElementsByName("'.$custom_name.'")[0].value =
data.getData("name");' ."\r\n";
+ $function_exchange_values .=
"opener.document.getElementById('txt_{$column}').innerHTML =
data.getData('name');\r\n";
$function_exchange_values .= 'window.close()';
@@ -3605,7 +3588,7 @@
$datatable['pagination']['records_start'] =
(int)$this->start;
$datatable['pagination']['records_limit'] =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$datatable['pagination']['records_returned']=
count($values);
- $datatable['pagination']['records_total'] =
$this->bo->total_records;
+ $datatable['pagination']['records_total'] =
$bogeneric->total_records;
if ( (phpgw::get_var("start")== "") &&
(phpgw::get_var("order",'string')== ""))
{
@@ -3669,7 +3652,7 @@
{
return $json;
}
-
+// _debug_array($json);die();
$datatable['json_data'] = json_encode($json);
//-------------------- JSON CODE ----------------------
@@ -3684,7 +3667,7 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
// Prepare YUI Library
- $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'lookup.tenant.index', 'property' );
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'lookup.generic.index', 'property' );
$this->save_sessiondata();
}
Modified: trunk/property/js/yahoo/entity.index.js
===================================================================
--- trunk/property/js/yahoo/entity.index.js 2014-04-12 13:57:37 UTC (rev
11907)
+++ trunk/property/js/yahoo/entity.index.js 2014-04-13 16:32:05 UTC (rev
11908)
@@ -33,7 +33,8 @@
// define the hidden column in datatable
var config_values = {
- date_search : 1 //if search has link "Data search"
+ date_search : 1, //if search has link "Data search"
+ org_unit_search : 1 //if search has link "Org unit search"
}
var linktoolTips =[
Copied: trunk/property/js/yahoo/lookup.generic.index.js (from rev 11907,
trunk/property/js/yahoo/lookup.tenant.index.js)
===================================================================
--- trunk/property/js/yahoo/lookup.generic.index.js
(rev 0)
+++ trunk/property/js/yahoo/lookup.generic.index.js 2014-04-13 16:32:05 UTC
(rev 11908)
@@ -0,0 +1,68 @@
+//--------------------------------------------------------
+// Declaration of lookup.tenant.index vars
+//--------------------------------------------------------
+
+ //define SelectButton
+ var selectsButtons = [
+ ]
+
+ // define buttons
+ var oNormalButton_0;
+ var normalButtons = [
+ {order:0, name:'btn_search', funct:"onSearchClick"}
+ ]
+
+/********************************************************************************/
+ var FormatterRight = function(elCell, oRecord, oColumn, oData)
+ {
+ elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+ }
+
+
+ // define Text buttons
+ var textImput = [
+ {order:0, name:'query', id:'txt_query'}
+ ]
+
+ // define the hidden column in datatable
+ var config_values = {
+ date_search : 0 //if search has link "Data search"
+ }
+/****************************************************************************************/
+
+ this.particular_setting = function()
+ {
+ if(flag_particular_setting=='init')
+ {
+ //--focus for txt_query---
+ YAHOO.util.Dom.get(textImput[0].id).focus();
+ }
+ else if(flag_particular_setting=='update')
+ {
+ // nothing
+ }
+ }
+/****************************************************************************************/
+
+ YAHOO.util.Event.addListener(window, "load", function()
+ {
+
YAHOO.util.Dom.getElementsByClassName('toolbar','div')[0].style.display =
'none';
+ var loader = new YAHOO.util.YUILoader();
+ loader.addModule({
+ name: "anyone", //module name; must be unique
+ type: "js", //can be "js" or "css"
+ fullpath: property_js //'property_js' have the path for
property.js, is render in HTML
+ });
+
+ loader.require("anyone");
+
+ //Insert JSON utility on the page
+
+ loader.insert();
+ });
+
+
+
+
+
+
Modified: trunk/property/js/yahoo/property.js
===================================================================
--- trunk/property/js/yahoo/property.js 2014-04-12 13:57:37 UTC (rev 11907)
+++ trunk/property/js/yahoo/property.js 2014-04-13 16:32:05 UTC (rev 11908)
@@ -360,6 +360,10 @@
path_values.start_date =
YAHOO.util.Dom.get('start_date').value;
path_values.end_date =
YAHOO.util.Dom.get('end_date').value;
}
+ if(config_values.org_unit_search !=
undefined && config_values.org_unit_search != 0)
+ {
+ path_values.org_unit_id =
YAHOO.util.Dom.get('org_unit_id').value;
+ }
execute_ds();
}
},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11908] property: more on org_unit,
Sigurd Nes <=