fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [9524] controller: register control til component
Date: Thu, 07 Jun 2012 06:20:57 +0000

Revision: 9524
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9524
Author:   sigurdne
Date:     2012-06-07 06:20:56 +0000 (Thu, 07 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/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-06 
13:43:52 UTC (rev 9523)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-07 
06:20:56 UTC (rev 9524)
@@ -76,7 +76,8 @@
                        'query2'                                                
        => true,
                        'get_category_by_entity'                        => true,
                        'get_entity_table_def'                          => true,
-                       'get_locations'                                         
=> true
+                       'get_locations'                                         
=> true,
+                       'get_location_type_category'            => true
                );
 
                function __construct()
@@ -606,10 +607,12 @@
                        $district_list  = 
$this->bocommon->select_district_list('filter',$this->district_id);
 
                        $part_of_town_list = 
execMethod('property.bogeneric.get_list', array('type'=>'part_of_town', 
'selected' => $part_of_town_id ));
+                       $location_type_list = 
execMethod('property.soadmin_location.select_location_type');
 
                        array_unshift($entity_list ,array 
('id'=>'','name'=>lang('select')));
                        array_unshift($district_list ,array 
('id'=>'','name'=>lang('select')));
                        array_unshift($part_of_town_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift($location_type_list ,array 
('id'=>'','name'=>lang('select')));
 
                        $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
                        $cats->supress_info     = true;
@@ -659,10 +662,11 @@
                                'msgbox_data'                                   
=> $msgbox_data,
                                'filter_form'                                   
=> array
                                                                                
                        (
-                                                                               
                                'control_area_list'     => array('options' => 
$control_area_list),
-                                                                               
                                'entity_list'           => array('options' => 
$entity_list),
-                                                                               
                                'district_list'         => array('options' => 
$district_list),
-                                                                               
                                'part_of_town_list'     => array('options' => 
$part_of_town_list),
+                                                                               
                                'control_area_list'             => 
array('options' => $control_area_list),
+                                                                               
                                'entity_list'                   => 
array('options' => $entity_list),
+                                                                               
                                'district_list'                 => 
array('options' => $district_list),
+                                                                               
                                'part_of_town_list'             => 
array('options' => $part_of_town_list),
+                                                                               
                                'location_type_list'    => array('options' => 
$location_type_list),
                                                                                
                        ),
                                'update_action'                                 
=> self::link(array('menuaction' => 
'controller.uicontrol_location.edit_component'))
                        );
@@ -691,6 +695,24 @@
                }
        
 
+               public function get_location_type_category()
+               {
+                       $location_type                  = 
phpgw::get_var('location_type', 'int');
+
+                       $values  = $this->bocommon->select_category_list(array
+                                       (
+                                               'format'=>'filter',
+                                       //      'selected' => $this->cat_id,
+                                               'type' =>'location',
+                                               'type_id' =>$location_type,
+                                               'order'=>'descr'
+                                       )
+                               );
+
+                       return $values;
+               }
+
+
                public function get_entity_table_def()
                {
                        $entity_id                      = 
phpgw::get_var('entity_id', 'int');

Modified: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js 2012-06-06 
13:43:52 UTC (rev 9523)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-07 
06:20:56 UTC (rev 9524)
@@ -88,6 +88,41 @@
     });
 
 
+       $("#location_type").change(function () {
+                var oArgs = 
{menuaction:'controller.uicontrol_location.get_location_type_category', 
location_type: $(this).val()};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+         var htmlString = "";
+
+         $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       var obj = data;
+                                               
+                                       $.each(obj, function(i)
+                                       {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+                                                                               
                        
+                                       $("#location_type_category").html( 
htmlString );
+                               $("#loc1").html( "<option 
value=''>Velg</option>" );
+                               $("#loc2").html( "<option 
value=''>Velg</option>" );
+                               }
+                               else
+                               {
+                               htmlString  += "<option value=''>Velg</option>";
+                               $("#part_of_town_id").html( htmlString );
+                               $("#loc1").html( htmlString );
+                               $("#loc2").html( htmlString );
+                       }
+                       }
+         });
+    });
+
        //update part of town category based on district
        $("#district_id").change(function () {
                var district_id = $(this).val();

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-06 13:43:52 UTC (rev 9523)
+++ 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-07 06:20:56 UTC (rev 9524)
@@ -89,6 +89,12 @@
                <td>
                        <xsl:value-of select="php:function('lang', 'control')" 
/>
                </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'location 
type')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'location 
category')" />
+               </td>
        </tr>
          <tr id="filter1">
                <td>
@@ -96,11 +102,20 @@
                        <xsl:apply-templates 
select="control_area_list/options"/>
                  </select>
                </td>           
-               <td colspan='4'>
+               <td>
                  <select id="control_id" name="control_id">
                        <xsl:apply-templates select="control/options"/>
                  </select>
                </td>           
+               <td >
+                 <select id="location_type" name="location_type">
+                       <xsl:apply-templates 
select="location_type_list/options"/>
+                 </select>
+               </td>
+               <td >
+                 <select id="location_type_category" 
name="location_type_category">
+                 </select>
+               </td>
          </tr>
        <tr>
                <td>




reply via email to

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