[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14642] more on bookingfrontend
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14642] more on bookingfrontend |
Date: |
Wed, 13 Jan 2016 15:06:03 +0000 |
Revision: 14642
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14642
Author: sigurdne
Date: 2016-01-13 15:06:02 +0000 (Wed, 13 Jan 2016)
Log Message:
-----------
more on bookingfrontend
Modified Paths:
--------------
branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
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
Modified: branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
2016-01-13 14:04:43 UTC (rev 14641)
+++ branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
2016-01-13 15:06:02 UTC (rev 14642)
@@ -13,11 +13,9 @@
$this->soevent =
CreateObject('booking.soevent');
}
- function search($searchterm, $building_id,
$filter_part_of_town, $activity_criteria = array())
+ function search($searchterm, $building_id,
$filter_part_of_town, $filter_top_level, $activity_criteria = array())
{
$building_filter = array(-1);
- $activity_top_levels = array_keys($activity_criteria);
-
$_filter_search_type = explode(',',
phpgw::get_var('filter_search_type', 'string'));
$types = array();
foreach($_filter_search_type as $key => $value)
@@ -49,9 +47,9 @@
$_filter_building['part_of_town_id'] =
$filter_part_of_town;
- if($activity_criteria && !$building_id)
+ if($filter_top_level && !$building_id)
{
- $buildings =
$this->sobuilding->get_buildings_from_activity($activity_top_levels);
+ $buildings =
$this->sobuilding->get_buildings_from_activity($filter_top_level);
$_filter_building['id'] = $buildings;
}
if($building_id)
@@ -103,9 +101,9 @@
{
$_filter_resource = array("active" => "1");
-// if($activity_top_levels)
+// if($filter_top_level)
// {
-// $_filter_resource['activity_id'] =
$activity_top_levels;
+// $_filter_resource['activity_id'] =
$filter_top_level;
// }
if($building_filter)
Modified: branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
===================================================================
--- branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
2016-01-13 14:04:43 UTC (rev 14641)
+++ branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
2016-01-13 15:06:02 UTC (rev 14642)
@@ -63,9 +63,15 @@
$activities =
ExecMethod('booking.boactivity.get_top_level');
+ $top_levels = array();
$filter_tree = array();
foreach($activities as &$activity)
{
+ $top_levels[] = array(
+ 'id' => $activity['id'],
+ 'location' =>
"resource_{$activity['id']}",
+ 'name' => $activity['name']
+ );
$_url = self::link(array(
'menuaction' =>
'bookingfrontend.uisearch.index',
'activity_top_level' =>
$activity['id'],
@@ -74,12 +80,13 @@
$dummy_sub = array();
$organized_fields =
$GLOBALS['phpgw']->custom_fields->get_attribute_tree('booking',
".resource.{$activity['id']}", 0, $activity['id']);
- if($organized_fields)
+ if(!$organized_fields)
{
- $dummy_sub[] = array(
- 'text' =>
$activity['name'],
- 'activity_top_level' =>
$activity['id'],
- );
+ continue;
+// $dummy_sub[] = array(
+// 'text' =>
$activity['name'],
+// 'activity_top_level' =>
$activity['id'],
+// );
}
$filter_tree[] = array(
'text' => $activity['id'] ==
$activity_top_level ? "[{$activity['name']}]" : $activity['name'],
@@ -96,7 +103,9 @@
// 'class' => "no_checkbox"
// ),
'activity_top_level' => $activity['id'],
- 'children' =>
array_merge($dummy_sub,$organized_fields),
+ 'activity_location' =>
"resource_{$activity['id']}",
+// 'children' =>
array_merge($dummy_sub,$organized_fields),
+ 'children' => $organized_fields,
);
}
//_debug_array($filter_tree);
@@ -108,6 +117,7 @@
$part_of_town['checked'] =
in_array($part_of_town['id'], $filter_part_of_town);
}
+ $params['top_levels'] = $top_levels;
$params['filter_tree'] = json_encode($filter_tree);
@@ -120,7 +130,6 @@
$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'));
- $search
= null;
$filter_part_of_town = array();
foreach($_filter_part_of_town as $key => $value)
@@ -130,7 +139,19 @@
$filter_part_of_town[] = $value;
}
}
+ unset($value);
+ $_filter_top_level = explode(',',
phpgw::get_var('filter_top_level', 'string'));
+ $filter_top_level = array();
+ foreach($_filter_top_level as $key => $value)
+ {
+ if($value)
+ {
+ $filter_top_level[] = $value;
+ }
+ }
+ unset($value);
+
$criteria = phpgw::get_var('criteria', 'string',
'REQUEST', array());
$activity_criteria = array();
foreach($criteria as $entry)
@@ -151,10 +172,10 @@
// _debug_array($activity_criteria);
// _debug_array($criteria);
// die();
- if($searchterm || $building_id || $activity_criteria ||
$filter_part_of_town || phpgw::get_var('filter_search_type'))
+ if($searchterm || $building_id || $activity_criteria ||
$filter_part_of_town || $filter_top_level
||phpgw::get_var('filter_search_type'))
{
$data = array(
- 'results' =>
$this->bo->search($searchterm, $building_id, $filter_part_of_town,
$activity_criteria)
+ 'results' =>
$this->bo->search($searchterm, $building_id,
$filter_part_of_town,$filter_top_level, $activity_criteria)
);
}
self::render_template_xsl('search_details', $data);
Modified: branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
===================================================================
--- branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
2016-01-13 14:04:43 UTC (rev 14641)
+++ branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
2016-01-13 15:06:02 UTC (rev 14642)
@@ -1,9 +1,11 @@
var filter_tree = null;
var building_id_selection = "";
+var search_types = [];
+var search_type_string = "";
var part_of_town_string = "";
var part_of_towns = [];
-var search_types = [];
-var search_type_string = "";
+var top_level_string = "";
+var top_levels = [];
var selected_building_id = null;
var selected_criteria = [];
@@ -17,13 +19,17 @@
JqueryPortico.autocompleteHelper(requestUrl,
'field_building_name', 'field_building_id', 'building_container');
}
+ $("#search_type :checkbox").on('click', function () {
+ update_search(selected_criteria, true);
+
+ });
$("#part_of_town :checkbox").on('click', function () {
selected_building_id = null;
update_search(selected_criteria);
});
- $("#search_type :checkbox").on('click', function () {
- update_search(selected_criteria, true);
+ $("#top_level :checkbox").on('click', function () {
+ update_search(selected_criteria);
});
//initate autocomplete;
@@ -63,6 +69,7 @@
update_search(selected_criteria);
});
+
update_activity_top_level = function (data, deselect) {
var parents = data.node.parents;
@@ -73,7 +80,8 @@
//Top node
if (level < 2)
{
-// activity_top_level =
data.node.a_attr.activity_top_level;
+ activity_location =
data.node.original.activity_location;
+ $("#" + activity_location).prop( "checked",
true );
}
else
{
@@ -85,6 +93,14 @@
// activity_top_level =
top_node.a_attr.activity_top_level;
}
}
+ else
+ {
+ if (level < 2)
+ {
+ activity_location =
data.node.original.activity_location;
+ $("#" + activity_location).prop( "checked",
false );
+ }
+ }
// $('#activity_top_level').val(activity_top_level);
// var href = data.node.a_attr.href;
@@ -106,24 +122,31 @@
}
// console.log(criteria);
- part_of_towns = [];
if(!keep_building_for_now)
{
$('#field_building_id').val('');
$("#field_building_name").val('');
}
+ search_types = [];
+ $("#search_type :checkbox:checked").each(function () {
+ search_types.push($(this).val());
+ });
+ search_type_string = search_types.join(',');
+
+ part_of_towns = [];
$("#part_of_town :checkbox:checked").each(function () {
part_of_towns.push($(this).val());
});
part_of_town_string = part_of_towns.join(',');
- search_types = [];
- $("#search_type :checkbox:checked").each(function () {
- search_types.push($(this).val());
+ top_levels = [];
+ $("#top_level :checkbox:checked").each(function () {
+ top_levels.push($(this).val());
});
- search_type_string = search_types.join(',');
+ top_level_string = top_levels.join(',');
+
update_autocompleteHelper();
// var activity_top_level = $('#activity_top_level').val();
@@ -132,8 +155,9 @@
menuaction: 'bookingfrontend.uisearch.query',
// activity_top_level: activity_top_level,
building_id: selected_building_id,
+ filter_search_type: search_type_string,
filter_part_of_town: part_of_town_string,
- filter_search_type: search_type_string
+ filter_top_level: top_level_string,
};
var requestUrl = phpGWLink('bookingfrontend/', oArgs);
Modified: branches/dev-syncromind/bookingfrontend/templates/base/search.xsl
===================================================================
--- branches/dev-syncromind/bookingfrontend/templates/base/search.xsl
2016-01-13 14:04:43 UTC (rev 14641)
+++ branches/dev-syncromind/bookingfrontend/templates/base/search.xsl
2016-01-13 15:06:02 UTC (rev 14642)
@@ -28,7 +28,7 @@
</div>
</form>
<div class="pure-g">
- <div class="pure-u-1-3">
+ <div class="pure-u-1-4">
<div class="heading">
<xsl:value-of select="php:function('lang',
'type')" />
</div>
@@ -59,7 +59,7 @@
</li-->
</ul>
</div>
- <div class="pure-u-1-3">
+ <div class="pure-u-1-4">
<div class="heading">
<xsl:value-of select="php:function('lang',
'part of town')" />
</div>
@@ -83,10 +83,37 @@
</xsl:for-each>
</ul>
</div>
+ <div class="pure-u-1-4">
+ <div class="heading">
+ <xsl:value-of select="php:function('lang',
'Activity')" />
+ </div>
+ <ul id="top_level">
+ <xsl:for-each select="top_levels">
+ <li>
+ <label>
+ <input type="checkbox"
name="top_levels[]">
+ <xsl:attribute
name="value">
+
<xsl:value-of select="id"/>
+ </xsl:attribute>
+ <xsl:attribute
name="id">
+
<xsl:value-of select="location"/>
+ </xsl:attribute>
+ <xsl:if
test="checked = 1">
+
<xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+
</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="name"/>
+ </label>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </div>
- <div class="pure-u-1-3" id="activity_tree">
+ <div class="pure-u-1-4" id="activity_tree">
<div class="heading">
- <xsl:value-of select="php:function('lang',
'tema')" />
+ <xsl:value-of select="php:function('lang',
'Resource')" />
</div>
<fieldset>
<!-- Some style for the expand/contract
section-->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14642] more on bookingfrontend,
Sigurd Nes <=