From: garvinhicking <garvinhicking>
Date: Sat, 18 Feb 2006 17:25:13 +0000 (+0000)
Subject: Added links to view an entry in reasonable places
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8f1e31f5c5f66c9615054c6f1b68ac5f23855bc9;p=s9y.git

Added links to view an entry in reasonable places
---

diff --git a/docs/NEWS b/docs/NEWS
index 9b9667c..b921a07 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 1.1-alpha1()
 ------------------------------------------------------------------------
 
+   * Added links to view an entry in reasonable places (comments / entry
+     overview) (garvinhicking)
+
    * Added on-the-fly synchronizing of the Serendipity media database
      with the file system (Marty, garvinhicking)
 
@@ -10,7 +13,7 @@ Version 1.1-alpha1()
 
    * Added config option for specifying number of entries in the RSS
      feed (garvinhicking)
-   
+
    * Added option whether to issue the "SET NAMES" mysql command
      (garvinhicking)
 
diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php
index 5807f5a..f467700 100644
--- a/include/admin/comments.inc.php
+++ b/include/admin/comments.inc.php
@@ -226,7 +226,7 @@ function highlightComment(id, checkvalue) {
     <tr>
         <td><?php echo COMMENTS; ?>:</td>
         <td><select name="serendipity[filter][perpage]">
-        <?php 
+        <?php
             $filter_vals = array(10, 20, 50, COMMENTS_FILTER_ALL);
             foreach($filter_vals AS $filter_val) { ?>
             <option value="<?php echo $filter_val; ?>" <?php echo ($commentsPerPage == $filter_val ? ' selected="selected"' : ''); ?>><?php echo $filter_val; ?></option>
@@ -302,6 +302,7 @@ foreach ($sql as $rs) {
         'entry_id'  => $rs['entry_id']
     );
 
+    $entrylink = serendipity_archiveURL($comment['entry_id'], 'comments', 'serendipityHTTPPath', true) . '#c' . $comment['id'];
     if (strlen($comment['fullBody']) > strlen($comment['summary']) ) {
         $comment['summary'] .= ' ...';
         $comment['excerpt'] = true;
@@ -314,7 +315,7 @@ foreach ($sql as $rs) {
 
         $comment['fullBody'] = $comment['summary'] = nl2br(htmlspecialchars($comment['fullBody']));
     }
-    
+
     serendipity_plugin_api::hook_event('backend_view_comment', $comment);
     $class = 'serendipity_admin_list_item_' . (($i % 2 == 0 ) ? 'even' : 'uneven');
     $header_class = ($comment['status'] == 'pending' ? 'serendipityAdminMsgNote' : '');
@@ -388,6 +389,7 @@ foreach ($sql as $rs) {
 <?php if ($comment['excerpt']) { ?>
           <a href="#c<?php echo $comment['id'] ?>" onclick="FT_toggle(<?php echo $comment['id'] ?>); return false;" title="<?php echo VIEW; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo VIEW; ?>" /><span id="<?php echo $comment['id'] ?>_text"><?php echo VIEW ?></span></a>
 <?php } ?>
+          <a target="_blank" href="<?php echo $entrylink; ?>" title="<?php echo VIEW; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo EDIT; ?>" /><?php echo VIEW ?></a>
           <a href="?serendipity[action]=admin&amp;serendipity[adminModule]=comments&amp;serendipity[adminAction]=edit&amp;serendipity[id]=<?php echo $comment['id'] ?>&amp;serendipity[entry_id]=<?php echo $comment['entry_id'] ?>&amp;<?php echo serendipity_setFormToken('url'); ?>" title="<?php echo EDIT; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/edit.png'); ?>" alt="<?php echo EDIT; ?>" /><?php echo EDIT ?></a>
           <a href="?serendipity[action]=admin&amp;serendipity[adminModule]=comments&amp;serendipity[adminAction]=delete&amp;serendipity[id]=<?php echo $comment['id'] ?>&amp;serendipity[entry_id]=<?php echo $comment['entry_id'] ?>&amp;<?php echo serendipity_setFormToken('url'); ?>" onclick='return confirm("<?php echo sprintf(COMMENT_DELETE_CONFIRM, $comment['id'], htmlspecialchars($comment['author'])) ?>")' title="<?php echo DELETE ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/delete.png'); ?>" alt="<?php echo DELETE; ?>" /><?php echo DELETE ?></a>
           <?php echo $comment['action_more']; ?>
diff --git a/include/admin/entries.inc.php b/include/admin/entries.inc.php
index 98546a3..0a6f7a4 100644
--- a/include/admin/entries.inc.php
+++ b/include/admin/entries.inc.php
@@ -208,7 +208,7 @@ function serendipity_drawList() {
 <?php
         // Print the entries
         $rows = 0;
-        foreach ( $entries as $entry ) {
+        foreach ($entries as $entry) {
             $rows++;
             // Find out if the entry has been modified later than 30 minutes after creation
             if ($entry['timestamp'] <= ($entry['last_modified'] - 60*30)) {
@@ -249,10 +249,12 @@ function serendipity_drawList() {
                     }
                     echo implode(', ', $cats);
                 }
+                $entry['link']      = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
                 ?>
 
                         </td>
                         <td align="right">
+                            <a target="_blank" href="<?php echo $entry['link']; ?>" title="<?php echo VIEW . ' #' . $entry['id']; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo VIEW; ?>" /><?php echo VIEW ?></a>
                             <a href="?serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=edit&amp;serendipity[id]=<?php echo $entry['id']; ?>" title="<?php echo EDIT . ' #' . $entry['id']; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/edit.png'); ?>" alt="<?php echo EDIT; ?>" /><?php echo EDIT ?></a>
                             <a href="?serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=delete&amp;serendipity[id]=<?php echo $entry['id']; ?>" title="<?php echo DELETE . ' #' . $entry['id']; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/delete.png'); ?>" alt="<?php echo DELETE; ?>" /><?php echo DELETE ?></a>
                         </td>
@@ -347,7 +349,7 @@ switch($serendipity['GET']['adminAction']) {
         // Save the entry, or just display a preview
         $use_legacy = true;
         serendipity_plugin_api::hook_event('backend_entry_iframe', $use_legacy);
-        
+
         if ($use_legacy) {
             if ($serendipity['POST']['preview'] != 'true') {
                 /* We don't need an iframe to save a draft */
@@ -368,15 +370,15 @@ switch($serendipity['GET']['adminAction']) {
                 if (!is_numeric($entry['timestamp'])) {
                     $entry['timestamp']  = time();
                 }
-    
+
                 if (!isset($entry['trackbacks']) || !$entry['trackbacks']) {
                     $entry['trackbacks'] = 0;
                 }
-    
+
                 if (!isset($entry['comments']) || !$entry['comments']) {
                     $entry['comments']   = 0;
                 }
-    
+
                 if (!isset($entry['realname']) || !$entry['realname']) {
                     if (!empty($serendipity['realname'])) {
                         $entry['realname']   = $serendipity['realname'];
@@ -384,7 +386,7 @@ switch($serendipity['GET']['adminAction']) {
                         $entry['realname']   = $serendipity['serendipityUser'];
                     }
                 }
-    
+
                 $categories = (array)$entry['categories'];
                 $entry['categories'] = array();
                 foreach ($categories as $catid) {
@@ -393,17 +395,17 @@ switch($serendipity['GET']['adminAction']) {
                     }
                     $entry['categories'][] = serendipity_fetchCategoryInfo($catid);
                 }
-    
+
                 if (count($entry['categories']) < 1) {
                     unset($entry['categories']);
                 }
-    
+
                 if (isset($entry['id'])) {
                     $serendipity['GET']['id'] = $entry['id'];
                 } else {
                     $serendipity['GET']['id'] = 1;
                 }
-    
+
                 if ($serendipity['use_iframe']) {
                     echo '<div class="serendipityAdminMsgSuccess">' . IFRAME_PREVIEW . '</div><br />';
                     serendipity_iframe_create('preview', $entry);
diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php
index 1ebecd7..9dcd0c9 100644
--- a/include/functions_config.inc.php
+++ b/include/functions_config.inc.php
@@ -571,7 +571,8 @@ function serendipity_iframe(&$entry, $mode = null, $use_smarty = true) {
                     // it needs to be stored with the new ID.
                     echo '<script type="text/javascript">parent.document.forms[\'serendipityEntry\'][\'serendipity[id]\'].value = "' . $serendipity['lastSavedEntry'] . '";</script>';
                 }
-                echo '<div class="serendipityAdminMsgSuccess">' . ENTRY_SAVED . '</div>';
+                $entrylink = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
+                echo '<div class="serendipityAdminMsgSuccess">' . ENTRY_SAVED . ' (<a href="' . $entrylink . '" target="_blank">' . VIEW . '</a>)</div>';
             }
             echo '<br style="clear: both" />';
 
@@ -1523,10 +1524,10 @@ function serendipity_ACL_SQL(&$cond, $append_category = false, $type = 'category
             $cond['joins'] .= " LEFT JOIN {$serendipity['dbPrefix']}category c
                                        ON ec.categoryid = c.categoryid";
         }
-        
+
         switch($type) {
             case 'directory':
-                $sql_artifact_column = 'i.path IS NULL OR 
+                $sql_artifact_column = 'i.path IS NULL OR
                                         acl_acc.groupid IS NULL';
                 $sql_artifact = 'AND acl_acc.artifact_index = i.path';
                 break;