[Pkg-owncloud-commits] [php-sabredav] 07/66: Showing an export button for calendars.

David Prévot taffit at moszumanska.debian.org
Wed May 27 13:56:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 3.0.0-alpha1
in repository php-sabredav.

commit 555b257d6e25afe2926cd027f9f77f320b9f724a
Author: Evert Pot <me at evertpot.com>
Date:   Mon Apr 13 16:10:11 2015 -0400

    Showing an export button for calendars.
---
 lib/CalDAV/ICSExportPlugin.php |  7 ++++++-
 lib/DAV/Browser/Plugin.php     | 11 +++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/CalDAV/ICSExportPlugin.php b/lib/CalDAV/ICSExportPlugin.php
index 8ad9234..1797d23 100644
--- a/lib/CalDAV/ICSExportPlugin.php
+++ b/lib/CalDAV/ICSExportPlugin.php
@@ -63,7 +63,12 @@ class ICSExportPlugin extends DAV\ServerPlugin {
     function initialize(DAV\Server $server) {
 
         $this->server = $server;
-        $this->server->on('method:GET', [$this,'httpGet'], 90);
+        $server->on('method:GET', [$this,'httpGet'], 90);
+        $server->on('browserButtonActions', function($path, $node, &$actions) {
+            if ($node instanceof ICalendar) {
+                $actions .= '<a href="' . htmlspecialchars($path, ENT_QUOTES, 'UTF-8'). '?export"><span class="oi" data-glyph="calendar"></span></a>';
+            }
+        });
 
     }
 
diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php
index 013d16f..4e5efbd 100644
--- a/lib/DAV/Browser/Plugin.php
+++ b/lib/DAV/Browser/Plugin.php
@@ -110,7 +110,7 @@ class Plugin extends DAV\ServerPlugin {
                 $this->serveAsset(isset($getVars['assetName'])?$getVars['assetName']:null);
                 return false;
             default :
-            case 'nodeInfo' :
+            case 'info' :
                 try {
                     $this->server->tree->getNodeForPath($request->getPath());
                 } catch (DAV\Exception\NotFound $e) {
@@ -301,7 +301,14 @@ class Plugin extends DAV\ServerPlugin {
                     $html.=$this->escapeHTML($lastMod->format('F j, Y, g:i a'));
                 }
                 $html.= '</td>';
-                $html.= '<td><a href="' . $this->escapeHTML($subProps['fullPath']) . '?sabreAction=info"><span class="oi" data-glyph="info"></span></a></td>';
+
+                $buttonActions = '';
+                if ($subNode instanceof DAV\IFile) {
+                    $buttonActions =  '<a href="' . $this->escapeHTML($subProps['fullPath']) . '?sabreAction=info"><span class="oi" data-glyph="info"></span></a>';
+                }
+                $this->server->emit('browserButtonActions', [$subProps['fullPath'], $subProps['subNode'], &$buttonActions]);
+
+                $html.= '<td>'. $buttonActions . '</td>';
                 $html.= '</tr>';
             }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list