Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /insurrection/src/

Project highlights: A modern, light-weight, self-contained, web-based toolset for Subversion repository browsing and administration.  A live system can be seen in action here.

insurrection
Discussion topic

Back to topic list

CVS update: /insurrection/src/

Author mksoft
Full name Michae Sinz
Date 2005-04-13 09:34:45 PDT
Message User: mksoft
Date: 05/04/13 09:34:45

Modified:
 /insurrection/src/
  svnindex.js, svnindex.xsl

Log:
 Some code cleanup.
 Made the top (already loaded) directory also foldable just for
 consistancy sake.
 

File Changes:

Directory: /insurrection/src/
=============================

File [changed]: svnindex.js
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/svnindex.js?r1=1.5​&r2=1.6
Delta lines: +80 -65
---------------------
--- svnindex.js 12 Apr 2005 19:16:03 -0000 1.5
+++ svnindex.js 13 Apr 2005 16:34:45 -0000 1.6
@@ -1,5 +1,5 @@
 /*
- * $Id: svnindex.js,v 1.5 2005/04/12 19:16:03 mksoft Exp $
+ * $Id: svnindex.js,v 1.6 2005/04/13 16:34:45 mksoft Exp $
  * Copyright 2004,2005 - Michael Sinz
  *
  * Some JavaScript support routines for the svn index pages
@@ -131,6 +131,31 @@
 }
 
 /*
+ * This is to support the changing of the visible state and the arrow.
+ */
+function foldDir(arrow)
+{
+ var target = document.getElementById('.' + arrow.id);
+ if (target)
+ {
+ var row = document.getElementB​yId(target.id + '_');
+ if (row)
+ {
+ if (row.style.display == 'none')
+ {
+ row.style.display = '';
+ arrow.src = document.getElementB​yId('openedImage').s​rc;
+ }
+ else
+ {
+ row.style.display = 'none';
+ arrow.src = document.getElementB​yId('closedImage').s​rc;
+ }
+ }
+ }
+}
+
+/*
  * We dynamically generate the in-line subdirectory DOM elements.
  * We do this "a few at a time" such that the browser remains
  * responsive during the potentially long operation. It does
@@ -295,16 +320,16 @@
 function loadDirCheck()
 {
     var target = _loadTarget;
- if (target.xml)
- {
- if (target.xml.readyState == 4)
+ if ((target) && (target.xml) && (target.xml.readyState == 4))
         {
+ // We are done with this one...
+ _loadTarget = null;
+
             if (target.xml.status == 200)
             {
- // Flag this directory as done and recall the loadDir
- // to flip its display state...
- target.done = 1;
- loadDir(target.arrow);
+ // Change the onclick to just fold the directory as
+ // we have completed the load...
+ target.arrow['onclick'] = function(){foldDir(this);};
 
                 // Create the table and table body for the subdirectory
                 var table = document.createEleme​nt('table');
@@ -342,48 +367,38 @@
 
                 // Ask the system to do the next action...
                 doNextItem();
+ }
 
                 // Remove the reference to the loaded document
                 target.xml = null;
             }
- }
- }
 }
 
 /*
  * In order to support in-line directory expansion, the directory
  * arrow calls us like this...
  */
-function loadDir(name)
+function loadDir(arrow)
 {
- var target = document.getElementById('.' + name.id);
+ var target = document.getElementById('.' + arrow.id);
     if (target)
     {
- if (target.done)
- {
- if (target.row.style.display == 'none')
- {
- target.row.style.display = '';
- target.arrow.src = document.getElementB​yId('openedImage').s​rc;
- }
- else
- {
- target.row.style.display = 'none';
- target.arrow.src = document.getElementB​yId('closedImage').s​rc;
- }
- }
- else
+ if (_loadTarget == null)
         {
- target.arrow = name;
+ _loadTarget = target;
+ target.arrow = arrow;
             target.row = document.getElementB​yId(target.id + '_');
             if (target.row)
             {
                 target.xml = getXMLHTTP();
                 if (target.xml)
                 {
+ // Flip the arrow and start showing the rows now...
+ foldDir(arrow);
+
+ // Set up the load operation...
                     target.xml.open("GET​",target.id,true);
                     target.xml.onreadystatechange = loadDirCheck;
- _loadTarget = target;
                     target.xml.send(null);
                 }
             }

File [changed]: svnindex.xsl
Url: http://insurrection.​tigris.org/source/br​owse/insurrection/sr​c/svnindex.xsl?r1=1.​11&r2=1.12
Delta lines: +29 -33
---------------------
--- svnindex.xsl 12 Apr 2005 06:28:52 -0000 1.11
+++ svnindex.xsl 13 Apr 2005 16:34:45 -0000 1.12
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- $Id: svnindex.xsl,v 1.11 2005/04/12 06:28:52 mksoft Exp $ -->
+<!-- $Id: svnindex.xsl,v 1.12 2005/04/13 16:34:45 mksoft Exp $ -->
 <!-- Copyright 2004,2005 - Michael Sinz -->
 <!-- This is my magic Subversion index XSLT transform to HTML -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/19​99/XSL/Transform" version="1.0">
@@ -88,7 +88,7 @@
               <div class="footer">
                 <xsl:text>Powered by Subversion </xsl:text>
                 <xsl:value-of select="@version"/>
- <xsl:text> -- $Id: svnindex.xsl,v 1.11 2005/04/12 06:28:52 mksoft Exp $</xsl:text>
+ <xsl:text> -- $Id: svnindex.xsl,v 1.12 2005/04/13 16:34:45 mksoft Exp $</xsl:text>
               </div>
             </td>
           </tr>
@@ -97,6 +97,26 @@
     </html>
   </xsl:template>
 
+ <xsl:template match="updir">
+ <tr class="updirrow">
+ <td colspan="4">
+ <xsl:element name="a">
+ <xsl:attribute name="href">..​</xsl:attribute>
+ <div class="updir">
+ <xsl:element name="img">
+ <xsl:attribute name="class">svne​ntryicon</xsl:att​ribute>
+ <xsl:attribute name="align">midd​le</xsl:attribute​>
+ <xsl:attribute name="src">
+ <xsl:value-of select="document('in​surrection.xml')/xml​/images/diricon/@src​"/>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:text>.. (Parent Directory)</xsl:text>
+ </div>
+ </xsl:element>
+ </td>
+ </tr>
+ </xsl:template>
+
   <xsl:template match="index">
     <div class="svn">
     <table width="100%" cellpadding="0" cellspacing="0" border="0">
@@ -104,8 +124,12 @@
       <tr class="pathrow">
         <td class="foldspace">
           <xsl:element name="img">
+ <xsl:attribute name="class">dira​rrow</xsl:attribu​te>
             <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">An opened directory</xsl:attribute>
+ <xsl:attribute name="onclick">fo​ldDir(this)</xsl:​attribute>
+ <xsl:attribute name="id">
+ <xsl:text>/​</xsl:text>
+ </xsl:attribute>
             <xsl:attribute name="src">
               <xsl:value-of select="document('in​surrection.xml')/xml​/images/openedicon/@​src"/>
             </xsl:attribute>
@@ -115,7 +139,6 @@
           <xsl:element name="img">
             <xsl:attribute name="class">svne​ntryicon</xsl:att​ribute>
             <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A directory</xsl:attribute>
             <xsl:attribute name="src">
               <xsl:value-of select="document('in​surrection.xml')/xml​/images/diricon/@src​"/>
             </xsl:attribute>
@@ -149,17 +172,16 @@
           </xsl:element>
         </td>
       </tr>
- <tr>
+ <tr id="./_">
         <td>
           <xsl:element name="img">
             <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A file spacer</xsl:attribute>
             <xsl:attribute name="src">
               <xsl:value-of select="document('in​surrection.xml')/xml​/images/blankicon/@s​rc"/>
             </xsl:attribute>
           </xsl:element>
         </td>
- <td colspan="3">
+ <td colspan="3" id="./">
           <table width="100%" cellpadding="0" cellspacing="0" border="0">
             <xsl:apply-templates select="dir"/>
             <xsl:apply-templates select="file"/>
@@ -170,34 +192,12 @@
     </div>
   </xsl:template>
 
- <xsl:template match="updir">
- <tr class="updirrow">
- <td colspan="4">
- <xsl:element name="a">
- <xsl:attribute name="href">..​</xsl:attribute>
- <div class="updir">
- <xsl:element name="img">
- <xsl:attribute name="class">svne​ntryicon</xsl:att​ribute>
- <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A directory</xsl:attribute>
- <xsl:attribute name="src">
- <xsl:value-of select="document('in​surrection.xml')/xml​/images/diricon/@src​"/>
- </xsl:attribute>
- </xsl:element>
- <xsl:text>.. (Parent Directory)</xsl:text>
- </div>
- </xsl:element>
- </td>
- </tr>
- </xsl:template>
-
   <xsl:template match="dir">
     <tr class="dirrow">
       <td class="foldspace">
         <xsl:element name="img">
           <xsl:attribute name="class">dira​rrow</xsl:attribu​te>
           <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A closed directory</xsl:attribute>
           <xsl:attribute name="src">
             <xsl:value-of select="document('in​surrection.xml')/xml​/images/closedicon/@​src"/>
           </xsl:attribute>
@@ -217,7 +217,6 @@
             <xsl:element name="img">
               <xsl:attribute name="class">svne​ntryicon</xsl:att​ribute>
               <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A directory</xsl:attribute>
               <xsl:attribute name="src">
                 <xsl:value-of select="document('in​surrection.xml')/xml​/images/diricon/@src​"/>
               </xsl:attribute>
@@ -255,7 +254,6 @@
       <td class="foldspace">
         <xsl:element name="img">
           <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A subdir spacer</xsl:attribute>
           <xsl:attribute name="src">
             <xsl:value-of select="document('in​surrection.xml')/xml​/images/blankicon/@s​rc"/>
           </xsl:attribute>
@@ -276,7 +274,6 @@
       <td class="foldspace">
         <xsl:element name="img">
           <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A file spacer</xsl:attribute>
           <xsl:attribute name="src">
             <xsl:value-of select="document('in​surrection.xml')/xml​/images/blankicon/@s​rc"/>
           </xsl:attribute>
@@ -291,7 +288,6 @@
             <xsl:element name="img">
               <xsl:attribute name="class">svne​ntryicon</xsl:att​ribute>
               <xsl:attribute name="align">midd​le</xsl:attribute​>
- <xsl:attribute name="alt">A file</xsl:attribute>
               <xsl:attribute name="src">
                 <xsl:value-of select="document('in​surrection.xml')/xml​/images/fileicon/@sr​c"/>
               </xsl:attribute>




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@insu​rrection.tigris.org
For additional commands, e-mail: cvs-help@insurrectio​n.tigris.org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /insurrection/src/ mksoft Michae Sinz 2005-04-13 09:34:45 PDT
Messages per page: