Make WordPress Core

Changeset 3660


Ignore:
Timestamp:
03/29/2006 01:51:55 AM (21 years ago)
Author:
ryan
Message:

AJAX, cause you love it. Props mdawaffe. fixes #2561

Location:
trunk
Files:
4 added
3 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-db.php

    r3570 r3660  
    175175
    176176        // Delete the category.
    177         $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
     177        if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") )
     178                return 0;
    178179
    179180        // Update children to point to new parent.
  • trunk/wp-admin/admin-functions.php

    r3653 r3660  
    603603function write_nested_categories($categories) {
    604604        foreach ($categories as $category) {
    605                 echo '<label for="category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label>\n";
    606 
    607                 if (isset ($category['children'])) {
    608                         echo "\n<span class='cat-nest'>\n";
     605                echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label></li>\n";
     606
     607                if ( $category['children'] ) {
     608                        echo "<ul>\n";
    609609                        write_nested_categories($category['children']);
    610                         echo "</span>\n";
     610                        echo "</ul>\n";
    611611                }
    612612        }
    … …  
    627627                foreach ($categories as $category) {
    628628                        if ($category->category_parent == $parent) {
    629                                 $category->cat_name = wp_specialchars($category->cat_name);
     629                                $category->cat_name = wp_specialchars($category->cat_name,'double');
    630630                                $pad = str_repeat('&#8212; ', $level);
    631631                                if ( current_user_can('manage_categories') ) {
    … …  
    635635
    636636                                        if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
    637                                                 $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts and bookmarks will go to the default categories.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
     637                                                $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts and bookmarks will go to the default categories.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), addslashes($category->cat_name))."' );\" class='delete'>".__('Delete')."</a>";
    638638                                        else
    639639                                                $edit .= "<td style='text-align:center'>".__("Default");
    … …  
    685685        <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
    686686    <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
    687     <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td>
     687    <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), addslashes(wp_specialchars(get_the_title(),'double')) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    688688  </tr>
    689689
    … …  
    829829        global $post_ID;
    830830        // Exit if no meta
    831         if (!$meta)
     831        if (!$meta) {
     832                echo '<tbody id="the-list"></tbody>'; //TBODY needed for list-manipulation JS
    832833                return;
     834        }
    833835        $count = 0;
    834836?>
    835 <table id='meta-list' cellpadding="3">
     837        <thead>
    836838        <tr>
    837839                <th><?php _e('Key') ?></th>
    … …  
    839841                <th colspan='2'><?php _e('Action') ?></th>
    840842        </tr>
     843        </thead>
    841844<?php
    842 
    843 
     845        $r ="\n\t<tbody id='the-list'>";
    844846        foreach ($meta as $entry) {
    845847                ++ $count;
    … …  
    850852                if ('_' == $entry['meta_key'] { 0 })
    851853                        $style .= ' hidden';
    852                 echo "
    853                         <tr class='$style'>
    854                                 <td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>
    855                                 <td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>
    856                                 <td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />
    857                                 <input name='deletemeta[{$entry['meta_id']}]' type='submit' class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>
    858                         </tr>
    859                 ";
    860         }
    861         echo "
    862                 </table>
    863         ";
     854                $key_js = addslashes(wp_specialchars( $entry['meta_key'], 'double' ));
     855                $entry['meta_key'] = wp_specialchars( $entry['meta_key'], true );
     856                $entry['meta_value'] = wp_specialchars( $entry['meta_value'], true );
     857                $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
     858                $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
     859                $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
     860                $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />";
     861                $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '";
     862                $r .= sprintf(__("You are about to delete the &quot;%s&quot; custom field on this post.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), $key_js);
     863                $r .= "' );\" class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>";
     864                $r .= "\n\t</tr>";
     865        }
     866        echo $r;
     867        echo "\n\t</tbody>";
    864868}
    865869
    … …  
    887891?>
    888892<h3><?php _e('Add a new custom field:') ?></h3>
    889 <table cellspacing="3" cellpadding="3">
     893<table id="newmeta" cellspacing="3" cellpadding="3">
    890894        <tr>
    891895<th colspan="2"><?php _e('Key') ?></th>
    … …  
    911915
    912916</table>
    913 <p class="submit"><input type="submit" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
     917<p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
    914918<?php
    915919
    … …  
    918922function add_meta($post_ID) {
    919923        global $wpdb;
     924        $post_ID = (int) $post_ID;
    920925
    921926        $metakeyselect = $wpdb->escape(stripslashes(trim($_POST['metakeyselect'])));
    … …  
    927932                // input for the key have data, the input takes precedence:
    928933
    929                 if ('#NONE#' != $metakeyselect)
     934                if ('#NONE#' != $metakeyselect)
    930935                        $metakey = $metakeyselect;
    931936
    … …  
    938943                                                VALUES ('$post_ID','$metakey','$metavalue')
    939944                                        ");
    940         }
     945                return $wpdb->insert_id;
     946        }
     947        return false;
    941948} // add_meta
    942949
    943950function delete_meta($mid) {
    944951        global $wpdb;
    945 
    946         $result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
     952        $mid = (int) $mid;
     953
     954        return $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
    947955}
    948956
    949957function update_meta($mid, $mkey, $mvalue) {
    950958        global $wpdb;
     959        $mid = (int) $mid;
    951960
    952961        return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
     962}
     963
     964function get_post_meta_by_id($mid) {
     965        global $wpdb;
     966        $mid = (int) $mid;
     967
     968        return $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'");
    953969}
    954970
  • trunk/wp-admin/admin-header.php

    r3570 r3660  
    44if ( $editing ) {
    55        $dbx_js = true;
    6         if ( current_user_can('manage_categories') )
     6        $pmeta_js = true;
     7        if ( current_user_can('manage_categories') ) {
     8                $list_js = true;
    79                $cat_js = true;
     10        }
    811}
    9 if ( $list_js || $cat_js )
     12if ( $list_js )
    1013        $sack_js = true;
    1114?>
    … …  
    3033<?php } ?>
    3134<?php if ( $list_js ) { ?>
    32 <script type="text/javascript" src="list-manipulation.js"></script>
     35<script type="text/javascript" src="list-manipulation-js.php"></script>
     36<?php } ?>
     37<?php if ( $pmeta_js ) { ?>
     38<script type="text/javascript" src="custom-fields.js"></script>
     39<?php } ?>
     40<?php if ( 'categories.php' == $pagenow && 'edit' != $action ) { ?>
     41<script type="text/javascript" src="categories.js"></script>
    3342<?php } ?>
    3443<?php if ( $dbx_js ) { ?>
  • trunk/wp-admin/admin.php

    r3607 r3660  
    4141}
    4242
    43 $xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
     43$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $pmeta_js = $editing = false;
    4444
    4545require(ABSPATH . '/wp-admin/menu.php');
  • trunk/wp-admin/cat-js.php

    r3645 r3660  
    33header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
    44?>
    5 var ajaxCat = new sack();
    6 var newcat;
    7  
     5addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.clearInputs.push('newcat');});
     6addLoadEvent(newCatAddIn);
    87function newCatAddIn() {
    98        if ( !document.getElementById('jaxcat') ) return false;
    … …  
    1716        newcat.size = '16';
    1817        newcat.setAttribute('autocomplete', 'off');
    19         newcat.onkeypress = ajaxNewCatKeyPress;
     18        newcat.onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','categorydiv');", e); };
    2019
    2120        var newcatSub = document.createElement('input');
    … …  
    2322        newcatSub.name = 'Button';
    2423        newcatSub.id = 'catadd';
    25         newcatSub.value = '<?php echo addslashes(__('Add')); ?>';
    26         newcatSub.onclick = ajaxNewCat;
     24        newcatSub.value = 'Add';
     25        newcatSub.onclick = function() { catList.ajaxAdder('category', 'categorydiv'); };
    2726
    2827        ajaxcat.appendChild(newcat);
    … …  
    3130
    3231        howto = document.createElement('span');
    33         howto.innerHTML = '<?php echo addslashes(__('Separate multiple categories with commas.')); ?>';
     32        howto.innerHTML = "<?php _e('Separate multiple categories with commas.'); ?>";
    3433        howto.id = 'howto';
    3534        ajaxcat.appendChild(howto);
    3635}
    37 
    38 addLoadEvent(newCatAddIn);
    39 
    40 function getResponseElement() {
    41         var p = document.getElementById('ajaxcatresponse');
    42         if (!p) {
    43                 p = document.createElement('span');
    44                 document.getElementById('jaxcat').appendChild(p);
    45                 p.id = 'ajaxcatresponse';
    46         }
    47         return p;
    48 }
    49 
    50 function newCatLoading() {
    51         var p = getResponseElement();
    52         p.innerHTML = '<?php echo addslashes(__('Sending Data...')); ?>';
    53 }
    54 
    55 function newCatLoaded() {
    56         var p = getResponseElement();
    57         p.innerHTML = '<?php echo addslashes(__('Data Sent...')); ?>';
    58 }
    59 
    60 function newCatInteractive() {
    61         var p = getResponseElement();
    62         p.innerHTML = '<?php echo addslashes(__('Processing Request...')); ?>';
    63 }
    64 
    65 function newCatCompletion() {
    66         var p = getResponseElement();
    67         var id    = 0;
    68         var ids   = new Array();
    69         var names = new Array();
    70 
    71         ids   = myPload( ajaxCat.response );
    72         names = myPload( newcat.value );
    73         for ( i = 0; i < ids.length; i++ ) {
    74                 id = ids[i].replace(/[\n\r]+/g, "");
    75                 if ( id == '-1' ) {
    76                         p.innerHTML = "<?php echo addslashes(__("You don't have permission to do that.")); ?>";
    77                         return;
    78                 }
    79                 if ( id == '0' ) {
    80                         p.innerHTML = "<?php echo addslashes(__('That category name is invalid.  Try something else.')); ?>";
    81                         return;
    82                 }
    83 
    84                 var exists = document.getElementById('category-' + id);
    85 
    86                 if (exists) {
    87                         var moveIt = exists.parentNode;
    88                         var container = moveIt.parentNode;
    89                         container.removeChild(moveIt);
    90                         container.insertBefore(moveIt, container.firstChild);
    91                         moveIt.id = 'new-category-' + id;
    92                         exists.checked = 'checked';
    93                         var nowClass = moveIt.className;
    94                         moveIt.className = nowClass + ' fade';
    95                         Fat.fade_all();
    96                         moveIt.className = nowClass;
    97                 } else {
    98                         var catDiv = document.getElementById('categorychecklist');
    99                         var newLabel = document.createElement('label');
    100                         newLabel.setAttribute('for', 'category-' + id);
    101                         newLabel.id = 'new-category-' + id;
    102                         newLabel.className = 'selectit fade';
    103 
    104                         var newCheck = document.createElement('input');
    105                         newCheck.type = 'checkbox';
    106                         newCheck.value = id;
    107                         newCheck.name = 'post_category[]';
    108                         newCheck.id = 'category-' + id;
    109                         newLabel.appendChild(newCheck);
    110 
    111                         var newLabelText = document.createTextNode(' ' + names[i]);
    112                         newLabel.appendChild(newLabelText);
    113 
    114                         catDiv.insertBefore(newLabel, catDiv.firstChild);
    115                         newCheck.checked = 'checked';
    116 
    117                         Fat.fade_all();
    118                         newLabel.className = 'selectit';
    119                 }
    120                 newcat.value = '';
    121         }
    122         p.parentNode.removeChild(p);
    123 //      var id = parseInt(ajaxCat.response, 10);
    124 }
    125 
    126 function ajaxNewCatKeyPress(e) {
    127         if (!e) {
    128                 if (window.event) {
    129                         e = window.event;
    130                 } else {
    131                         return;
    132                 }
    133         }
    134         if (e.keyCode == 13) {
    135                 ajaxNewCat();
    136                 e.returnValue = false;
    137                 e.cancelBubble = true;
    138                 return false;
    139         }
    140 }
    141 
    142 function ajaxNewCat() {
    143         var newcat = document.getElementById('newcat');
    144         var split_cats = new Array(1);
    145         var catString = '';
    146 
    147         catString = 'ajaxnewcat=' + encodeURIComponent(newcat.value);
    148         ajaxCat.requestFile = 'edit-form-ajax-cat.php';
    149         ajaxCat.method = 'GET';
    150         ajaxCat.onLoading = newCatLoading;
    151         ajaxCat.onLoaded = newCatLoaded;
    152         ajaxCat.onInteractive = newCatInteractive;
    153         ajaxCat.onCompletion = newCatCompletion;
    154         ajaxCat.runAJAX(catString);
    155 }
    156 
    157 function myPload( str ) {
    158         var fixedExplode = new Array();
    159         var comma = new String(',');
    160         var count = 0;
    161         var currentElement = '';
    162 
    163         for( x=0; x < str.length; x++) {
    164                 andy = str.charAt(x);
    165                 if ( comma.indexOf(andy) != -1 ) {
    166                         currentElement = currentElement.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // trim
    167                         fixedExplode[count] = currentElement;
    168                         currentElement = "";
    169                         count++;
    170                 } else {
    171                         currentElement += andy;
    172                 }
    173         }
    174 
    175         if ( currentElement != "" )
    176                 fixedExplode[count] = currentElement;
    177         return fixedExplode;
    178 }
  • trunk/wp-admin/categories.php

    r3585 r3660  
    44$title = __('Categories');
    55$parent_file = 'edit.php';
    6 $list_js = true;
    76
    87$wpvarstoreset = array('action','cat');
    … …  
    105104default:
    106105
     106$list_js = true;
    107107require_once ('admin-header.php');
    108108
    … …  
    122122        <h2><?php _e('Categories') ?> </h2>
    123123<?php endif; ?>
    124 <table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
     124<table width="100%" cellpadding="3" cellspacing="3">
     125        <thead>
    125126        <tr>
    126127                <th scope="col"><?php _e('ID') ?></th>
    … …  
    131132        <th colspan="2"><?php _e('Action') ?></th>
    132133        </tr>
     134        </thead>
     135        <tbody id="the-list">
    133136<?php
    134137cat_rows();
    135138?>
     139        </tbody>
    136140</table>
    137141
    … …  
    150154       
    151155        <p><?php _e('Name:') ?><br />
    152         <input type="text" name="cat_name" value="" /></p>
     156        <input type="text" name="cat_name" id="cat_name" value="" /></p>
    153157        <p><?php _e('Category parent:') ?><br />
    154         <select name='category_parent' class='postform'>
     158        <select name='category_parent' id='category_parent' class='postform'>
    155159        <option value='0'><?php _e('None') ?></option>
    156160        <?php wp_dropdown_cats(0); ?>
    157161        </select></p>
    158162        <p><?php _e('Description: (optional)') ?> <br />
    159         <textarea name="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
     163        <textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
    160164        <p class="submit"><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
    161165    </form>
  • trunk/wp-admin/edit-comments.php

    r3652 r3660  
    134134                </li>
    135135
    136 <?php } // end foreach ?>
     136<?php } // end foreach($comment) ?>
    137137</ol>
    138138
    … …  
    140140
    141141<?php
    142         } else {
     142        } else { //no comments to show
    143143
    144144                ?>
    … …  
    163163                foreach ($comments as $comment) {
    164164                $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
     165                $comment_status = wp_get_comment_status($comment->comment_ID);
    165166                $class = ('alternate' == $class) ? '' : 'alternate';
    166 ?>
    167   <tr class='<?php echo $class; ?>'>
     167                $class .= ('unapproved' == $comment_status) ? ' unapproved' : '';
     168?>
     169  <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
    168170    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
    169171    <td><?php comment_author_link() ?></td>
    … …  
    171173    <td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td>
    172174    <td><?php comment_excerpt(); ?></td>
    173     <td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td>
     175    <td>
     176        <?php if ('unapproved' == $comment_status) { ?>
     177                (Unapproved)
     178        <?php } else { ?>
     179                <a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a>
     180        <?php } ?>
     181    </td>
    174182    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    175183        echo "<a href='comment.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
    176184    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
    177             echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\"    class='delete'>" . __('Delete') . "</a>"; } ?></td>
     185                echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\" class='edit'>" . __('Delete') . "</a> ";
     186                } ?></td>
    178187  </tr>
    179188                <?php
    … …  
    184193                        <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p>
    185194  </form>
     195<div id="ajax-response"></div>
    186196<?php
    187197        } else {
  • trunk/wp-admin/edit-form-advanced.php

    r3651 r3660  
    2222        $form_action = 'post';
    2323        $temp_ID = -1 * time();
    24         $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
     24        $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
    2525} else {
    2626        $form_action = 'editpost';
    27         $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
     27        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
    2828}
    2929
    … …  
    5050
    5151<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
    52 <input type="hidden" name="action" value="<?php echo $form_action ?>" />
     52<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
    5353<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
    5454<input type="hidden" name="post_type" value="post" />
    … …  
    7373<div class="dbx-content">
    7474<p id="jaxcat"></p>
    75 <div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></div>
     75<ul id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></ul></div>
    7676</fieldset>
    7777
    … …  
    249249<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
    250250<div id="postcustomstuff" class="dbx-content">
    251 <?php
    252 if($metadata = has_meta($post_ID)) {
    253 ?>
    254 <?php
    255         list_meta($metadata);
    256 ?>
    257 <?php
    258 }
     251<table cellpadding="3">
     252<?php
     253$metadata = has_meta($post_ID);
     254list_meta($metadata);
     255?>
     256
     257</table>
     258<?php
    259259        meta_form();
    260260?>
     261<div id="ajax-response"></div>
    261262</div>
    262263</fieldset>
  • trunk/wp-admin/edit-page-form.php

    r3563 r3660  
    77        $form_action = 'post';
    88        $temp_ID = -1 * time();
    9         $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
     9        $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
    1010} else {
    1111        $form_action = 'editpost';
    12         $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
     12        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
    1313}
    1414
    … …  
    210210<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
    211211<div id="postcustomstuff" class="dbx-content">
     212<table cellpadding="3">
    212213<?php
    213 if($metadata = has_meta($post_ID)) {
    214 ?>
    215 <?php
    216         list_meta($metadata);
    217 ?>
    218 <?php
    219 }
     214$metadata = has_meta($post_ID);
     215list_meta($metadata);
     216?>
     217
     218</table>
     219<?php
    220220        meta_form();
    221221?>
  • trunk/wp-admin/edit-pages.php

    r3564 r3660  
    2929if ($posts) {
    3030?>
    31 <table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
    32   <tr>
    33     <th scope="col"><?php _e('ID') ?></th>
    34     <th scope="col"><?php _e('Title') ?></th>
     31<table width="100%" cellpadding="3" cellspacing="3">
     32  <thead>
     33  <tr>
     34    <th scope="col"><?php _e('ID') ?></th>
     35    <th scope="col"><?php _e('Title') ?></th>
    3536    <th scope="col"><?php _e('Owner') ?></th>
    3637        <th scope="col"><?php _e('Updated') ?></th>
    37         <th scope="col"></th>
    38     <th scope="col"></th>
    39     <th scope="col"></th>
    40   </tr>
     38        <th scope="col"></th>
     39    <th scope="col"></th>
     40    <th scope="col"></th>
     41  </tr>
     42  </thead>
     43  <tbody id="the-list">
    4144<?php
    4245page_rows(0, 0, $posts, $all);
    4346?>
    44 </table>
     47  </tbody>
     48</table>
    4549
    4650<div id="ajax-response"></div>
  • trunk/wp-admin/edit.php

    r3564 r3660  
    115115
    116116<?php
    117 
    118117// define the columns to display, the syntax is 'internal name' => 'display name'
    119118$posts_columns = array(
    … …  
    134133?>
    135134
    136 <table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
     135<table width="100%" cellpadding="3" cellspacing="3">
     136        <thead>
    137137        <tr>
    138138
    … …  
    142142
    143143        </tr>
     144        </thead>
     145        <tbody id="the-list">
    144146<?php
    145147if ($posts) {
    146148$bgcolor = '';
    147149foreach ($posts as $post) { start_wp();
     150add_filter('the_title','wp_specialchars');
    148151$class = ('alternate' == $class) ? '' : 'alternate';
    149152?>
    … …  
    208211        case 'control_delete':
    209212                ?>
    210                 <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
     213                <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), addslashes(wp_specialchars(get_the_title(),'double')) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
    211214                <?php
    212215                break;
    … …  
    230233<?php
    231234} // end if ($posts)
    232 ?>
     235?>
     236        </tbody>
    233237</table>
    234238
    … …  
    247251        ?>
    248252<h3><?php _e('Comments') ?></h3>
    249 <ol id="comments">
    250 <?php
     253<ol id="the-list">
     254<?php
     255$i = 0;
    251256foreach ($comments as $comment) {
    252 $comment_status = wp_get_comment_status($comment->comment_ID);
     257$class = ( ++$i % 2 ) ? array('alternate') : array();
     258if ( 'unapproved' == $comment_status = wp_get_comment_status($comment->comment_ID) )
     259        $class[] = 'unapproved';
    253260?>
    254261
    255 <li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
     262<li id='comment-<?php echo $comment->comment_ID; ?>'<?php if ( $class ) echo " class='" . join(' ', $class) . "'"; ?>>
    256263  <?php comment_date('Y-n-j') ?>
    257264  @
    … …  
    259266  <?php
    260267                        if ( current_user_can('edit_post', $post->ID) ) {
    261                                 echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" .  __('Edit') . "</a>";
    262                                 echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
     268                                echo "[ <a href='post.php?action=editcomment&amp;comment=".$comment->comment_ID."\'>" .  __('Edit') . '</a>';
     269                                echo ' - <a href="post.php?action=deletecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars($comment->comment_author, 1)) . "' );\">" . __('Delete') . '</a> ';
    263270                                if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
    264                                         if ('approved' == wp_get_comment_status($comment->comment_ID)) {
    265                                                 echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
    266                                         } else {
    267                                                 echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Approve') . "</a> ";
    268                                         }
     271                                        echo '<span class="unapprove"> - <a href="comment.php?action=unapprovecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\' );">' . __('Unapprove') . '</a> </span>';
     272                                        echo '<span class="approve"> - <a href="comment.php?action=approvecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\' );">' . __('Approve') . '</a> </span>';
    269273                                }
    270274                                echo "]";
  • trunk/wp-admin/link-manager.php

    r3617 r3660  
    115115<input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
    116116<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
    117 <table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
     117<table width="100%" cellpadding="3" cellspacing="3">
     118        <thead>
    118119        <tr>
    119120                <th width="15%"><?php _e('Name') ?></th>
    … …  
    125126                <th><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
    126127        </tr>
     128        </thead>
     129        <tbody id="the-list">
    127130<?php
    128131if ( 'all' == $cat_id )
    … …  
    175178        }
    176179?>
     180        </tbody>
    177181</table>
    178182
  • trunk/wp-admin/post.php

    r3621 r3660  
    1818        }
    1919}
    20 
    2120if (isset($_POST['deletepost']))
    2221$action = "delete";
    2322
    2423switch($action) {
     24case 'postajaxpost':
    2525case 'post':
    2626        check_admin_referer();
    2727       
    28         $post_ID = write_post();
     28        $post_ID = 'post' == $action ? write_post() : edit_post();
    2929
    3030        // Redirect.
  • trunk/wp-admin/wp-admin.css

    r3570 r3660  
    9090fieldset legend {
    9191        padding: .1em .3em;
    92 }
    93 
    94 fieldset span.cat-nest {
    95         display: block;
    96         margin-left: 10px;
    9792}
    9893
    … …  
    325320.unapproved a:hover {
    326321        color: #009ef0;
     322}
     323
     324.approve {
     325        display: none;
     326}
     327
     328.unapproved .approve {
     329        display: inline;
     330}
     331
     332.unapproved .unapprove {
     333        display: none;
    327334}
    328335
    … …  
    805812}
    806813
    807 #categorydiv div div {
     814#categorydiv ul {
     815        list-style: none;
     816        padding: 0;
     817        margin-left:10px;
     818}
     819#categorychecklist {
    808820        height: 12em;
    809821        overflow: auto;
    810 }
    811 
     822        margin-top: 8px;
     823}
     824#categorychecklist li {
     825        margin: 0;
     826        padding: 0;
     827}
    812828#ajaxcat input {
    813829        border: 1px solid #ccc;
  • trunk/wp-includes/functions-formatting.php

    r3641 r3660  
    102102        $text = str_replace('<', '&lt;', $text);
    103103        $text = str_replace('>', '&gt;', $text);
    104         if ( $quotes ) {
     104        if ( 'double' === $quotes ) {
     105                $text = str_replace('"', '&quot;', $text);
     106        } elseif ( $quotes ) {
    105107                $text = str_replace('"', '&quot;', $text);
    106108                $text = str_replace("'", '&#039;', $text);
  • trunk/wp-includes/js/fat.js

    r3517 r3660  
    1212                return "#" + r + g + b;
    1313        },
    14         fade_all : function ()
     14        fade_all : function (dur)
    1515        {
    1616                var a = document.getElementsByTagName("*");
    … …  
    2222                        {
    2323                                if (!r[1]) r[1] = "";
    24                                 if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
     24                                if (o.id) Fat.fade_element(o.id,null,dur,"#"+r[1]);
    2525                        }
    2626                }
  • trunk/wp-includes/pluggable-functions.php

    r3566 r3660  
    235235                die(__('Sorry, you need to <a href="http://codex.wordpress.org/Enable_Sending_Referrers">enable sending referrers</a> for this feature to work.'));
    236236        do_action('check_admin_referer');
     237}
     238endif;
     239
     240if ( !function_exists('check_ajax_referer') ) :
     241function check_ajax_referer() {
     242        $cookie = explode(';', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
     243        foreach ( $cookie as $tasty ) {
     244                if ( false !== strpos($tasty, USER_COOKIE) )
     245                        $user = substr(strstr($tasty, '='), 1);
     246                if ( false !== strpos($tasty, PASS_COOKIE) )
     247                        $pass = substr(strstr($tasty, '='), 1);
     248        }
     249        if ( !wp_login( $user, $pass, true ) )
     250                die('-1');
     251        do_action('check_ajax_referer');
    237252}
    238253endif;
Note: See TracChangeset for help on using the changeset viewer.