Wordpress 2.3.2-scripts
[autoinstalls/wordpress.git] / wp-admin / edit-form-advanced.php
1 <?php
2 if ( isset($_GET['message']) )
3         $_GET['message'] = (int) $_GET['message'];
4 $messages[1] = __('Post updated');
5 $messages[2] = __('Custom field updated');
6 $messages[3] = __('Custom field deleted.');
7 ?>
8 <?php if (isset($_GET['message'])) : ?>
9 <div id="message" class="updated fade"><p><?php echo wp_specialchars($messages[$_GET['message']]); ?></p></div>
10 <?php endif; ?>
11
12 <form name="post" action="post.php" method="post" id="post">
13 <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
14 <input type="hidden" name="mode" value="bookmarklet" />
15 <?php endif; ?>
16
17 <div class="wrap">
18 <?php
19
20 if (0 == $post_ID) {
21         $form_action = 'post';
22         $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
23         $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
24         wp_nonce_field('add-post');
25 } else {
26         $post_ID = (int) $post_ID;
27         $form_action = 'editpost';
28         $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
29         wp_nonce_field('update-post_' .  $post_ID);
30 }
31
32 $form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
33
34 $form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
35
36 $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
37
38 if ('' != $post->pinged) {
39         $pings = '<p>'. __('Already pinged:') . '</p><ul>';
40         $already_pinged = explode("\n", trim($post->pinged));
41         foreach ($already_pinged as $pinged_url) {
42                 $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
43         }
44         $pings .= '</ul>';
45 }
46
47 $saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
48
49 if (empty($post->post_status)) $post->post_status = 'draft';
50
51 ?>
52
53 <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
54 <input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
55 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
56 <input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
57 <input type="hidden" id="post_type" name="post_type" value="post" />
58
59 <?php echo $form_extra ?>
60 <?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
61 <script type="text/javascript">
62 function focusit() {
63         // focus on first input field
64         document.post.title.focus();
65 }
66 addLoadEvent(focusit);
67 </script>
68 <?php endif; ?>
69 <div id="poststuff">
70
71 <div id="moremeta">
72 <div id="grabit" class="dbx-group">
73
74 <fieldset id="categorydiv" class="dbx-box">
75 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
76 <div class="dbx-content">
77 <p id="jaxcat"></p>
78 <ul id="categorychecklist"><?php dropdown_categories(); ?></ul></div>
79 </fieldset>
80
81 <fieldset id="commentstatusdiv" class="dbx-box">
82 <h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
83 <div class="dbx-content">
84 <input name="advanced_view" type="hidden" value="1" />
85 <label for="comment_status" class="selectit">
86 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
87 <?php _e('Allow Comments') ?></label>
88 <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>
89 </div>
90 </fieldset>
91
92 <fieldset id="passworddiv" class="dbx-box">
93 <h3 class="dbx-handle"><?php _e('Post Password') ?></h3>
94 <div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div>
95 </fieldset>
96
97 <fieldset id="slugdiv" class="dbx-box">
98 <h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>
99 <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div>
100 </fieldset>
101
102 <fieldset id="poststatusdiv" class="dbx-box">
103 <h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
104 <div class="dbx-content">
105 <?php if ( current_user_can('publish_posts') ) : ?>
106         <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'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
107 <?php endif; ?>
108         <label for="post_status_pending" class="selectit"><input id="post_status_pending" name="post_status" type="radio" value="pending" <?php checked($post->post_status, 'pending'); ?> /> <?php _e('Pending Review') ?></label>
109           <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>
110           <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>
111 </fieldset>
112
113 <?php if ( current_user_can('edit_posts') ) : ?>
114 <fieldset id="posttimestampdiv" class="dbx-box">
115 <h3 class="dbx-handle"><?php _e('Post Timestamp'); ?></h3>
116 <div class="dbx-content"><?php touch_time(($action == 'edit')); ?></div>
117 </fieldset>
118 <?php endif; ?>
119
120 <?php
121 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
122 if ( $post->post_author && !in_array($post->post_author, $authors) )
123         $authors[] = $post->post_author;
124 if ( $authors && count( $authors ) > 1 ) :
125 ?>
126 <fieldset id="authordiv" class="dbx-box">
127 <h3 class="dbx-handle"><?php _e('Post Author'); ?></h3>
128 <div class="dbx-content">
129 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
130 </div>
131 </fieldset>
132 <?php endif; ?>
133
134 <?php do_action('dbx_post_sidebar'); ?>
135
136 </div>
137 </div>
138
139 <fieldset id="titlediv">
140         <legend><?php _e('Title') ?></legend>
141         <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /></div>
142 </fieldset>
143
144 <fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
145 <legend><?php _e('Post') ?>
146
147 <?php if ( 'publish' == $post->post_status ) { ?>
148 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" class="view-link" target="_blank"><?php _e('View &raquo;'); ?></a>
149 <?php } elseif ( 'edit' == $action ) { ?>
150 <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" class="view-link" target="_blank"><?php _e('Preview &raquo;'); ?></a>
151 <?php } ?>
152 </legend>
153
154         <?php the_editor($post->post_content); ?>
155 </fieldset>
156
157 <?php echo $form_pingback ?>
158 <?php echo $form_prevstatus ?>
159
160 <fieldset id="tagdiv">
161         <legend><?php _e('Tags (separate multiple tags with commas: cats, pet food, dogs)'); ?></legend>
162         <div><input type="text" name="tags_input" class="tags-input" id="tags-input" size="30" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></div>
163 </fieldset>
164
165 <p class="submit">
166 <span id="autosave"></span>
167 <?php echo $saveasdraft; ?>
168 <input type="submit" name="submit" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
169 <?php
170 if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
171 ?>
172 <?php if ( current_user_can('publish_posts') ) : ?>
173         <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
174 <?php else : ?>
175         <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
176 <?php endif; ?>
177 <?php
178 }
179 ?>
180 <input name="referredby" type="hidden" id="referredby" value="<?php
181 if ( !empty($_REQUEST['popupurl']) )
182         echo clean_url(stripslashes($_REQUEST['popupurl']));
183 else if ( url_to_postid(wp_get_referer()) == $post_ID )
184         echo 'redo';
185 else
186         echo clean_url(stripslashes(wp_get_referer()));
187 ?>" /></p>
188
189 <?php do_action('edit_form_advanced'); ?>
190
191 <?php
192 if (current_user_can('upload_files')) {
193         $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
194         $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading');
195         $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
196         if ( false != $uploading_iframe_src )
197                 echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
198 }
199 ?>
200
201 <div id="advancedstuff" class="dbx-group" >
202
203 <div class="dbx-b-ox-wrapper">
204 <fieldset id="postexcerpt" class="dbx-box">
205 <div class="dbx-h-andle-wrapper">
206 <h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
207 </div>
208 <div class="dbx-c-ontent-wrapper">
209 <div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
210 </div>
211 </fieldset>
212 </div>
213
214 <div class="dbx-b-ox-wrapper">
215 <fieldset id="trackbacksdiv" class="dbx-box">
216 <div class="dbx-h-andle-wrapper">
217 <h3 class="dbx-handle"><?php _e('Trackbacks') ?></h3>
218 </div>
219 <div class="dbx-c-ontent-wrapper">
220 <div class="dbx-content"><?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?> (<?php _e('Separate multiple URLs with spaces'); ?>)
221 <?php
222 if ( ! empty($pings) )
223         echo $pings;
224 ?>
225 </div>
226 </div>
227 </fieldset>
228 </div>
229
230 <div class="dbx-b-ox-wrapper">
231 <fieldset id="postcustom" class="dbx-box">
232 <div class="dbx-h-andle-wrapper">
233 <h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
234 </div>
235 <div class="dbx-c-ontent-wrapper">
236 <div id="postcustomstuff" class="dbx-content">
237 <table cellpadding="3">
238 <?php
239 $metadata = has_meta($post_ID);
240 list_meta($metadata);
241 ?>
242
243 </table>
244 <?php
245         meta_form();
246 ?>
247 <div id="ajax-response"></div>
248 </div>
249 </div>
250 </fieldset>
251 </div>
252
253 <?php do_action('dbx_post_advanced'); ?>
254
255 </div>
256
257 <?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
258 <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
259 <?php endif; ?>
260
261 </div>
262
263 </div>
264
265 </form>