fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8235]


From: Torstein
Subject: [Fmsystem-commits] [8235]
Date: Mon, 05 Dec 2011 09:01:59 +0000

Revision: 8235
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8235
Author:   vator
Date:     2011-12-05 09:01:59 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/templates/base/control.xsl

Added Paths:
-----------
    trunk/controller/templates/base/add_location_to_control.xsl
    trunk/controller/templates/base/common.xsl
    trunk/controller/templates/base/control_location_tabs.xsl
    trunk/controller/templates/base/view_locations_for_control.xsl

Removed Paths:
-------------
    trunk/controller/templates/base/locations.xsl

Added: trunk/controller/templates/base/add_location_to_control.xsl
===================================================================
--- trunk/controller/templates/base/add_location_to_control.xsl                 
        (rev 0)
+++ trunk/controller/templates/base/add_location_to_control.xsl 2011-12-05 
09:01:59 UTC (rev 8235)
@@ -0,0 +1,199 @@
+<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>
+
+<xsl:template name="add_location_to_control">
+       <!-- IMPORTANT!!! Loads YUI javascript -->
+       <xsl:call-template name="common"/>
+
+       <div class="yui-content">
+               <div id="control_details">
+                       <xsl:call-template name="yui_booking_i18n"/>
+                       <xsl:apply-templates select="control_filters" />
+                       <xsl:apply-templates select="filter_form" />
+                       <xsl:apply-templates select="paging"/>
+                       <xsl:apply-templates select="datatable"/>
+                       <xsl:apply-templates select="form/list_actions"/>
+               </div>
+       </div>
+</xsl:template>
+
+<xsl:template match="control_filters" name="control_filters">
+       <div style="margin: 10px;padding: 10px; width: 25%;">
+               
+               <!-- When control area is chosen, an ajax request is executed. 
The operation fetches controls from db and populates the control list.
+                        The ajax opearation is handled in ajax.js --> 
+                <select style="float:left;" id="control_area_list" 
name="control_area_list">
+                       <xsl:for-each select="control_area_array">
+                               <xsl:variable 
name="control_area_id"><xsl:value-of select="id"/></xsl:variable>
+                               <option value="{$control_area_id}">
+                                       <xsl:value-of select="title"/>
+                               </option>                       
+                   </xsl:for-each>
+               </select>
+                
+                <form id="loc_form" action="" method="GET">
+                       <select id="control_id" name="control_id">
+                               <xsl:choose>
+                                       <xsl:when 
test="control_array/child::node()">
+                                               <xsl:for-each 
select="control_array">
+                                                       <xsl:variable 
name="control_id"><xsl:value-of select="id"/></xsl:variable>
+                                                       <option 
value="{$control_id}">
+                                                               <xsl:value-of 
select="title"/>
+                                                       </option>               
                
+                                           </xsl:for-each>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <option>
+                                                       Ingen kontroller
+                                               </option>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </select>
+               </form>
+       </div>
+</xsl:template>
+
+<xsl:template match="filter_form">
+       <form id="queryForm">
+               <xsl:attribute name="method">
+                       <xsl:value-of select="phpgw:conditional(not(method), 
'GET', method)"/>
+               </xsl:attribute>
+
+               <xsl:attribute name="action">
+                       <xsl:value-of select="phpgw:conditional(not(action), 
'', action)"/>
+               </xsl:attribute>
+        <xsl:call-template name="filter_list"/>
+       </form>
+       
+       <form id="update_table_dummy" method='POST' action='' >
+       </form>
+
+</xsl:template>
+
+<xsl:template name="filter_list" xmlns:php="http://php.net/xsl";>
+    <div>
+         <ul id="filters">
+               <li>
+                 <select id="type_id" name="type_id">
+                       <option value="">
+                               <xsl:value-of select="php:function('lang', 
'Choose_building_type')"/>
+                       </option>
+                       <xsl:for-each select="building_types">
+                               <xsl:variable 
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
+                               <option value="{$building_type_id}">
+                                       <xsl:value-of select="name"/>
+                               </option>
+                   </xsl:for-each>
+                 </select>
+           </li>
+           <li>
+                 <select id="cat_id" name="cat_id">
+                       <option value="">
+                               <xsl:value-of select="php:function('lang', 
'Choose_building_category')"/>
+                       </option>
+                       <xsl:for-each select="category_types">
+                               <xsl:variable 
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
+                               <option value="{$category_type_id}">
+                                       <xsl:value-of select="name"/>
+                               </option>
+                   </xsl:for-each>
+                 </select>
+           </li>
+           <li>
+                 <select id="district_id" name="district_id">
+                       <option value="">
+                                       <xsl:value-of 
select="php:function('lang', 'Choose_district')"/>
+                       </option>
+                       <xsl:for-each select="district_list">
+                               <xsl:variable name="district_id"><xsl:value-of 
select="id"/></xsl:variable>
+                               <option value="{$district_id}">
+                                       <xsl:value-of select="name"/>
+                               </option>
+                   </xsl:for-each>
+                 </select>
+           </li>
+           <li>
+                 <select id="part_of_town_id" name="part_of_town_id">
+                       <option value="">
+                                       <xsl:value-of 
select="php:function('lang', 'Choose_part_of_town')"/>
+                       </option>
+                       <xsl:for-each select="part_of_town_list">
+                               <xsl:variable 
name="part_of_town_id"><xsl:value-of select="id"/></xsl:variable>
+                               <option value="{$part_of_town_id}">
+                                       <xsl:value-of select="name"/>
+                               </option>
+                   </xsl:for-each>
+                 </select>
+           </li>           
+         </ul>
+         <ul id="search_list">
+                 <li>
+                       <input type="text" name="query" />
+                 </li>
+                 <li>
+                       <xsl:variable name="lang_search"><xsl:value-of 
select="php:function('lang', 'Search')" /></xsl:variable>
+                       <input type="submit" name="search" 
value="{$lang_search}" title = "{$lang_search}" />
+                 </li>             
+         </ul>
+       
+    </div>
+</xsl:template>
+
+<xsl:template match="datatable">
+    <div id="data_paginator"/>
+    <div id="datatable-container"/>
+       <xsl:call-template name="datasource-definition" />
+</xsl:template>
+
+
+<xsl:template name="datasource-definition">
+       <script>
+               YAHOO.namespace('controller');
+        
+               YAHOO.controller.columnDefs = [
+                               <xsl:for-each select="//datatable/field">
+                                       {
+                                               key: "<xsl:value-of 
select="key"/>",
+                                               <xsl:if test="label">
+                                               label: "<xsl:value-of 
select="label"/>",
+                                           </xsl:if>
+                                               sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+                                               <xsl:if test="hidden">
+                                               hidden: true,
+                                           </xsl:if>
+                                               <xsl:if test="formatter">
+                                               formatter: <xsl:value-of 
select="formatter"/>,
+                                           </xsl:if>
+                                               className: "<xsl:value-of 
select="className"/>"
+                                       }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+                               </xsl:for-each>
+                       ];
+
+               var main_source = '<xsl:value-of select="source"/>';
+               var main_columnDefs = YAHOO.controller.columnDefs;
+               var main_form = 'queryForm';
+               var main_filters = ['type_id', 'cat_id', 'district_id', 
'part-of_town_list', 'responsibility_roles_list'];
+               var main_container = 'datatable-container';
+               var main_table_id = 'datatable';
+               var main_pag = 'data_paginator';
+               var related_table = new Array('locations_table');
+       
+               setDataSource(main_source, main_columnDefs, main_form, 
main_filters, main_container, main_pag, main_table_id, related_table ); 
+               
+       </script>
+        
+</xsl:template>
\ No newline at end of file


Property changes on: trunk/controller/templates/base/add_location_to_control.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/controller/templates/base/common.xsl
===================================================================
--- trunk/controller/templates/base/common.xsl                          (rev 0)
+++ trunk/controller/templates/base/common.xsl  2011-12-05 09:01:59 UTC (rev 
8235)
@@ -0,0 +1,527 @@
+<xsl:template name="common" xmlns:php="http://php.net/xsl";>
+
+
+<script type="text/javascript">
+
+<![CDATA[
+
+/**
+ * Javascript for the controller module.  Holds datasource init functions and 
form helpers.
+ *
+ * Functions and objects within this file are kept in the YAHOO.controller 
namespace.
+ */
+
+       YAHOO.namespace('controller');
+
+       // Holds data source setup funtions
+       YAHOO.controller.setupDatasource = new Array();
+
+       //Holds all data sources
+       YAHOO.controller.datatables = new Array();
+
+       counter = 0;
+       // Adds data source setup funtions
+       function setDataSource(source_url, column_defs, form_id, filter_ids, 
container_id, paginator_id, datatable_id,rel_id, editor_action, 
disable_left_click) {
+               YAHOO.controller.setupDatasource.push(
+                       function() {
+                               this.url = source_url;
+                               this.columns = column_defs;
+                               this.form = form_id;
+                               this.filters = filter_ids;
+                               this.container = container_id;
+                               this.paginator = paginator_id;
+                               this.tid = datatable_id;
+                               this.related_datatable = rel_id;
+                               this.editor_action = editor_action;
+                               if(disable_left_click) {
+                                       this.disable_left_click = true;
+                               } else {
+                                       this.disable_left_click = false;
+                               }
+                       }
+               );
+       }
+       
+       // Reloads all data sources that are necessary based on the selected 
related datatable
+       function reloadDataSources(selected_datatable){
+                               
+               //... hooks into  the regular callback function 
(onDataReturnInitializeTable) call to set empty payload array
+               var loaded =  function  ( sRequest , oResponse , oPayload ) {
+                       var payload = new Array();
+                       this.onDataReturnInitializeTable( sRequest , oResponse 
, payload );
+               }
+               
+               //... refresh the selected data tables
+               
selected_datatable.getDataSource().sendRequest('',{success:loaded, 
scope:selected_datatable});
+               
+               //... traverse all datatables and refresh related (to the 
selected) data tables
+               for(var i=0; i<YAHOO.controller.datatables.length; i++){
+                       var datatable = YAHOO.controller.datatables[i];
+
+                       for(var j=0;j<selected_datatable.related.length;j++){
+                               var curr_related = 
selected_datatable.related[j];
+                       
+                               if(datatable.tid == curr_related){
+                                       
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
+                               }
+                       }
+               }
+       }
+
+       var highlightEditableCell = function(oArgs) {
+               var elCell = oArgs.target;
+               if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+                       this.highlightCell(elCell);
+               }
+       };
+
+       // Wraps data sources setup logic
+       function dataSourceWrapper(source_properties,pag) {
+
+               this.properties = source_properties;
+               this.paginator = pag;
+
+               //... prepare base url
+               this.url = this.properties.url;
+               if(this.url[length-1] != '&') {
+                       this.url += '&';
+               }
+
+               //... set up a new data source
+               this.source = new YAHOO.util.DataSource(this.url);
+
+               this.source.responseType = YAHOO.util.DataSource.TYPE_JSON;
+               this.source.connXhrMode = "queueRequests";
+
+               this.source.responseSchema = {
+                       resultsList: "ResultSet.Result",
+                       fields: this.properties.columns,
+                       metaFields : {
+                               totalRecords: "ResultSet.totalRecords"
+                       }
+               };
+       
+               //... set up a new data table
+               
+               ]]>
+               
+               this.table = new YAHOO.widget.DataTable(
+                       this.properties.container,
+                       this.properties.columns,
+                       this.source,
+                       {
+                               paginator: this.paginator,
+                               dynamicData: true,
+                               MSG_EMPTY: '<xsl:value-of 
select="php:function('lang', 'DATATABLE_MSG_EMPTY')"/>',
+                               MSG_ERROR: '<xsl:value-of 
select="php:function('lang', 'DATATABLE_MSG_ERROR')"/>',
+                               MSG_LOADING: '<xsl:value-of 
select="php:function('lang', 'DATATABLE_MSG_LOADING')"/>'
+                       }
+               );
+               
+               <![CDATA[
+
+               //... set table properties
+               this.table.related = this.properties.related_datatable;
+               this.table.tid = this.properties.tid;
+               this.table.container_id = this.properties.container;
+               this.table.editor_action = this.properties.editor_action;
+
+               //... push the data table on a stack
+               YAHOO.controller.datatables.push(this.table);
+
+               //... ?
+               this.table.handleDataReturnPayload = function(oRequest, 
oResponse, oPayload) {
+                       if(oPayload){
+                               oPayload.totalRecords = 
oResponse.meta.totalRecords;
+                               return oPayload;
+                       }
+               }
+
+               //... create context menu for each record after the table has 
loaded the data
+               this.table.doAfterLoadData = function() {
+                       onContextMenuBeforeShow = function(p_sType, p_aArgs)
+                       {
+                               var oTarget = this.contextEventTarget;
+                               if (this.getRoot() == this)
+                               {
+                                       if(oTarget.tagName != "TD")
+                                       {
+                                               oTarget = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+                                       }
+                                       oSelectedTR = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+                                       oSelectedTR.style.backgroundColor  = 
'#AAC1D8' ;
+                                       oSelectedTR.style.color = "black";
+                                       YAHOO.util.Dom.addClass(oSelectedTR, 
prefixSelected);
+                               }
+                       }
+
+                       onContextMenuHide = function(p_sType, p_aArgs)
+                       {
+                               if (this.getRoot() == this && oSelectedTR)
+                               {
+                                       oSelectedTR.style.backgroundColor  = "" 
;
+                                       oSelectedTR.style.color = "";
+                                       YAHOO.util.Dom.removeClass(oSelectedTR, 
prefixSelected);
+                               }
+                       }
+                       
+                       var records = this.getRecordSet();
+                       
+                       var validRecords = 0;
+                       for(var i=0; i<records.getLength(); i++) {
+                               var record = records.getRecord(i);
+                               
+                               if(record == null)
+                               {
+                                       continue;
+                               }
+                               else
+                               {
+                                       validRecords++;
+                               }
+                                       
+                               // use a global counter to create unique names 
(even for the same datatable) for all context menues on the page
+                               var menuName = this.container_id + "_cm_" + 
counter;
+                               counter++;
+
+                               //... add menu items with label and handler 
function for click events
+                               var labels = record.getData().labels;
+                                
+                               //create a context menu that triggers on the 
HTML row element
+                               record.menu = new 
YAHOO.widget.ContextMenu(menuName,{trigger:this.getTrEl(validRecords -1 
),itemdata: labels, lazyload: true});
+
+                               //... subscribe handler for click events
+                               
record.menu.clickEvent.subscribe(onContextMenuClick, this);
+                               record.menu.subscribe("beforeShow", 
onContextMenuBeforeShow);
+                               record.menu.subscribe("hide", 
onContextMenuHide);
+
+                               //... render the menu on the related table row
+                               
record.menu.render(this.getTrEl(validRecords-1));
+                       }
+
+                       
+               }
+
+               //... calback methods for handling ajax calls
+               var ajaxResponseSuccess = function(o){
+                       reloadDataSources(this.args);
+               };
+
+               var ajaxResponseFailure = function(o){
+                       reloadDataSources(this.args);
+               };
+
+               //...create a handler for context menu clicks
+               var onContextMenuClick = function(eventString, args, table) {
+                       //... the argument holds the selected index number in 
the context menu
+                       var task = args[1];
+                       
+                       //... only act on a data table
+                       if(table instanceof YAHOO.widget.DataTable) {
+                               //... retrieve the record based on the selected 
table row
+                               var row = 
table.getTrEl(this.contextEventTarget);
+                               var record = table.getRecord(row);
+                                                                               
                
+                               //... check whether this action should be an 
AJAX call
+                               if( record.getData().ajax[task.index] ) {
+                                       
+                                       //var control_id = 
YAHOO.util.Dom.get("control_id").value;
+                                                                               
+                                       var alertStatus = false;
+
+                                       // Check if confirm box should be 
displayed before request is executed
+                                       if( record.getData().alert != null )
+                                           alertStatus = 
record.getData().alert[0];
+
+                                       if( alertStatus ){
+                                               // Display confirm box with 
message
+                                               var alertMessage = 
record.getData().alert[1];
+                                               var answer = confirm( 
alertMessage );
+                                               
+                                               // Abort request if user clicks 
the abort button
+                                               if (!answer){
+                                                       return false;
+                                               }
+                                       }
+                                       
+                                       var requestUrl = 
record.getData().actions[ task.index ] + "&control_id=" + control_id;
+                                       alert(requestUrl)
+                                       var request = 
YAHOO.util.Connect.asyncRequest(
+                                               'GET',
+                                               requestUrl,
+                                               {
+                                                       success: 
ajaxResponseSuccess,
+                                                       success: 
ajaxResponseFailure,
+                                                       args: table
+                                               });
+                               } else {
+                                       window.location = 
record.getData().actions[task.index];
+                               }
+                       }
+               };
+
+               // Handle mouseover and click events for inline editing
+               this.table.subscribe("cellMouseoverEvent", 
highlightEditableCell);
+               this.table.subscribe("cellMouseoutEvent", 
this.table.onEventUnhighlightCell);
+               this.table.subscribe("cellClickEvent", 
this.table.onEventShowCellEditor);
+
+               this.table.subscribe("editorSaveEvent", function(oArgs) {
+                       var field = oArgs.editor.getColumn().field;
+                       var value = oArgs.newData;
+                       var id = oArgs.editor.getRecord().getData().id;
+                       var action = oArgs.editor.getDataTable().editor_action;
+
+                       // Translate to unix time if the editor is a calendar.
+                       if (oArgs.editor._sType == 'date') {
+                               var selectedDate = 
oArgs.editor.calendar.getSelectedDates()[0];
+                               //alert("selDate1: " + selectedDate);
+                               // Make sure we're at midnight GMT
+                               selectedDate = selectedDate.toString().split(" 
");
+                               //for(var e=0;e<selectedDate.length;e++){
+                               //      alert("element " + e + ": " + 
selectedDate[e]);
+                               //}
+                               if(selectedDate[3] == "00:00:00"){
+                               //      alert("seldate skal byttes!");
+                                       selectedDate = 
selectedDate.slice(0,3).join(" ") + " " + selectedDate[5] + " 00:00:00 GMT"; 
+                               }
+                               else{
+                                       selectedDate = 
selectedDate.slice(0,4).join(" ") + " 00:00:00 GMT";
+                               }
+                               //selectedDate = 
selectedDate.toString().split(" ").slice(0, 4).join(" ") + " 00:00:00 GMT";
+                               //alert("selDate2: " + selectedDate);
+                               var value = Math.round(Date.parse(selectedDate) 
/ 1000);
+                               //alert("selDate3 value: " + value);
+                       }
+
+                       var request = YAHOO.util.Connect.asyncRequest(
+                                       'GET',
+                                       'index.php?menuaction=' + action + 
"&amp;field=" + field + "&amp;value=" + value + "&amp;id=" + id,
+                                       {
+                                               success: ajaxResponseSuccess,
+                                               failure: ajaxResponseFailure,
+                                               args:oArgs.editor.getDataTable()
+                                       }
+                               );
+               });
+
+               // Don't set the row to be left-clickable if the table is 
editable by inline editors.
+               // In that case we use cellClickEvents instead
+               var table_should_be_clickable = true;
+               for (i in this.properties.columns) {
+                       if (this.properties.columns[i].editor) {
+                               table_should_be_clickable = false;
+                       }
+               }
+
+               if (table_should_be_clickable && 
!this.properties.disable_left_click) {
+                       //... create a handler for regular clicks on a table row
+                       this.table.subscribe("rowClickEvent", function(e,obj) {
+                               YAHOO.util.Event.stopEvent(e);
+
+                               //... trigger first action on row click
+                               var row = obj.table.getTrEl(e.target);
+                               if(row) {
+                                       var record = obj.table.getRecord(row);
+
+                                       //... check whether this action should 
be an AJAX call
+                                       if(record.getData().ajax[0]) {
+                                               var request = 
YAHOO.util.Connect.asyncRequest(
+                                                       'GET',
+                                                       //... execute first 
action
+                                                       
record.getData().actions[0],
+                                                       {
+                                                               success: 
ajaxResponseSuccess,
+                                                               failure: 
ajaxResponseFailure,
+                                                               args:obj.table
+                                                       }
+                                               );
+                                       } else {
+                                               //... execute first action
+                                               window.location = 
record.getData().actions[0];
+                                       }
+                               }
+                       },this);
+
+                       //... highlight rows on mouseover.  This too only 
happens if the table is
+                       // not editable.
+                       this.table.subscribe("rowMouseoverEvent", 
this.table.onEventHighlightRow);
+                       this.table.subscribe("rowMouseoutEvent", 
this.table.onEventUnhighlightRow);
+               }
+
+
+               //... create context menues when the table renders
+               this.table.subscribe("renderEvent",this.table.doAfterLoadData);
+
+               //... listen for form submits and filter changes
+               
YAHOO.util.Event.addListener(this.properties.form,'submit',formListener,this,true);
+               YAHOO.util.Event.addListener(this.properties.filters, 
'change',formListener,this,true);
+       }
+
+
+       // Set up data sources when the document has loaded
+       YAHOO.util.Event.addListener(window, "load", function() {
+               var i = 0; 
+               while(YAHOO.controller.setupDatasource.length > 0){
+                       //... create a variable name, assign set up function to 
that variable and instantiate properties
+                       variableName = "YAHOO.controller.datasource" + i;
+                       eval(variableName + " = 
YAHOO.controller.setupDatasource.shift()");
+                       var source_properties = eval("new " + variableName + 
"()");
+
+]]>
+                       // ... create a paginator for this datasource
+
+                       var pag = new YAHOO.widget.Paginator({
+                               rowsPerPage: 10,
+                               alwaysVisible: true,
+                               rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+                               firstPageLinkLabel: "&lt;&lt; <xsl:value-of 
select="php:function('lang', 'first')"/>",
+                               previousPageLinkLabel: "&lt; <xsl:value-of 
select="php:function('lang', 'previous')"/>",
+                               nextPageLinkLabel: "<xsl:value-of 
select="php:function('lang', 'next')"/> &gt;",
+                               lastPageLinkLabel: "<xsl:value-of 
select="php:function('lang', 'last')"/> &gt;&gt;",
+                               template                        : 
"{RowsPerPageDropdown}<xsl:value-of select="php:function('lang', 
'elements_pr_page')"/>.{CurrentPageReport}<br/>  {FirstPageLink} 
{PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",
+                               pageReportTemplate      : "<xsl:value-of 
select="php:function('lang', 'shows_from')"/> {startRecord} <xsl:value-of 
select="php:function('lang', 'to')"/> {endRecord} <xsl:value-of 
select="php:function('lang', 'of_total')"/> {totalRecords}.",
+                               containers: [source_properties.paginator]
+                       });
+                       
+<![CDATA[
+                       
+                       pag.render();
+
+                       //... send data source properties and paginator to 
wrapper function
+                       this.wrapper = new dataSourceWrapper(source_properties, 
pag);
+                       i+=1;
+/*
+                       <?php
+                               $populate = phpgw::get_var('populate_form');
+                               if(isset($populate)){?>
+                                       var qs = 
YAHOO.controller.serializeForm(source_properties.form);
+                                   this.wrapper.source.liveData = 
this.wrapper.url + qs + '&';
+                                   this.wrapper.source.sendRequest('', 
{success: function(sRequest, oResponse, oPayload) {
+                                       
this.wrapper.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.wrapper.paginator);
+                                   }, scope: this});
+                       <?php }
+                       ?>
+*/
+                       // XXX: Create generic column picker for all datasources
+
+                       // Shows dialog, creating one when necessary
+                       var newCols = true;
+                       var showDlg = function(e) {
+                               YAHOO.util.Event.stopEvent(e);
+
+                               if(newCols) {
+                                       // Populate Dialog
+                                       // Using a template to create elements 
for the SimpleDialog
+                                       var allColumns = 
this.wrapper.table.getColumnSet().keys;
+                                       var elPicker = 
YAHOO.util.Dom.get("dt-dlg-picker");
+                                       var elTemplateCol = 
document.createElement("div");
+                                       YAHOO.util.Dom.addClass(elTemplateCol, 
"dt-dlg-pickercol");
+                                       var elTemplateKey = 
elTemplateCol.appendChild(document.createElement("span"));
+                                       YAHOO.util.Dom.addClass(elTemplateKey, 
"dt-dlg-pickerkey");
+                                       var elTemplateBtns = 
elTemplateCol.appendChild(document.createElement("span"));
+                                       YAHOO.util.Dom.addClass(elTemplateBtns, 
"dt-dlg-pickerbtns");
+                                       var onclickObj = {fn:handleButtonClick, 
obj:this, scope:false };
+
+                                       // Create one section in the 
SimpleDialog for each Column
+                                       var elColumn, elKey, elButton, 
oButtonGrp;
+
+                                       for(var 
i=0,l=allColumns.length;i<l;i++) {
+                                               var oColumn = allColumns[i];
+                                               if(oColumn.label != 
'unselectable') { // We haven't marked the column as unselectable for the user
+                                                       // Use the template
+                                                       elColumn = 
elTemplateCol.cloneNode(true);
+
+                                                       // Write the Column key
+                                                       elKey = 
elColumn.firstChild;
+                                                       elKey.innerHTML = 
oColumn.label;
+
+                                                       // Create a ButtonGroup
+                                                       oButtonGrp = new 
YAHOO.widget.ButtonGroup({
+                                                               id: 
"buttongrp"+i,
+                                                               name: 
oColumn.getKey(),
+                                                               container: 
elKey.nextSibling
+                                                       });
+                                                       oButtonGrp.addButtons([
+                                                               { label: "Vis", 
value: "Vis", checked: ((!oColumn.hidden)), onclick: onclickObj},
+                                                               { label: 
"Skjul", value: "Skjul", checked: ((oColumn.hidden)), onclick: onclickObj}
+                                                       ]);
+
+                                                       
elPicker.appendChild(elColumn);
+                                               }
+                                       }
+
+                                       newCols = false;
+                               }
+
+                               myDlg.show();
+                       };
+
+                       var storeColumnsUrl = YAHOO.controller.storeColumnsUrl;
+                       var hideDlg = function(e) {
+                               this.hide();
+                               // After we've hidden the dialog we send a post 
call to store the columns the user has selected
+                               var postData = 'values[save]=1';
+                               var allColumns = 
wrapper.table.getColumnSet().keys;
+                               for(var i=0; i < allColumns.length; i++) {
+                                       if(!allColumns[i].hidden){
+                                               postData += 
'&values[columns][]=' + allColumns[i].getKey();
+                                       }
+                               }
+
+                               YAHOO.util.Connect.asyncRequest('POST', 
storeColumnsUrl, null, postData);
+                       };
+
+                       var handleButtonClick = function(e, oSelf) {
+                               var sKey = this.get("name");
+                               if(this.get("value") === "Skjul") {
+                                       // Hides a Column
+                                       wrapper.table.hideColumn(sKey);
+                               } else {
+                                       // Shows a Column
+                                       wrapper.table.showColumn(sKey);
+                               }
+                       };
+
+                       // Create the SimpleDialog
+                       YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
+                       var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
+                               width: "30em",
+                               visible: false,
+                               modal: false, // modal: true doesn't work for 
some reason - the dialog becomes unclickable
+                               buttons: [
+                                       {text:"Lukk", handler:hideDlg}
+                               ],
+                               fixedcenter: true,
+                               constrainToViewport: true
+                       });
+                       myDlg.render();
+
+                       // Nulls out myDlg to force a new one to be created
+                       wrapper.table.subscribe("columnReorderEvent", 
function(){
+                               newCols = true;
+                               YAHOO.util.Event.purgeElement("dt-dlg-picker", 
true);
+                               YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = 
"";
+                       }, this, true);
+
+                       // Hook up the SimpleDialog to the link
+                       YAHOO.util.Event.addListener("dt-options-link", 
"click", showDlg, this, true);
+               }
+       });
+
+       /*
+        * Listen for events in form. Serialize all form elements. Stop
+        * the original request and send new request.
+        */
+       function formListener(event){
+               YAHOO.util.Event.stopEvent(event);
+               var qs = YAHOO.portico.serializeForm(this.properties.form);
+           this.source.liveData = this.url + qs + '&';
+           this.source.sendRequest('', {success: function(sRequest, oResponse, 
oPayload) {
+               this.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.paginator);
+           }, scope: this});
+       }
+
+]]>
+
+</script>
+</xsl:template>
\ No newline at end of file


Property changes on: trunk/controller/templates/base/common.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/controller/templates/base/control.xsl
===================================================================
--- trunk/controller/templates/base/control.xsl 2011-12-05 09:01:39 UTC (rev 
8234)
+++ trunk/controller/templates/base/control.xsl 2011-12-05 09:01:59 UTC (rev 
8235)
@@ -70,16 +70,16 @@
                                        <label for="title">Tittel</label>
                                </dt>
                                <dd>
-                               <xsl:choose>
-                                       <xsl:when test="editable">
-                                               <input type="text" name="title" 
id="title" value="{control/title}" size="80"/>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <xsl:value-of 
select="control/title" />
-                                       </xsl:otherwise>
-                               </xsl:choose>
+                                       <xsl:choose>
+                                               <xsl:when test="editable">
+                                                       <input type="text" 
name="title" id="title" value="{control/title}" size="80"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="control/title" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
                                </dd>
-<dt>
+                               <dt>
                                        <label 
for="start_date">Startdato</label>
                                </dt>
                                <dd>

Added: trunk/controller/templates/base/control_location_tabs.xsl
===================================================================
--- trunk/controller/templates/base/control_location_tabs.xsl                   
        (rev 0)
+++ trunk/controller/templates/base/control_location_tabs.xsl   2011-12-05 
09:01:59 UTC (rev 8235)
@@ -0,0 +1,26 @@
+<!-- separate tabs and  inline tables-->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+<div class="yui-navset yui-navset-top" id="control_location_tabview">
+       <xsl:choose>
+               <xsl:when test="view = 'view_locations_for_control'">
+                       <div class="identifier-header">
+                               <h1><xsl:value-of select="php:function('lang', 
'Locations_for_control')"/></h1>
+                       </div>
+                       <!-- Prints tabs array -->
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                        
+                       <xsl:call-template name="view_locations_for_control" />
+               </xsl:when>
+               <xsl:when test="view = 'add_location_to_control'">
+                       <div class="identifier-header">
+                               <h1><xsl:value-of select="php:function('lang', 
'Add_location_to_control')"/></h1>
+                       </div>
+                       <!-- Prints tabs array -->
+                       <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
+                       <xsl:call-template name="add_location_to_control" />
+               </xsl:when>
+       </xsl:choose>
+</div>
+       
+</xsl:template>


Property changes on: trunk/controller/templates/base/control_location_tabs.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: trunk/controller/templates/base/locations.xsl
===================================================================
--- trunk/controller/templates/base/locations.xsl       2011-12-05 09:01:39 UTC 
(rev 8234)
+++ trunk/controller/templates/base/locations.xsl       2011-12-05 09:01:59 UTC 
(rev 8235)
@@ -1,319 +0,0 @@
-<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>
-
-<xsl:template match="data">
-       
-       <div id="addedProperties">
-               <ul id="locations_for_control" name="locations_for_control">
-                       <xsl:for-each select="locations_for_control">
-                               <li>
-                                       <div><xsl:value-of select="id"/></div>
-                                       <div><xsl:value-of 
select="title"/></div>
-                                       <div><xsl:value-of 
select="location_code"/></div>
-                               </li>                   
-                   </xsl:for-each>
-               </ul>
-       </div>
-       
-       <iframe id="yui-history-iframe" 
src="phpgwapi/js/yahoo/history/assets/blank.html" 
style="position:absolute;top:0; left:0;width:1px; 
height:1px;visibility:hidden;"></iframe>
-       <input id="yui-history-field" type="hidden"/>
-       <xsl:call-template name="yui_booking_i18n"/>
-       <xsl:apply-templates select="form" />
-       <xsl:apply-templates select="paging"/>
-       <div id="list_flash">
-               <xsl:call-template name="msgbox"/>
-       </div>
-       <xsl:apply-templates select="datatable"/> 
-       <xsl:apply-templates select="form/list_actions"/>
-       
-</xsl:template>
-
-<xsl:template match="form">
-       <form id="queryForm" style="margin: 20px; width: 65%;">
-               <xsl:attribute name="method">
-                       <xsl:value-of select="phpgw:conditional(not(method), 
'GET', method)"/>
-               </xsl:attribute>
-
-               <xsl:attribute name="action">
-                       <xsl:value-of select="phpgw:conditional(not(action), 
'', action)"/>
-               </xsl:attribute>
-        <xsl:apply-templates select="toolbar"/>
-       </form>
-
-       <form id="update_table_dummy" method='POST' action='' >
-       </form>
-
-</xsl:template>
-
-
-<xsl:template match="toolbar">
-    <div id="toolbar">
-                 <table class='yui-skin-sam' border="0" cellspacing="0" 
cellpadding="0" style="padding:0px; margin:0px;">
-                       <tr>
-        <xsl:for-each select="item">
-                       <xsl:variable name="filter_key" 
select="concat('filter_', name)"/>
-                       <xsl:variable name="filter_key_name" 
select="concat(concat('filter_', name), '_name')"/>
-                       <xsl:variable name="filter_key_id" 
select="concat(concat('filter_', name), '_id')"/>
-               
-                       <xsl:choose>
-                               <xsl:when test="type = 'date-picker'">
-                                       <td valign="top">
-                                       <div class="date-picker">
-                       <input id="filter_{name}" name="filter_{name}" 
type="text">
-                                                       <xsl:attribute 
name="value"><xsl:value-of select="../../../filters/*[local-name() = 
$filter_key]"/></xsl:attribute>
-                                               </input>
-                </div>
-                                       </td>
-                               </xsl:when>
-                               <xsl:when test="type = 'autocomplete'">
-                                       <td valign="top" width="160px">
-                                               <div style="width:140px">
-                                                       <input 
id="filter_{name}_name" name="filter_{name}_name" type="text">
-                                                               <xsl:attribute 
name="value"><xsl:value-of select="../../../filters/*[local-name() = 
$filter_key_name]"/></xsl:attribute>
-                                                       </input>
-                                                       <input 
id="filter_{name}_id" name="filter_{name}_id" type="hidden">
-                                                               <xsl:attribute 
name="value"><xsl:value-of select="../../../filters/*[local-name() = 
$filter_key_id]"/></xsl:attribute>
-                                                       </input>
-                                                       <div 
id="filter_{name}_container"/>
-                                               </div>
-                                               <script type="text/javascript"> 
-                                               
YAHOO.util.Event.onDOMReady(function() {
-                                                  var name = "<xsl:value-of 
select="name"/>";
-                                                       var ui = "<xsl:value-of 
select="ui"/>";
-
-                                                       var itemSelectCallback 
= false;
-                                                       <xsl:if 
test="onItemSelect">
-                                                               
itemSelectCallback = <xsl:value-of select="onItemSelect"/>;
-                                                       </xsl:if>
-
-                                                       var 
onClearSelectionCallback = false;
-                                                       <xsl:if 
test="onClearSelection">
-                                                               
onClearSelectionCallback = <xsl:value-of select="onClearSelection"/>;
-                                                       </xsl:if>
-
-                                                       var requestGenerator = 
false;
-                                                       <xsl:if 
test="requestGenerator">
-                                                               
requestGenerator = <xsl:value-of select="requestGenerator"/>;
-                                                       </xsl:if>
-
-                                                       <![CDATA[
-                                                       var oAC = 
YAHOO.portico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&',
 
-                                                                               
 'filter_'+name+'_name', 'filter_'+name+'_id', 'filter_'+name+'_container');
-
-                                                       if (requestGenerator) {
-                                                               
oAC.generateRequest = requestGenerator;
-                                                       }
-
-                                                       if (itemSelectCallback) 
{
-                                                               
oAC.itemSelectEvent.subscribe(itemSelectCallback);
-                                                       }
-
-                                                       
YAHOO.util.Event.addBlurListener('filter_'+name+'_name', function()
-                                                       {
-                                                               if 
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "")
-                                                               {
-                                                                       
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
-                                                                       if 
(onClearSelectionCallback) {
-                                                                               
onClearSelectionCallback();
-                                                                       }
-                                                               }
-                                                       });
-
-                                                       
YAHOO.portico.addPreSerializeQueryFormListener(function(form)
-                                                       {
-                                                               if 
(YAHOO.util.Dom.get('filter_'+name+'_name').value == "")
-                                                               {
-                                                                       
YAHOO.util.Dom.get('filter_'+name+'_id').value = "";
-                                                               } 
-                                                       });
-                                                       ]]>
-                                               });
-                                               </script>
-                                       </td>
-                               </xsl:when>
-                               <xsl:when test="type = 'filter'">
-                                       <td valign="top">
-                    <xsl:variable name="name"><xsl:value-of 
select="name"/></xsl:variable>
-                       
-                       <select id="{$name}" name="{$name}" 
onMouseout="window.status='';return true;">
-                        <xsl:for-each select="list">
-                               <xsl:variable name="id"><xsl:value-of 
select="id"/></xsl:variable>
-                                                       <xsl:if test="id = 
'NEW'">
-                                       <option value="{$id}" 
selected="selected">
-                                                                       
<xsl:value-of select="name"/>
-                                                               </option>
-                                                       </xsl:if>
-                                                       <xsl:if test="id != 
'NEW'">
-                                       <option value="{$id}">
-                                                                       
<xsl:value-of select="name"/>
-                                                               </option>
-                                                       </xsl:if>
-                        </xsl:for-each>
-                       </select>
-                    </td>
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       <td valign="top">
-                                       <input id="innertoolbar">
-                                               <xsl:attribute 
name="type"><xsl:value-of select="phpgw:conditional(not(type), '', 
type)"/></xsl:attribute>
-                                               <xsl:attribute 
name="name"><xsl:value-of select="phpgw:conditional(not(name), '', 
name)"/></xsl:attribute>
-                                               <xsl:attribute 
name="onclick"><xsl:value-of select="phpgw:conditional(not(onClick), '', 
onClick)"/></xsl:attribute>
-                                               <xsl:attribute 
name="value"><xsl:value-of select="phpgw:conditional(not(value), '', 
value)"/></xsl:attribute>
-                                               <xsl:attribute 
name="href"><xsl:value-of select="phpgw:conditional(not(href), '', 
href)"/></xsl:attribute>
-                                               <xsl:attribute 
name="class"><xsl:value-of select="phpgw:conditional(not(class), '', 
class)"/></xsl:attribute>
-                                       </input>
-                                       </td>
-                               </xsl:otherwise>
-                       </xsl:choose>
-        </xsl:for-each>
-                 </tr>
-                       <xsl:if test="item/text and normalize-space(item/text)">
-                               <thead style="background:none">
-                                       <tr>
-                                               <xsl:for-each select="item">
-                                                       <td>
-                                                               <xsl:if 
test="name">
-                                                                       <label 
style='margin:auto 0.25em'>
-                                                                               
<xsl:attribute name="for"><xsl:value-of select="phpgw:conditional(not(name), 
'', name)"/></xsl:attribute>
-                                                                               
<xsl:value-of select="phpgw:conditional(not(text), '', text)"/>
-                                                                       </label>
-                                                               </xsl:if>
-                                                       </td>
-                                               </xsl:for-each>
-                                       </tr>
-                               </thead>
-                       </xsl:if>
-               </table>
-    </div>
-</xsl:template>
-
-<xsl:template match="datatable">
-    <div id="paginator"/>
-    <div id="datatable-container"/>
-       <xsl:call-template name="datasource-definition" />
-</xsl:template>
-
-
-<xsl:template name="datasource-definition">
-       <script>
-               YAHOO.namespace('controller');
-        
-               YAHOO.controller.columnDefs = [
-                               <xsl:for-each select="//datatable/field">
-                                       {
-                                               key: "<xsl:value-of 
select="key"/>",
-                                               <xsl:if test="label">
-                                               label: "<xsl:value-of 
select="label"/>",
-                                           </xsl:if>
-                                               sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
-                                               <xsl:if test="hidden">
-                                               hidden: true,
-                                           </xsl:if>
-                                               <xsl:if test="formatter">
-                                               formatter: <xsl:value-of 
select="formatter"/>,
-                                           </xsl:if>
-                                               className: "<xsl:value-of 
select="className"/>"
-                                       }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
-                               </xsl:for-each>
-                       ];
-
-               setDataSource('<xsl:value-of select="source"/>', 
YAHOO.controller.columnDefs, 'queryForm', ['building_types', 'cat_id', 
'district_id', 'part-of_town_list', 'responsibility_roles_list'], 
'datatable-container', '_form', '_paginator', null); 
-               
-       </script>
-        
-</xsl:template>
-<!-- 
-<xsl:template match="lists">
- 
-<div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px solid 
#243356;margin: 20px;padding: 20px;">
--->
-               <!-- When control area is chosen an ajax request is executed. 
The operation fetches controls from db and populates the control list below.
-                        The ajax opearation is handled in file ajax.js 
-                -->
-                <!-- 
-               <select id="control_area_list" name="control_area_list">
-                       <xsl:for-each select="control_area_list">
-                               <xsl:variable 
name="control_area_id"><xsl:value-of select="id"/></xsl:variable>
-                               <option value="{$control_area_id}">
-                                       <xsl:value-of select="title"/>
-                               </option>                       
-                   </xsl:for-each>
-               </select>
-               
-               <select id="control_list" name="control_list">
-                       <xsl:for-each select="control_list">
-                               <xsl:variable name="control_id"><xsl:value-of 
select="id"/></xsl:variable>
-                               <option value="{$control_id}">
-                                       <xsl:value-of select="title"/>
-                               </option>
-                                                                               
-                   </xsl:for-each>
-               </select>
-       </div>
-       
-       <div style="background: none repeat scroll 0 0 #EDF5FF;border: 1px 
solid #243356;margin: 20px;padding: 20px;">
-               <select id="building_types" name="building_types">
-                       <xsl:for-each select="building_types">
-                               <xsl:variable 
name="building_type_id"><xsl:value-of select="id"/></xsl:variable>
-                               <option value="{$building_type_id}">
-                                       <xsl:value-of select="name"/>
-                               </option>
-                                                                               
-                   </xsl:for-each>
-               </select>
-               
-               <select id="category_types" name="category_types">
-                       <xsl:for-each select="category_types">
-                               <xsl:variable 
name="category_type_id"><xsl:value-of select="id"/></xsl:variable>
-                               <option value="{$category_type_id}">
-                                       <xsl:value-of select="name"/>
-                               </option>
-                                                                               
-                   </xsl:for-each>
-               </select>
-               
-               <select id="district_list" name="district_list">
-                       <xsl:for-each select="district_list">
-                               <xsl:variable 
name="district_list_id"><xsl:value-of select="id"/></xsl:variable>
-                               <option value="{$district_list_id}">
-                                       <xsl:value-of select="name"/>
-                               </option>
-                                                                               
-                   </xsl:for-each>
-               </select>
-               
-               <select id="part_of_town_list" name="part_of_town_list">
-                       <xsl:for-each select="part_of_town_list">
-                               <xsl:variable 
name="part_of_town_list_id"><xsl:value-of select="id"/></xsl:variable>
-                               <option value="{$part_of_town_list_id}">
-                                       <xsl:value-of select="name"/>
-                               </option>
-                                                                               
-                   </xsl:for-each>
-               </select>
-               <select id="responsibility_roles" name="responsibility_roles">
-                       <xsl:for-each select="responsibility_roles_list">
-                               <xsl:variable 
name="responsibility_roles_list_id"><xsl:value-of select="id"/></xsl:variable>
-                               <option value="{$responsibility_roles_list_id}">
-                                       <xsl:value-of select="name"/>
-                               </option>
-                                                                               
-                   </xsl:for-each>
-               </select>
-       </div>
-</xsl:template>
--->
\ No newline at end of file

Copied: trunk/controller/templates/base/view_locations_for_control.xsl (from 
rev 8203, trunk/controller/templates/base/locations.xsl)
===================================================================
--- trunk/controller/templates/base/view_locations_for_control.xsl              
                (rev 0)
+++ trunk/controller/templates/base/view_locations_for_control.xsl      
2011-12-05 09:01:59 UTC (rev 8235)
@@ -0,0 +1,124 @@
+<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>
+
+<xsl:template name="view_locations_for_control">
+       <!-- IMPORTANT!!! Loads YUI javascript -->
+       <xsl:call-template name="common"/>
+
+       <div class="yui-content">
+               <div id="control_details">
+                       <div style="margin: 10px;padding: 10px; width: 25%;">
+                               
+                               <!-- When control area is chosen, an ajax 
request is executed. 
+                                        The operation fetches controls from db 
and populates the control list.
+                                        The ajax operation is handled in 
ajax.js 
+                                --> 
+                                <select style="float:left;" 
id="control_area_list" name="control_area_list">
+                                       <xsl:for-each 
select="control_area_array">
+                                               <xsl:variable 
name="control_area_id"><xsl:value-of select="id"/></xsl:variable>
+                                               <option 
value="{$control_area_id}">
+                                                       <xsl:value-of 
select="title"/>
+                                               </option>                       
+                                   </xsl:for-each>
+                                </select>
+                                
+                                <form id="loc_form" action="" method="GET">
+                       
+                                       <select id="control_id" 
name="control_id">
+                                       <xsl:choose>
+                                               <xsl:when 
test="control_array/child::node()">
+                                                       <xsl:for-each 
select="control_array">
+                                                               <xsl:variable 
name="control_id"><xsl:value-of select="id"/></xsl:variable>
+                                                               <option 
value="{$control_id}">
+                                                                       
<xsl:value-of select="title"/>
+                                                               </option>       
                        
+                                                   </xsl:for-each>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <option>
+                                                               Ingen kontroller
+                                                       </option>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                                               
+                                       </select>
+                               </form>
+                       </div>
+                       
+                       <div id="addedProperties">
+                               <ul id="locations_for_control" 
name="locations_for_control">
+                                       <xsl:for-each 
select="locations_for_control">
+                                               <li>
+                                                       <div><xsl:value-of 
select="id"/></div>
+                                                       <div><xsl:value-of 
select="title"/></div>
+                                                       <div><xsl:value-of 
select="location_code"/></div>
+                                               </li>                   
+                                   </xsl:for-each>
+                               </ul>
+                       </div>
+                       
+                       <iframe id="yui-history-iframe" 
src="phpgwapi/js/yahoo/history/assets/blank.html" 
style="position:absolute;top:0; left:0;width:1px; 
height:1px;visibility:hidden;"></iframe>
+                       <input id="yui-history-field" type="hidden"/>
+                       
+                       <xsl:apply-templates select="locations_table"/>
+                       <xsl:call-template name="yui_booking_i18n"/>
+               </div>
+       </div>
+</xsl:template>
+
+<xsl:template match="locations_table" xmlns:php="http://php.net/xsl";>
+    
+    <div id="loc_paginator"/>
+    <div style="margin:20px;" id="locations-container"/>
+       <xsl:call-template name="locations-definition" />
+</xsl:template>
+
+<xsl:template name="locations-definition">
+       <script>
+        
+               YAHOO.controller.columnDefs = [
+                               <xsl:for-each select="//locations_table/field">
+                                       {
+                                               key: "<xsl:value-of 
select="key"/>",
+                                               <xsl:if test="label">
+                                               label: "<xsl:value-of 
select="label"/>",
+                                           </xsl:if>
+                                               sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+                                               <xsl:if test="hidden">
+                                               hidden: true,
+                                           </xsl:if>
+                                               <xsl:if test="formatter">
+                                               formatter: <xsl:value-of 
select="formatter"/>,
+                                           </xsl:if>
+                                               className: "<xsl:value-of 
select="className"/>"
+                                       }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+                               </xsl:for-each>
+                       ];
+                       
+               var loc_source = '<xsl:value-of select="source"/>';
+               var loc_columnDefs = YAHOO.controller.columnDefs;
+               var loc_form = 'loc_form';
+               var loc_filters = ['control_id'];
+               var loc_container = 'locations-container';
+               var loc_table_id = 'locations_table';
+               var loc_data_table_pag = 'loc_paginator';
+       
+               setDataSource(loc_source, loc_columnDefs, loc_form, 
loc_filters, loc_container, loc_data_table_pag, loc_table_id, null, null, 
null); 
+               
+       </script>
+        
+</xsl:template>
\ No newline at end of file


Property changes on: 
trunk/controller/templates/base/view_locations_for_control.xsl
___________________________________________________________________
Added: svn:mime-type
   + text/plain




reply via email to

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