fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [9600] controller: register control til component
Date: Fri, 15 Jun 2012 15:56:10 +0000

Revision: 9600
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9600
Author:   sigurdne
Date:     2012-06-15 15:56:09 +0000 (Fri, 15 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-15 
10:42:19 UTC (rev 9599)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-15 
15:56:09 UTC (rev 9600)
@@ -284,6 +284,7 @@
                                        );              
                                }
 
+/*
                                $control_info = 
execMethod('controller.socontrol.get_single', $control_id);
                                if($control_info)
                                {
@@ -293,7 +294,7 @@
                                                'title' => 
$control_info->get_title()
                                        );
                                }
-
+*/
                                $tabs = array
                                ( 
                                        array
@@ -304,23 +305,14 @@
                                        array
                                        (
                                                'label' => 
lang('Add_locations_for_control')
-                                       ),
-                                       array
-                                       (
-                                               'label' => lang('add components 
for control'),
-                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_location.register_control_to_component'))
                                        )
-
                                );
                                                
                                $data = array(
                                        'tabs'                                  
        => $GLOBALS['phpgw']->common->create_tabs($tabs, 1),
                                        'view'                                  
        => "register_control_to_location",
                                        'control_id'                            
=> $control_id,
-                                       'control_filters'                       
=> array(
-                                               'control_areas_array'   => 
$control_areas_array,
-                                               'control_array'                 
        => $control_array
-                                       ),
+                                       'control_areas_array'           => 
$control_areas_array,
                                        'filter_form'                           
=> array(
                                                'building_types'                
        => $building_types,
                                                'category_types'                
        => $category_types,
@@ -655,12 +647,13 @@
                        (
                                'tabs'                                          
        => $GLOBALS['phpgw']->common->create_tabs($tabs, 2),
                                'td_count'                                      
        => '""',
-                               'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+               //              'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                'datatable'                                     
        => $datavalues,
                                'myColumnDefs'                                  
=> $myColumnDefs,
                                'myButtons'                                     
        => $myButtons,
 
                                'msgbox_data'                                   
=> $msgbox_data,
+                               'control_area_list'             => 
array('options' => $control_area_list),
                                'filter_form'                                   
=> array
                                                                                
                        (
                                                                                
                                'control_area_list'             => 
array('options' => $control_area_list),
@@ -728,7 +721,7 @@
                        (
                                'key'           => 'select',
                                'label'         => lang('select'),
-                               'sortable'      => true,
+                               'sortable'      => false,
                                'formatter'     => false,
                                'hidden'        => false,
                                'formatter' => '',
@@ -796,6 +789,7 @@
                        $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');
+                       $results                        = 
phpgw::get_var('results', 'int');
 
                        if(!$entity_id && !$cat_id)
                        {
@@ -805,7 +799,7 @@
                        {
                                $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
                                $boentity       = 
CreateObject('property.boentity',false, 'entity');
-                               $boentity->results = phpgw::get_var('results', 
'int');
+                               $boentity->results = $results;
                                $values = $boentity->read();
                        }               
 
@@ -820,22 +814,25 @@
                                $entry['select'] = "<input class 
=\"mychecks_add\" type =\"checkbox\" $checked 
name=\"values[register_component][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
                        }
 
-                       $results['recordsReturned'] = count($values);
-                       $results['totalRecords'] = $boentity->total_records;
-                       $results['startIndex'] = $this->start;
-                       $results['sort'] = 'location_code';
-                       $results['dir'] = "ASC";
-                       $results['pageSize'] = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       $results['activePage'] = floor($this->start / 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) + 1;
-                       $results['records'] = $values;
+                       
+                       $results = $results ? $results : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $return_data['recordsReturned'] = count($values);
+                       $return_data['totalRecords'] = $boentity->total_records;
+                       $return_data['startIndex'] = $this->start;
+                       $return_data['sort'] = 'location_code';
+                       $return_data['dir'] = "ASC";
+                       $return_data['pageSize'] = $results;
+                       $return_data['activePage'] = floor($this->start / 
$results) + 1;
+                       $return_data['records'] = $values;
 
-                       return $results;
+                       return $return_data;
                }
 
                public function edit_component()
                {
                        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-15 
10:42:19 UTC (rev 9599)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-15 
15:56:09 UTC (rev 9600)
@@ -238,10 +238,10 @@
 
     });
 
-
-
        $("#control_id").change(function ()
        {
+               $("#control_id_hidden").val( $(this).val() );
+
                update_component_table();
     });
 
@@ -261,6 +261,14 @@
 
        $("#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');
+                       return;
+               }
+
                var thisForm = $(this);
                var submitBnt = $(thisForm).find("input[type='submit']");
                var requestUrl = $(thisForm).attr("action");
@@ -393,8 +401,7 @@
                success: function(data) {
                        if( data != null)
                        {               
-                               myColumnDefs = [];
-                               myColumnDefs.push(data);
+                               myColumnDefs = data;
                                init_component_table();
                        }
                        else
@@ -416,11 +423,11 @@
                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").val() != null ? 
$("#control_id").val():''
+               control_id:$("#control_id_hidden").val() != null ? 
$("#control_id_hidden").val():''
        };
        var requestUrl = phpGWLink('index.php', oArgs, true);
 
-       YAHOO.PORTICO.init_datatable(myColumnDefs[0],requestUrl);
+       YAHOO.PORTICO.init_datatable(myColumnDefs,requestUrl);
 }
 
 
@@ -435,7 +442,7 @@
                        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").val() != null ? 
$("#control_id").val():''
+                       control_id:$("#control_id_hidden").val() != null ? 
$("#control_id_hidden").val():''
                };
 
                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-15 
10:42:19 UTC (rev 9599)
+++ trunk/controller/js/yahoo/register_control_to_component2.js 2012-06-15 
15:56:09 UTC (rev 9600)
@@ -139,6 +139,7 @@
 //                                             previousPageLinkLabel: "&lt; 
previous",
 //                                             nextPageLinkLabel: "next &gt;",
 //                                             lastPageLinkLabel: "last 
&gt;&gt;",
+//                                             template                        
: "{RowsPerPageDropdown} elements_pr_page. {CurrentPageReport}<br/>  
{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",
                                                template                        
: "{CurrentPageReport}<br/>  {FirstPageLink} {PreviousPageLink} {PageLinks} 
{NextPageLink} {LastPageLink}",
                                                pageReportTemplate      : 
"shows_from {startRecord} to {endRecord} of_total {totalRecords}."
                                                }
@@ -156,7 +157,7 @@
     };
     
     // DataTable instance
-    var myDataTable = new YAHOO.widget.DataTable("dynamicdata", myColumnDefs, 
myDataSource, myConfigs);
+    var myDataTable = new YAHOO.widget.DataTable("datatable-container", 
myColumnDefs, myDataSource, myConfigs);
     // Update totalRecords on the fly with values from server
     myDataTable.doBeforeLoadData = function(oRequest, oResponse, oPayload) {
                YAHOO.PORTICO.requestUrl = requestUrl + oRequest;

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-15 10:42:19 UTC (rev 9599)
+++ 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-15 15:56:09 UTC (rev 9600)
@@ -24,6 +24,15 @@
        <style type="text/css">
                select { width: 100px; }
        </style>
+       <div id="choose_control" class="select-box">
+               <label>Velg kontrollen du vil vise komponent for</label>
+               <select id="control_area_id" name="control_area_id">
+                       <xsl:apply-templates 
select="control_area_list/options"/>
+               </select>                
+               <select id="control_id" name="control_id">
+                       <xsl:apply-templates select="control/options"/>
+               </select>
+       </div>
 
 <div class="yui-navset yui-navset-top" id="control_location_tabview">
        <div class="identifier-header">
@@ -82,12 +91,14 @@
        <td colspan = '6'>
        <table>
        <tr>
+<!--
                <td>
                        <xsl:value-of select="php:function('lang', 'control 
area')" />
                </td>
                <td>
                        <xsl:value-of select="php:function('lang', 'control')" 
/>
                </td>
+-->
                <td>
                        <xsl:value-of select="php:function('lang', 'location 
type')" />
                </td>
@@ -96,6 +107,7 @@
                </td>
        </tr>
          <tr id="filter1">
+<!--
                <td>
                  <select id="control_area_id" name="control_area_id">
                        <xsl:apply-templates 
select="control_area_list/options"/>
@@ -105,8 +117,10 @@
                  <select id="control_id" name="control_id">
                        <xsl:apply-templates select="control/options"/>
                  </select>
-               </td>           
+               </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"/>
                  </select>
@@ -135,9 +149,11 @@
                <td>
                        <xsl:value-of select="php:function('lang', 'building')" 
/>
                </td>
+<!--
                <td >
                        <xsl:value-of select="php:function('lang', 'search')" />
                </td>
+-->
        </tr>
          <tr id="filter2">
                <td>
@@ -170,10 +186,12 @@
                        <xsl:apply-templates select="loc2_list/options"/>
                  </select>
                </td>
+<!--
                <td>
                        <xsl:variable name="lang_search"><xsl:value-of 
select="php:function('lang', 'Search')" /></xsl:variable>
                        <input type="button" id = "search" name="search" 
value="{$lang_search}" title = "{$lang_search}" />
-               </td>                   
+               </td>    
+-->            
          </tr>
          </table>
          </td>
@@ -185,7 +203,7 @@
 
 <xsl:template match="datatable" xmlns:php="http://php.net/xsl";>
        <div id="paging"></div>
-       <div id="dynamicdata"></div>
+       <div id="datatable-container"></div>
 
        <xsl:call-template name="datasource-definition" />
        <div id="receipt"></div>




reply via email to

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