add cms, add todo
[ssproject1617.git] / testcms-final-anon / system / admin / theme / posts / edit.php
1
2 <h1>Editing &ldquo;<?php echo truncate($article->title, 4); ?>&rdquo;</h1>
3
4 <?php echo Notifications::read(); ?>
5
6 <section class="content">
7 <nav class="tabs">
8 <ul>
9 <li><a href="#post">Post</a></li>
10 <li><a href="#customise">Customise</a></li>
11 <li><a href="#fields">Custom Fields</a></li>
12 <li>
13 <a href="#comments">Comments
14 <?php if($pending > 0): ?>
15 <span title="You have <?php echo $pending; ?> comments"><?php echo $pending; ?></span>
16 <?php endif; ?>
17 </a>
18 </li>
19 </ul>
20 </nav>
21 <form method="post" action="<?php echo Url::current(); ?>" novalidate>
22
23 <div data-tab="post" class="tab">
24
25 <fieldset>
26 <p>
27 <label for="title">Title:</label>
28 <input id="title" name="title" value="<?php echo Input::post('title', $article->title); ?>">
29
30 <em>Your post&rsquo;s title.</em>
31 </p>
32
33 <p>
34 <label for="slug">Slug:</label>
35 <input type="url" id="slug" autocomplete="off" name="slug" value="<?php echo Input::post('slug', $article->slug); ?>">
36
37 <em>The slug for your post (<code id="output">slug</code>).</em>
38 </p>
39
40 <p>
41 <label for="description">Description:</label>
42 <textarea id="description" name="description"><?php echo Input::post('description', $article->description); ?></textarea>
43
44 <em>A brief outline of what your post is about. Used in the post introduction, RSS feed, and <code>&lt;meta name="description" /&gt;</code>.</em>
45 </p>
46
47 <p>
48 <label for="html">Content:</label>
49 <textarea id="html" name="html"><?php echo Input::post('html', $article->html); ?></textarea>
50
51 <em>Your post's main content. Enjoys a healthy dose of valid HTML.</em>
52 </p>
53
54 <p>
55 <label>Status:</label>
56 <select id="status" name="status">
57 <?php foreach(array('draft', 'archived', 'published') as $status): ?>
58 <?php $selected = (Input::post('status', $article->status) == $status) ? ' selected' : ''; ?>
59 <option value="<?php echo $status; ?>"<?php echo $selected; ?>>
60 <?php echo ucwords($status); ?>
61 </option>
62 <?php endforeach; ?>
63 </select>
64
65 <em>Statuses: live (published), pending (draft), or hidden (archived).</em>
66 </p>
67
68 <p>
69 <label for="comments">Allow Comments:</label>
70 <input id="comments" name="comments" type="checkbox" value="1"<?php if(Input::post('comments', $article->comments)) echo ' checked'; ?>>
71 <em>This will allow users to comment on your posts.</em>
72 </p>
73 </fieldset>
74
75 </div>
76 <div data-tab="customise" class="tab">
77
78 <fieldset>
79 <legend>Customise</legend>
80 <em>Here, you can customise your posts. This section is optional.</em>
81
82 <p>
83 <label for="css">Custom CSS:</label>
84 <textarea id="css" name="css"><?php echo Input::post('css', $article->css); ?></textarea>
85
86 <em>Custom CSS. Will be wrapped in a <code>&lt;style&gt;</code> block.</em>
87 </p>
88
89 <p>
90 <label for="js">Custom JS:</label>
91 <textarea id="js" name="js"><?php echo Input::post('js', $article->js); ?></textarea>
92
93 <em>Custom Javascript. Will be wrapped in a <code>&lt;script&gt;</code> block.</em>
94 </p>
95 </fieldset>
96
97 </div>
98 <div data-tab="fields" class="tab">
99
100 <fieldset>
101 <legend>Custom fields</legend>
102 <em>Create custom fields here.</em>
103
104 <div id="fields">
105 <!-- Re-Populate data -->
106 <?php foreach(parse_fields($article->custom_fields) as $key => $data): ?>
107 <p>
108 <label><?php echo $data['label']; ?></label>
109 <input name="field[<?php echo $key; ?>:<?php echo $data['label']; ?>]" value="<?php echo $data['value']; ?>">
110 </p>
111 <?php endforeach; ?>
112
113 <!-- Re-Populate post data -->
114 <?php foreach(Input::post('field', array()) as $data => $value): ?>
115 <?php list($key, $label) = explode(':', $data); ?>
116 <p>
117 <label><?php echo $label; ?></label>
118 <input name="field[<?php echo $key; ?>:<?php echo $label; ?>]" value="<?php echo $value; ?>">
119 </p>
120 <?php endforeach; ?>
121 </div>
122
123
124 <button id="create" type="button">Create a custom field</button>
125 </fieldset>
126
127 </div>
128 <div data-tab="comments" class="tab">
129
130 <fieldset>
131 <legend>Comments</legend>
132 <em>Here, you can moderate your comments.</em>
133
134 <?php if(count($comments)): ?>
135 <ul id="comments">
136 <?php foreach($comments as $comment):?>
137 <li data-id="<?php echo $comment->id; ?>">
138 <header>
139 <p><strong><?php echo $comment->name; ?></strong>
140 <?php echo date(Config::get('metadata.date_format'), $comment->date); ?><br>
141 <em>Status: <span data-status="<?php echo $comment->id; ?>"><?php echo $comment->status; ?></span></em></p>
142 </header>
143
144 <p class="comment" data-text="<?php echo $comment->id; ?>"><?php echo $comment->text; ?></p>
145
146 <ul class="options">
147 <?php if($comment->status == 'pending'): ?>
148 <li><a href="#publish">Publish</a></li>
149 <?php endif; ?>
150 <li><a href="#edit">Edit</a></li>
151 <li><a href="#delete">Delete</a></li>
152 </ul>
153 </li>
154 <?php endforeach; ?>
155 </ul>
156 <?php else: ?>
157 <p>No comments yet.</p>
158 <?php endif; ?>
159 </fieldset>
160
161 </div>
162
163 <p class="buttons">
164 <button name="save" type="submit">Save</button>
165 <button name="delete" type="submit">Delete</button>
166 <a href="<?php echo admin_url('posts'); ?>">Return to posts</a>
167 </p>
168
169 </form>
170 </section>
171
172 <aside id="sidebar">
173 <h2>Editing</h2>
174 <em>Some useful links.</em>
175 <ul>
176 <li><a href="<?php echo Url::make($page->slug . '/' . $article->slug); ?>">View this post on your site</a></li>
177 </ul>
178 </aside>
179
180 <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script>
181 <script>window.MooTools || document.write('<script src="<?php echo theme_url('assets/js/mootools.js'); ?>"><\/script>');</script>
182 <script src="<?php echo theme_url('assets/js/helpers.js'); ?>"></script>
183 <script src="<?php echo theme_url('assets/js/popup.js'); ?>"></script>
184 <script src="<?php echo theme_url('assets/js/custom_fields.js'); ?>"></script>
185 <script src="<?php echo theme_url('assets/js/comments.js'); ?>"></script>
186 <script src="<?php echo theme_url('assets/js/tabs.js'); ?>"></script>
187 <script>
188 (function() {
189 var slug = $('slug'), output = $('output');
190
191 // call the function to init the input text
192 formatSlug(slug, output);
193
194 // bind to input
195 slug.addEvent('keyup', function() {formatSlug(slug, output)});
196 }());
197 </script>