fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9603] controller: register control til component


From: Sigurd Nes
Subject: [Fmsystem-commits] [9603] controller: register control til component
Date: Sat, 16 Jun 2012 20:05:11 +0000

Revision: 9603
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9603
Author:   sigurdne
Date:     2012-06-16 20:05:10 +0000 (Sat, 16 Jun 2012)
Log Message:
-----------
controller: register control til component

Modified Paths:
--------------
    trunk/controller/inc/class.uicontrol_location.inc.php
    trunk/controller/js/controller/ajax_control_to_component.js
    trunk/controller/js/yahoo/register_control_to_component2.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-16 
20:04:57 UTC (rev 9602)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-16 
20:05:10 UTC (rev 9603)
@@ -790,6 +790,7 @@
                        $part_of_town_id        = 
phpgw::get_var('part_of_town_id', 'int');
                        $control_id                     = 
phpgw::get_var('control_id', 'int');
                        $results                        = 
phpgw::get_var('results', 'int');
+                       $control_registered     = 
phpgw::get_var('control_registered', 'bool');
 
                        if(!$entity_id && !$cat_id)
                        {
@@ -800,7 +801,7 @@
                                $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
                                $boentity       = 
CreateObject('property.boentity',false, 'entity');
                                $boentity->results = $results;
-                               $values = $boentity->read();
+                               $values = 
$boentity->read(array('control_registered' => $control_registered));
                        }               
 
                        foreach($values as &$entry)
@@ -832,7 +833,6 @@
                {
                        if($values = phpgw::get_var('values'))
                        {
-_debug_Array($values);
                                if(!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_EDIT, 'property'))
                                {
                                        $receipt['error'][]=true;

Modified: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js 2012-06-16 
20:04:57 UTC (rev 9602)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-16 
20:05:10 UTC (rev 9603)
@@ -238,6 +238,12 @@
 
     });
 
+
+       $("#control_registered").change(function ()
+       {
+               update_component_table();
+    });
+
        $("#control_id").change(function ()
        {
                $("#control_id_hidden").val( $(this).val() );
@@ -245,7 +251,12 @@
                update_component_table();
     });
 
+       $("#loc2").change(function ()
+       {
+               update_component_table();
+    });
 
+
        $("#cat_id").change(function ()
        {
                get_table_def();
@@ -416,14 +427,32 @@
 
 function init_component_table()
 {
+       var control_registered = 0;
+       if (typeof($($("#control_registered")).attr("checked")) != 'udefined' 
&& $($("#control_registered")).attr("checked") == 'checked')
+       {
+               control_registered = 1;
+       }
+
+       var location_code = '';
+               
+       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_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(),
-               location_code:$("#loc1").val() != null ? $("#loc1").val():'',
-               control_id:$("#control_id_hidden").val() != null ? 
$("#control_id_hidden").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);
 
@@ -433,16 +462,35 @@
 
 function update_component_table()
 {
+
+       var control_registered = 0;
+       if (typeof($($("#control_registered")).attr("checked")) != 'udefined' 
&& $($("#control_registered")).attr("checked") == 'checked')
+       {
+               control_registered = 1;
+       }
+
        if($("#cat_id").val() != null)
        {
+               var location_code = '';
+               
+               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_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(),
-                       location_code:$("#loc1").val() != null ? 
$("#loc1").val():'',
-                       control_id:$("#control_id_hidden").val() != null ? 
$("#control_id_hidden").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);

Modified: trunk/controller/js/yahoo/register_control_to_component2.js
===================================================================
--- trunk/controller/js/yahoo/register_control_to_component2.js 2012-06-16 
20:04:57 UTC (rev 9602)
+++ trunk/controller/js/yahoo/register_control_to_component2.js 2012-06-16 
20:05:10 UTC (rev 9603)
@@ -106,7 +106,8 @@
         // Access to values in the server response
         metaFields: {
             totalRecords: "totalRecords",
-            startIndex: "startIndex"
+            startIndex: "startIndex",
+            pageSize: "pageSize"
         }
     };
     
@@ -117,7 +118,7 @@
         var sort = (oState.sortedBy) ? oState.sortedBy.key : "id";
         var dir = (oState.sortedBy && oState.sortedBy.dir === 
YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
         var startIndex = (oState.pagination) ? oState.pagination.recordOffset 
: 0;
-        var results = (oState.pagination) ? oState.pagination.rowsPerPage : 10;
+        var results = (oState.pagination) ? oState.pagination.rowsPerPage : 0;
 
         // Build custom request
         return  "&order=" + sort +
@@ -132,7 +133,7 @@
                                                containers                      
: ['paging'],
 //                                             totalRecords            : 
mytotalRows,
                                            initialPage                 : 
myinitialPage,
-                                               rowsPerPage: 10,
+                                               rowsPerPage                     
: 10,
 //                                             alwaysVisible: true,
 //                                             rowsPerPageOptions: [5, 10, 25, 
50, 100, 200],
 //                                             firstPageLinkLabel: "<< 
first",
@@ -162,6 +163,7 @@
     myDataTable.doBeforeLoadData = function(oRequest, oResponse, oPayload) {
                YAHOO.PORTICO.requestUrl = requestUrl + oRequest;
         oPayload.totalRecords = oResponse.meta.totalRecords;
+               oPayload.pagination.rowsPerPage = oResponse.meta.pageSize;
         oPayload.pagination.recordOffset = oResponse.meta.startIndex;
         return oPayload;
     };

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-16 20:04:57 UTC (rev 9602)
+++ 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-16 20:05:10 UTC (rev 9603)
@@ -100,6 +100,9 @@
                </td>
 -->
                <td>
+                       <xsl:value-of select="php:function('lang', 
'registered')" />
+               </td>
+               <td>
                        <xsl:value-of select="php:function('lang', 'location 
type')" />
                </td>
                <td>
@@ -120,6 +123,10 @@
                </td>
 -->
                <td >
+                 <input id= "control_registered" type="checkbox" 
name="control_registered" value="1"/>
+               </td>
+
+               <td >
                  <input id= "control_id_hidden" type="hidden" 
name="control_id"/>
                  <select id="location_type" name="location_type">
                        <xsl:apply-templates 
select="location_type_list/options"/>
@@ -222,7 +229,6 @@
 
                <!--  DATATABLE DEFINITIONS-->
                <script type="text/javascript">
-                       var property_js = <xsl:value-of 
select="//property_js"/>;
                        var datatable = new Array();
                        var myColumnDefs = new Array();
                        var myButtons = new Array();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]