Wordpress 2.0.2
[autoinstalls/wordpress.git] / wp-admin / edit-form-advanced.php
1 <?php
2 $messages[1] = __('Post updated');
3 $messages[2] = __('Custom field updated');
4 $messages[3] = __('Custom field deleted.');
5 ?>
6 <?php if (isset($_GET['message'])) : ?>
7 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
8 <?php endif; ?>
9
10 <form name="post" action="post.php" method="post" id="post">
11 <?php if ( (isset($mode) && 'bookmarklet' == $mode) || 
12             isset($_GET['popupurl']) ): ?>
13 <input type="hidden" name="mode" value="bookmarklet" />
14 <?php endif; ?>
15
16 <div class="wrap">
17 <h2 id="write-post"><?php _e('Write Post'); ?><?php if ( 0 != $post_ID ) : ?>
18  <small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small><?php endif; ?></h2>
19 <?php
20
21 if (0 == $post_ID) {
22         $form_action = 'post';
23         $temp_ID = -1 * time();
24         $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
25 } else {
26         $form_action = 'editpost';
27         $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
28 }
29
30 $form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />';
31
32 $form_prevstatus = '<input type="hidden" name="prev_status" value="' . $post->post_status . '" />';
33
34 $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $post->to_ping) .'" />';
35
36 if ('' != $post->pinged) {
37         $pings = '<p>'. __('Already pinged:') . '</p><ul>';
38         $already_pinged = explode("\n", trim($post->pinged));
39         foreach ($already_pinged as $pinged_url) {
40                 $pings .= "\n\t<li>$pinged_url</li>";
41         }
42         $pings .= '</ul>';
43 }
44
45 $saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />';
46
47 if (empty($post->post_status)) $post->post_status = 'draft';
48
49 ?>
50
51 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
52 <input type="hidden" name="action" value="<?php echo $form_action ?>" />
53 <input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
54
55 <?php echo $form_extra ?>
56 <?php if (isset($_GET['message']) && 2 > $_GET['message']) : ?>
57 <script type="text/javascript">
58 function focusit() {
59         // focus on first input field
60         document.post.title.focus();
61 }
62 addLoadEvent(focusit);
63 </script>
64 <?php endif; ?>
65 <div id="poststuff">
66
67 <div id="moremeta">
68 <div id="grabit" class="dbx-group">
69
70 <fieldset id="commentstatusdiv" class="dbx-box">
71 <h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
72 <div class="dbx-content">
73 <input name="advanced_view" type="hidden" value="1" />
74 <label for="comment_status" class="selectit">
75 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
76 <?php _e('Allow Comments') ?></label> 
77 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
78 </div>
79 </fieldset>
80
81 <fieldset id="passworddiv" class="dbx-box">
82 <h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3> 
83 <div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
84 </fieldset>
85
86 <fieldset id="slugdiv" class="dbx-box">
87 <h3 class="dbx-handle"><?php _e('Post slug') ?></h3> 
88 <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
89 </fieldset>
90
91 <fieldset id="categorydiv" class="dbx-box">
92 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
93 <div class="dbx-content">
94 <p id="jaxcat"></p>
95 <div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></div>
96 </fieldset>
97
98 <fieldset class="dbx-box">
99 <h3 class="dbx-handle"><?php _e('Post Status') ?></h3> 
100 <div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?>
101 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
102 <?php endif; ?>
103           <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
104           <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
105 </fieldset>
106
107 <?php if ( current_user_can('edit_posts') ) : ?>
108 <fieldset class="dbx-box">
109 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?>:</h3>
110 <div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
111 </fieldset>
112 <?php endif; ?>
113
114 <?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
115 <fieldset id="authordiv" class="dbx-box">
116 <h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3>
117 <div class="dbx-content">
118 <select name="post_author_override" id="post_author_override">
119 <?php 
120 foreach ($authors as $o) :
121 $o = get_userdata( $o->ID );
122 if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
123 else $selected = '';
124 echo "<option value='$o->ID' $selected>$o->display_name</option>";
125 endforeach;
126 ?>
127 </select>
128 </div>
129 </fieldset>
130 <?php endif; ?>
131
132 <?php do_action('dbx_post_sidebar'); ?>
133
134 </div>
135 </div>
136
137 <fieldset id="titlediv">
138   <legend><?php _e('Title') ?></legend> 
139   <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
140 </fieldset>
141
142 <fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
143 <legend><?php _e('Post') ?></legend>
144
145 <?php
146  $rows = get_settings('default_post_edit_rows');
147  if (($rows < 3) || ($rows > 100)) {
148      $rows = 12;
149  }
150 ?>
151 <?php the_quicktags(); ?>
152
153 <div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div>
154 </fieldset>
155
156 <script type="text/javascript">
157 <!--
158 edCanvas = document.getElementById('content');
159 <?php if ( user_can_richedit() ) : ?>
160 // This code is meant to allow tabbing from Title to Post (TinyMCE).
161 if ( tinyMCE.isMSIE )
162         document.getElementById('title').onkeydown = function (e)
163                 {
164                         e = e ? e : window.event;
165                         if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
166                                 var i = tinyMCE.selectedInstance;
167                                 if(typeof i ==  'undefined')
168                                         return true;
169                                 tinyMCE.execCommand("mceStartTyping");
170                                 this.blur();
171                                 i.contentWindow.focus();
172                                 e.returnValue = false;
173                                 return false;
174                         }
175                 }
176 else
177         document.getElementById('title').onkeypress = function (e)
178                 {
179                         e = e ? e : window.event;
180                         if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
181                                 var i = tinyMCE.selectedInstance;
182                                 if(typeof i ==  'undefined')
183                                         return true;
184                                 tinyMCE.execCommand("mceStartTyping");
185                                 this.blur();
186                                 i.contentWindow.focus();
187                                 e.returnValue = false;
188                                 return false;
189                         }
190                 }
191 <?php endif; ?>
192 //-->
193 </script>
194
195 <?php echo $form_pingback ?>
196 <?php echo $form_prevstatus ?>
197
198
199 <p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" /> 
200 <?php 
201 if ('publish' != $post->post_status || 0 == $post_ID) {
202 ?>
203 <?php if ( current_user_can('publish_posts') ) : ?>
204         <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 
205 <?php endif; ?>
206 <?php
207 }
208 ?>
209 <input name="referredby" type="hidden" id="referredby" value="<?php 
210 if ( !empty($_REQUEST['popupurl']) )
211         echo wp_specialchars($_REQUEST['popupurl']);
212 else if ( url_to_postid($_SERVER['HTTP_REFERER']) == $post_ID )
213         echo 'redo';
214 else
215         echo wp_specialchars($_SERVER['HTTP_REFERER']);
216 ?>" /></p>
217
218 <?php do_action('edit_form_advanced'); ?>
219
220 <?php
221 if (current_user_can('upload_files')) {
222         $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
223         $uploading_iframe_src = "inline-uploading.php?action=view&amp;post=$uploading_iframe_ID";
224         $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
225         if ( false != $uploading_iframe_src )
226                 echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
227 }
228 ?>
229
230 <div id="advancedstuff" class="dbx-group" >
231
232 <fieldset id="postexcerpt" class="dbx-box">
233 <h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
234 <div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
235 </fieldset>
236
237 <fieldset class="dbx-box">
238 <h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
239 <div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
240 <?php 
241 if ( ! empty($pings) )
242         echo $pings;
243 ?>
244 </div>
245 </fieldset>
246
247 <fieldset id="postcustom" class="dbx-box">
248 <h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
249 <div id="postcustomstuff" class="dbx-content">
250 <?php 
251 if($metadata = has_meta($post_ID)) {
252 ?>
253 <?php
254         list_meta($metadata); 
255 ?>
256 <?php
257 }
258         meta_form();
259 ?>
260 </div>
261 </fieldset>
262
263 <?php do_action('dbx_post_advanced'); ?>
264
265 </div>
266
267 <?php if ('edit' == $action) : ?>
268 <input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), addslashes($post->post_title) ) . "')\""; ?> />
269 <?php endif; ?>
270
271 </div>
272
273 </div>
274
275 </form>