]> git.mjollnir.org Git - s9y.git/commitdiff
Remove 'View' option for drafted entries in the 'Edit entries' section and replace...
authorgarvinhicking <garvinhicking>
Sun, 14 Jan 2007 16:06:03 +0000 (16:06 +0000)
committergarvinhicking <garvinhicking>
Sun, 14 Jan 2007 16:06:03 +0000 (16:06 +0000)
docs/NEWS
include/admin/entries.inc.php

index 3431dae5eecc368fd1be786cb0f2336c19abe07f..82dc87a28f79fdef72b878d42356106eefec51a4 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 1.2 ()
 ------------------------------------------------------------------------
 
+    * Remove "View" option for drafted entries in the "Edit entries"
+      section and replace with a "Preview" option. (garvinhicking)
+
     * Make spamblock plugin be more verbose in moderation-queue emails.
       RFE #1626712 (garvinhicking)
 
index 38627878ea31e844663778301d691b77cff9f24e..17b5407fd78bcf2ab01b684e460e030d4c61849f 100644 (file)
@@ -274,12 +274,17 @@ function serendipity_drawList() {
                     }
                     echo implode(', ', $cats);
                 }
-                $entry['link']      = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
+                $entry['link']         = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
+                $entry['preview_link'] = '?serendipity[noBanner]=true&amp;serendipity[noSidebar]=true&amp;serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=preview&amp;serendipity[id]=' . $entry['id'];
                 ?>
 
                         </td>
                         <td align="right">
+                            <?php if (serendipity_db_bool($entry['isdraft'])) { ?>
+                            <a target="_blank" href="<?php echo $entry['preview_link']; ?>" title="<?php echo PREVIEW . ' #' . $entry['id']; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo PREVIEW; ?>" /><?php echo PREVIEW ?></a>
+                            <?php } else { ?>
                             <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>
+                            <?php } ?>
                             <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="?<?php echo serendipity_setFormToken('url'); ?>&amp;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>
                             <input type="checkbox" name="serendipity[multiDelete][]" value="<?php echo $entry['id']; ?>" />
@@ -345,20 +350,29 @@ if (!empty($serendipity['GET']['editSubmit'])) {
     $serendipity['GET']['adminAction'] = 'edit';
 }
 
+$preview_only = false;
+
 switch($serendipity['GET']['adminAction']) {
+    case 'preview':
+        $entry        = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
+        $serendipity['POST']['preview'] = true;
+        $preview_only = true;
+
     case 'save':
-        $entry = array(
-                   'id'                 => $serendipity['POST']['id'],
-                   'title'              => $serendipity['POST']['title'],
-                   'timestamp'          => $serendipity['POST']['timestamp'],
-                   'body'               => $serendipity['POST']['body'],
-                   'extended'           => $serendipity['POST']['extended'],
-                   'categories'         => $serendipity['POST']['categories'],
-                   'isdraft'            => $serendipity['POST']['isdraft'],
-                   'allow_comments'     => $serendipity['POST']['allow_comments'],
-                   'moderate_comments'  => $serendipity['POST']['moderate_comments'],
-                   'exflag'             => (!empty($serendipity['POST']['extended']) ? true : false)
-        );
+        if (!$preview_only) {
+            $entry = array(
+                       'id'                 => $serendipity['POST']['id'],
+                       'title'              => $serendipity['POST']['title'],
+                       'timestamp'          => $serendipity['POST']['timestamp'],
+                       'body'               => $serendipity['POST']['body'],
+                       'extended'           => $serendipity['POST']['extended'],
+                       'categories'         => $serendipity['POST']['categories'],
+                       'isdraft'            => $serendipity['POST']['isdraft'],
+                       'allow_comments'     => $serendipity['POST']['allow_comments'],
+                       'moderate_comments'  => $serendipity['POST']['moderate_comments'],
+                       'exflag'             => (!empty($serendipity['POST']['extended']) ? true : false)
+            );
+        }
 
         if ($entry['allow_comments'] != 'true' && $entry['allow_comments'] !== true) {
             $entry['allow_comments'] = 'false';
@@ -464,18 +478,20 @@ switch($serendipity['GET']['adminAction']) {
             $entry['id'] = $serendipity['lastSavedEntry'];
         }
 
-        include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
-        serendipity_printEntryForm(
-            '?',
-            array(
-              'serendipity[action]'      => 'admin',
-              'serendipity[adminModule]' => 'entries',
-              'serendipity[adminAction]' => 'save',
-              'serendipity[timestamp]'   => $entry['timestamp']
-            ),
-
-            $entry
-        );
+        if (!$preview_only) {
+            include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
+            serendipity_printEntryForm(
+                '?',
+                array(
+                  'serendipity[action]'      => 'admin',
+                  'serendipity[adminModule]' => 'entries',
+                  'serendipity[adminAction]' => 'save',
+                  'serendipity[timestamp]'   => $entry['timestamp']
+                ),
+
+                $entry
+            );
+        }
 
         break;