[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11883] controller: more on bookmarks
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11883] controller: more on bookmarks |
Date: |
Thu, 03 Apr 2014 12:50:19 +0000 |
Revision: 11883
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11883
Author: sigurdne
Date: 2014-04-03 12:50:18 +0000 (Thu, 03 Apr 2014)
Log Message:
-----------
controller: more on bookmarks
Modified Paths:
--------------
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2014-04-02 21:41:23 UTC
(rev 11882)
+++ trunk/controller/inc/class.uicalendar.inc.php 2014-04-03 12:50:18 UTC
(rev 11883)
@@ -452,8 +452,21 @@
$control_id = phpgw::get_var('control_id', 'int');
$control = $this->so_control->get_single($control_id);
$year = phpgw::get_var('year', 'int');
- $location_code = phpgw::get_var('location_code');
+ $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
+
+ $bookmark_locations = array();
+ $bookmarks = phpgwapi_cache::user_get('controller',
"location_bookmark", $user_id);
+ if(is_array($bookmarks))
+ {
+ $bookmark_locations = array_keys($bookmarks);
+ }
+
+ if($location_code = phpgw::get_var('location_code'))
+ {
+ $bookmark_locations[] = $location_code;
+ }
+
$locations_list = array();
if (is_numeric($control_id) & $control_id > 0)
@@ -494,7 +507,7 @@
{
$curr_location_code =
$location['location_code'];
- if(!$location_code ||
$curr_location_code != $location_code)
+ if(!$bookmark_locations ||
!in_array($curr_location_code, $bookmark_locations))
{
continue;
}
@@ -511,7 +524,14 @@
$year_calendar_agg = new
year_calendar_agg($control, $year, $curr_location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
$calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
- $locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
+
+ $locations_with_calendar_array[] = array
+ (
+ 'location'
=> $location,
+ 'calendar_array' =>
$calendar_array,
+ 'selected'
=> $bookmarks && isset($bookmarks[$curr_location_code])
+ );
+
}
// COMPONENTS: Process aggregated values for
controls with repeat type day or week
@@ -563,7 +583,7 @@
{
$curr_location_code =
$location['location_code'];
- if(!$location_code ||
$curr_location_code != $location_code)
+ if(!$bookmark_locations ||
!in_array($curr_location_code, $bookmark_locations))
{
continue;
}
@@ -574,7 +594,12 @@
$year_calendar = new
year_calendar($control, $year, null, $curr_location_code, "location");
$calendar_array =
$year_calendar->build_calendar($check_lists_array);
- $locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
+ $locations_with_calendar_array[] = array
+ (
+ 'location'
=> $location,
+ 'calendar_array' =>
$calendar_array,
+ 'selected'
=> $bookmarks && isset($bookmarks[$curr_location_code])
+ );
}
foreach ($components_for_control_array as
$component)
@@ -647,8 +672,21 @@
$control = $this->so_control->get_single($control_id);
$year = intval(phpgw::get_var('year'));
$month = intval(phpgw::get_var('month'));
- $location_code = phpgw::get_var('location_code');
+ $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
+
+ $bookmark_locations = array();
+ $bookmarks = phpgwapi_cache::user_get('controller',
"location_bookmark", $user_id);
+ if(is_array($bookmarks))
+ {
+ $bookmark_locations = array_keys($bookmarks);
+ }
+
+ if($location_code = phpgw::get_var('location_code'))
+ {
+ $bookmark_locations[] = $location_code;
+ }
+
if (is_numeric($control_id) & $control_id > 0)
{
$locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
@@ -686,7 +724,7 @@
{
$curr_location_code =
$location['location_code'];
- if(!$location_code || $curr_location_code !=
$location_code)
+ if(!$bookmark_locations ||
!in_array($curr_location_code, $bookmark_locations))
{
continue;
}
@@ -697,7 +735,12 @@
$month_calendar = new month_calendar($control, $year, $month,
null, $curr_location_code, "location");
$calendar_array =
$month_calendar->build_calendar($check_lists_array);
- $locations_with_calendar_array[] =
array("location" => $location, "calendar_array" => $calendar_array);
+ $locations_with_calendar_array[] = array
+ (
+ 'location' =>
$location,
+ 'calendar_array' =>
$calendar_array,
+ 'selected' =>
$bookmarks && isset($bookmarks[$curr_location_code])
+ );
}
foreach ($components_for_control_array as $component)
@@ -980,9 +1023,6 @@
$bookmarks[$location_code] = true;
$status = lang('added');
}
- //FIXME:
- $status = 'Implement me';
-
phpgwapi_cache::user_set('controller',
"location_bookmark", $bookmarks, $user_id);
Modified:
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
===================================================================
---
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2014-04-02 21:41:23 UTC (rev 11882)
+++
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2014-04-03 12:50:18 UTC (rev 11883)
@@ -92,7 +92,10 @@
<xsl:choose>
<xsl:when
test="locations_with_calendar_array/child::node()">
-
+ <xsl:variable name="lang_bookmark">
+ <xsl:value-of
select="php:function('lang', 'bookmark')" />
+ </xsl:variable>
+
<xsl:for-each
select="locations_with_calendar_array">
<tr>
<xsl:choose>
@@ -105,6 +108,13 @@
</xsl:choose>
<td>
+ <input type="checkbox"
name = "bookmark_location" value ="location/location_code"
title="{$lang_bookmark}">
+ <xsl:attribute
name="onchange">javascript:update_bookmark('<xsl:value-of
select="location/location_code"/>');</xsl:attribute>
+ <xsl:if
test="selected = 1">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xls:text> </xls:text>
<xsl:value-of
select="location/location_code"/>
</td>
<td class="location-name">
Modified:
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
===================================================================
---
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
2014-04-02 21:41:23 UTC (rev 11882)
+++
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
2014-04-03 12:50:18 UTC (rev 11883)
@@ -108,8 +108,8 @@
</xsl:choose>
<td class="title">
<input type="checkbox"
name = "bookmark_location" value ="location/location_code"
title="{$lang_bookmark}">
- <xsl:attribute
name="onchange">javascript:update_bookmark(<xsl:value-of
select="location/location_code"/>);</xsl:attribute>
- <xsl:if
test="location/selected = 1">
+ <xsl:attribute
name="onchange">javascript:update_bookmark('<xsl:value-of
select="location/location_code"/>');</xsl:attribute>
+ <xsl:if
test="selected = 1">
<xsl:attribute
name="checked">checked</xsl:attribute>
</xsl:if>
</input>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11883] controller: more on bookmarks,
Sigurd Nes <=