Annotate improvements from CVS HEAD
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 9 Jan 2009 22:54:35 +0000 (15:54 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 9 Jan 2009 22:54:35 +0000 (15:54 -0700)
chora/annotate.php
chora/js/annotate.js
chora/js/src/annotate.js
chora/templates/annotate/line.inc
chora/themes/screen.css

index 1ae747e..4808210 100644 (file)
@@ -58,7 +58,7 @@ require CHORA_TEMPLATES . '/headerbar.inc';
 require CHORA_TEMPLATES . '/annotate/header.inc';
 
 $author = '';
-$i = $style = 0;
+$style = 0;
 
 /* Use this counter so that we can give each tooltip object a unique
  * id attribute (which we use to set the tooltip text later). */
@@ -78,7 +78,6 @@ while (list(,$line) = each($lines)) {
 
     $line = Text::htmlAllSpaces($line['line']);
     include CHORA_TEMPLATES . '/annotate/line.inc';
-    ++$i;
 }
 
 require $registry->get('templates', 'horde') . '/common-footer.inc';
index f0f1e8e..c8233a5 100644 (file)
@@ -1 +1 @@
-var Chora_Annotate={showLog:function(d){var c=d.findElement("SPAN").hide(),b=c.up("TD").down("A").readAttribute("id").slice(4,-2),a=new Element("TD",{colspan:5}).insert(Chora.loading_text);c.up("TR").insert({after:new Element("TR").insert(a)});new Ajax.Updater(a,Chora.ANNOTATE_URL+b)}};document.observe("dom:loaded",function(){$$(".logdisplay").invoke("observe","click",Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate))});
\ No newline at end of file
+var Chora_Annotate={showLog:function(d){var c=d.element(),b,a;if(!c.hasClassName("logdisplay")){c=c.up("SPAN.logdisplay");if(!c){return}}d.stop();b=c.hide().up("TD").down("A").readAttribute("rev");a=new Element("TD",{colspan:5}).insert(Chora.loading_text);c.up("TR").insert({after:new Element("TR",{className:"logentry"}).insert(a)});new Ajax.Updater(a,Chora.ANNOTATE_URL+b)}};document.observe("click",Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate));
\ No newline at end of file
index c9a0f96..60d6ad4 100644 (file)
@@ -9,15 +9,23 @@
 
 var Chora_Annotate = {
     showLog: function(e) {
-        var elt = e.findElement('SPAN').hide(),
-            rev = elt.up('TD').down('A').readAttribute('id').slice(4, -2),
-            newelt = new Element('TD', { colspan: 5 }).insert(Chora.loading_text);
-        elt.up('TR').insert({ after: new Element('TR').insert(newelt) });
+        var elt = e.element(), rev, newelt;
+        if (!elt.hasClassName('logdisplay')) {
+            elt = elt.up('SPAN.logdisplay');
+            if (!elt) {
+                return;
+            }
+        }
+
+        e.stop();
+
+        rev = elt.hide().up('TD').down('A').readAttribute('rev');
+        newelt = new Element('TD', { colspan: 5 }).insert(Chora.loading_text);
+
+        elt.up('TR').insert({ after: new Element('TR', { className: 'logentry' }).insert(newelt) });
 
         new Ajax.Updater(newelt, Chora.ANNOTATE_URL + rev);
     }
 };
 
-document.observe('dom:loaded', function() {
-    $$('.logdisplay').invoke('observe', 'click', Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate));
-});
+document.observe('click', Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate));
index 42d773b..a7824ae 100644 (file)
@@ -6,7 +6,7 @@
     <?php echo $author ?>
   </td>
   <td class="rev">
-    <a id="rev_<?php echo htmlspecialchars($rev) . '_' . $i ?>" href="<?php echo Chora::url('co', $where, array('r' => $rev)) ?>" title="<?php echo htmlspecialchars($rev) ?>"><?php echo htmlspecialchars($rev_ob->abbrev($rev)) ?></a>
+    <a rev="<?php echo htmlspecialchars($rev) ?>" href="<?php echo Chora::url('co', $where, array('r' => $rev)) ?>" title="<?php echo htmlspecialchars($rev) ?>"><?php echo htmlspecialchars($rev_ob->abbrev($rev)) ?></a>
 <?php if ($prev): ?>
     <a href="<?php echo Chora::url('diff', $where, array('r1' => $prev, 'r2' => $rev)) ?>" title="<?php echo sprintf(_("Diff to %s"), htmlspecialchars($prev)) ?>"><?php echo Horde::img('diff.png') ?></a>
     <span class="logdisplay"><?php echo Horde::img('log.png') ?></span>
@@ -14,7 +14,7 @@
   </td>
   <td class="rev">
 <?php if ($prev): ?>
-    <a id="prev_<?php echo htmlspecialchars($prev) . '_' . $i ?>" href="<?php echo Chora::url('annotate', $where, array('rev' => $prev)) . '#l' . $lineno ?>" title="<?php echo htmlspecialchars($prev) ?>"><?php echo htmlspecialchars($rev_ob->abbrev($prev)) ?></a>
+    <a rev="<?php echo htmlspecialchars($prev) ?>" href="<?php echo Chora::url('annotate', $where, array('rev' => $prev)) . '#l' . $lineno ?>" title="<?php echo htmlspecialchars($prev) ?>"><?php echo htmlspecialchars($rev_ob->abbrev($prev)) ?></a>
 <?php endif; ?>
   </td>
   <td class="item<?php echo $style ?>">
index d0dfbd6..2e5db5e 100644 (file)
@@ -224,6 +224,9 @@ table.annotate .rev {
     padding-right: 2px;
     white-space: nowrap;
 }
+table.annotate .logentry {
+    background: #cde;
+}
 
 /* Diff styles. */
 table.hrdiff {