JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
first entry in page history links to actual page
authorJason Woofenden <jason@jasonwoof.com>
Wed, 21 Jun 2017 03:03:36 +0000 (23:03 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Wed, 21 Jun 2017 03:03:36 +0000 (23:03 -0400)
admin_pages.html
admin_pages.php

index 26c7f18..798cdcb 100644 (file)
 
                <h2>Edit history for page "~title html~"</h2>
 
 
                <h2>Edit history for page "~title html~"</h2>
 
-               <table cellspacing="0" cellpadding="4" border="0" summary="" class="evenodd">
-                       <tr>
-                               <th>title</th>
-                               <th>at</th>
-                               <th>by</th>
-                               <th></th>
-                       </tr>
-                       <!--~rows {~-->
+               <!--~rows once_else {~-->
+                       <p>There are no archived versions of this page.</p>
+               <!--~}~-->
+               <!--~rows once_if {~-->
+                       <table cellspacing="0" cellpadding="4" border="0" summary="" class="evenodd">
                                <tr>
                                <tr>
-                                       <td>~title html~<!--~title empty {~--><em>(untitled)</em><!--~}~--></td>
-                                       <td class="timestamp">~timestamp~</td>
-                                       <td>~who html~</td>
-                                       <td>
-                                               <form style="display: inline-block" action="admin_pages"><input type="hidden" name="history_id" value="~history_id~"><input type="submit" value="view"></form>
-                                       </td>
+                                       <th>title</th>
+                                       <th>at</th>
+                                       <th>by</th>
+                                       <th></th>
                                </tr>
                                </tr>
-                       <!--~}~-->
-               </table>
+                               <!--~rows {~-->
+                                       <tr>
+                                               <td>~title html~<!--~title empty {~--><em>(untitled)</em><!--~}~--></td>
+                                               <td class="timestamp">~timestamp~</td>
+                                               <td>~who html~</td>
+                                               <td>
+                                                       <!--~first {~-->
+                                                               <!--~filename nonempty {~-->
+                                                                       <form style="display: inline-block" action="~filename attr~"><input type="submit" value="view"></form>
+                                                               <!--~}~-->
+                                                               <!--~filename empty {~-->
+                                                                       <form style="display: inline-block" action="admin_pages"><input type="hidden" name="id" value="~page_id~"><input type="submit" value="view"></form>
+                                                               <!--~}~-->
+                                                       <!--~}~-->
+                                                       <!--~first unset {~-->
+                                                               <form style="display: inline-block" action="admin_pages"><input type="hidden" name="history_id" value="~history_id~"><input type="submit" value="view"></form>
+                                                       <!--~}~-->
+                                               </td>
+                                       </tr>
+                               <!--~}~-->
+                       </table>
+               <!--~}~-->
        <!--~}~-->
 <!--~}~-->
 </body>
        <!--~}~-->
 <!--~}~-->
 </body>
index 06aa3ea..910acef 100644 (file)
@@ -140,10 +140,14 @@ function admin_pages_main_listing() {
 function admin_pages_main_page_history ($id) {
        $data = array();
 
 function admin_pages_main_page_history ($id) {
        $data = array();
 
-       $rows = db_get_assocs('history_cms_pages left join users on history_cms_pages.history_user_id = users.id', 'history_cms_pages.id as page_id,history_cms_pages.history_id,coalesce(nullif(history_cms_pages.nav_title,""), history_cms_pages.title) as title,history_when as timestamp,coalesce(nullif(users.name,""), users.username) as who', 'where history_cms_pages.id=%i order by history_id desc', $id);
+       $rows = db_get_assocs('history_cms_pages left join users on history_cms_pages.history_user_id = users.id', 'history_cms_pages.id as page_id,history_cms_pages.history_id,history_cms_pages.filename,coalesce(nullif(history_cms_pages.nav_title,""), history_cms_pages.title) as title,history_when as timestamp,coalesce(nullif(users.name,""), users.username) as who', 'where history_cms_pages.id=%i order by history_id desc', $id);
        if (count($rows) !== 0) {
        if (count($rows) !== 0) {
-               $data['rows'] = $rows;
                $data['title'] = $rows[0]['title'];
                $data['title'] = $rows[0]['title'];
+               $rows[0]['first'] = true;
+               if ($rows[0]['filename'] === 'index') {
+                       $rows[0]['filename'] = './';
+               }
+               $data['rows'] = $rows;
        }
        tem_set('page_history', $data);
 }
        }
        tem_set('page_history', $data);
 }