Use a partial for showing log messages - this can be re-used in other places soon
authorChuck Hagenbuch <chuck@horde.org>
Wed, 24 Nov 2010 15:37:42 +0000 (10:37 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Wed, 24 Nov 2010 15:40:47 +0000 (10:40 -0500)
chora/app/views/_logMessage.html.php [new file with mode: 0644]
chora/diff.php
chora/templates/diff/header.inc
chora/themes/default/screen.css
chora/themes/hordeweb/screen.css
chora/themes/tango-blue/screen.css

diff --git a/chora/app/views/_logMessage.html.php b/chora/app/views/_logMessage.html.php
new file mode 100644 (file)
index 0000000..71fdcba
--- /dev/null
@@ -0,0 +1,41 @@
+<!-- <h3><?php /*echo date('Y-m-d', $logMessage->queryDate()) */?></h3> -->
+<div class="commit-summary">
+ <div class="commit-info">
+  <ul>
+   <li>
+    <a href="<?php echo Chora::url('co', $GLOBALS['where'], array('r' => $logMessage->queryRevision())) ?>" title="<?php echo $this->escape($logMessage->queryRevision()) ?>"><?php echo $this->escape($logMessage->queryRevision()) ?></a>
+    <span class="diffadd">+<?php echo $this->escape($logMessage->getAddedLines()) ?></span>, <span class="diffdel">-<?php echo $this->escape($logMessage->getDeletedLines()) ?></span>
+   </li>
+  </ul>
+  <ul>
+   <li></li>
+  </ul>
+
+  <?php if ($branchinfo = $logMessage->queryBranch()): ?>
+  <h4><?php echo _("Branches") ?></h4>
+  <ul>
+  <?php foreach ($branchinfo as $branchname): ?>
+   <li><a href="<?php echo Chora::url('browsefile', $GLOBALS['where'], array('onb' => $branchname)) ?>"><?php echo $this->escape($branchname) ?></a></li>
+  <?php endforeach; ?>
+  </ul>
+  <?php endif; ?>
+
+  <?php if ($tags = $logMessage->queryTags()): ?>
+  <h4><?php echo _("Tags") ?></h4>
+  <ul>
+  <?php foreach ($tags as $tag): ?>
+   <li><?php echo $this->escape($tag) ?></li>
+  <?php endforeach; ?>
+  </ul>
+  <?php endif; ?>
+ </div>
+
+ <div class="commit-message"><?php echo Chora::formatLogMessage($logMessage->queryLog()) ?></div>
+
+ <div class="commit-author">
+  <?php echo Chora::showAuthorName($logMessage->queryAuthor(), true) ?><br>
+  <?php echo Chora::formatDate($logMessage->queryDate()) ?>
+ </div>
+
+ <div class="clear">&nbsp;</div>
+</div>
index 7d890b2..9304b56 100644 (file)
@@ -62,19 +62,7 @@ $log_messages = array();
 foreach ($VC->getRevisionRange($fl, $r1, $r2) as $val) {
     $clog = $fl->queryLogs($val);
     if (!is_null($clog)) {
-        $fileinfo = $clog->queryFiles($where);
-        $stats = ($fileinfo && isset($fileinfo['added']))
-            ? array('added' => $fileinfo['added'], 'deleted' => $fileinfo['deleted'])
-            : array();
-
-        $log_messages[] = array_merge(array(
-            'rev' => $val,
-            'msg' => Chora::formatLogMessage($clog->queryLog()),
-            'author' => Chora::showAuthorName($clog->queryAuthor(), true),
-            'branchinfo' => $clog->queryBranch(),
-            'date' => Chora::formatDate($clog->queryDate()),
-            'tags' => Chora::getTags($clog, $where),
-        ), $stats);
+        $log_messages[] = $clog;
     }
 }
 
@@ -93,7 +81,7 @@ if (substr($mime_type, 0, 6) == 'image/') {
     echo "<tr><td><img src=\"$url1\" alt=\"" . htmlspecialchars($r1) . '" /></td>' .
         "<td><img src=\"$url2\" alt=\"" . htmlspecialchars($r2) . '" /></td></tr>';
 } else {
-    $view = $injector->createInstance('Horde_View_Base');
+    $view = $injector->createInstance('Horde_View');
     $view->addHelper('Chora_Diff_Helper');
     echo $view->diff($VC->diff($fl, $r1, $r2, array('human' => true, 'num' => $num, 'ws' => $ws)));
     echo $view->diffCaption();
index 2ebe29d..a5005d5 100644 (file)
 </div>
 
 <?php if (!empty($log_messages)): ?>
-<h3 class="revision_log"><?php echo _("Log Message") ?></h3>
-<div class="revision_log">
-<?php foreach ($log_messages as $val): ?>
- <div class="difflog">
-  <ul class="revision striped">
-   <?php if (!empty($val['author'])): ?><li><?php echo _("Author:") ?> <?php echo $val['author'] ?></li><?php endif; ?>
-   <?php if (!empty($val['date'])): ?><li><?php echo _("Date:") ?> <?php echo $val['date'] ?></li><?php endif; ?>
-<?php if (!empty($val['branchinfo'])): ?>
-   <li><?php echo _("Branch:") ?>
-<?php foreach ($val['branchinfo'] as $branchname): ?>
-    <strong><a href="<?php echo Chora::url('browsefile', $where, array('onb' => $branchname)) ?>"><?php echo $branchname ?></a></strong>
-<?php endforeach; ?>
-   </li>
-<?php endif; ?>
-   <?php if (!empty($val['tags'])): ?><li class="tags"><?php echo _("Tags:") ?> <?php echo implode(', ', $val['tags']) ?></li><?php endif; ?>
-   <?php if (isset($val['added'])): ?><li><?php echo _("Changes:") ?> <span class="diffadd">+<?php echo htmlspecialchars($val['added']) ?></span>, <span class="diffdel">-<?php echo htmlspecialchars($val['deleted']) ?></span> <?php echo _("lines") ?></li><?php endif; ?>
-  </ul>
-  <a href="<?php echo Chora::url('co', $where, array('r' => $val['rev'])) ?>" title="<?php echo htmlspecialchars($val['rev']) ?>"><?php echo htmlspecialchars($VC->abbrev($val['rev'])) ?></a>: <?php echo $val['msg'] ?>
-  <div class="diffclear"></div>
- </div>
-<?php endforeach; ?>
+<div class="commitList">
+<?php
+$view = $injector->createInstance('Horde_View');
+echo $view->renderPartial('app/views/logMessage', array('collection' => $log_messages));
+?>
 </div>
 <?php endif; ?>
index cbbd1b9..ffd4342 100644 (file)
@@ -75,11 +75,6 @@ table.history a {
 }
 
 /* Individual revision information. */
-div.revision_log {
-    margin: 2px 5px 8px 0;
-    border: 1px solid #ddd;
-    padding: 3px;
-}
 ul.revision {
     padding: 2px;
     float: right;
@@ -91,7 +86,7 @@ ul.revision li.tags {
 }
 
 /* Labels. */
-h3.revision_log, h3.checkout, h3.file-view-header {
+h3.checkout, h3.file-view-header {
     background: #e9e9e9;
     display: inline;
     font-weight: bold;
@@ -174,9 +169,41 @@ ul.singlepsfiles li {
     padding-bottom: 4px;
 }
 
+.commit-list h3 {
+    font-size: 130%;
+    font-weight: bold;
+    margin-top: 1em;
+}
+.commit-summary {
+    border: 1px solid #ccc;
+    background: #eee;
+    padding: .5em;
+    font-size: 100%;
+    margin: .2em 0;
+}
+.commit-message {
+    font-size: 110%;
+    margin-bottom: .5em;
+}
+.commit-info {
+    width: 33%;
+    float: right;
+    border-left: 1px solid #ccc;
+    padding: 0 1em 1em 1em;
+    font-family: Menlo,Consolas,"Lucida Console","DejaVu Sans Mono",monospace;
+    font-size: 90%;
+}
+.commit-info ul {
+    list-style: none;
+    margin-bottom: .5em;
+}
+.commit-author {
+    font-size: 90%;
+}
+
 /* Diff stat information. */
 .diffadd {
-    color: blue;
+    color: green;
 }
 .diffdel {
     color: red;
@@ -292,15 +319,6 @@ div.diff-right {
     vertical-align: baseline;
 }
 
-div.difflog {
-    padding: 2px;
-    margin: 0;
-    border: 1px solid #ddd;
-}
-div.diffclear {
-    clear: both;
-}
-
 /* Browsefile definitions. */
 td.browseLocation em {
     display: block;
index bd2b91c..e2a85ab 100644 (file)
@@ -26,12 +26,12 @@ table.headerbar td.text {
     border-bottom: 5px solid #cfc;
 }
 
-div.revision_log, h3.revision_log, h3.checkout, #revlog tr.hover, #revlog tr:hover, div.checkout, table.hrdiff, table.history, p.history {
+h3.checkout, #revlog tr.hover, #revlog tr:hover, div.checkout, table.hrdiff, table.history, p.history {
     margin-left: 0;
     margin-right: 0;
     border-color: #cfc;
 }
-h3.revision_log, h3.checkout {
+h3.checkout {
     background: #cfc;
     color: #063;
     font-size: 100%;
index 80c67ce..193804d 100644 (file)
@@ -1,3 +1,3 @@
-div.revision_log, div.checkout {
+div.checkout {
     background: #fff;
 }