[Pkg-owncloud-commits] [php-sabredav] 85/275: Browser plugin now supports supported-privilege-set.
David Prévot
taffit at moszumanska.debian.org
Thu Sep 25 14:55:55 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 487b3cd0bd104040b26f24928a116aff217df125
Author: Evert Pot <me at evertpot.com>
Date: Fri Jul 4 21:41:10 2014 -0400
Browser plugin now supports supported-privilege-set.
---
lib/DAV/Browser/Plugin.php | 42 ++++++++++++++++++++++-----
lib/DAV/Browser/assets/sabredav.css | 12 ++++++++
lib/DAVACL/Property/SupportedPrivilegeSet.php | 11 +++++++
3 files changed, 57 insertions(+), 8 deletions(-)
diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php
index 9af7533..b242ef2 100644
--- a/lib/DAV/Browser/Plugin.php
+++ b/lib/DAV/Browser/Plugin.php
@@ -541,6 +541,7 @@ HTML;
'Sabre\\DAV\\Property\\ResourceType' => 'xmlvaluelist',
'Sabre\\DAV\\Property\\SupportedReportSet' => 'xmlvaluelist',
'Sabre\\DAVACL\\Property\\CurrentUserPrivilegeSet' => 'xmlvaluelist',
+ 'Sabre\\DAVACL\\Property\\SupportedPrivilegeSet' => 'supported-privilege-set',
];
$view = 'complex';
@@ -561,6 +562,15 @@ HTML;
ob_start();
+ $xmlValueDisplay = function($propName) {
+ $realPropName = $propName;
+ list($ns, $localName) = DAV\XMLUtil::parseClarkNotation($propName);
+ if (isset($this->server->xmlNamespaces[$ns])) {
+ $propName = $this->server->xmlNamespaces[$ns] . ':' . $localName;
+ }
+ return "<span title=\"" . $this->escapeHTML($realPropName) . "\">" . $this->escapeHTML($propName) . "</span>";
+ };
+
echo "<tr><th><span title=\"", $this->escapeHTML($realName), "\">", $this->escapeHTML($name), "</span></th><td>";
switch($view) {
@@ -578,18 +588,34 @@ HTML;
}, $value->getHrefs()));
break;
case 'xmlvaluelist' :
- echo implode(', ', array_map(function($propName) {
- $realPropName = $propName;
- list($ns, $localName) = DAV\XMLUtil::parseClarkNotation($propName);
- if (isset($this->server->xmlNamespaces[$ns])) {
- $propName = $this->server->xmlNamespaces[$ns] . ':' . $localName;
- }
- return "<span title=\"" . $this->escapeHTML($realPropName) . "\">" . $this->escapeHTML($propName) . "</span>";
- }, $value->getValue()));
+ echo implode(', ', array_map($xmlValueDisplay, $value->getValue()));
break;
case 'valuelist' :
echo $this->escapeHTML(implode(', ', $value->getValue()));
break;
+ case 'supported-privilege-set' :
+ $traverse = function($priv) use (&$traverse, $xmlValueDisplay) {
+ echo "<li>";
+ echo $xmlValueDisplay($priv['privilege']);
+ if (isset($priv['abstract']) && $priv['abstract']) {
+ echo " <i>(abstract)</i>";
+ }
+ if (isset($priv['description'])) {
+ echo " " . $this->escapeHTML($priv['description']);
+ }
+ if (isset($priv['aggregates'])) {
+ echo "\n<ul>\n";
+ foreach($priv['aggregates'] as $subPriv) {
+ $traverse($subPriv);
+ }
+ echo "</ul>";
+ }
+ echo "</li>\n";
+ };
+ echo "<ul class=\"tree\">";
+ $traverse($value->getValue(), '');
+ echo "</ul>\n";
+ break;
case 'string' :
echo $this->escapeHTML($value);
break;
diff --git a/lib/DAV/Browser/assets/sabredav.css b/lib/DAV/Browser/assets/sabredav.css
index b369630..f758e5a 100644
--- a/lib/DAV/Browser/assets/sabredav.css
+++ b/lib/DAV/Browser/assets/sabredav.css
@@ -208,3 +208,15 @@ footer {
font-size: 80%;
text-align: center;
}
+
+ul.tree {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+ul.tree ul {
+ list-style: none;
+ padding-left: 10px;
+ border-left: 4px solid #ccc;
+}
diff --git a/lib/DAVACL/Property/SupportedPrivilegeSet.php b/lib/DAVACL/Property/SupportedPrivilegeSet.php
index 5f152d9..0cc8145 100644
--- a/lib/DAVACL/Property/SupportedPrivilegeSet.php
+++ b/lib/DAVACL/Property/SupportedPrivilegeSet.php
@@ -39,6 +39,17 @@ class SupportedPrivilegeSet extends DAV\Property {
}
/**
+ * Returns the privilege value.
+ *
+ * @return array
+ */
+ public function getValue() {
+
+ return $this->privileges;
+
+ }
+
+ /**
* Serializes the property into a domdocument.
*
* @param DAV\Server $server
--
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