[Repoze-checkins] r1169 - repoze.debug/trunk/repoze/debug/static
Paul Everitt
paul at agendaless.com
Sat Jun 28 18:17:22 EDT 2008
Author: Paul Everitt <paul at agendaless.com>
Date: Sat Jun 28 18:17:22 2008
New Revision: 1169
Log:
First cut at getting Safari support. Mostly works, need to fix the colorizer to have proper display:block elements (works under Firefox). Just open static/debugui.html in Safari, using a file:/// or http:// URL.
Added:
repoze.debug/trunk/repoze/debug/static/debugui-html.js
- copied, changed from r1165, /repoze.debug/trunk/repoze/debug/static/debugui.js
repoze.debug/trunk/repoze/debug/static/debugui-html.xsl
- copied, changed from r1155, /repoze.debug/trunk/repoze/debug/static/debugui.xsl
repoze.debug/trunk/repoze/debug/static/debugui-shared.js
Removed:
repoze.debug/trunk/repoze/debug/static/debugui.js
repoze.debug/trunk/repoze/debug/static/debugui.xsl
Modified:
repoze.debug/trunk/repoze/debug/static/debugui-entryviewer.xsl
repoze.debug/trunk/repoze/debug/static/debugui-html.css
repoze.debug/trunk/repoze/debug/static/debugui-xul.js
repoze.debug/trunk/repoze/debug/static/debugui-xul.xsl
repoze.debug/trunk/repoze/debug/static/debugui.html
repoze.debug/trunk/repoze/debug/static/debugui.xul
repoze.debug/trunk/repoze/debug/static/samplefeed.xml
Modified: repoze.debug/trunk/repoze/debug/static/debugui-entryviewer.xsl
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/debugui-entryviewer.xsl (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui-entryviewer.xsl Sat Jun 28 18:17:22 2008
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:atom="http://www.w3.org/2005/Atom" xmlns:rz="http://repoze.org/namespace"
- xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="atom rz"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:import href="xmlverbatim.xsl"/>
+ xmlns:verb="http://informatik.hu-berlin.de/xmlverbatim" xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="atom rz verb" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+ <!--<xsl:import href="xmlverbatim.xsl"/>-->
<xsl:output indent="yes"/>
<xsl:variable name="entryid" select="/atom:feed/@selected"/>
<xsl:template match="/">
- <div><h1>kdkdkd</h1><xsl:apply-templates select="/atom:feed/atom:entry[atom:id=$entryid]"/></div>
+ <div>
+ <xsl:apply-templates select="/atom:feed/atom:entry[atom:id=$entryid]"/>
+ </div>
</xsl:template>
<xsl:template match="atom:entry">
<div>
@@ -16,4 +19,342 @@
<xsl:apply-templates select="." mode="xmlverb"/>
</div>
</xsl:template>
+
+
+
+
+ <!--
+ XML to HTML Verbatim Formatter with Syntax Highlighting
+ Version 1.1
+ Contributors: Doug Dicks, added auto-indent (parameter indent-elements)
+ for pretty-print
+
+ Copyright 2002 Oliver Becker
+ ob at obqo.de
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations under the License.
+
+ Alternatively, this software may be used under the terms of the
+ GNU Lesser General Public License (LGPL).
+-->
+ <xsl:param name="indent-elements" select="false()"/>
+ <!-- root -->
+ <xsl:template match="/" mode="xmlverb">
+ <xsl:text>
</xsl:text>
+ <xsl:comment>
+ <xsl:text> converted by xmlverbatim.xsl 1.1, (c) O. Becker </xsl:text>
+ </xsl:comment>
+ <xsl:text>
</xsl:text>
+
+ <div class="xmlverb-default">
+ <xsl:apply-templates mode="xmlverb">
+ <xsl:with-param name="indent-elements" select="$indent-elements"/>
+ </xsl:apply-templates>
+ </div>
+ <xsl:text>
</xsl:text>
+ </xsl:template>
+
+ <!-- wrapper -->
+
+ <xsl:template match="verb:wrapper">
+ <xsl:apply-templates mode="xmlverb">
+ <xsl:with-param name="indent-elements" select="$indent-elements"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="verb:wrapper" mode="xmlverb">
+ <xsl:apply-templates mode="xmlverb">
+ <xsl:with-param name="indent-elements" select="$indent-elements"/>
+
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- element nodes -->
+ <xsl:template match="*" mode="xmlverb">
+ <xsl:param name="indent-elements" select="false()"/>
+ <xsl:param name="indent" select="''"/>
+ <xsl:param name="indent-increment" select="'   '"/>
+ <xsl:if test="$indent-elements">
+
+ <br/>
+ <xsl:value-of select="$indent"/>
+ </xsl:if>
+ <xsl:text><</xsl:text>
+ <xsl:variable name="ns-prefix" select="substring-before(name(),':')"/>
+ <xsl:if test="$ns-prefix != ''">
+ <span class="xmlverb-element-nsprefix">
+ <xsl:value-of select="$ns-prefix"/>
+ </span>
+
+ <xsl:text>:</xsl:text>
+ </xsl:if>
+ <span class="xmlverb-element-name">
+ <xsl:value-of select="local-name()"/>
+ </span>
+ <xsl:variable name="pns" select="../namespace::*"/>
+ <xsl:if test="$pns[name()=''] and not(namespace::*[name()=''])">
+ <span class="xmlverb-ns-name">
+
+ <xsl:text> xmlns</xsl:text>
+ </span>
+ <xsl:text>=""</xsl:text>
+ </xsl:if>
+ <xsl:for-each select="namespace::*">
+ <xsl:if
+ test="not($pns[name()=name(current()) and
+ .=current()])">
+ <xsl:call-template name="xmlverb-ns"/>
+
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="@*">
+ <xsl:call-template name="xmlverb-attrs"/>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="node()">
+ <xsl:text>></xsl:text>
+ <xsl:apply-templates mode="xmlverb">
+
+ <xsl:with-param name="indent-elements" select="$indent-elements"/>
+ <xsl:with-param name="indent" select="concat($indent, $indent-increment)"/>
+ <xsl:with-param name="indent-increment" select="$indent-increment"/>
+ </xsl:apply-templates>
+ <xsl:if test="* and $indent-elements">
+ <br/>
+ <xsl:value-of select="$indent"/>
+ </xsl:if>
+ <xsl:text></</xsl:text>
+
+ <xsl:if test="$ns-prefix != ''">
+ <span class="xmlverb-element-nsprefix">
+ <xsl:value-of select="$ns-prefix"/>
+ </span>
+ <xsl:text>:</xsl:text>
+ </xsl:if>
+ <span class="xmlverb-element-name">
+ <xsl:value-of select="local-name()"/>
+
+ </span>
+ <xsl:text>></xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> /></xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="not(parent::*)">
+ <br/>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- attribute nodes -->
+ <xsl:template name="xmlverb-attrs">
+ <xsl:text> </xsl:text>
+ <span class="xmlverb-attr-name">
+ <xsl:value-of select="name()"/>
+ </span>
+ <xsl:text>="</xsl:text>
+
+ <span class="xmlverb-attr-content">
+ <xsl:call-template name="html-replace-entities">
+ <xsl:with-param name="text" select="normalize-space(.)"/>
+ <xsl:with-param name="attrs" select="true()"/>
+ </xsl:call-template>
+ </span>
+ <xsl:text>"</xsl:text>
+ </xsl:template>
+
+ <!-- namespace nodes -->
+ <xsl:template name="xmlverb-ns">
+ <xsl:if test="name()!='xml'">
+ <span class="xmlverb-ns-name">
+ <xsl:text> xmlns</xsl:text>
+ <xsl:if test="name()!=''">
+ <xsl:text>:</xsl:text>
+
+ </xsl:if>
+ <xsl:value-of select="name()"/>
+ </span>
+ <xsl:text>="</xsl:text>
+ <span class="xmlverb-ns-uri">
+ <xsl:value-of select="."/>
+ </span>
+ <xsl:text>"</xsl:text>
+
+ </xsl:if>
+ </xsl:template>
+
+ <!-- text nodes -->
+ <xsl:template match="text()" mode="xmlverb">
+ <span class="xmlverb-text">
+ <xsl:call-template name="preformatted-output">
+ <xsl:with-param name="text">
+ <xsl:call-template name="html-replace-entities">
+
+ <xsl:with-param name="text" select="."/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </span>
+ </xsl:template>
+
+ <!-- comments -->
+ <xsl:template match="comment()" mode="xmlverb">
+
+ <xsl:text><!--</xsl:text>
+ <span class="xmlverb-comment">
+ <xsl:call-template name="preformatted-output">
+ <xsl:with-param name="text" select="."/>
+ </xsl:call-template>
+ </span>
+ <xsl:text>--></xsl:text>
+ <xsl:if test="not(parent::*)">
+ <br/>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- processing instructions -->
+ <xsl:template match="processing-instruction()" mode="xmlverb">
+ <xsl:text><?</xsl:text>
+ <span class="xmlverb-pi-name">
+ <xsl:value-of select="name()"/>
+ </span>
+ <xsl:if test=".!=''">
+
+ <xsl:text> </xsl:text>
+ <span class="xmlverb-pi-content">
+ <xsl:value-of select="."/>
+ </span>
+ </xsl:if>
+ <xsl:text>?></xsl:text>
+ <xsl:if test="not(parent::*)">
+ <br/>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- =========================================================== -->
+ <!-- Procedures / Functions -->
+ <!-- =========================================================== -->
+
+ <!-- generate entities by replacing &, ", < and > in $text -->
+ <xsl:template name="html-replace-entities">
+ <xsl:param name="text"/>
+ <xsl:param name="attrs"/>
+
+ <xsl:variable name="tmp">
+ <xsl:call-template name="replace-substring">
+ <xsl:with-param name="from" select="'>'"/>
+ <xsl:with-param name="to" select="'&gt;'"/>
+ <xsl:with-param name="value">
+ <xsl:call-template name="replace-substring">
+ <xsl:with-param name="from" select="'<'"/>
+ <xsl:with-param name="to" select="'&lt;'"/>
+ <xsl:with-param name="value">
+
+ <xsl:call-template name="replace-substring">
+ <xsl:with-param name="from" select="'&'"/>
+ <xsl:with-param name="to" select="'&amp;'"/>
+ <xsl:with-param name="value" select="$text"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ </xsl:variable>
+ <xsl:choose>
+ <!-- $text is an attribute value -->
+ <xsl:when test="$attrs">
+ <xsl:call-template name="replace-substring">
+ <xsl:with-param name="from" select="'
'"/>
+ <xsl:with-param name="to" select="'&#xA;'"/>
+ <xsl:with-param name="value">
+ <xsl:call-template name="replace-substring">
+
+ <xsl:with-param name="from" select="'"'"/>
+ <xsl:with-param name="to" select="'&quot;'"/>
+ <xsl:with-param name="value" select="$tmp"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tmp"/>
+
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- replace in $value substring $from with $to -->
+ <xsl:template name="replace-substring">
+ <xsl:param name="value"/>
+ <xsl:param name="from"/>
+ <xsl:param name="to"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($value,$from)">
+ <xsl:value-of select="substring-before($value,$from)"/>
+ <xsl:value-of select="$to"/>
+ <xsl:call-template name="replace-substring">
+ <xsl:with-param name="value" select="substring-after($value,$from)"/>
+ <xsl:with-param name="from" select="$from"/>
+ <xsl:with-param name="to" select="$to"/>
+ </xsl:call-template>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- preformatted output: space as , tab as 8
+ nl as <br> -->
+ <xsl:template name="preformatted-output">
+
+ <xsl:param name="text"/>
+ <xsl:call-template name="output-nl">
+ <xsl:with-param name="text">
+ <xsl:call-template name="replace-substring">
+ <xsl:with-param name="value" select="translate($text,' ',' ')"/>
+ <xsl:with-param name="from" select="'	'"/>
+ <xsl:with-param name="to"
+ select="'        '"
+ />
+ </xsl:call-template>
+ </xsl:with-param>
+
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- output nl as <br> -->
+ <xsl:template name="output-nl">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="contains($text,'
')">
+ <xsl:value-of select="substring-before($text,'
')"/>
+
+ <br/>
+ <xsl:text>
</xsl:text>
+ <xsl:call-template name="output-nl">
+ <xsl:with-param name="text" select="substring-after($text,'
')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text"/>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:template>
</xsl:stylesheet>
Modified: repoze.debug/trunk/repoze/debug/static/debugui-html.css
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/debugui-html.css (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui-html.css Sat Jun 28 18:17:22 2008
@@ -1,20 +1,42 @@
body {
font-family: sans-serif;
- font-size: 0.85em;
+ font-size: 0.9em;
}
#lhc {
position: absolute;
top: 0;
left: 0;
- width: 200px;
+ width: 230px;
height: 100%;
background-color: silver;
color: black;
border-right: solid black 0px;
}
-#tree {
+#logtree {
margin: 0.4em;
+ height: 90%;
+ padding: 0.2em
}
#selected-entry {
- margin-left: 230px;
+ margin-left: 260px;
+}
+.tree-entry, .tree-item-entry {
+ margin-bottom: 0.6em;
+}
+.tree-item {
+ margin-left: 0.8em;
+}
+.tree-entry > div > a {
+ font-weight:bold;
+}
+.tree-entry a, .tree-item a {
+ text-decoration: none;
+ color: black;
+ background-color:silver;
+ padding-top: 0.2em;
+ padding-bottom: 0.2em;
+}
+.tree-entry a:hover, .tree-item a:hover {
+ color:black;
+ border:dashed gray 1px;
}
\ No newline at end of file
Copied: repoze.debug/trunk/repoze/debug/static/debugui-html.js (from r1165, /repoze.debug/trunk/repoze/debug/static/debugui.js)
==============================================================================
--- /repoze.debug/trunk/repoze/debug/static/debugui.js (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui-html.js Sat Jun 28 18:17:22 2008
@@ -1,28 +1,99 @@
+var gm;
-var processor;
-var url = "../feed.xml";
+function GuiModel (tree_id, atom_url) {
+ this.tree_id = tree_id;
+ this.atom_url = atom_url;
+ this.tree = document.getElementById(tree_id);
+ this.viewer = document.getElementById("selected-entry");
+ this.processor = null;
+ this.viewerprocessor = null;
+ this.atom_doc = null;
+ this.curr_tree_selection = 0;
+ this.ns = {
+ 'xhtml' : 'http://www.w3.org/1999/xhtml',
+ 'mathml': 'http://www.w3.org/1998/Math/MathML',
+ 'atom' : 'http://www.w3.org/2005/Atom',
+ };
-function asxml (node) {
- return new XMLSerializer().serializeToString(node);
+ // Register handlers
+ this.tree.addEventListener("click", this.selectEntry, false);
}
-function geturl(url) {
+GuiModel.prototype.tostring = function (node) {
+ /* Dump a document or node to a string representation */
+
+ var s = new XMLSerializer();
+ return s.serializeToString(node);
+}
+
+
+GuiModel.prototype.loadURL = function (url) {
+ /* Synchronously load some XML, return the document element */
+
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, false);
- xmlhttp.send('');
+ xmlhttp.setRequestHeader("Cache-Control","no-cache");
+ xmlhttp.send('');
return xmlhttp.responseXML;
}
-function reloadFeed () {
- var target = document.getElementById("tree");
- Sarissa.updateContentFromURI(url, target, processor);
+GuiModel.prototype.loadProcessor = function (xslurl) {
+ /* Load the XSLT that massages Atom-data into XML datasources */
+
+ this.xsldoc = this.loadURL(xslurl);
+ this.processor = new XSLTProcessor();
+ this.processor.importStylesheet(this.xsldoc);
}
-function debuginit () {
- var xsldoc = geturl("debugui.xsl");
- processor = new XSLTProcessor();
- processor.importStylesheet(xsldoc);
+GuiModel.prototype.loadViewerProcessor = function (xslurl) {
+ /* Load the XSLT that views selected entries */
+
+ this.viewerxsldoc = this.loadURL(xslurl);
+ this.viewerprocessor = new XSLTProcessor();
+ this.viewerprocessor.importStylesheet(this.viewerxsldoc);
+}
+
+
+GuiModel.prototype.reloadModel = function () {
+ /* Fetch the atom data, then update various trees */
+
+ Sarissa.updateContentFromURI(gm.atom_url, gm.tree, gm.processor);
+
+}
+
+
+GuiModel.prototype.selectEntry = function (e) {
+ /* Activate the right-hand side */
+
+ e.preventDefault();
+ var entrynode = e.target;
+ var entryid = entrynode.getAttribute("href");
+
+ // Change the contents of the viewer
+ gm.atom_doc.documentElement.setAttribute("selected", entryid);
+ var result = gm.viewerprocessor.transformToDocument(gm.atom_doc);
+ var iresult = document.importNode(result.documentElement, true);
+ Sarissa.moveChildNodes(iresult, gm.viewer);
+
+}
+
+
+function initGuiModel () {
+ /* Run on document load by the onload handler */
+
+ if (window.location.host.indexOf(":") == -1){
+ // Running from FS, not dynamicall via WSGI, use dummy data
+ var atom_url = "samplefeed.xml";
+ } else {
+ var atom_url = "../feed.xml";
+ }
+ gm = new GuiModel("logtree", atom_url);
+ gm.loadProcessor("debugui-html.xsl");
+ gm.loadViewerProcessor("debugui-entryviewer.xsl");
+ gm.atom_doc = gm.loadURL(atom_url);
+ gm.reloadModel();
+ console.log("init ran, model loaded");
}
Copied: repoze.debug/trunk/repoze/debug/static/debugui-html.xsl (from r1155, /repoze.debug/trunk/repoze/debug/static/debugui.xsl)
==============================================================================
--- /repoze.debug/trunk/repoze/debug/static/debugui.xsl (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui-html.xsl Sat Jun 28 18:17:22 2008
@@ -1,18 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:atom="http://www.w3.org/2005/Atom"
- exclude-result-prefixes="atom" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ xmlns:rz="http://repoze.org/namespace" exclude-result-prefixes="atom rz"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:key name="getsubentry" match="atom:entry" use="atom:content/rz:entry/rz:request/@tid"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/atom:feed">
- <h1>
- <xsl:value-of select="atom:title"/>
- </h1>
<div>
- <em>Last Updated: <xsl:value-of select="atom:updated"/></em>
+ <xsl:apply-templates select="atom:entry[atom:content/rz:entry/rz:response/@tid]"
+ mode="entry"/>
+ </div>
+ </xsl:template>
+ <xsl:template match="atom:entry" mode="entry">
+ <!-- The parent request is the one with a @tid on the response -->
+ <div class="tree-entry">
+ <xsl:apply-templates select="." mode="item"/>
+ <xsl:variable name="thistid" select="atom:content/rz:entry/rz:response/@tid"/>
+ <div class="tree-item"><xsl:apply-templates select="key('getsubentry', $thistid)" mode="item"/></div>
+ </div>
+ </xsl:template>
+ <xsl:template match="atom:entry" mode="item">
+ <!-- The parent request is the one with a @tid on the response -->
+ <div class="tree-item-entry">
+ <a href="{atom:id}">
+ <xsl:value-of select="atom:title"/>
+ </a>
</div>
- <ul>
- <xsl:for-each select="atom:entry">
- <li>Item: <xsl:value-of select="atom:title"/></li>
- </xsl:for-each>
- </ul>
</xsl:template>
</xsl:stylesheet>
Added: repoze.debug/trunk/repoze/debug/static/debugui-shared.js
==============================================================================
--- (empty file)
+++ repoze.debug/trunk/repoze/debug/static/debugui-shared.js Sat Jun 28 18:17:22 2008
@@ -0,0 +1,41 @@
+
+
+/* Companion functions, stolen from Sarissa */
+
+function selectNodes (sExpr, returnSingle) {
+ var nsDoc = gm.atom_doc;
+ function nsresolver(prefix) {
+ return gm.ns[prefix] || null;
+ }
+ var result = null;
+ if(!returnSingle){
+ var oResult = nsDoc.evaluate(sExpr,
+ nsDoc,
+ nsresolver,
+ XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+ var nodeList = new SarissaNodeList(oResult.snapshotLength);
+ nodeList.expr = sExpr;
+ for(var i=0;i<nodeList.length;i++){
+ nodeList[i] = oResult.snapshotItem(i);
+ }
+ result = nodeList;
+ }
+ else {
+ var xf = XPathResult.FIRST_ORDERED_NODE_TYPE;
+ result = nsDoc.evaluate(sExpr,
+ nsDoc,
+ nsresolver,
+ xf, null).singleNodeValue;
+ }
+ return result;
+};
+
+function selectSingleNode (sExpr) {
+ return selectNodes(sExpr, true);
+}
+
+function SarissaNodeList (i) {
+ this.length = i;
+};
+
+
Modified: repoze.debug/trunk/repoze/debug/static/debugui-xul.js
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/debugui-xul.js (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui-xul.js Sat Jun 28 18:17:22 2008
@@ -91,7 +91,7 @@
gm.curr_tree_selection = gm.tree.view.selection.currentIndex;
// Change the contents of the viewer
- gm.viewerprocessor.setParameter(null, "entryid", entryid);
+ gm.atom_doc.documentElement.setAttribute("selected", entryid);
var result = gm.viewerprocessor.transformToDocument(gm.atom_doc);
var iresult = document.importNode(result.documentElement, true);
Sarissa.moveChildNodes(iresult, gm.viewer);
@@ -115,42 +115,3 @@
document.addEventListener("DOMContentLoaded", initGuiModel, false);
-
-
-/* Companion functions, stolen from Sarissa */
-
-function selectNodes (sExpr, returnSingle) {
- var nsDoc = gm.atom_doc;
- function nsresolver(prefix) {
- return gm.ns[prefix] || null;
- }
- var result = null;
- if(!returnSingle){
- var oResult = nsDoc.evaluate(sExpr,
- nsDoc,
- nsresolver,
- XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
- var nodeList = new SarissaNodeList(oResult.snapshotLength);
- nodeList.expr = sExpr;
- for(var i=0;i<nodeList.length;i++){
- nodeList[i] = oResult.snapshotItem(i);
- }
- result = nodeList;
- }
- else {
- var xf = XPathResult.FIRST_ORDERED_NODE_TYPE;
- result = nsDoc.evaluate(sExpr,
- nsDoc,
- nsresolver,
- xf, null).singleNodeValue;
- }
- return result;
-};
-
-function selectSingleNode (sExpr) {
- return selectNodes(sExpr, true);
-}
-
-function SarissaNodeList (i) {
- this.length = i;
-};
Modified: repoze.debug/trunk/repoze/debug/static/debugui-xul.xsl
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/debugui-xul.xsl (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui-xul.xsl Sat Jun 28 18:17:22 2008
@@ -5,15 +5,8 @@
exclude-result-prefixes="atom rz" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:key name="getsubentry" match="atom:entry" use="atom:content/rz:entry/rz:request/@tid"/>
- <xsl:template match="/" priority="99">
- <xsl:choose>
- <xsl:when test="/atom:feed">
+ <xsl:template match="/">
<xsl:apply-templates select="atom:feed" mode="tree"/>
- </xsl:when>
- <xsl:otherwise>
- <main><!--<xsl:apply-templates select="." mode="viewer"/>--></main>
- </xsl:otherwise>
- </xsl:choose>
</xsl:template>
<xsl:template match="atom:feed" mode="tree">
<!-- Recurse into the feed and make data to load into the tree -->
Modified: repoze.debug/trunk/repoze/debug/static/debugui.html
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/debugui.html (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui.html Sat Jun 28 18:17:22 2008
@@ -6,16 +6,24 @@
<title>repoze.debug GUI</title>
<link rel="stylesheet" type="text/css" href="debugui-html.css"/>
<link rel="stylesheet" type="text/css" href="debugui-shared.css"/>
- <script type="text/javascript" src="debugui.js">
- /**/</script>
<script type="text/javascript" src="sarissa.js">
/**/</script>
+ <script type="text/javascript" src="debugui-shared.js">
+ /**/</script>
+ <script type="text/javascript" src="debugui-html.js">
+ /**/</script>
</head>
- <body onload="debuginit();">
+ <body onload="initGuiModel();">
<div id="lhc">
- <div id="tree" style="height:95%">x</div>
- <button onclick="reloadFeed();">Reload</button>
+ <div id="logtree">x</div>
+ <button id="reloadEntries" onclick="gm.reloadModel();">Reload</button>
+ </div>
+ <div id="selected-entry">
+ <h1>repoze.debug Browser</h1>
+ <p>Click on an entry on the left to browse it. Click the reload button at the bottom
+ right to update from the remote data.</p>
+ <p>Note: To simulate changing the server, open <code>samplefeed.xml</code> and edit one
+ of the title elements.</p>
</div>
- <div id="selected-entry">x</div>
</body>
</html>
Modified: repoze.debug/trunk/repoze/debug/static/debugui.xul
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/debugui.xul (original)
+++ repoze.debug/trunk/repoze/debug/static/debugui.xul Sat Jun 28 18:17:22 2008
@@ -6,6 +6,7 @@
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rz="http://repoze.org/namespaces"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="sarissa.js"/>
+ <script src="debugui-shared.js"/>
<script src="debugui-xul.js"/>
<vbox flex="1">
<tree id="xui-logtree" datasources="samplelogentries.xml" ref="*" querytype="xml"
Modified: repoze.debug/trunk/repoze/debug/static/samplefeed.xml
==============================================================================
--- repoze.debug/trunk/repoze/debug/static/samplefeed.xml (original)
+++ repoze.debug/trunk/repoze/debug/static/samplefeed.xml Sat Jun 28 18:17:22 2008
@@ -11,7 +11,7 @@
<entry>
<id>urn:uuid:20323</id>
- <title>/profile/chris/edit.html</title>
+ <title>/profile/paul/edit.html</title>
<link href="http://www.google.com/"/>
<updated>2003-12-13T18:31:01Z</updated>
<content>
More information about the Repoze-checkins
mailing list