[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10258] controller: generalize
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10258] controller: generalize |
Date: |
Thu, 18 Oct 2012 13:07:21 +0000 |
Revision: 10258
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10258
Author: sigurdne
Date: 2012-10-18 13:07:20 +0000 (Thu, 18 Oct 2012)
Log Message:
-----------
controller: generalize
Modified Paths:
--------------
trunk/controller/inc/class.uicontrol_register_to_component.inc.php
trunk/controller/inc/class.uicontrol_register_to_location.inc.php
trunk/controller/js/controller/ajax_control_to_component.js
trunk/controller/js/controller/ajax_control_to_location.js
Modified: trunk/controller/inc/class.uicontrol_register_to_component.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_register_to_component.inc.php
2012-10-18 07:31:56 UTC (rev 10257)
+++ trunk/controller/inc/class.uicontrol_register_to_component.inc.php
2012-10-18 13:07:20 UTC (rev 10258)
@@ -190,7 +190,6 @@
self::add_javascript('controller', 'controller',
'ajax_control_to_component.js');
self::add_javascript('controller', 'yahoo',
'register_control.js');
- self::add_javascript('controller', 'yahoo',
'datatable_light.js');
self::render_template_xsl(array('control_location/register_control_to_component'
), $data);
}
@@ -303,6 +302,11 @@
{
$location_id =
$GLOBALS['phpgw']->locations->get_id('property',
".entity.{$entity_id}.{$cat_id}");
$boentity =
CreateObject('property.boentity',false, 'entity');
+
+ $boentity->sort = phpgw::get_var('dir');
+ $boentity->order = phpgw::get_var('sort');
+ $boentity->start = phpgw::get_var('startIndex', 'int',
'REQUEST', 0);
+
$boentity->results = $results;
$values =
$boentity->read(array('control_registered' => $control_registered, 'control_id'
=> $control_id));
}
@@ -322,6 +326,24 @@
}
$results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+
+ $data = array(
+ 'ResultSet' => array(
+ 'totalResultsAvailable' =>
$boentity->total_records,
+ 'startIndex' => $this->start,
+ 'sortKey' => 'location_code',
+ 'sortDir' => "ASC",
+ 'Result' => $values,
+ //FIXME: Sigurd 18 oct 2012...
+ 'pageSize' => $results,
+ 'activePage' => floor($this->bo->start
/ $results) + 1
+ )
+ );
+
+ return $data;
+
+
+
$return_data['recordsReturned'] = count($values);
$return_data['totalRecords'] = $boentity->total_records;
$return_data['startIndex'] = $this->start;
Modified: trunk/controller/inc/class.uicontrol_register_to_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_register_to_location.inc.php
2012-10-18 07:31:56 UTC (rev 10257)
+++ trunk/controller/inc/class.uicontrol_register_to_location.inc.php
2012-10-18 13:07:20 UTC (rev 10258)
@@ -188,7 +188,6 @@
self::add_javascript('controller', 'controller',
'ajax_control_to_location.js');
self::add_javascript('controller', 'yahoo',
'register_control.js');
- self::add_javascript('controller', 'yahoo',
'datatable_light.js');
self::render_template_xsl(array('control_location/register_control_to_location'
), $data);
}
@@ -311,7 +310,7 @@
(
'key' =>
$uicols['name'][$i],
'label' =>
$uicols['descr'][$i],
- 'sortable' =>
$uicols['sortable'][$i],
+ 'sortable' =>
!!$uicols['sortable'][$i],
'formatter' =>
$uicols['formatter'][$i],
'hidden' =>
$uicols['input_type'][$i] == 'hidden' ? true : false ,
'className' =>
$uicols['classname'][$i],
@@ -354,6 +353,9 @@
$control_registered =
phpgw::get_var('control_registered', 'bool');
$this->bo->results = $results;
+ $this->bo->sort = phpgw::get_var('dir');
+ $this->bo->order = phpgw::get_var('sort');
+ $this->bo->start = phpgw::get_var('startIndex', 'int', 'REQUEST',
0);
$values = $this->bo->read(array('control_registered' =>
$control_registered,
'control_id' => $control_id,
@@ -379,16 +381,21 @@
}
$results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- $return_data['recordsReturned'] = count($values);
- $return_data['totalRecords'] = $this->bo->total_records;
- $return_data['startIndex'] = $this->bo->start;
- $return_data['sort'] = 'location_code';
- $return_data['dir'] = "ASC";
- $return_data['pageSize'] = $results;
- $return_data['activePage'] = floor($this->bo->start /
$results) + 1;
- $return_data['records'] = $values;
- return $return_data;
+ $data = array(
+ 'ResultSet' => array(
+ 'totalResultsAvailable' =>
$this->bo->total_records,
+ 'startIndex' => $this->bo->start,
+ 'sortKey' => 'location_code',
+ 'sortDir' => "ASC",
+ 'Result' => $values,
+ //FIXME: Sigurd 18 oct 2012...
+ 'pageSize' => $results,
+ 'activePage' => floor($this->bo->start
/ $results) + 1
+ )
+ );
+
+ return $data;
}
public function edit_location()
Modified: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js 2012-10-18
07:31:56 UTC (rev 10257)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-10-18
13:07:20 UTC (rev 10258)
@@ -343,7 +343,7 @@
{
$(submitBnt).val("Lagret");
-
YAHOO.portico.update_datatable();
+
YAHOO.portico.updateinlineTableHelper('datatable-container');
}
else
{
@@ -509,51 +509,12 @@
};
var requestUrl = phpGWLink('index.php', oArgs, true);
- YAHOO.portico.init_datatable(myColumnDefs,requestUrl);
+ YAHOO.portico.inlineTableHelper('datatable-container', requestUrl,
myColumnDefs);
}
function update_component_table()
{
-
- var control_registered = 0;
- if (typeof($($("#control_registered")).attr("checked")) != 'undefined'
&& $($("#control_registered")).attr("checked") == 'checked')
- {
- control_registered = 1;
- }
-
- if($("#cat_id").val() != null)
- {
- var location_code = '';
-
- if( $("#search-location_code").val() != null &&
$("#search-location_code").val())
- {
- location_code = $("#search-location_code").val();
- }
- else if( $("#loc2").val() != null && $("#loc2").val())
- {
- location_code = $("#loc2").val();
- }
- else if ( $("#loc1").val() != null && $("#loc1").val())
- {
- location_code = $("#loc1").val();
- }
-
- var oArgs = {
-
menuaction:'controller.uicontrol_register_to_component.query',
- entity_id:$("#entity_id").val(),
- cat_id:$("#cat_id").val(),
- district_id:$("#district_id").val(),
- part_of_town_id:$("#part_of_town_id").val(),
- location_code:location_code,
- control_id:$("#control_id_hidden").val() != null ?
$("#control_id_hidden").val():'',
- control_registered:control_registered
- };
-
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- YAHOO.portico.update_datatable(requestUrl);
- }
-// $("#receipt").html('');
+ init_component_table();
}
Modified: trunk/controller/js/controller/ajax_control_to_location.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_location.js 2012-10-18
07:31:56 UTC (rev 10257)
+++ trunk/controller/js/controller/ajax_control_to_location.js 2012-10-18
13:07:20 UTC (rev 10258)
@@ -250,7 +250,7 @@
{
$("#control_id_hidden").val( $(this).val() );
- init_component_table();
+ update_location_table();
});
$("#loc2").change(function ()
@@ -299,7 +299,7 @@
{
$(submitBnt).val("Lagret");
-
YAHOO.portico.update_datatable();
+
YAHOO.portico.updateinlineTableHelper('datatable-container');
}
else
{
@@ -466,61 +466,12 @@
};
var requestUrl = phpGWLink('index.php', oArgs, true);
- YAHOO.portico.init_datatable(myColumnDefs,requestUrl);
+ YAHOO.portico.inlineTableHelper('datatable-container', requestUrl,
myColumnDefs);
}
function update_location_table()
{
-
- var control_registered = 0;
- if (typeof($($("#control_registered")).attr("checked")) != 'undefined'
&& $($("#control_registered")).attr("checked") == 'checked')
- {
- control_registered = 1;
- }
-
- var location_type = $("#location_type").val() != null ?
$("#location_type").val():'';
-
- if(!location_type)
- {
- return false;
- }
-
-
- var cat_id = $("#location_type_category").val() != null ?
$("#location_type_category").val():'';
-
- if($("#control_id_hidden").val() != null)
- {
- var location_code = '';
-
- if( $("#search-location_code").val() != null &&
$("#search-location_code").val())
- {
- location_code = $("#search-location_code").val();
- }
- else if( $("#loc2").val() != null && $("#loc2").val())
- {
- location_code = $("#loc2").val();
- }
- else if ( $("#loc1").val() != null && $("#loc1").val())
- {
- location_code = $("#loc1").val();
- }
-
- var oArgs = {
-
menuaction:'controller.uicontrol_register_to_location.query',
- location_level:location_type,
- district_id:$("#district_id").val(),
- part_of_town_id:$("#part_of_town_id").val(),
- location_code:location_code,
- control_id:$("#control_id_hidden").val() != null ?
$("#control_id_hidden").val():'',
- cat_id:cat_id,
- control_registered:control_registered
- };
-
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- YAHOO.portico.update_datatable(requestUrl);
- }
-// $("#receipt").html('');
+ init_component_table();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10258] controller: generalize,
Sigurd Nes <=