fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11881] controller add location bookmark


From: Sigurd Nes
Subject: [Fmsystem-commits] [11881] controller add location bookmark
Date: Tue, 01 Apr 2014 14:03:26 +0000

Revision: 11881
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11881
Author:   sigurdne
Date:     2014-04-01 14:03:25 +0000 (Tue, 01 Apr 2014)
Log Message:
-----------
controller add location bookmark

Modified Paths:
--------------
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/js/controller/ajax.js
    
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-01 07:37:42 UTC 
(rev 11880)
+++ trunk/controller/inc/class.uicalendar.inc.php       2014-04-01 14:03:25 UTC 
(rev 11881)
@@ -62,7 +62,8 @@
                        'view_calendar_for_month' => true,
                        'view_calendar_for_year' => true,
                        'view_calendar_year_for_locations' => true,
-                       'view_calendar_month_for_locations' => true
+                       'view_calendar_month_for_locations' => true,
+                       'update_bookmark'                                       
=> true
                );
 
                public function __construct()
@@ -958,6 +959,38 @@
                {
 
                }
+               public function update_bookmark()
+               {
+                       $location_code = phpgw::get_var('location_code', 
'string');
+                       $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
 
+                       $bookmarks = phpgwapi_cache::user_get('controller', 
"location_bookmark", $user_id);
+                       if($bookmarks && is_array($bookmarks) && 
isset($bookmarks[$location_code]))
+                       {
+                               unset($bookmarks[$location_code]);
+                               $status = lang('deleted');
+                       }
+                       else
+                       {
+                               if(! is_array($bookmarks))
+                               {
+                                       $bookmarks = array();
+                               }
+
+                               $bookmarks[$location_code] = true;
+                               $status = lang('added');
+                       }
+                       //FIXME:
+                       $status = 'Implement me';
+
+                       
+                       phpgwapi_cache::user_set('controller', 
"location_bookmark", $bookmarks, $user_id);
+
+                       return array
+                       (
+                               'status' => $status
+                       );
+               }
+
        }
 

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2014-04-01 07:37:42 UTC (rev 
11880)
+++ trunk/controller/js/controller/ajax.js      2014-04-01 14:03:25 UTC (rev 
11881)
@@ -707,3 +707,23 @@
        // Updating order number in front of row
        $(span_order_nr).text(updated_order_nr);
 }
+
+//Updates order number for hidden field and number in front of row
+function update_bookmark(location_code){
+               var oArgs = 
{menuaction:'controller.uicalendar.update_bookmark', 
location_code:location_code};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+       
+               $.ajax({
+                         type: 'POST',
+                         url: requestUrl,
+                         dataType: 'json',
+                 success: function(data) {
+                         if(data)
+                                 {
+                                         alert(data.status);
+                                 }
+                 }
+                  });
+
+
+}

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-01 07:37:42 UTC (rev 11880)
+++ 
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl   
    2014-04-01 14:03:25 UTC (rev 11881)
@@ -93,7 +93,10 @@
                        <xsl:choose>
                                <xsl:when 
test="locations_with_calendar_array/child::node()">
                                
-                               <xsl:for-each 
select="locations_with_calendar_array">
+                                       <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>
                                                <xsl:when test="(position() mod 
2) != 1">
@@ -103,8 +106,14 @@
                                                    <xsl:attribute 
name="class">even</xsl:attribute>
                                                </xsl:otherwise>
                                            </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="checked">checked</xsl:attribute>
+                                                         </xsl:if>
+                                                       </input>
+                                                       <xls:text> </xls:text>
                                                        <xsl:value-of 
select="location/location_code"/>
                                                </td>
                                                <td class="location-name">




reply via email to

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