[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9512] controller: register control to component
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9512] controller: register control to component |
Date: |
Tue, 05 Jun 2012 09:12:53 +0000 |
Revision: 9512
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9512
Author: sigurdne
Date: 2012-06-05 09:12:53 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
controller: register control to component
Modified Paths:
--------------
trunk/controller/inc/class.uicontrol_location.inc.php
trunk/controller/js/controller/ajax_control_to_component.js
trunk/controller/templates/base/control_location/register_control_to_component.xsl
Modified: trunk/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_location.inc.php 2012-06-05
08:23:11 UTC (rev 9511)
+++ trunk/controller/inc/class.uicontrol_location.inc.php 2012-06-05
09:12:53 UTC (rev 9512)
@@ -73,6 +73,7 @@
'get_district_part_of_town' => true,
'entity' => true,
'index2' => true,
+
'query2' => true,
'get_category_by_entity' => true
);
@@ -1314,15 +1315,23 @@
public function query2()
{
- $user_id = phpgw::get_var('user_id', 'int');
- $dimb_id = phpgw::get_var('dimb_id', 'int');
- $role_id = phpgw::get_var('role_id', 'int');
- $query_start = phpgw::get_var('query_start');
- $query_end = phpgw::get_var('query_end');
+ $entity_id =
phpgw::get_var('entity_id', 'int');
+ $cat_id =
phpgw::get_var('cat_id', 'int');
+ $district_id = phpgw::get_var('district_id',
'int');
+ $part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
+ $control_id =
phpgw::get_var('control_id', 'int');
-// $this->bo->allrows = true;
- $values = $this->bo->read(array('user_id' => $user_id,
'dimb_id' => $dimb_id, 'role_id' => $role_id, 'query_start' => $query_start,
'query_end' => $query_end));
+ if(!$entity_id && !$cat_id)
+ {
+ return json_encode(array());
+ }
+
+ $boentity =
CreateObject('property.boentity',false, 'entity');
+// $boentity->allrows = true;
+
+ $values = $boentity->read();
+
foreach($values as &$entry)
{
if($entry['active_from'])
Modified: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js 2012-06-05
08:23:11 UTC (rev 9511)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-05
09:12:53 UTC (rev 9512)
@@ -11,15 +11,15 @@
var htmlString = "";
$.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl + "&control_area_id=" +
control_area_id,
- success: function(data) {
- if( data != null){
- htmlString = "<option>Velg
kontroll</option>"
- var obj = jQuery.parseJSON(data);
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&control_area_id=" + control_area_id,
+ success: function(data) {
+ if( data != null){
+ htmlString = "<option>Velg
kontroll</option>"
+ var obj = jQuery.parseJSON(data);
- $.each(obj, function(i) {
+ $.each(obj, function(i) {
var selected = '';
/*
@@ -29,17 +29,17 @@
}
*/
htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
- });
-
- $("#control_id").html( htmlString );
+ });
+
+ $("#control_id").html( htmlString );
}
else
{
- htmlString += "<option>Ingen
kontroller</option>"
- $("#control_id").html( htmlString );
-//
$("#hidden_control_id").val(-1); //reset
- }
- }
+ htmlString += "<option>Ingen
kontroller</option>"
+ $("#control_id").html( htmlString );
+//
$("#hidden_control_id").val(-1); //reset
+ }
+ }
});
});
@@ -53,15 +53,16 @@
var htmlString = "";
$.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function(data) {
- if( data != null){
- htmlString = "<option>Velg</option>"
- var obj = data;
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data) {
+ if( data != null){
+ htmlString = "<option>Velg</option>"
+ var obj = data;
- $.each(obj, function(i) {
+ $.each(obj, function(i)
+ {
var selected = '';
/*
@@ -71,16 +72,17 @@
}
*/
htmlString += "<option
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
- });
-
- $("#category_id").html( htmlString );
+ });
+
+ $("#cat_id").html( htmlString );
+ update_component_table();
}
else
{
- htmlString += "<option>Ingen
kontroller</option>"
- $("#category_id").html( htmlString );
- }
- }
+ htmlString += "<option>Ingen
kontroller</option>"
+ $("#cat_id").html( htmlString );
+ }
+ }
});
});
@@ -95,48 +97,44 @@
var htmlString = "";
$.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl + "&district_id=" + district_id,
- success: function(data) {
- if( data != null){
- var obj = jQuery.parseJSON(data);
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl + "&district_id=" + district_id,
+ success: function(data) {
+ if( data != null)
+ {
+ var obj = jQuery.parseJSON(data);
- $.each(obj, function(i) {
- htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
- });
-
- $("#part_of_town_id").html(
htmlString );
- }else {
- htmlString += "<option>Ingen
kontroller</option>"
- $("#part_of_town_id").html( htmlString
);
- }
- }
+ $.each(obj, function(i)
+ {
+ htmlString += "<option
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+ });
+
+ $("#part_of_town_id").html( htmlString
);
+
+ update_component_table();
+ }
+ else
+ {
+ htmlString += "<option>Ingen
kontroller</option>"
+ $("#part_of_town_id").html( htmlString
);
+ }
+ }
});
});
-
-
- $("#dimb_id").change(function ()
+ $("#control_id").change(function ()
{
- update_dimb_role_user_table();
+ update_component_table();
});
- $("#user_id").change(function ()
- {
- update_dimb_role_user_table();
- });
- $("#role_id").change(function ()
+ $("#cat_id").change(function ()
{
- update_dimb_role_user_table();
+ update_component_table();
});
- $("#search").click(function(e)
- {
- update_dimb_role_user_table();
- });
$("#acl_form").live("submit", function(e){
e.preventDefault();
@@ -155,48 +153,48 @@
return;
}
- var obj = data;
-
- var submitBnt =
$(thisForm).find("input[type='submit']");
- if(obj.status == "updated")
- {
- $(submitBnt).val("Lagret");
+ var obj = data;
+
+ var submitBnt =
$(thisForm).find("input[type='submit']");
+ if(obj.status == "updated")
+ {
+ $(submitBnt).val("Lagret");
var oArgs =
{menuaction:'property.uidimb_role_user.query', dimb_id:$("#dimb_id").val(),
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query_start:$("#query_start").val(),query_end:$("#query_end").val()};
execute_async(myDataTable_0,oArgs);
}
else
{
- $(submitBnt).val("Feil ved lagring");
+ $(submitBnt).val("Feil ved lagring");
}
-
- // Changes text on save button back to original
- window.setTimeout(function() {
+
+ // Changes text on save button back to original
+ window.setTimeout(function() {
$(submitBnt).val('Lagre');
$(submitBnt).addClass("not_active");
- }, 1000);
+ }, 1000);
var htmlString = "";
- if(typeof(data['receipt']['error']) !=
'undefined')
- {
+ if(typeof(data['receipt']['error']) !=
'undefined')
+ {
for ( var i = 0; i <
data['receipt']['error'].length; ++i )
{
htmlString += "<div
class=\"error\">";
htmlString +=
data['receipt']['error'][i]['msg'];
htmlString += '</div>';
}
-
- }
- if(typeof(data['receipt']['message'])
!= 'undefined')
- {
+
+ }
+ if(typeof(data['receipt']['message'])
!= 'undefined')
+ {
for ( var i = 0; i <
data['receipt']['message'].length; ++i )
{
htmlString += "<div
class=\"msg_good\">";
htmlString +=
data['receipt']['message'][i]['msg'];
htmlString += '</div>';
}
-
- }
- $("#receipt").html(htmlString);
+
+ }
+ $("#receipt").html(htmlString);
}
}
});
@@ -204,13 +202,17 @@
});
-function update_dimb_role_user_table()
+function update_component_table()
{
- var oArgs = {menuaction:'property.uidimb_role_user.query',
dimb_id:$("#dimb_id").val(),
user_id:$("#user_id").val(),role_id:$("#role_id").val(),query_start:$("#query_start").val(),query_end:$("#query_end").val()};
- execute_async(myDataTable_0, oArgs);
+ var oArgs = {
+ menuaction:'controller.uicontrol_location.query2',
+ entity_id:$("#entity_id").val(),
+ cat_id:$("#cat_id").val(),
+ district_id:$("#district_id").val(),
+ part_of_town_id:$("#part_of_town_id").val(),
+ control_id:$("#control_id").val()
+ };
+ execute_async(myDataTable_0, oArgs);
$("#receipt").html('');
}
-
-
-
Modified:
trunk/controller/templates/base/control_location/register_control_to_component.xsl
===================================================================
---
trunk/controller/templates/base/control_location/register_control_to_component.xsl
2012-06-05 08:23:11 UTC (rev 9511)
+++
trunk/controller/templates/base/control_location/register_control_to_component.xsl
2012-06-05 09:12:53 UTC (rev 9512)
@@ -133,7 +133,7 @@
</select>
</td>
<td>
- <select id="category_id" name="category_id">
+ <select id="cat_id" name="cat_id">
<xsl:apply-templates select="category_list/options"/>
</select>
</td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9512] controller: register control to component,
Sigurd Nes <=