[Pkg-owncloud-commits] [php-sabredav] 20/148: XML output improvements in browser.
David Prévot
taffit at moszumanska.debian.org
Wed Apr 15 01:37:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit 6e13708022167537f5ac5b77a711fa3f83e8c21c
Author: Evert Pot <me at evertpot.com>
Date: Fri Feb 6 01:25:40 2015 -0500
XML output improvements in browser.
---
lib/DAV/Browser/Plugin.php | 18 ++++++++----------
lib/DAV/Browser/assets/sabredav.css | 5 +++++
lib/DAV/XMLUtil.php | 1 +
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php
index 6294f4d..1832c4c 100644
--- a/lib/DAV/Browser/Plugin.php
+++ b/lib/DAV/Browser/Plugin.php
@@ -634,8 +634,7 @@ HTML;
} elseif($value instanceof \Sabre\Xml\XmlSerializable) {
$mapping = [
- 'Sabre\\DAV\\Property\\IHref' => 'href',
- 'Sabre\\DAV\\Property\\HrefList' => 'hreflist',
+ 'Sabre\\DAV\\Xml\\Property\\Href' => 'href',
'Sabre\\DAV\\Xml\\Property\\SupportedMethodSet' => 'valuelist',
'Sabre\\DAV\\Xml\\Property\\ResourceType' => 'xmlvaluelist',
'Sabre\\DAV\\Xml\\Property\\SupportedReportSet' => 'xmlvaluelist',
@@ -676,9 +675,6 @@ HTML;
switch($view) {
case 'href' :
- echo "<a href=\"" . $this->server->getBaseUri() . $value->getHref() . '">' . $this->server->getBaseUri() . $value->getHref() . '</a>';
- break;
- case 'hreflist' :
echo implode('<br />', array_map(function($href) {
if (stripos($href,'mailto:')===0 || stripos($href,'/')===0 || stripos($href,'http:')===0 || stripos($href,'https:') === 0) {
return "<a href=\"" . $this->escapeHTML($href) . '">' . $this->escapeHTML($href) . '</a>';
@@ -720,11 +716,13 @@ HTML;
echo $this->escapeHTML($value);
break;
case 'xml' :
- $writer = new XmlWriter();
- $writer->openMemory();
- $writer->namespaceMap = $this->server->xml->namespaceMap;
- $writer->write($value);
- echo $this->escapeHtml($writer->outputMemory());
+ $xml = $this->server->xml->write(['{DAV:}root' => $value], $this->server->getBaseUri());
+ // removing first and last line, as they contain our root
+ // element.
+ $xml = substr($xml, strpos($xml,"\n")+1);
+ $xml = substr($xml, 0, strrpos($xml,"\n"));
+ $xml = substr($xml, 0, strrpos($xml,"\n"));
+ echo "<pre>", $this->escapeHtml($xml), "</pre>";
break;
case 'complex' :
echo '<em title="' . get_class($value) . '">complex</em>';
diff --git a/lib/DAV/Browser/assets/sabredav.css b/lib/DAV/Browser/assets/sabredav.css
index f758e5a..7133eaa 100644
--- a/lib/DAV/Browser/assets/sabredav.css
+++ b/lib/DAV/Browser/assets/sabredav.css
@@ -174,6 +174,11 @@ section table {
background: #eeeeee;
}
+.propTable pre {
+ font-size: 80%;
+ background: #f8f8f8;
+}
+
.actions {
border: 1px dotted #76baa6;
padding: 20px;
diff --git a/lib/DAV/XMLUtil.php b/lib/DAV/XMLUtil.php
index e9453ec..3e06af6 100644
--- a/lib/DAV/XMLUtil.php
+++ b/lib/DAV/XMLUtil.php
@@ -82,6 +82,7 @@ class XMLUtil {
$writer->baseUri = $baseUri;
$writer->namespaceMap = $this->namespaceMap;
$writer->openMemory();
+ $writer->setIndent(true);
$writer->write($output);
return $writer->outputMemory();
--
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