fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14481] bookingfrontend: more on search


From: Sigurd Nes
Subject: [Fmsystem-commits] [14481] bookingfrontend: more on search
Date: Thu, 26 Nov 2015 10:20:23 +0000

Revision: 14481
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14481
Author:   sigurdne
Date:     2015-11-26 10:20:22 +0000 (Thu, 26 Nov 2015)
Log Message:
-----------
bookingfrontend: more on search

Modified Paths:
--------------
    branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
    branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
    branches/dev-syncromind/bookingfrontend/templates/base/search.xsl
    branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php

Added Paths:
-----------
    branches/dev-syncromind/bookingfrontend/templates/base/search_details.xsl

Modified: branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
===================================================================
--- branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php  
2015-11-26 00:37:45 UTC (rev 14480)
+++ branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php  
2015-11-26 10:20:22 UTC (rev 14481)
@@ -5,7 +5,8 @@
        {
                public $public_functions = array
                (
-                       'index' =>      true
+                       'index' =>      true,
+                       'query' =>      true
                );
 
                function __construct()
@@ -33,6 +34,10 @@
                        $filter_part_of_town = explode(',', 
phpgw::get_var('filter_part_of_town','string'));
                        $imploded_filter_part_of_town = implode(',', 
$filter_part_of_town);
                        $search = null;
+
+                       $criteria = phpgw::get_var('criteria');
+//                     _debug_array($criteria);die();
+
                        if ($config->config_data['frontpagetext'] != '')
                        {
                                $frontpagetext = 
$config->config_data['frontpagetext'];
@@ -42,17 +47,13 @@
                                $frontpagetext = 'Velkommen til AktivBy.<br 
/>Her finner du informasjon om idrettsanlegg som leies ut<br />av 
idrettsavdelingen.';
                        }
                        
-                       if ($building_id || $type || $activity_top_level || 
(isset($filter_part_of_town[0]) && $filter_part_of_town[0]))
-                       {
-                               $search = array(
-                                       'results'    => 
$this->bo->search($searchterm, $activity_top_level, $building_id, 
$filter_part_of_town),
-                                       'searchterm' => $searchterm,
-                                       'activity_top_level'=> 
$activity_top_level
-                               );
-                       }
 
-                       $params         = is_null($search) ? array('baseurl' => 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}", 'frontimage' => 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/templates/bkbooking/images/newlayout/forsidebilde.jpg",
 'frontpagetext' => $frontpagetext) : array('search' => $search);
-                       $params['activity_top_level'] = $activity_top_level;
+                       $params = array(
+                               'baseurl'               => 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}",
+                               'frontimage'    => 
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/templates/bkbooking/images/newlayout/forsidebilde.jpg",
+                               'frontpagetext' => $frontpagetext,
+                               'activity_top_level' => $activity_top_level
+                       );
 
                        $bobuilding = CreateObject('booking.bobuilding');
                        $building = $bobuilding->read_single($building_id);
@@ -74,11 +75,14 @@
                                $filter_tree[] = array(
                                        'text'          => $activity['id'] == 
$activity_top_level ? "[{$activity['name']}]" : $activity['name'],
                                        'state'         => array (
-                                                       'opened' => true,
-                                                       'selected'      => 
$activity['id'] == $activity_top_level ? 'true' : 'false'
+                                                       'opened' => false,
+                                                       'selected'      => 
$activity['id'] == $activity_top_level ? true : false,
+                                                       'checked'       => 
false,
+                                                       'checkbox_disabled' => 
true,
+                                                       'checkbox_hide' => true
                                                ),
                                        'parent'        => '#',
-                                       'a_attr'        => array('href' => 
$_url),
+                                       'a_attr'        => array('href' => 
$_url,'activity_top_level' => $activity['id'], 'class' => "no_checkbox"),
                                        'children'      => $organized_fields,
                                );
 
@@ -102,7 +106,22 @@
 
                function query()
                {
-                       
+                       $searchterm = trim(phpgw::get_var('searchterm', 
'string', 'REQUEST', null));
+                       $type = phpgw::get_var('type','string', 'REQUEST', 
null);
+                       $activity_top_level = 
phpgw::get_var('activity_top_level', 'int', 'REQUEST', null);
+                       $building_id = phpgw::get_var('building_id', 'int', 
'REQUEST', null);
+                       $filter_part_of_town = explode(',', 
phpgw::get_var('filter_part_of_town','string'));
+                       $imploded_filter_part_of_town = implode(',', 
$filter_part_of_town);
+                       $search = null;
+
+                       $criteria = phpgw::get_var('criteria');
+//                     _debug_array($criteria);die();
+                       if ($building_id || $type || $activity_top_level || 
(isset($filter_part_of_town[0]) && $filter_part_of_town[0]))
+                       {
+                               $data = array(
+                                       'results'    => 
$this->bo->search($searchterm, $activity_top_level, $building_id, 
$filter_part_of_town)
+                               );
+                       }
+                       self::render_template_xsl('search_details', $data);
                }       
-               
        }

Modified: branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
===================================================================
--- branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js        
2015-11-26 00:37:45 UTC (rev 14480)
+++ branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js        
2015-11-26 10:20:22 UTC (rev 14481)
@@ -2,77 +2,132 @@
 var building_id_selection = "";
 var part_of_town_string = "";
 var part_of_towns = [];
+var selected_criteria = [];
 $(document).ready(function () {
-       $("#part_of_town :checkbox:checked").each(function() {
-         part_of_towns.push($(this).val());
-        });
-       part_of_town_string = part_of_towns.join(',');
-       oArgs = {
-               menuaction: 'bookingfrontend.uibuilding.index',
-               filter_part_of_town_id: part_of_town_string
-       };
-       var requestUrl = phpGWLink('bookingfrontend/', oArgs, true);
-       JqueryPortico.autocompleteHelper(requestUrl, 'field_building_name', 
'field_building_id', 'building_container');
-
-
-$("#part_of_town :checkbox").on('click', function() {
-               part_of_towns = [];
-               $('#field_building_id').val('');
-               $("#field_building_name").val('');
-       $("#part_of_town :checkbox:checked").each(function() {
-               part_of_towns.push($(this).val());
-       });
-               part_of_town_string = part_of_towns.join(',');
-
-               var activity_top_level = $('#activity_top_level').val();
-
-               var oArgs = {
-                       menuaction: 'bookingfrontend.uisearch.index',
-                       activity_top_level: activity_top_level,
-                       building_id:  $('#field_building_id').val(),
-                       filter_part_of_town: part_of_town_string
+       update_autocompleteHelper = function () {
+               oArgs = {
+                       menuaction: 'bookingfrontend.uibuilding.index',
+                       filter_part_of_town_id: part_of_town_string
                };
-               var requestUrl = phpGWLink('bookingfrontend/', oArgs);
+               var requestUrl = phpGWLink('bookingfrontend/', oArgs, true);
+               JqueryPortico.autocompleteHelper(requestUrl, 
'field_building_name', 'field_building_id', 'building_container');
+       }
 
-               window.location.href = requestUrl;
-   });
+       $("#part_of_town :checkbox").on('click', function () {
+               update_search(selected_criteria);
 
+       });
+       //initate autocomplete;
+       update_autocompleteHelper();
 
 // Filter tree
        $("#treeDiv1").jstree({
-               "core" : {
-            "multiple" : true,
-                       "themes" : { "stripes" : true },
-                       "data" : filter_tree
+               core: {
+                       multiple: false,
+                       data: filter_tree,
+                       themes: {"stripes": true}
                },
-        "plugins" : [ "themes","html_data","ui","state","checkbox" ]
+               checkbox: {whole_node: true, three_state: false, cascade: 
"up+down+undetermined"},
+               plugins: ["themes", "state", "checkbox"]
        });
 
+
+       $("#treeDiv1").bind("deselect_node.jstree", function (event, data) {
+               if (typeof (data.event) == 'undefined')
+               {
+                       return false;
+               }
+               var href = data.node.a_attr.href;
+               if (href == "#")
+               {
+                       selected_criteria = 
$("#treeDiv1").jstree('get_selected', true);
+               }
+               else
+               {
+                       var activity_top_level = 
data.node.a_attr.activity_top_level;
+                       $('#activity_top_level').val(activity_top_level);
+
+               }
+               update_search(selected_criteria);
+
+       });
+
+
        $("#treeDiv1").bind("select_node.jstree", function (event, data) {
-               if(typeof(data.event) == 'undefined')
+               if (typeof (data.event) == 'undefined')
                {
                        return false;
                }
                var href = data.node.a_attr.href;
-               if(href != "#")
+               if (href == "#")
                {
-                       window.location.href = href;
+                       selected_criteria = 
$("#treeDiv1").jstree('get_selected', true);
                }
+               else
+               {
+                       var activity_top_level = 
data.node.a_attr.activity_top_level;
+                       $('#activity_top_level').val(activity_top_level);
+               }
+               update_search(selected_criteria);
        });
 
-       $('#collapse1').on('click',function(){
-               $(this).attr('href','javascript:;');
+       update_search = function (selected_criteria) {
+
+               var criteria = [];
+
+               for (var i = 0; i < selected_criteria.length; ++i)
+               {
+                       criteria.push(selected_criteria[i].original);
+               }
+//             console.log(criteria);
+
+               part_of_towns = [];
+               $('#field_building_id').val('');
+               $("#field_building_name").val('');
+               $("#part_of_town :checkbox:checked").each(function () {
+                       part_of_towns.push($(this).val());
+               });
+               part_of_town_string = part_of_towns.join(',');
+
+               update_autocompleteHelper();
+
+               var activity_top_level = $('#activity_top_level').val();
+
+               var oArgs = {
+                       menuaction: 'bookingfrontend.uisearch.query',
+                       activity_top_level: activity_top_level,
+                       building_id: $('#field_building_id').val(),
+                       filter_part_of_town: part_of_town_string
+               };
+               var requestUrl = phpGWLink('bookingfrontend/', oArgs);
+
+               requestUrl += '&phpgw_return_as=stripped_html';
+               $.ajax({
+                       type: 'POST',
+                       data: {criteria: criteria},
+                       url: requestUrl,
+                       success: function (data) {
+                               if (data != null)
+                               {
+                                       $("#no_result").html('');
+                                       $("#result").html(data);
+                               }
+                       }
+               });
+
+       }
+
+       $('#collapse1').on('click', function () {
+               $(this).attr('href', 'javascript:;');
                $('#treeDiv1').jstree('close_all');
        })
 
-       $('#expand1').on('click',function(){
-               $(this).attr('href','javascript:;');
+       $('#expand1').on('click', function () {
+               $(this).attr('href', 'javascript:;');
                $('#treeDiv1').jstree('open_all');
        });
 
 
-
-
 });
 
 $(window).load(function () {
@@ -80,25 +135,7 @@
        $("#field_building_name").on("autocompleteselect", function (event, ui) 
{
                var building_id = ui.item.value;
                if (building_id != building_id_selection) {
-
-       //              var menuaction = $('#menuaction').val();
-                       var activity_top_level = $('#activity_top_level').val();
-                       $("#part_of_town :checkbox:checked").each(function() {
-                         part_of_towns.push($(this).val());
-                        });
-                         part_of_town_string = part_of_towns.join(',');
-
-                       var oArgs = {
-                               menuaction: 'bookingfrontend.uisearch.index',
-                               activity_top_level: activity_top_level,
-                               building_id: building_id,
-                               filter_part_of_town: part_of_town_string
-                       };
-                       var requestUrl = phpGWLink('bookingfrontend/', oArgs);
-
-                       window.location.href = requestUrl;
-
-//                     building_id_selection = building_id;
+                       update_search(selected_criteria);
                }
        });
 });

Modified: branches/dev-syncromind/bookingfrontend/templates/base/search.xsl
===================================================================
--- branches/dev-syncromind/bookingfrontend/templates/base/search.xsl   
2015-11-26 00:37:45 UTC (rev 14480)
+++ branches/dev-syncromind/bookingfrontend/templates/base/search.xsl   
2015-11-26 10:20:22 UTC (rev 14481)
@@ -1,21 +1,6 @@
-<xsl:template name="strip-tags" xmlns:php="http://php.net/xsl";>
-       <xsl:param name="text"/>
-       <xsl:choose>
-               <xsl:when test="contains($text, '&lt;')">
-                       <xsl:value-of select="substring-before($text, '&lt;')"/>
-                       <xsl:call-template name="strip-tags">
-                               <xsl:with-param name="text" select="concat(' ', 
substring-after($text, '&gt;'))"/>
-                       </xsl:call-template>
-               </xsl:when>
-               <xsl:otherwise>
-                       <xsl:value-of select="$text"/>
-               </xsl:otherwise>
-       </xsl:choose>
-</xsl:template>
-
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
        <script type="text/javascript">
-//             var selected_part_of_towns = "<xsl:value-of 
select="selected_part_of_towns"/>";
+               //              var selected_part_of_towns = "<xsl:value-of 
select="selected_part_of_towns"/>";
        </script>
        <div id="content">
                <form action="" method="GET" id="search">
@@ -55,9 +40,9 @@
                                                                        
<xsl:value-of select="id"/>
                                                                </xsl:attribute>
                                                                <xsl:if 
test="checked = 1">
-                                                               <xsl:attribute 
name="checked">
-                                                                       
<xsl:text>checked</xsl:text>
-                                                               </xsl:attribute>
+                                                                       
<xsl:attribute name="checked">
+                                                                               
<xsl:text>checked</xsl:text>
+                                                                       
</xsl:attribute>
                                                                </xsl:if>
                                                        </input>
                                                        <xsl:value-of 
select="name"/>
@@ -73,118 +58,41 @@
                                <style>
                                        #expandcontractdiv {border:1px dotted 
#dedede; margin:0 0 .5em 0; padding:0.4em;}
                                        #treeDiv1 { background: #fff; 
padding:1em; margin-top:1em; }
+                                       .no_checkbox>i.jstree-checkbox{ 
display:none}
                                </style>
                                <script type="text/javascript">
                                        filter_tree = <xsl:value-of 
select="filter_tree"/>;
                                </script>
                                <!-- markup for expand/contract links -->
                                <div id="treecontrol">
-                                       <a id="collapse1" title="Collapse the 
entire tree below" href="#"><xsl:value-of select="php:function('lang', 
'collapse all')"/></a>
+                                       <a id="collapse1" title="Collapse the 
entire tree below" href="#">
+                                               <xsl:value-of 
select="php:function('lang', 'collapse all')"/>
+                                       </a>
                                        <xsl:text> | </xsl:text>
-                                       <a id="expand1" title="Expand the 
entire tree below" href="#"><xsl:value-of select="php:function('lang', 'expand 
all')"/></a>
+                                       <a id="expand1" title="Expand the 
entire tree below" href="#">
+                                               <xsl:value-of 
select="php:function('lang', 'expand all')"/>
+                                       </a>
                                </div>
                                <div id="treeDiv1"></div>
                        </fieldset>
                </div>
 
-               <xsl:if test="not(search)">
-                       <div id="cloud">
-                               <div class="frontpagetext">
-                                       <xsl:value-of 
disable-output-escaping="yes" select="frontpagetext"/>
+               <div id="no_result">
+                       <xsl:if test="not(search)">
+                               <div id="cloud">
+                                       <div class="frontpagetext">
+                                               <xsl:value-of 
disable-output-escaping="yes" select="frontpagetext"/>
+                                       </div>
                                </div>
-                       </div>
-                       <div style="text-align:center;">
-                               <img alt="" >
-                                       <xsl:attribute name="src">
-                                               <xsl:value-of 
select="frontimage"/>
-                                       </xsl:attribute>
-                               </img>
-                       </div>
-               </xsl:if>
-               <xsl:if test="search">
-                       <div id="result">
-                               <h5>
-                                       <u>
-                                               <strong>
-                                                       <xsl:value-of 
select="php:function('lang', 'Found %1 results', 
search/results/total_records_sum)" />
-                                               </strong>
-                                       </u>
-                               </h5>
-                               <br />
-                               <br />
-                               <xsl:if test="search/results/total_records_sum 
&gt; 0">
-                                       <ol id="result">
-                                               <xsl:for-each 
select="search/results/results">
-                                                       <li>
-                                                               <div 
class="header">
-                                                                       <a 
class="bui_single_view_link">
-                                                                               
<xsl:attribute name="href">
-                                                                               
        <xsl:value-of select="link"/>
-                                                                               
</xsl:attribute>
-                                                                               
<xsl:value-of select="name"/>
-                                                                       </a>
-                                                                       
(<xsl:value-of select="php:function('lang', string(type))"/>)
-                                                               </div>
-                                                               <div 
class="details">
-                                                                       <div>
-                                                                               
<dl>
-                                                                               
        <dt>
-                                                                               
                <h4>
-                                                                               
                        <xsl:value-of select="php:function('lang', 
'Description')" />
-                                                                               
                </h4>
-                                                                               
        </dt>
-                                                                               
        <dd class="description">
-                                                                               
                <xsl:variable name="tag_stripped_description">
-                                                                               
                        <xsl:call-template name="strip-tags">
-                                                                               
                                <xsl:with-param name="text" 
select="description"/>
-                                                                               
                        </xsl:call-template>
-                                                                               
                </xsl:variable>
-                                                                               
                <xsl:choose>
-                                                                               
                        <xsl:when 
test="string-length($tag_stripped_description) &gt; 1">
-                                                                               
                                <xsl:choose>
-                                                                               
                                        <xsl:when 
test="string-length($tag_stripped_description) &gt; 100">
-                                                                               
                                                <xsl:value-of 
select="substring($tag_stripped_description, 0, 97)"/>...
-                                                                               
                                        </xsl:when>
-                                                                               
                                        <xsl:otherwise>
-                                                                               
                                                <xsl:value-of 
select="$tag_stripped_description"/>
-                                                                               
                                        </xsl:otherwise>
-                                                                               
                                </xsl:choose>
-                                                                               
                        </xsl:when>
-                                                                               
                        <xsl:otherwise>
-                                                                               
                                <xsl:value-of select="php:function('lang', 'No 
description yet')" />
-                                                                               
                        </xsl:otherwise>
-                                                                               
                </xsl:choose>
-                                                                               
                <div id="{img_container}"/>
-                                                                               
                <script type="text/javascript">
-                                                                               
                        $(window).load(function() {
-                                                                               
                        JqueryPortico.booking.inlineImages('<xsl:value-of 
select="img_container"/>', '<xsl:value-of select="img_url"/>');
-                                                                               
                        });
-                                                                               
                </script>
-                                                                               
        </dd>
-                                                                               
        <xsl:if test="string-length(homepage) &gt; 1">
-                                                                               
                <dt>
-                                                                               
                        <h4>
-                                                                               
                                <xsl:value-of select="php:function('lang', 
'Homepage')" />
-                                                                               
                        </h4>
-                                                                               
                </dt>
-                                                                               
                <dd class="description">
-                                                                               
                        <a>
-                                                                               
                                <xsl:attribute name="href">
-                                                                               
                                        <xsl:value-of select="homepage"/>
-                                                                               
                                </xsl:attribute>
-                                                                               
                                <xsl:value-of select="homepage"/>
-                                                                               
                        </a>
-                                                                               
                </dd>
-                                                                               
        </xsl:if>
-                                                                               
</dl>
-                                                                       </div>
-                                                                       <div 
class="clr"></div>
-                                                               </div>
-                                                       </li>
-                                               </xsl:for-each>
-                                       </ol>
-                               </xsl:if>
-                       </div>
-               </xsl:if>
+                               <div style="text-align:center;">
+                                       <img alt="" >
+                                               <xsl:attribute name="src">
+                                                       <xsl:value-of 
select="frontimage"/>
+                                               </xsl:attribute>
+                                       </img>
+                               </div>
+                       </xsl:if>
+               </div>
+               <div id="result"></div>
        </div>
 </xsl:template>

Added: branches/dev-syncromind/bookingfrontend/templates/base/search_details.xsl
===================================================================
--- branches/dev-syncromind/bookingfrontend/templates/base/search_details.xsl   
                        (rev 0)
+++ branches/dev-syncromind/bookingfrontend/templates/base/search_details.xsl   
2015-11-26 10:20:22 UTC (rev 14481)
@@ -0,0 +1,98 @@
+<xsl:template name="strip-tags" xmlns:php="http://php.net/xsl";>
+       <xsl:param name="text"/>
+       <xsl:choose>
+               <xsl:when test="contains($text, '&lt;')">
+                       <xsl:value-of select="substring-before($text, '&lt;')"/>
+                       <xsl:call-template name="strip-tags">
+                               <xsl:with-param name="text" select="concat(' ', 
substring-after($text, '&gt;'))"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:value-of select="$text"/>
+               </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <xsl:if test="results/total_records_sum &gt; 0">
+               <h5>
+                       <u>
+                               <strong>
+                                       <xsl:value-of 
select="php:function('lang', 'Found %1 results', results/total_records_sum)" />
+                               </strong>
+                       </u>
+               </h5>
+               <br />
+               <br />
+               <ol id="result">
+                       <xsl:for-each select="results/results">
+                               <li>
+                                       <div class="header">
+                                               <a class="bui_single_view_link">
+                                                       <xsl:attribute 
name="href">
+                                                               <xsl:value-of 
select="link"/>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="name"/>
+                                               </a>
+                                               (<xsl:value-of 
select="php:function('lang', string(type))"/>)
+                                       </div>
+                                       <div class="details">
+                                               <div>
+                                                       <dl>
+                                                               <dt>
+                                                                       <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'Description')" />
+                                                                       </h4>
+                                                               </dt>
+                                                               <dd 
class="description">
+                                                                       
<xsl:variable name="tag_stripped_description">
+                                                                               
<xsl:call-template name="strip-tags">
+                                                                               
        <xsl:with-param name="text" select="description"/>
+                                                                               
</xsl:call-template>
+                                                                       
</xsl:variable>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="string-length($tag_stripped_description) &gt; 1">
+                                                                               
        <xsl:choose>
+                                                                               
                <xsl:when test="string-length($tag_stripped_description) &gt; 
100">
+                                                                               
                        <xsl:value-of 
select="substring($tag_stripped_description, 0, 97)"/>...
+                                                                               
                </xsl:when>
+                                                                               
                <xsl:otherwise>
+                                                                               
                        <xsl:value-of select="$tag_stripped_description"/>
+                                                                               
                </xsl:otherwise>
+                                                                               
        </xsl:choose>
+                                                                               
</xsl:when>
+                                                                               
<xsl:otherwise>
+                                                                               
        <xsl:value-of select="php:function('lang', 'No description yet')" />
+                                                                               
</xsl:otherwise>
+                                                                       
</xsl:choose>
+                                                                       <div 
id="{img_container}"/>
+                                                                       <script 
type="text/javascript">
+                                                                               
$(document).ready(function () {
+                                                                               
JqueryPortico.booking.inlineImages('<xsl:value-of select="img_container"/>', 
'<xsl:value-of select="img_url"/>');
+                                                                               
});
+                                                                       
</script>
+                                                               </dd>
+                                                               <xsl:if 
test="string-length(homepage) &gt; 1">
+                                                                       <dt>
+                                                                               
<h4>
+                                                                               
        <xsl:value-of select="php:function('lang', 'Homepage')" />
+                                                                               
</h4>
+                                                                       </dt>
+                                                                       <dd 
class="description">
+                                                                               
<a>
+                                                                               
        <xsl:attribute name="href">
+                                                                               
                <xsl:value-of select="homepage"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:value-of select="homepage"/>
+                                                                               
</a>
+                                                                       </dd>
+                                                               </xsl:if>
+                                                       </dl>
+                                               </div>
+                                               <div class="clr"></div>
+                                       </div>
+                               </li>
+                       </xsl:for-each>
+               </ol>
+       </xsl:if>
+</xsl:template>

Modified: branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php    
2015-11-26 00:37:45 UTC (rev 14480)
+++ branches/dev-syncromind/phpgwapi/inc/class.custom_fields.inc.php    
2015-11-26 10:20:22 UTC (rev 14481)
@@ -1526,15 +1526,17 @@
                        {
                                $id = $this->_db2->f('id');
                                $tree[] = array(
+                                       'id'            => 
"ajson{$this->node_id}",
                                        'db_id'         => $id,
                                        'parent'        => 
$this->_db2->f('parent_id'),
                                        'text'          => 
$this->_db2->f('name',true),
                                );
+                               $this->node_id++;
                        }
 
                        foreach($tree as &$node)
                        {
-                               $children = 
$this->get_group_children($location_id, $node['db_id'], 0);
+                               $children = 
$this->get_group_children($location_id, $node['db_id'], $node['db_id']);
                                $attribute_children = 
$this->get_attribute_children($location_id, $node['id'], $node['db_id']);
                                if($children)
                                {
@@ -1621,11 +1623,14 @@
 
                        while($this->_db2->next_record())
                        {
+                               $id = $this->_db2->f('id');
                                $children[] = array(
-                                       'id'    => "ajson{$this->node_id}",
-                                       'db_id'         => $this->_db2->f('id'),
-                                       'parent'        => $parent,
-                                       'text'          => 
$this->_db2->f('input_text',true),
+                                       'id'                    => 
"ajson{$this->node_id}",
+                                       'db_id'                 => $id,
+                                       'location_id'   => $location_id,
+                                       'attribute_id'  => $id,
+                                       'parent'                => $parent,
+                                       'text'                  => 
$this->_db2->f('input_text',true),
                                );
                                $this->node_id++;
                        }
@@ -1637,9 +1642,12 @@
                                {
                                        foreach ($_choices as &$_choice)
                                        {
-                                               $_choice['parent'] = 
$child['id'];
-                                               $_choice['db_id']  = 
$_choice['id'];
-                                               $_choice['id']  = 
"ajson{$this->node_id}";
+                                               $_choice['parent']              
= $child['id'];
+                                               $_choice['db_id']               
= $_choice['id'];
+                                               $_choice['location_id'] = 
$location_id;
+                                               $_choice['attribute_id']= 
$child['db_id'];
+                                               $_choice['choice_id']   = 
$_choice['id'];
+                                               $_choice['id']                  
= "ajson{$this->node_id}";
                                                $this->node_id++;
                                        }
                                        $child['children'] = $_choices;




reply via email to

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