Make WordPress Core

Changeset 658


Ignore:
Timestamp:
12/28/2003 11:44:05 AM (22 years ago)
Author:
saxmatt
Message:

New two-stage post process.Some HTML cleanup and general tweaking. Split edit form into several files.

Location:
trunk/wp-admin
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form.php

    r639 r658  
    1313}
    1414
    15 switch($action) {
    16     case 'post':
    17         $submitbutton_text = 'Blog this!';
    18         $toprow_title = 'New Post';
    19         $form_action = 'post';
    20         $form_extra = '';
    21         if ($use_pingback) {
    22             $form_pingback = '<input type="checkbox" class="checkbox" name="post_pingback" value="1" ';
    23             if ($post_pingback) $form_pingback .= 'checked="checked" ';
    24             $form_pingback .= 'tabindex="7" id="pingback" /> <label for="pingback"><strong>PingBack</strong> the <acronym title="Uniform Resource Locators">URL</acronym>s in this post</label> <a href="http://wordpress.org/docs/reference/post/#pingback" title="Help on Pingbacks">?</a><br />';
    25         } else {
    26             $form_pingback = '';
     15$submitbutton_text = 'Blog this!';
     16$toprow_title = 'New Post';
     17$form_action = 'post';
     18$form_extra = '';
     19if ($use_pingback) {
     20    $form_pingback = '<input type="checkbox" class="checkbox" name="post_pingback" value="1" ';
     21    if ($post_pingback) $form_pingback .= 'checked="checked" ';
     22    $form_pingback .= 'tabindex="7" id="pingback" /> <label for="pingback"><strong>PingBack</strong> the <acronym title="Uniform Resource Locators">URL</acronym>s in this post</label> <a href="http://wordpress.org/docs/reference/post/#pingback" title="Help on Pingbacks">?</a><br />';
     23} else {
     24    $form_pingback = '';
     25}
     26if ($use_trackback) {
     27    $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a>:</label> (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br />
     28    <input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" /></p>';
     29    if ('' != $pinged) {
     30        $form_trackback .= '<p>Already pinged:</p><ul>';
     31        $already_pinged = explode("\n", trim($pinged));
     32        foreach ($already_pinged as $pinged_url) {
     33            $form_trackback .= "\n\t<li>$pinged_url</li>";
    2734        }
    28         if ($use_trackback) {
    29             $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a>:</label> (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br />
    30             <input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" /></p>';
    31             if ('' != $pinged) {
    32                 $form_trackback .= '<p>Already pinged:</p><ul>';
    33                 $already_pinged = explode("\n", trim($pinged));
    34                 foreach ($already_pinged as $pinged_url) {
    35                     $form_trackback .= "\n\t<li>$pinged_url</li>";
    36                 }
    37                 $form_trackback .= '</ul>';
    38             }
    39         } else {
    40             $form_trackback = '';
    41         }
    42         $colspan = 3;
    43         $saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="Save and Continue Editing" />';
    44         break;
    45     case "edit":
    46         $submitbutton_text = 'Edit this!';
    47         $toprow_title = 'Editing Post #' . $postdata['ID'];
    48         $form_action = 'editpost';
    49         $form_extra = "' />\n<input type='hidden' name='post_ID' value='$post->ID";
    50         $colspan = 2;
    51         $form_pingback = '<input type="hidden" name="post_pingback" value="0" />';
    52         $form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
    53         if ($use_trackback) {
    54             $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a></label>
    55              (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br />
    56             <input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>';
    57             if ('' != $pinged) {
    58                 $form_trackback .= '<p>Already pinged:</p><ul>';
    59                 $already_pinged = explode("\n", trim($pinged));
    60                 foreach ($already_pinged as $pinged_url) {
    61                     $form_trackback .= "\n\t<li>$pinged_url</li>";
    62                 }
    63                 $form_trackback .= '</ul>';
    64             }
    65         } else {
    66             $form_trackback = '';
    67         }
    68         $saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="Save and Continue Editing" />';
    69         break;
    70     case "editcomment":
    71         $submitbutton_text = 'Edit this!';
    72         $toprow_title = 'Editing Comment # '.$commentdata['comment_ID'];
    73         $form_action = 'editedcomment';
    74         $form_extra = "' />\n<input type='hidden' name='comment_ID' value='$comment' />\n<input type='hidden' name='comment_post_ID' value='".$commentdata["comment_post_ID"];
    75         $colspan = 3;
    76         $form_pingback = '<input type="hidden" name="post_pingback" value="0" />';
    77         $form_trackback = '';
    78         break;
     35        $form_trackback .= '</ul>';
     36    }
     37} else {
     38    $form_trackback = '';
    7939}
     40$colspan = 3;
     41$saveasdraft = '';
     42
    8043
    8144?>
     
    8548<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
    8649
    87 <?php if ($action != 'editcomment') {
    88   // this is for everything but comment editing
    89 ?>
    9050<script type="text/javascript">
    9151<!--
     
    9757//-->
    9858</script>
    99 
     59<style media="screen" type="text/css">
     60#titlediv, #postpassworddiv {
     61    height: 3.5em;
     62}
     63</style>
    10064<div id="poststuff">
    10165    <fieldset id="titlediv">
     
    10872      <div><?php dropdown_categories($default_post_cat); ?></div>
    10973    </fieldset>
    110 
    111     <fieldset id="poststatusdiv">
    112       <legend><a href="http://wordpress.org/docs/reference/post/#post_status" title="Help on post status">Post Status</a></legend>
    113       <div><label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post_status, 'publish'); ?> /> Publish</label>
    114       <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post_status, 'draft'); ?> /> Draft</label>
    115       <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post_status, 'private'); ?> /> Private</label></div>
    116     </fieldset>
    117     <fieldset id="commentstatusdiv">
    118       <legend><a href="http://wordpress.org/docs/reference/post/#comments" title="Help on comment status">Comments</a></legend>
    119       <div><label for="comment_status_open" class="selectit"><input id="comment_status_open" name="comment_status" type="radio" value="open" <?php checked($comment_status, 'open'); ?> /> Open</label>
    120       <label for="comment_status_closed" class="selectit"><input id="comment_status_closed" name="comment_status" type="radio" value="closed" <?php checked($comment_status, 'closed'); ?> /> Closed</label></div>
    121     </fieldset>
    122     <fieldset id="pingstatusdiv">
    123       <legend><a href="http://wordpress.org/docs/reference/post/#pings" title="Help on ping status">Pings</a></legend>
    124       <div><label for="ping_status_open" class="selectit"><input id="ping_status_open" name="ping_status" type="radio" value="open" <?php checked($ping_status, 'open'); ?> /> Open</label>
    125       <label for="ping_status_closed" class="selectit"><input id="ping_status_closed" name="ping_status" type="radio" value="closed" <?php checked($ping_status, 'closed'); ?> /> Closed</label></div>
    126     </fieldset>
    12774    <fieldset id="postpassworddiv">
    12875      <legend><a href="http://wordpress.org/docs/reference/post/#post_password" title="Help on post password">Post Password</a></legend>
    129       <div><input name="post_password" type="text" size="18" id="post_password" value="<?php echo $post_password ?>" /></div>
     76      <div><input name="post_password" type="text" size="18" tabindex="3" id="post_password" value="<?php echo $post_password ?>" /></div>
    13077    </fieldset>
    13178
    132 <?php
    133 } else {
    134  
    135 // this is for comment editing
    136 ?>
    137 <script type="text/javascript">
    138 function focusit() {
    139     // focus on first input field
    140     document.post.name.focus();
    141 }
    142 window.onload = focusit;
    143 </script>
    144 <table>
    145     <tr>
    146     <td>
    147         <label for="name">Name:</label><br />
    148         <input type="text" name="newcomment_author" size="22" value="<?php echo format_to_edit($commentdata['comment_author']) ?>" tabindex="1" id="name" /></td>
    149     <td>
    150         <label for="email">E-mail:</label><br />
    151         <input type="text" name="newcomment_author_email" size="30" value="<?php echo format_to_edit($commentdata['comment_author_email']) ?>" tabindex="2" id="email" />
    152     </td>
    153     <td>
    154         <label for="URL">URL:</label><br />
    155         <input type="text" name="newcomment_author_url" size="35" value="<?php echo format_to_edit($commentdata['comment_author_url']) ?>" tabindex="3" id="URL" />
    156     </td>
    157     </tr>
    158 </table>
    159 <?php
    160  
    161 } // end else comment editing
    162 
    163 ?>
    164 
    165 <?php
    166 if ($action != 'editcomment') {
    167 ?>
    16879<br />
    16980<fieldset style="clear:both">
    170 <legend><a href="http://wordpress.org/docs/reference/post/#excerpt" title="Help with excerpts">Excerpt</a></legend>
    171 <div><textarea rows="2" cols="40" name="excerpt" tabindex="4" id="excerpt"><?php echo $excerpt ?></textarea></div>
    172 </fieldset>
    173 <?php
    174 } // if not a comment
    175 ?>
    176 <fieldset>
    177 <?php
    178 if ($action != 'editcomment') {
    179     echo '<legend><a href="http://wordpress.org/docs/reference/post/#post" title="Help with post field">Post</a></legend>';
    180 } else {
    181     echo '<legend>Comment</legend>';
    182 }
    183 ?>
     81<legend><a href="http://wordpress.org/docs/reference/post/#post" title="Help with post field">Post</a></legend>
    18482        <div id="quicktags">
    18583<?php
     
    207105//-->
    208106</script>
    209 <?php
    210 }
    211 if ($action != 'editcomment') {
    212     if (get_settings('use_geo_positions')) {
    213         if (empty($edited_lat)) {
    214             if (get_settings('use_default_geourl')) {
    215                 $edited_lat = get_settings('default_geourl_lat');
    216                 $edited_lon = get_settings('default_geourl_lon');
    217             }
    218         }
    219 ?>
    220 <label for="post_latf">Latitude:</label><input size="8" type="text" value="<?php echo $edited_lat; ?>" name="post_latf">&nbsp;
    221 <label for="post_lonf">Longitude:</label><input size="8" type="text" value="<?php echo $edited_lon; ?>" name="post_lonf">&nbsp; <a href="http://www.geourl.org/resources.html" rel="external" >click for Geo Info</a>
    222 <br>
    223 <?php
    224     }
    225 }
    226 ?>
     107<?php } ?>
    227108
    228109<?php echo $form_pingback ?>
    229110<?php echo $form_prevstatus ?>
    230111
    231 <p><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php echo $submitbutton_text ?>" style="font-weight: bold;" tabindex="6" />
     112<p><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
     113  <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="Save as Private" />
     114  <input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
     115  <input name="advanced" type="submit" id="advancededit" tabindex="7" value="Advanced Editing &raquo;" />
    232116  <input name="referredby" type="hidden" id="referredby" value="<?php echo $HTTP_SERVER_VARS['HTTP_REFERER']; ?>" />
    233117</p>
     
    235119
    236120<?php
    237 if ($action != 'editcomment') {
    238     if ( ($use_fileupload) && ($user_level >= $fileupload_minlevel)
    239          && (in_array($user_login, $allowed_users) || (trim($fileupload_allowedusers)=="")) ) { ?>
    240 <input type="button" value="upload a file/image" onclick="launchupload();" class="search"  tabindex="10" />
    241 <?php }
    242 }
    243121
    244122echo $form_trackback;
    245 
    246 // if the level is 5+, allow user to edit the timestamp - not on 'new post' screen though
    247 // if (($user_level > 4) && ($action != "post"))
    248 if ($user_level > 4) {
    249     touch_time(($action == 'edit'));
    250 }
    251 if ('edit' == $action) echo "
    252 <p><a href='post.php?action=delete&amp;post=$post->ID' onclick=\"return confirm('You are about to delete this post \'".addslashes($edited_post_title)."\'\\n  \'Cancel\' to stop, \'OK\' to delete.')\">Delete this post</a></p>";
    253123?>
    254124
  • trunk/wp-admin/link-manager.php

    r656 r658  
    341341      echo('            <option value="'.$r.'" ');
    342342      if ($link_rating == $r)
    343         echo('selected');
     343        echo 'selected="selected"';
    344344      echo('>'.$r.'</option>');
    345345    }
     
    469469</ul>
    470470<div class="wrap">
    471     <form name="cats" method="post">
     471    <form name="cats" method="post" action="">
    472472    <table width="75%" cellpadding="3" cellspacing="3">
    473473      <tr>
     
    487487    echo "          <option value=\"All\"";
    488488    if ($cat_id == 'All')
    489       echo " selected";
     489      echo " selected='selected'";
    490490    echo "> All</option>\n";
    491491    foreach ($results as $row) {
    492492      echo "          <option value=\"".$row->cat_id."\"";
    493493      if ($row->cat_id == $cat_id)
    494         echo " selected";
     494        echo " selected='selected'";
    495495        echo ">".$row->cat_id.": ".$row->cat_name;
    496496        if ($row->auto_toggle == 'Y')
     
    503503        <td>
    504504          <select name="order_by">
    505             <option value="order_id"     <?php if ($order_by == 'order_id')     echo " selected";?>>Id</option>
    506             <option value="order_name"   <?php if ($order_by == 'order_name')   echo " selected";?>>Name</option>
    507             <option value="order_url"    <?php if ($order_by == 'order_url')    echo " selected";?>>URL</option>
    508             <option value="order_desc"   <?php if ($order_by == 'order_desc')   echo " selected";?>>Description</option>
    509             <option value="order_owner"  <?php if ($order_by == 'order_owner')  echo " selected";?>>Owner</option>
    510             <option value="order_rating" <?php if ($order_by == 'order_rating') echo " selected";?>>Rating</option>
     505            <option value="order_id"     <?php if ($order_by == 'order_id')     echo " selected='selected'";?>>Link ID</option>
     506            <option value="order_name"   <?php if ($order_by == 'order_name')   echo " selected='selected'";?>>Name</option>
     507            <option value="order_url"    <?php if ($order_by == 'order_url')    echo " selected='selected'";?>>URI</option>
     508            <option value="order_desc"   <?php if ($order_by == 'order_desc')   echo " selected='selected'";?>>Description</option>
     509            <option value="order_owner"  <?php if ($order_by == 'order_owner')  echo " selected='selected'";?>>Owner</option>
     510            <option value="order_rating" <?php if ($order_by == 'order_rating') echo " selected='selected'";?>>Rating</option>
    511511          </select>
    512512        </td>
     
    522522<div class="wrap">
    523523
    524     <form name="links" id="links" method="post">
     524    <form name="links" id="links" method="post" action="">
    525525    <input type="hidden" name="link_id" value="" />
    526526    <input type="hidden" name="action" value="" />
     
    592592        <td><a href="link-manager.php?link_id=$link->link_id&amp;action=linkedit" class="edit">Edit</a></td>
    593593        <td><a href="link-manager.php?link_id=$link->link_id&amp;action=Delete" onclick="return confirm('You are about to delete this link.\\n  \'Cancel\' to stop, \'OK\' to delete.');" class="delete">Delete</a></td>
    594         <td><input type="checkbox" name="linkcheck[]" value="$link->link_id" /><td>
     594        <td><input type="checkbox" name="linkcheck[]" value="$link->link_id" /></td>
    595595LINKS;
    596596            } else {
     
    635635    </tr>
    636636</table>
    637 </form>
     637
    638638<?php
    639639  } // end if !popup
    640640?>
     641</form>
    641642</div>
    642643
  • trunk/wp-admin/post.php

    r639 r658  
    8585            $now = date('Y-m-d H:i:s', (time() + ($time_difference * 3600)));
    8686        }
    87        
    88         if ('' != $HTTP_POST_VARS['save']) $post_status = 'draft';
     87
     88        if (!empty($HTTP_POST_VARS['mode'])) {
     89        switch($HTTP_POST_VARS['mode']) {
     90            case 'bookmarklet':
     91                $location = 'bookmarklet.php?a=b';
     92                break;
     93            case 'sidebar':
     94                $location = 'sidebar.php?a=b';
     95                break;
     96            default:
     97                $location = 'post.php';
     98                break;
     99            }
     100        } else {
     101            $location = 'post.php';
     102        }
     103
     104        // What to do based on which button they pressed
     105        if ('' != $HTTP_POST_VARS['saveasdraft']) $post_status = 'draft';
     106        if ('' != $HTTP_POST_VARS['saveasprivate']) $post_status = 'private';
     107        if ('' != $HTTP_POST_VARS['publish']) $post_status = 'publish';
     108        if ('' != $HTTP_POST_VARS['advanced']) $post_status = 'draft';
     109
    89110
    90111        if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
     
    106127        $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
    107128
     129        if ('' != $HTTP_POST_VARS['advanced'])
     130            $location = "post.php?action=edit&post=$post_ID";
     131
     132
    108133        // Insert categories
    109134        // Check to make sure there is a category, if not just set it to some default
     
    127152        }
    128153
    129         if (!empty($HTTP_POST_VARS['mode'])) {
    130             switch($HTTP_POST_VARS['mode']) {
    131                 case 'bookmarklet':
    132                     $location = 'bookmarklet.php?a=b';
    133                     break;
    134                 case 'sidebar':
    135                     $location = 'sidebar.php?a=b';
    136                     break;
    137                 default:
    138                     $location = 'post.php';
    139                     break;
    140             }
    141         } else {
    142             $location = 'post.php';
    143         }
    144        
    145         if ('' != $HTTP_POST_VARS['save']) $location = "post.php?action=edit&post=$post_ID";
    146154       
    147155        header("Location: $location");
     
    210218            $pinged = $postdata['pinged'];
    211219
    212             include('edit-form.php');
     220            include('edit-form-advanced.php');
    213221        } else {
    214222?>
     
    262270        // Format trackbacks
    263271        $trackback = preg_replace('|\s+|', '\n', $trackback);
     272       
     273        if ('' != $HTTP_POST_VARS['publish']) $post_status = 'publish';
    264274
    265275        if (($user_level > 4) && (!empty($HTTP_POST_VARS['edit_date']))) {
     
    408418        $content = format_to_edit($content);
    409419
    410         include('edit-form.php');
     420        include('edit-form-comment.php');
    411421
    412422        break;
  • trunk/wp-admin/wp-admin.css

    r654 r658  
    302302}
    303303
    304 #titlediv, #poststatusdiv, #commentstatusdiv, #pingstatusdiv, #postpassworddiv {
     304#titlediv, #poststatusdiv, #commentstatusdiv, #pingstatusdiv, #postpassworddiv, #namediv, #uridiv, #emaildiv {
    305305    float: left;
    306306    height: 6em;
Note: See TracChangeset for help on using the changeset viewer.