JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
link to archived versions from page edit page
[wfpl-cms.git] / admin_pages.html
index e6630f5..638b630 100644 (file)
                                });
                        }
                });
-               function make_wysiwyg(name) {
+               function make_wysiwyg(name, bodyid_postfix) {
                        CKEDITOR.replace(name, {
                                'contentsCss': 'css.css?m=~css.css mtime~',
                                'allowedContent': true,
-                               bodyId: '~$basename~' + '_wysiwyg_' + name,
+                               bodyId: '~$basename~' + '_wysiwyg_' + (bodyid_postfix ? bodyid_postfix : name),
                                'stylesSet': [
                                        { name: 'Paragraph', element: 'p'},
                                        { name: 'Page Headline', element: 'h1'},
                                ]
                        });
                }
+               window.admin_pages_cur_layout = null
+               function admin_pages_layout(layout) {
+                       if (layout === undefined) {
+                               layout = document.getElementById('layout').value
+                       }
+                       if (typeof layout === 'string') {
+                               layout = parseInt(layout);
+                       }
+                       if (layout === window.admin_pages_cur_layout) {
+                               return;
+                       }
+                       // hide/show sidebar editor
+                       if (layout === 0) {
+                               document.getElementById('sidebar_editor').style.display = 'none'
+                       } else {
+                               document.getElementById('sidebar_editor').style.display = 'block'
+                       }
+                       // remove existing ckeditors
+                       if (window.admin_pages_cur_layout !== null) {
+                               for (name in CKEDITOR.instances) {
+                                       CKEDITOR.instances[name].destroy();
+                               }
+                       }
+                       // create ckeditors
+                       if (layout === 0) {
+                               make_wysiwyg('content', 'content_full_main');
+                       } else if (layout === 1) {
+                               make_wysiwyg('content', 'content_with_sidebar_main');
+                               make_wysiwyg('sidebar_content', 'content_with_sidebar_sidebar_plain');
+                       } else {
+                               make_wysiwyg('content', 'content_with_sidebar_main');
+                               make_wysiwyg('sidebar_content', 'content_with_sidebar_sidebar_bordered');
+                       }
+
+                       window.admin_pages_cur_layout = layout
+               }
        </script>
        <!--~}~-->
 
 
                <h2><!--~id unset {~-->Add a new page<!--~}~--><!--~id {~-->Edit page "~title html~"<!--~}~--></h2>
 
+               <!--~archived_versions {~-->
+                       <p><a href="admin_pages?history_page_id=~id~">View archived versions of this page</a></p>
+               <!--~}~-->
+
                <form action="admin_pages" method="post"><!--~id {~--><div style="display: none"><input type="hidden" name="edit_id" value="~id attr~"></div><!--~}~-->
 
                        <div class="caption">Title</div>
                        <div class="field_notes">(If you'd like this page to appear in the navigation with a shorter title.)</div>
                        <div class="field"><input type="text" name="nav_title" value="~nav_title attr~"></div>
 
+                       <div class="caption">Page Template/Layout</div>
+                       <div class="field"><select id="layout" name="layout" onchange="return admin_pages_layout()"><!--~layout options~--></select></div>
+
                        <div class="caption">Page Contents</div>
                        <div class="field_notes">
                                <ul class="first">
                                        <li>To insert an image: place the cursor at the beginning of a line and click the "insert image" button in the editor. Note that you will only be able to insert images that you have already uploaded on the <a href="admin_images" target="_blank">manage images</a> page.</li>
                                </ul>
                        </div>
-                       <div class="field"><textarea class="html_editor" rows="20" cols="50" id="content" name="content">~content html~</textarea><script>make_wysiwyg('content');</script></div>
+                       <div class="field"><textarea class="html_editor" rows="20" cols="50" id="content" name="content">~content html~</textarea></div>
+
+                       <div id="sidebar_editor" style="display: ~sidebar_editor_display~">
+                               <div class="caption">Sidebar Contents</div>
+                               <div class="field_notes">
+                                       <ul class="first">
+                                               <li>Ditto to the notes above "Page Contents" field.</li>
+                                               <li>Centered images appear smaller in this editor than on the real page.</li>
+                                               <li>Don't use the "Insert on Left" and "or Insert on Right" options for images inserting images in this sidebar.</li>
+                                       </ul>
+                               </div>
+                               <div class="field"><textarea class="html_editor" rows="20" cols="50" id="sidebar_content" name="sidebar_content">~sidebar_content html~</textarea></div>
+                       </div>
+
+                       <script>admin_pages_layout()</script>
 
                        <!--
                        <div class="caption">Description</div>
 
        <!--~listing {~-->
                <h1>~$host~ Admin Control Panel</h1>
+
                <h2>Manage Pages</h2>
 
-               <!--~rows once_if {~-->
-                       <p><a href="admin_pages?new=1">[Add a new page]</a></p>
+               <table cellspacing="0" cellpadding="4" border="0" summary="" class="evenodd">
+                       <tr>
+                               <td><em>(new)</em></td>
+                               <td>
+                                       <form style="display: inline-block" action="admin_pages"><input type="hidden" name="new" value="1"><input type="submit" value="create"></form>
+                               </td>
+                       </tr>
+                       <!--~no_home {~-->
+                               <tr>
+                                       <td><em>(home page)</em></td>
+                                       <td>
+                                               <form style="display: inline-block" action="admin_pages">
+                                                       <input type="hidden" name="new" value="1">
+                                                       <input type="hidden" name="new_filename" value="index">
+                                                       <input type="submit" value="create"></form>
+                                       </td>
+                               </tr>
+                       <!--~}~-->
+                       <!--~rows {~-->
+                       <tr>
+                               <td>~title html~<!--~title empty {~--><em>(untitled)</em><!--~}~--></td>
+                               <td>
+                                       <form style="display: inline-block" action="admin_pages"><input type="hidden" name="edit_id" value="~id~"><input type="submit" value="edit"></form>
+                                       <form style="display: inline-block" action="admin_pages"><input type="hidden" name="history_page_id" value="~id~"><input type="submit" value="history"></form>
+                                       <form style="display: inline-block" action="admin_pages" onsubmit="return confirm('Permanently delete?')"><input type="hidden" name="admin_pages_delete_id" value="~id~"><input type="submit" value="delete"></form>
+                               </td>
+                       </tr><!--~}~-->
+
+               </table>
+       <!--~}~-->
+       <!--~page_history {~-->
+               <h1>~$host~ Admin Control Panel</h1>
+
+               <h2>Edit history for page "~title html~"</h2>
 
+               <!--~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>
-                                       <th><a href="?sort=~sorting-by-filename~filename">Filename</a></th>
-                                       <th><a href="?sort=~sorting-by-title~title">Title</a></th>
-                                       <th>&nbsp;</th>
-                               </tr><!--~rows {~-->
-                               <tr>
-                                       <td class="listing"><a href="admin_pages?edit_id=~id~">~filename html~<!--~filename empty {~--><em>(offline)</em><!--~}~--></a></td>
-                                       <td class="listing"><a href="admin_pages?edit_id=~id~">~title html~<!--~title empty {~--><em>(untitled)</em><!--~}~--></a></td>
-                                       <td><a href="admin_pages?admin_pages_delete_id=~id~" onclick="return confirm('Permanently delete?')">[delete]</a></td>
-                               </tr><!--~}~-->
-
+                                       <th>title</th>
+                                       <th>at</th>
+                                       <th>by</th>
+                                       <th></th>
+                               </tr>
+                               <!--~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>
                <!--~}~-->
-               <!--~rows once_else {~-->
-                       <p>No pages in database.</p>
-               <!--~}~-->
-
-               <p><a href="admin_pages?new=1">[Add a new page]</a></p>
        <!--~}~-->
 <!--~}~-->
 </body>