fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [9606] controller: register control til component
Date: Sun, 17 Jun 2012 19:03:19 +0000

Revision: 9606
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9606
Author:   sigurdne
Date:     2012-06-17 19:03:18 +0000 (Sun, 17 Jun 2012)
Log Message:
-----------
controller: register control til component

Modified Paths:
--------------
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/class.uicontrol_location.inc.php
    trunk/controller/js/controller/ajax_control_to_component.js
    trunk/controller/setup/phpgw_no.lang
    
trunk/controller/templates/base/control_location/register_control_to_component.xsl

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-06-17 08:50:05 UTC 
(rev 9605)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-06-17 19:03:18 UTC 
(rev 9606)
@@ -601,4 +601,4 @@
                }
 
                public function query(){}
-       }
\ No newline at end of file
+       }

Modified: trunk/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-17 
08:50:05 UTC (rev 9605)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-17 
19:03:18 UTC (rev 9606)
@@ -678,9 +678,14 @@
                        phpgwapi_yui::load_widget('tabview');
                        phpgwapi_yui::load_widget('paginator');
                        phpgwapi_yui::load_widget('animation');
+//                     phpgwapi_yui::load_widget('autocomplete');
 
                        phpgwapi_jquery::load_widget('core');
+                       phpgwapi_jquery::load_widget('autocomplete');
+                       //FIXME
+//                     self::add_javascript('controller', 'controller', 
'jquery-ui-1.8.20.custom.min.js');
 
+
                        self::add_javascript('controller', 'controller', 
'ajax_control_to_component.js');
        //              self::add_javascript('controller', 'yahoo', 
'register_control_to_component.js');
                        self::add_javascript('controller', 'yahoo', 
'register_control_to_component2.js');

Modified: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js 2012-06-17 
08:50:05 UTC (rev 9605)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-17 
19:03:18 UTC (rev 9606)
@@ -18,7 +18,7 @@
                                if( data != null){
                                        htmlString  = "<option>Velg 
kontroll</option>"
                                        var obj = jQuery.parseJSON(data);
-                                               
+
                                        $.each(obj, function(i) {
 
                                                var selected = '';
@@ -30,7 +30,7 @@
 */
                                                        htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
                                        });
-                                                                               
                        
+                                        
                                        $("#control_id").html( htmlString );
                                        }
                                        else
@@ -41,7 +41,7 @@
                                }
                        }
                        });
-                       
+
     });
 
 
@@ -73,7 +73,7 @@
 */
                                                        htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
                                        });
-                                                                               
                        
+                                        
                                        $("#cat_id").html( htmlString );
                                        }
                                        else
@@ -83,7 +83,7 @@
                                }
                        }
                        });
-                       
+
     });
 
 
@@ -101,12 +101,12 @@
                                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>" );
@@ -127,6 +127,43 @@
                update_loc(level);
     });
 
+       var oArgs = {menuaction:'property.bolocation.get_locations_by_name'};
+       var baseUrl = phpGWLink('index.php', oArgs, true);
+
+       $("#search-location-name").autocomplete({
+               source: function( request, response ) {
+                       location_type = $("#location_type").val();
+                       $.ajax({
+                               url: baseUrl,
+                               dataType: "json",
+                               data: {
+                                       location_name: request.term,
+                                       level: location_type
+                               },
+                               success: function( data ) {
+                                       response( $.map( data, function( item ) 
{
+                                               return {
+                                                       label: item.name,
+                                                       value: 
item.location_code
+                                               }
+                                       }));
+                               }
+                       });
+               },
+               focus: function (event, ui) {
+                       $(event.target).val(ui.item.label);
+                       return false;
+               },
+               minLength: 1,
+               select: function( event, ui ) {
+//                     console.log(ui.item);
+//                     $("#search-location-name").val( ui.item.label );
+                       $("#search-location_code").val( ui.item.value );
+                       update_component_table();
+               }
+       });
+
+
        //update part of town category based on district
        $("#district_id").change(function () {
                var district_id = $(this).val();
@@ -143,12 +180,12 @@
                                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 
);
                                $("#loc1").html( "<option 
value=''>Velg</option>" );
                                $("#loc2").html( "<option 
value=''>Velg</option>" );
@@ -163,6 +200,7 @@
                        }
          });
 
+               $("#search-location_code").val('');
                update_component_table();
     });
 
@@ -182,12 +220,12 @@
                                if( data != null)
                                {
                                        var obj = data;
-                                               
+
                                        $.each(obj, function(i)
                                        {
                                                htmlString  += "<option 
value='" + obj[i].id + "'>" +  obj[i].id + " " + obj[i].name + "</option>";
                                        });
-                                                                               
                        
+                                        
                                        $("#loc1").html( htmlString );
                                $("#loc2").html( "<option 
value=''>Velg</option>" );
                                        }
@@ -200,6 +238,7 @@
                        }
          });
 
+               $("#search-location_code").val('');
                update_component_table();
     });
 
@@ -218,12 +257,12 @@
                                if( data != null)
                                {
                                        var obj = data;
-                                               
+
                                        $.each(obj, function(i)
                                        {
                                                htmlString  += "<option 
value='" + obj[i].id + "'>" +  obj[i].id + " " + obj[i].name + "</option>";
                                        });
-                                                                               
                        
+                                        
                                        $("#loc2").html( htmlString );
                                        }
                                        else
@@ -234,6 +273,7 @@
                        }
          });
 
+               $("#search-location_code").val('');
                update_component_table();
 
     });
@@ -253,6 +293,7 @@
 
        $("#loc2").change(function ()
        {
+               $("#search-location_code").val('');
                update_component_table();
     });
 
@@ -273,7 +314,7 @@
        $("#acl_form").live("submit", function(e){
                e.preventDefault();
                var control_id = $("#control_id_hidden").val();
-               
+
                if(!control_id || control_id == null)
                {
                        alert('du må velge kontroll');
@@ -296,7 +337,7 @@
                                        }
 
                                var obj = data;
-                       
+                 
                                var submitBnt = 
$(thisForm).find("input[type='submit']");
                                if(obj.status == "updated")
                                {
@@ -306,9 +347,9 @@
                                }
                                else
                                {
-                                       $(submitBnt).val("Feil ved lagring");   
                                
+                                       $(submitBnt).val("Feil ved lagring");
                                }
-                                               
+                 
                                // Changes text on save button back to original
                                window.setTimeout(function() {
                                                $(submitBnt).val('Lagre');
@@ -324,7 +365,7 @@
                                                        htmlString += 
data['receipt']['error'][i]['msg'];
                                                        htmlString += '</div>';
                                                }
-                                       
+        
                                        }
                                        if(typeof(data['receipt']['message']) 
!= 'undefined')
                                        {
@@ -334,7 +375,7 @@
                                                        htmlString += 
data['receipt']['message'][i]['msg'];
                                                        htmlString += '</div>';
                                                }
-                                       
+        
                                        }
                                        $("#receipt").html(htmlString);
                                }
@@ -367,12 +408,12 @@
                                if( data != null)
                                {
                                        var obj = data;
-                                               
+
                                        $.each(obj, function(i)
                                        {
                                                htmlString  += "<option 
value='" + obj[i].location_code + "'>" +  obj[i].location_code + " " + 
obj[i]["loc"+level+"_name"] + "</option>";
                                        });
-                                                                               
                        
+                                        
                                        $("#loc" + level).html( htmlString );
                                        if(level == 1)
                                        {
@@ -411,7 +452,7 @@
                url: requestUrl,
                success: function(data) {
                        if( data != null)
-                       {               
+                       {
                                myColumnDefs = data;
                                init_component_table();
                        }
@@ -433,18 +474,22 @@
                control_registered = 1;
        }
 
-       
+
        var cat_id = $("#cat_id").val() != null ? $("#cat_id").val():'';
-       
+
        if(!cat_id)
        {
                return false;
        }
-       
+
        var location_code = '';
-               
-       if( $("#loc2").val() != null && $("#loc2").val())
+
+       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())
@@ -480,16 +525,20 @@
        if($("#cat_id").val() != null)
        {
                var location_code = '';
-               
-               if( $("#loc2").val() != null && $("#loc2").val())
+
+               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_location.query2',
                        entity_id:$("#entity_id").val(),

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2012-06-17 08:50:05 UTC (rev 
9605)
+++ trunk/controller/setup/phpgw_no.lang        2012-06-17 19:03:18 UTC (rev 
9606)
@@ -197,6 +197,7 @@
 property       controller      no      Eiendom
 quarterly      controller      no      Kvartalvis
 recurrence     controller      no      Gjentakelse
+registered     controller      no      Registrert
 remove controller      no      Fjern
 controller     controller      no      Kontroll
 reports        controller      no      Rapporter
@@ -347,4 +348,5 @@
 components for control controller      no      Komponenter tilknyttet kontroll
 add components for control     controller      no      Legg til knytning 
mellom kontroll og komponent(er)
 location category      controller      no      Lokaliseringskategori
-select delete  controller      no      slett
\ No newline at end of file
+select add     controller      no      Velg for å legge til
+select delete  controller      no      Velg for sletting

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-17 08:50:05 UTC (rev 9605)
+++ 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-17 19:03:18 UTC (rev 9606)
@@ -108,6 +108,9 @@
                <td>
                        <xsl:value-of select="php:function('lang', 'location 
category')" />
                </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'name')" />
+               </td>
        </tr>
          <tr id="filter1">
 <!--
@@ -136,6 +139,10 @@
                  <select id="location_type_category" 
name="location_type_category">
                  </select>
                </td>
+               <td >
+                       <input type="text" value="" id="search-location-name" />
+                       <input id= "search-location_code" type="hidden" 
name="search-location_code"/>
+               </td>
          </tr>
        <tr>
                <td>
@@ -217,7 +224,7 @@
        <xsl:variable name="label_submit"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
        <div><input type="submit" name="update_acl" id="frm_update_acl" 
value="{$label_submit}"/></div>
 
-       <xsl:variable name="label_select_add"><xsl:value-of 
select="php:function('lang', 'select')" /></xsl:variable>
+       <xsl:variable name="label_select_add"><xsl:value-of 
select="php:function('lang', 'select add')" /></xsl:variable>
        <div><input type="button" name="select_add" id="frm_update_add" 
value="{$label_select_add}" onclick="checkAll('mychecks_add')"/></div>
        
        <xsl:variable name="label_select_delete"><xsl:value-of 
select="php:function('lang', 'select delete')" /></xsl:variable>




reply via email to

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