fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9489] controller: register control to component


From: Sigurd Nes
Subject: [Fmsystem-commits] [9489] controller: register control to component
Date: Mon, 04 Jun 2012 13:10:11 +0000

Revision: 9489
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9489
Author:   sigurdne
Date:     2012-06-04 13:10:10 +0000 (Mon, 04 Jun 2012)
Log Message:
-----------
controller: register control to component

Modified Paths:
--------------
    trunk/controller/inc/class.uicontrol_location.inc.php

Added Paths:
-----------
    trunk/controller/js/controller/ajax_control_to_component.js
    trunk/controller/js/yahoo/register_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-04 
13:07:30 UTC (rev 9488)
+++ trunk/controller/inc/class.uicontrol_location.inc.php       2012-06-04 
13:10:10 UTC (rev 9489)
@@ -29,6 +29,12 @@
        */
        
        phpgw::import_class('phpgwapi.yui');
+
+       /**
+       * Import the jQuery class
+       */
+       phpgw::import_class('phpgwapi.jquery');
+
        phpgw::import_class('controller.uicommon');
        phpgw::import_class('controller.socontrol_area');
        
@@ -57,7 +63,7 @@
                private $so_procedure;
        
                var $public_functions = array(
-                                                                               
'index' => true,
+                                                                               
'index'                                                         => true,
                                                                                
'view_locations_for_control'            => true,
                                                                                
'register_control_to_location'          => true,
                                                                                
'register_control_to_location_2'        => true,
@@ -65,7 +71,9 @@
                                                                                
'get_locations_for_control'             => true,
                                                                                
'get_location_category'                         => true,
                                                                                
'get_district_part_of_town'                     => true,
-                                                                               
'entity'                                                        => true
+                                                                               
'entity'                                                        => true,
+                                                                               
'index2'                                                        => true,
+                                                                               
'get_category_by_entity'                        => true
                                                                        );
 
                function __construct()
@@ -973,7 +981,8 @@
                        return $this->yui_results($results);
                }
                
-               public function query(){
+               public function query()
+               {
                        $type_id = phpgw::get_var('type_id', 'int');
                        $control_id = phpgw::get_var('control_id', 'int');
                        $control_id_init = phpgw::get_var('control_id_init', 
'int');
@@ -1090,4 +1099,302 @@
 
                        return json_encode( $part_of_town_list );
                }
+
+
+               /*
+
+                * Return parts of town based on chosen district
+                */
+               public function get_category_by_entity()
+               {
+                       $entity_id              = phpgw::get_var('entity_id');
+                       $entity                 = 
CreateObject('property.soadmin_entity');
+
+                       $category_list = 
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+
+/*                     $default_value = array 
('id'=>'','name'=>lang('select'));
+                       array_unshift($category_list,$default_value);
+*/
+                       return $category_list;
+               }
+
+               function index2()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $receipt = array();
+
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query2();
+                       }
+
+                       $msgbox_data = array();
+                       if( phpgw::get_var('phpgw_return_as') != 'json' && 
$receipt = phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                       {
+                               phpgwapi_cache::session_clear('phpgwapi', 
'phpgw_messages');
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($receipt);
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                       }
+
+                       $myColumnDefs = array();
+                       $datavalues = array();
+                       $myButtons      = array();
+
+                       $datavalues[] = array
+                       (
+                               'name'                          => "0",
+                               'values'                        => 
$this->query2(),//json_encode(array()),
+                               'total_records'         => 0,
+                               'permission'            => "''",
+                               'is_paginator'          => 0,
+                               'edit_action'           => "''",
+                               'footer'                        => 0
+                       );
+
+                       $datatable = array
+                       (
+                               array
+                               (
+                               'key' => 'id',
+                               'hidden' => true
+                               ),
+                               array
+                               (
+                                       'key' => 'user',
+                                       'label' => lang('user'),
+                                       'sortable' => false
+                               ),
+                               array
+                               (
+                                       'key' => 'ecodimb',
+                                       'label' => lang('dim b'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key'   =>      'role',
+                                       'label' =>      lang('role'),
+                                       'formatter' => 'FormatterRight',
+                                       'sortable'      =>      true
+                               ),
+                               array
+                               (
+                                       'key' => 'default_user',
+                                       'label' => lang('default'),
+                                       'sortable'      => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'active_from',
+                                       'label' => lang('date from'),
+                                       'sortable'      => true,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key' => 'active_to',
+                                       'label' => lang('date to'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'add',
+                                       'label' => lang('add'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'delete',
+                                       'label' => lang('delete'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'alter_date',
+                                       'label' => lang('alter_date'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode($datatable)
+                       );      
+
+
+
+                       $GLOBALS['phpgw']->translation->add_app('property');
+                       $entity                 = 
CreateObject('property.soadmin_entity');
+                       $entity_list    = $entity->read(array('allrows' => 
true));
+
+                       $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 ));
+
+                       array_unshift($entity_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift($district_list ,array 
('id'=>'','name'=>lang('select')));
+
+
+
+                       array_unshift ($role_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift ($dimb_list ,array 
('id'=>'','name'=>lang('select')));
+
+
+
+                       $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
+                       $cats->supress_info     = true;
+
+                       $control_area = 
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl' 
=> $this->_category_acl));
+
+                                                               
+                       $control_area_list = array();
+                       foreach($control_area['cat_list'] as $cat_list)
+                       {
+                               $control_area_list[] = array
+                               (
+                                       'id'    => $cat_list['cat_id'],
+                                       'name'  => $cat_list['name'],
+                               );              
+                       }
+
+                       array_unshift ($control_area_list ,array 
('id'=>'','name'=>lang('select')));
+
+                       $data = array
+                       (
+                               'td_count'                                      
        => '""',
+                               '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,
+                               '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),
+                                                                               
                        ),
+                               'update_action'                                 
=> self::link(array('menuaction' => 'controller.uicontrol_location.edit'))
+                       );
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('query_start');
+                       $GLOBALS['phpgw']->jqcal->add_listener('query_end');
+                       $GLOBALS['phpgw']->jqcal->add_listener('active_from');
+                       $GLOBALS['phpgw']->jqcal->add_listener('active_to');
+
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
+                       phpgwapi_yui::load_widget('paginator');
+                       phpgwapi_yui::load_widget('animation');
+
+                       phpgwapi_jquery::load_widget('core');
+
+                       self::add_javascript('controller', 'controller', 
'ajax_control_to_component.js');
+                       self::add_javascript('controller', 'yahoo', 
'register_control_to_component.js');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('control_location/register_control_to_component'));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
+               }
+       
+
+               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');
+
+//                     $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));
+
+                       foreach($values as &$entry)
+                       {
+                               if($entry['active_from'])
+                               {
+                                       $default_user_checked = 
$entry['default_user'] == 1 ? 'checked = "checked"' : '';
+                                       $entry['default_user'] = "<input 
id=\"default_user\" type =\"checkbox\" $default_user_checked 
name=\"values[default_user][]\" value=\"{$entry['id']}\">";
+                                       $entry['delete'] = "<input 
id=\"delete\" type =\"checkbox\" name=\"values[delete][]\" 
value=\"{$entry['id']}\">";
+                                       $entry['alter_date'] = "<input 
id=\"alter_date\" type =\"checkbox\" name=\"values[alter_date][]\" 
value=\"{$entry['id']}\">";
+                                       $entry['add'] = '';
+                               }
+                               else
+                               {
+                                       $entry['default_user'] = '';
+                                       $entry['delete'] = '';
+                                       $entry['alter_date'] = '';
+                                       $entry['add'] = "<input id=\"add\" type 
=\"checkbox\" name=\"values[add][]\" 
value=\"{$entry['ecodimb']}_{$entry['role_id']}_{$entry['user_id']}\">";        
                   
+                               }
+                               $results['results'][]= $entry;
+                       }
+
+                       return json_encode($values);
+               }
+
+               public function edit()
+               {
+                       $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 =        phpgw::get_var('query');
+
+                       if($values = phpgw::get_var('values'))
+                       {
+                               if(!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_EDIT, 'property'))
+                               {
+                                       $receipt['error'][]=true;
+                                       phpgwapi_cache::message_set(lang('you 
are not approved for this task'), 'error');
+                               }
+                               if(!$receipt['error'])
+                               {
+                                       if($this->bo->edit($values))
+                                       {
+                                               $result =  array
+                                               (
+                                                       'status'        => 
'updated'
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $result =  array
+                                               (
+                                                       'status'        => 
'error'
+                                               );
+                                       }
+                               }
+                       }
+
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               if( $receipt = 
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                               {
+                                       
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                       $result['receipt'] = $receipt;
+                               }
+                               else
+                               {
+                                       $result['receipt'] = array();
+                               }
+                               return $result;
+                       }
+                       else
+                       {
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_location.index2', 'user_id' => 
$user_id, 'dimb_id' => $dimb_id, 'role_id' => $role_id, 'query' => $query));
+                       }
+               }
        }

Added: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js                 
        (rev 0)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-04 
13:10:10 UTC (rev 9489)
@@ -0,0 +1,216 @@
+$(document).ready(function()
+{
+
+       $("#control_area_id").change(function () {
+               var control_area_id = $(this).val();
+                var oArgs = 
{menuaction:'controller.uicontrol.get_controls_by_control_area'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+        
+       //      $("#hidden_control_area_id").val( control_area_id );
+    //     var control_id_init = $("#hidden_control_id").val();
+         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);
+                                               
+                                         $.each(obj, function(i) {
+
+                                               var selected = '';
+/*
+                                               if(obj[i].id == control_id_init)
+                                               {
+                                                       selected = ' selected';
+                                               }
+*/
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
+                                       });
+                                                                               
                          
+                                         $("#control_id").html( htmlString );
+                                       }
+                                       else
+                                       {
+                                       htmlString  += "<option>Ingen 
kontroller</option>"
+                                       $("#control_id").html( htmlString );
+//                                             
$("#hidden_control_id").val(-1); //reset
+                               }
+                         }  
+                       });
+                       
+    });
+
+
+
+       $("#entity_id").change(function () {
+                var oArgs = 
{menuaction:'controller.uicontrol_location.get_category_by_entity', entity_id: 
$(this).val()};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+        
+         var htmlString = "";
+         
+         $.ajax({
+                         type: 'POST',
+                         dataType: 'json',
+                         url: requestUrl,
+                         success: function(data) {
+                                 if( data != null){
+                                         htmlString  = "<option>Velg</option>"
+                                         var obj = data;
+
+                                         $.each(obj, function(i) {
+
+                                               var selected = '';
+/*
+                                               if(obj[i].id == control_id_init)
+                                               {
+                                                       selected = ' selected';
+                                               }
+*/
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                       });
+                                                                               
                          
+                                         $("#category_id").html( htmlString );
+                                       }
+                                       else
+                                       {
+                                       htmlString  += "<option>Ingen 
kontroller</option>"
+                                       $("#category_id").html( htmlString );
+                               }
+                         }  
+                       });
+                       
+    });
+
+
+       //update part of town category based on district
+       $("#district_id").change(function () {
+               var district_id = $(this).val();
+                var oArgs = 
{menuaction:'controller.uicontrol_location.get_district_part_of_town'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+         
+         var htmlString = "";
+         
+         $.ajax({
+                         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 
);
+                               }
+                         }  
+         });
+    });
+
+
+
+
+       $("#dimb_id").change(function ()
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#user_id").change(function ()
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#role_id").change(function ()
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#search").click(function(e)
+       {
+               update_dimb_role_user_table();
+    });
+
+       $("#acl_form").live("submit", function(e){
+               e.preventDefault();
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                       success: function(data) {
+                               if(data)
+                               {
+                                       if(data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                               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");   
                                
+                                       }
+                                                
+                               // Changes text on save button back to original
+                               window.setTimeout(function() {
+                                               $(submitBnt).val('Lagre');
+                                               
$(submitBnt).addClass("not_active");
+                               }, 1000);
+
+                                       var htmlString = "";
+                                       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')
+                                       {
+                                               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);
+                               }
+                       }
+               });
+       });
+});
+
+
+function update_dimb_role_user_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);
+       $("#receipt").html('');
+}
+
+
+
+

Added: trunk/controller/js/yahoo/register_control_to_component.js
===================================================================
--- trunk/controller/js/yahoo/register_control_to_component.js                  
        (rev 0)
+++ trunk/controller/js/yahoo/register_control_to_component.js  2012-06-04 
13:10:10 UTC (rev 9489)
@@ -0,0 +1,38 @@
+var    myPaginator_0, myDataTable_0
+
+       this.myParticularRenderEvent = function()
+       {
+
+       }
+
+
+
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+       }       
+
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
+
+
+ 
/********************************************************************************/
+
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+       loader = new YAHOO.util.YUILoader();
+       loader.addModule({
+               name: "anyone",
+               type: "js",
+           fullpath: property_js
+           });
+
+       loader.require("anyone");
+    loader.insert();
+});
+
+
+

Added: 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
===================================================================
--- 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
                          (rev 0)
+++ 
trunk/controller/templates/base/control_location/register_control_to_component.xsl
  2012-06-04 13:10:10 UTC (rev 9489)
@@ -0,0 +1,217 @@
+<!-- $Id: dimb_role_user.xsl 9320 2012-05-08 18:07:51Z sigurdne $ -->
+
+<func:function name="phpgw:conditional">
+       <xsl:param name="test"/>
+       <xsl:param name="true"/>
+       <xsl:param name="false"/>
+
+       <func:result>
+               <xsl:choose>
+                       <xsl:when test="$test">
+                               <xsl:value-of select="$true"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$false"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </func:result>
+</func:function>
+
+<!-- separate tabs and  inline tables-->
+
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <style type="text/css">
+       #box { width: 200px; height: 5px; background: blue; }
+       select { width: 200px; }
+       .row_on,.th_bright
+       {
+               background-color: #CCEEFF;
+       }
+
+       .row_off
+       {
+               background-color: #DDF0FF;
+       }
+
+       </style>
+
+       <xsl:call-template name="invoice" />
+       <div id="popupBox"></div>       
+       <div id="curtain"></div>
+</xsl:template>
+
+<xsl:template name="invoice" xmlns:php="http://php.net/xsl";>
+       <!-- loads translations into array for use with javascripts -->
+       <!--
+       <script type="text/javascript">
+               var lang = <xsl:value-of select="php:function('js_lang', 
'edit')"/>;
+       </script>
+       -->
+
+       <div class="yui-content">
+               <div id="invoice-layout">
+                               <div class="header">
+                                       <h2><xsl:value-of 
select="php:function('lang', 'invoice')"/></h2>
+                               </div>
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <xsl:call-template name="msgbox"/>
+                               </xsl:when>
+                       </xsl:choose>
+                               <div class="body">
+                                       <div id="voucher_details">
+                                               <!--<xsl:call-template 
name="yui_phpgw_i18n"/>-->
+                                               <table align = "center" 
width="95%">
+                                                       <xsl:apply-templates 
select="filter_form" />
+                                               </table>
+                                               <form action="{update_action}" 
name="acl_form" id="acl_form" method="post">
+                                                       <table align = "center" 
width="95%">
+                                                               <tr>
+                                                                       <td 
colspan = '6'>
+                                                                               
<xsl:apply-templates select="paging"/>
+                                                                               
<xsl:apply-templates select="datatable"/>
+                                                                       </td>
+                                                               </tr>
+                                                       </table>
+                                               </form>
+                                       </div>
+                               </div>
+               </div>
+       </div>
+</xsl:template>
+
+<xsl:template match="filter_form" xmlns:php="http://php.net/xsl";>
+               <xsl:call-template name="filter_list"/>
+</xsl:template>
+
+<xsl:template name="filter_list" xmlns:php="http://php.net/xsl";>
+       <tr>
+       <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 
id')" />
+               </td>
+       </tr>
+         <tr id="filter1">
+               <td>
+                 <select id="control_area_id" name="control_area_id">
+                       <xsl:apply-templates 
select="control_area_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="control_id" name="control_id">
+                       <xsl:apply-templates select="control/options"/>
+                 </select>
+               </td>           
+         </tr>
+       <tr>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'entity')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'category')" 
/>
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'district')" 
/>
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'part of 
town')" />
+               </td>
+               <td >
+                       <xsl:value-of select="php:function('lang', 'search')" />
+               </td>
+       </tr>
+         <tr id="filter2">
+               <td>
+                 <select id="entity_id" name="entity_id">
+                       <xsl:apply-templates select="entity_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="category_id" name="category_id">
+                       <xsl:apply-templates select="category_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="district_id" name="district_id">
+                       <xsl:apply-templates select="district_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="part_of_town_id" name="part_of_town_id">
+                       <xsl:apply-templates 
select="part_of_town_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>                   
+         </tr>
+         </table>
+         </td>
+         </tr>
+</xsl:template>
+
+
+
+
+<xsl:template match="datatable" xmlns:php="http://php.net/xsl";>
+       <div id="paging_0"/>
+       <div id="datatable-container_0"/>
+
+       <div id="data_paginator"/>
+       <div id="datatable-container"/>
+       
+       <xsl:call-template name="datasource-definition" />
+       <div id="receipt"></div>
+       <xsl:variable name="label_submit"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
+       <div class="row_on"><input type="submit" name="update_acl" 
id="frm_update_acl" value="{$label_submit}"/></div>
+</xsl:template>
+
+<xsl:template name="datasource-definition" xmlns:php="http://php.net/xsl";>
+
+               <!--  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();
+                       var td_count = <xsl:value-of select="//td_count"/>;
+
+                       <xsl:for-each select="//datatable">
+                               datatable[<xsl:value-of select="name"/>] = [
+                                       {
+                                               values:<xsl:value-of 
select="values"/>,
+                                               total_records: <xsl:value-of 
select="total_records"/>,
+                                               is_paginator:  <xsl:value-of 
select="is_paginator"/>,
+                                               edit_action:  <xsl:value-of 
select="edit_action"/>,
+                                               footer:<xsl:value-of 
select="footer"/>
+                                       }
+                               ]
+                       </xsl:for-each>
+                       <xsl:for-each select="//myColumnDefs">
+                               myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+                       <xsl:for-each select="//myButtons">
+                               myButtons[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
+                       </xsl:for-each>
+               </script>
+
+
+</xsl:template>
+
+<!-- options for use with select-->
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected"/>
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>
+




reply via email to

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