[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12579]
From: |
Nelson Guerra |
Subject: |
[Fmsystem-commits] [12579] |
Date: |
Fri, 09 Jan 2015 23:50:31 +0000 |
Revision: 12579
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12579
Author: nelson224
Date: 2015-01-09 23:50:30 +0000 (Fri, 09 Jan 2015)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind/property/templates/base/lookup.entity.xsl
Modified: branches/dev-syncromind/property/templates/base/lookup.entity.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/lookup.entity.xsl
2015-01-09 23:36:07 UTC (rev 12578)
+++ branches/dev-syncromind/property/templates/base/lookup.entity.xsl
2015-01-09 23:50:30 UTC (rev 12579)
@@ -1,4 +1,20 @@
+<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">
<xsl:choose>
<xsl:when test="datatable_name">
@@ -23,51 +39,7 @@
<xsl:template match="toolbar">
- <style id='toggle-box-css' type='text/css' scoped='scoped'>
-.toggle-box {
- display: none;
-}
-.toggle-box + label {
- cursor: pointer;
- display: block;
- font-weight: bold;
- line-height: 21px;
- margin-bottom: 5px;
-}
-
-.toggle-box + label + div {
- display: none;
- margin-bottom: 10px;
-}
-
-.toggle-box:checked + label + div {
- display: block;
-}
-
-.toggle-box + label:before {
- background-color: #4F5150;
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- color: #FFFFFF;
- content: "+";
- display: block;
- float: left;
- font-weight: bold;
- height: 20px;
- line-height: 20px;
- margin-right: 5px;
- text-align: center;
- width: 20px;
-}
-
-.toggle-box:checked + label:before {
- content: "\2212";
-}
-
- </style>
-
<input class="toggle-box" id="header1" type="checkbox" />
<label for="header1">
<xsl:value-of select="php:function('lang', 'toolbar')"/>
@@ -76,178 +48,125 @@
<div id="toolbar">
<!--xsl:if test="item/text and normalize-space(item/text)"-->
<xsl:if test="item">
- <table id="toolbar_table" class="pure-table">
- <thead>
- <tr>
- <th>
- <xsl:value-of
select="php:function('lang', 'name')"/>
- </th>
- <th>
- <xsl:value-of
select="php:function('lang', 'item')"/>
- </th>
- </tr>
- </thead>
+ <table id="toolbar_table" class="pure-table">
+ <thead>
+ <tr>
+ <th>
+ <xsl:value-of
select="php:function('lang', 'name')"/>
+ </th>
+ <th>
+ <xsl:value-of
select="php:function('lang', 'item')"/>
+ </th>
+ </tr>
+ </thead>
<tbody>
-
- <xsl:for-each select="item">
- <tr>
- <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')"/>
- <td>
- <xsl:if test="name">
- <label>
- <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:choose>
- <xsl:when test="type = 'date-picker'">
- <td valign="top">
- <div>
- <input id="filter_{name}"
name="filter_{name}" type="text"></input>
- </div>
+ <xsl:for-each select="item">
+ <tr>
+ <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')"/>
+ <td>
+ <xsl:if test="name">
+ <label>
+ <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:when>
- <xsl:when test="type = 'autocomplete'">
- <td class="auto">
- <div class="auto">
- <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 app = "<xsl:value-of
select="app"/>";
- 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>
+ <xsl:choose>
+ <xsl:when test="type =
'date-picker'">
+ <td valign="top">
+ <div>
+ <input
id="filter_{name}" name="filter_{name}" type="text"></input>
+ </div>
+ </td>
+ </xsl:when>
+ <xsl:when test="type =
'filter'">
+ <td valign="top">
+ <xsl:variable
name="name"><xsl:value-of select="name"/></xsl:variable>
- var
onClearSelectionCallback = false;
- <xsl:if
test="onClearSelection">
-
onClearSelectionCallback = <xsl:value-of select="onClearSelection"/>;
- </xsl:if>
+ <select
id="{$name}" name="{$name}">
+
<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:when test="type =
'filter-category'">
+ <td valign="top">
+ <xsl:variable
name="name"><xsl:value-of select="name"/></xsl:variable>
- 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');
-
- var oArgs =
{menuaction: app + '.ui'+ui+'.index'};
- var requestUrl =
phpGWLink('index.php', oArgs, true);
- requestUrl +=
'filter_'+name+'_name', 'filter_'+name+'_id', 'filter_'+name+'_container';
- // alert('FIXME:
autocompleteHelper::requestUrl ' + requestUrl );
-
-
- 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}">
- <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:when test="type = 'link'">
- <td valign="top">
- <a href="{href}">
- <xsl:if test="onclick">
- <xsl:attribute
name="onclick">
-
<xsl:value-of select="onclick"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:value-of
select="value"/>
- </a>
- </td>
- </xsl:when>
- <xsl:when test="type = 'hidden'">
- <td valign="top">
- <input>
- <xsl:attribute
name="type"><xsl:value-of select="phpgw:conditional(not(type), '',
type)"/></xsl:attribute>
- <xsl:attribute
name="id"><xsl:value-of select="phpgw:conditional(not(id), '',
id)"/></xsl:attribute>
- <xsl:attribute
name="name"><xsl:value-of select="phpgw:conditional(not(name), '',
name)"/></xsl:attribute>
- <xsl:attribute
name="value"><xsl:value-of select="phpgw:conditional(not(value), '',
value)"/></xsl:attribute>
- </input>
- </td>
- </xsl:when>
- <xsl:when test="type = 'label'">
- <td valign="top">
- <label><xsl:attribute
name="id"><xsl:value-of select="phpgw:conditional(not(id), '',
id)"/></xsl:attribute></label>
- </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>
- </tr>
- </xsl:for-each>
- </tbody>
+ <select
id="{$name}" name="{$name}" onchange="filterByCategory()">
+
<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:when test="type = 'link'">
+ <td valign="top">
+ <a
href="{href}">
+ <xsl:if
test="onclick">
+
<xsl:attribute name="onclick">
+
<xsl:value-of select="onclick"/>
+
</xsl:attribute>
+
</xsl:if>
+
<xsl:value-of select="value"/>
+ </a>
+ </td>
+ </xsl:when>
+ <xsl:when test="type =
'hidden'">
+ <td valign="top">
+ <input>
+
<xsl:attribute name="type"><xsl:value-of select="phpgw:conditional(not(type),
'', type)"/></xsl:attribute>
+
<xsl:attribute name="id"><xsl:value-of select="phpgw:conditional(not(id), '',
id)"/></xsl:attribute>
+
<xsl:attribute name="name"><xsl:value-of select="phpgw:conditional(not(name),
'', name)"/></xsl:attribute>
+
<xsl:attribute name="value"><xsl:value-of select="phpgw:conditional(not(value),
'', value)"/></xsl:attribute>
+ </input>
+ </td>
+ </xsl:when>
+ <xsl:when test="type = 'label'">
+ <td valign="top">
+
<label><xsl:attribute name="id"><xsl:value-of
select="phpgw:conditional(not(id), '', id)"/></xsl:attribute></label>
+ </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>
+ </tr>
+ </xsl:for-each>
+ </tbody>
</table>
</xsl:if>
</div>
@@ -272,12 +191,10 @@
<xsl:template match="datatable">
<xsl:call-template name="datasource-definition" />
-
</xsl:template>
<xsl:template name="datasource-definition">
-
<table id="datatable-container" class="display cell-border compact
responsive no-wrap" width="100%">
<thead>
<xsl:for-each select="//datatable/field">
@@ -297,27 +214,11 @@
</xsl:choose>
</xsl:for-each>
</thead>
- <tfoot>
- <tr>
- <xsl:for-each select="//datatable/field">
- <xsl:choose>
- <xsl:when test="hidden">
- <xsl:if test="hidden
=0">
- <th>
- </th>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <th>
- </th>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </tr>
- </tfoot>
</table>
+
<script>
-
+ var oTable = null;
+ var ajax_url = '<xsl:value-of select="source"/>';
var columns = [
<xsl:for-each select="//datatable/field">
{
@@ -379,11 +280,10 @@
}
// console.log(JqueryPortico.columns);
]]>
- </script>
- <script type="text/javascript" class="init">
+ $(document).ready(function() {
- var oTable = null;
+ oTable = JqueryPortico.inlineTableHelper("datatable-container",
'', JqueryPortico.columns);
/**
* Add left click action..
@@ -401,22 +301,6 @@
});
</xsl:if>
- /**
- * Add dbl click action..
- */
- <xsl:if test="dbl_click_action != ''">
- $("#datatable-container").on("dblclick", "tr",
function() {
- var iPos = oTable.fnGetPosition( this );
- var aData = oTable.fnGetData( iPos );
//complete dataset from json returned from server
- try {
- <xsl:value-of
select="dbl_click_action"/>(aData);
- }
- catch(err) {
-
document.getElementById("message").innerHTML = err.message;
- }
- });
- </xsl:if>
-
<xsl:for-each select="//form/toolbar/item">
<xsl:if test="type = 'filter'">
$('select#<xsl:value-of
select="name"/>').change( function()
@@ -425,17 +309,6 @@
<xsl:value-of select="extra"/>
});
</xsl:if>
- <xsl:if test="type = 'date-picker'">
- var previous_<xsl:value-of
select="id"/>;
- $("#filter_<xsl:value-of
select="id"/>").on('keyup change', function ()
- {
- if ( $.trim($(this).val()) !=
$.trim(previous_<xsl:value-of select="id"/>) )
- {
-
filterData('<xsl:value-of select="id"/>', $(this).val());
- previous_<xsl:value-of
select="id"/> = $(this).val();
- }
- });
- </xsl:if>
</xsl:for-each>
<![CDATA[
@@ -454,23 +327,6 @@
return aReturn;
}
- function execute_ajax(requestUrl, callback, data,type,
dataType)
- {
- type = typeof type !== 'undefined' ? type :
'POST';
- dataType = typeof dataType !== 'undefined' ?
dataType : 'html';
- data = typeof data !== 'undefined' ? data : {};
-
- $.ajax({
- type: type,
- dataType: dataType,
- data: data,
- url: requestUrl,
- success: function(result) {
- callback(result);
- }
- });
- }
-
function substr_count( haystack, needle, offset, length
)
{
var pos = 0, cnt = 0;
@@ -493,7 +349,9 @@
}
return cnt;
}
-
+
+ });
+
function searchData(query)
{
var api = oTable.api();
@@ -505,6 +363,16 @@
oTable.dataTableSettings[0]['ajax']['data'][param] =
value;
oTable.fnDraw();
}
+
+ function filterByCategory()
+ {
+ var data = {"cat_id": $('#cat_id').val(), "head": 1};
+ JqueryPortico.execute_ajax(ajax_url,
+ function(result){
+ alert('mensaje');
+ }, data, "GET", "json"
+ );
+ }
]]>
</script>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12579],
Nelson Guerra <=