[Pkg-owncloud-commits] [php-sabredav] 28/66: Added a bunch of principal information to the browser plugin.

David Prévot taffit at moszumanska.debian.org
Sat Jan 18 20:08:20 UTC 2014


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

taffit pushed a commit to branch master
in repository php-sabredav.

commit 9ab52e9ef64dbaf9b230b2f270422d937c61cf23
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Wed Dec 11 20:57:06 2013 -0500

    Added a bunch of principal information to the browser plugin.
    
    Hope this will one day be a bit prettier. Pretty aweful right now.
---
 lib/Sabre/DAV/Browser/Plugin.php |  1 +
 lib/Sabre/DAVACL/Plugin.php      | 61 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/lib/Sabre/DAV/Browser/Plugin.php b/lib/Sabre/DAV/Browser/Plugin.php
index a3d888d..ea539a0 100644
--- a/lib/Sabre/DAV/Browser/Plugin.php
+++ b/lib/Sabre/DAV/Browser/Plugin.php
@@ -237,6 +237,7 @@ class Plugin extends DAV\ServerPlugin {
   <style type=\"text/css\">
   body { Font-family: arial}
   h1 { font-size: 150% }
+  th { text-align: left; vertical-align: top}
   </style>
         ";
 
diff --git a/lib/Sabre/DAVACL/Plugin.php b/lib/Sabre/DAVACL/Plugin.php
index dc6fa57..1abba42 100644
--- a/lib/Sabre/DAVACL/Plugin.php
+++ b/lib/Sabre/DAVACL/Plugin.php
@@ -658,13 +658,14 @@ class Plugin extends DAV\ServerPlugin {
         $this->server = $server;
         $server->on('beforeGetProperties',[$this,'beforeGetProperties'], 20);
 
-        $server->on('beforeMethod',    [$this,'beforeMethod'],20);
-        $server->on('beforeBind',      [$this,'beforeBind'],20);
-        $server->on('beforeUnbind',    [$this,'beforeUnbind'],20);
-        $server->on('updateProperties',[$this,'updateProperties']);
-        $server->on('beforeUnlock',    [$this,'beforeUnlock'],20);
-        $server->on('report',          [$this,'report']);
-        $server->on('method:ACL',      [$this,'httpAcl']);
+        $server->on('beforeMethod',        [$this,'beforeMethod'],20);
+        $server->on('beforeBind',          [$this,'beforeBind'],20);
+        $server->on('beforeUnbind',        [$this,'beforeUnbind'],20);
+        $server->on('updateProperties',    [$this,'updateProperties']);
+        $server->on('beforeUnlock',        [$this,'beforeUnlock'],20);
+        $server->on('report',              [$this,'report']);
+        $server->on('method:ACL',          [$this,'httpAcl']);
+        $server->on('onHTMLActionsPanel',  [$this,'htmlActionsPanel']);
 
         array_push($server->protectedProperties,
             '{DAV:}alternate-URI-set',
@@ -1398,5 +1399,51 @@ class Plugin extends DAV\ServerPlugin {
 
 
     /* }}} */
+    /* Browser plugin additions  {{{ */
+
+    /**
+     * This method is used to generate HTML output for the
+     * DAV\Browser\Plugin. This allows us to generate an interface users
+     * can use to create new calendars.
+     *
+     * @param DAV\INode $node
+     * @param string $output
+     * @return bool
+     */
+    public function htmlActionsPanel(DAV\INode $node, &$output) {
+
+        if (!$node instanceof IPrincipal)
+            return;
+
+        $properties['{DAV:}principal-URL'] = $node->getPrincipalUrl();
+        $properties['{DAV:}alternate-URI-set'] = $node->getAlternateUriSet();
+        $properties['{DAV:}group-member-set'] = $node->getGroupMemberSet();
+        $properties['{DAV:}group-membership'] = $node->getGroupMembership();
+
+        $output.= <<<HTML
+
+<tr>
+    <td colspan="2">
+        <h3>Principal properties</h3>
+    </td>
+</tr>
+HTML;
+
+        foreach($properties as $key=>$property) {
+
+            $output.="<tr><th colspan=\"2\">" . $key . "</th><td colspan=\"3\">";
+            $property = (array)$property;
+            foreach($property as $key=>$value) {
+                $property[$key] = $this->server->getBaseUri() . $value;
+            }
+            $output.=implode("<br />", $property);
+            $output.="</td></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