Make WordPress Core

Ticket #2633: 2633.diff

File 2633.diff, 10.1 KB (added by mdawaffe, 20 years ago)

Display a link to the newly added list item.

  • wp-admin/custom-fields.js

     
    11addLoadEvent(customFieldsAddIn);
    22function customFieldsAddIn() {
     3        theList.showLink=0;
    34        if (!theList.theList) return false;
    45        inputs = theList.theList.getElementsByTagName('input');
    56        for ( var i=0; i < inputs.length; i++ ) {
     
    1415
    1516        document.getElementById('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta", customFieldsOnComplete);', e); };
    1617        document.getElementById('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta", customFieldsOnComplete);', e); };
    17         theList.clearInputs.push('metakeyselect','metakeyinput','metavalue');
    1818}
    1919function customFieldsOnComplete() {
    2020        var pidEl = document.getElementById('post_ID');
  • wp-admin/wp-admin.css

     
    627627        width: 170px;
    628628}
    629629
    630 #templateside h3, #postcustom p {
     630#templateside h3, #postcustom p.submit {
    631631        margin: 0;
    632632}
    633633
     
    968968        margin: 0;
    969969        padding: 0;
    970970}
     971#ajax-response.alignleft {
     972        margin-left: 2em;
     973}
  • wp-admin/edit-link-form.php

     
    4040<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
    4141<div class="dbx-content">
    4242<p id="jaxcat"></p>
    43 <div id="categorychecklist"><?php dropdown_categories(get_settings('default_link_category')); ?></div></div>
     43<ul id="categorychecklist"><?php dropdown_categories(get_settings('default_link_category')); ?></ul>
     44</div>
    4445</fieldset>
    4546
    4647<fieldset class="dbx-box">
     
    250251<?php endif; ?>
    251252</div>
    252253</form>
    253 </div>
    254  No newline at end of file
     254</div>
  • wp-admin/categories.js

     
    22function newCategoryAddIn() {
    33        if (!theList.theList) return false;
    44        document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); };
    5         theList.clearInputs.push('cat_name','category_parent','category_description');
    65}
  • wp-admin/cat-js.php

     
    22require_once('../wp-config.php');
    33header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
    44?>
    5 addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.clearInputs.push('newcat');catList.topAdder=1;catList.alt=0});
     5addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});
    66addLoadEvent(newCatAddIn);
    77function newCatAddIn() {
    88        if ( !document.getElementById('jaxcat') ) return false;
  • wp-admin/list-manipulation-js.php

     
    77function dimSomething(what,id,dimClass){return theList.ajaxDimmer(what,id,dimClass);}
    88
    99function WPAjax(file, responseEl){//class WPAjax extends sack
    10         this.getResponseElement=function(r){var p=document.getElementById(r+'-p');if(!p){p=document.createElement('span');p.id=r+'ajax-response-p';document.getElementById(r).appendChild(p);}this.myResponseElement=p; }
     10        this.getResponseElement=function(r){var p=document.getElementById(r+'-p');if(!p){p=document.createElement('span');p.id=r+'-p';document.getElementById(r).appendChild(p);}this.myResponseElement=p;      }
    1111        this.parseAjaxResponse=function(){
    12                 if(isNaN(this.response)){this.myResponseElement.innerHTML='<div class="error">'+this.response+'</div>';return false;}
     12                if(isNaN(this.response)){this.myResponseElement.innerHTML='<div class="error"><p>'+this.response+'</p></div>';return false;}
    1313                this.response=parseInt(this.response,10);
    14                 if(-1==this.response){this.myResponseElement.innerHTML="<?php _e("You don't have permission to do that."); ?>";return false;}
    15                 else if(0==this.response){this.myResponseElement.innerHTML="<?php _e("Something odd happened. Try refreshing the page? Either that or what you tried to change never existed in the first place."); ?>";return false;}
     14                if(-1==this.response){this.myResponseElement.innerHTML="<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>";return false;}
     15                else if(0==this.response){this.myResponseElement.innerHTML="<div class='error'><p><?php _e("Something odd happened. Try refreshing the page? Either that or what you tried to change never existed in the first place."); ?></p></div>";return false;}
    1616                return true;
    1717        }
    1818        this.parseAjaxResponseXML=function(){
    1919                if(this.responseXML&&typeof this.responseXML=='object')return true;
    20                 if(isNaN(this.response)){this.myResponseElement.innerHTML='<div class="error">'+this.response+'</div>';return false;}
     20                if(isNaN(this.response)){this.myResponseElement.innerHTML='<div class="error"><p>'+this.response+'</p></div>';return false;}
    2121                var r=parseInt(this.response,10);
    22                 if(-1==r){this.myResponseElement.innerHTML="<?php _e("You don't have permission to do that."); ?>";}
    23                 else if(0==r){this.myResponseElement.innerHTML="<?php _e("Invalid Entry."); ?>";}
     22                if(-1==r){this.myResponseElement.innerHTML="<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>";}
     23                else if(0==r){this.myResponseElement.innerHTML="<div class='error'><p><?php _e("Invalid Entry."); ?></p></div>";}
    2424                return false;
    2525        }
    2626        this.init(file,responseEl);
     
    3636function listMan(theListId){
    3737        this.theList=null;
    3838        this.ajaxRespEl=null;
    39         this.inputData='';this.clearInputs=new Array();
     39        this.inputData='';this.clearInputs=new Array();this.showLink=1;
    4040        this.topAdder=0;this.alt='alternate';this.recolorPos;this.reg_color='#FFFFFF';this.alt_color='#F1F1F1';
    4141        var listType;var listItems;
    4242        self.aTrap=0;
     
    5757                                if(exists)tempObj.replaceListItem(exists.id,getNodeValue(newItems[c],'newitem'),newItems.length,update);
    5858                                else tempObj.addListItem(getNodeValue(newItems[c],'newitem'),newItems.length);
    5959                        }}
    60                         this.myResponseElement.innerHTML='';tempObj.inputData='';
     60                        tempObj.inputData='';
     61                        if(tempObj.showLink){this.myResponseElement.innerHTML='<div id="jumplink" class="updated fade"><p><a href="#'+what+'-'+id+'"><?php _e('Jump to new item'); ?></a></p></div>';}
     62                        else this.myResponseElement.innerHTML='';
    6163                        for(var i=0;i<tempObj.clearInputs.length;i++){try{var theI=document.getElementById(tempObj.clearInputs[i]);if(theI.tagName.match(/select/i))theI.selectedIndex=0;else theI.value='';}catch(e){}}
    6264                        if(onComplete&&typeof onComplete=='function')onComplete();
    63                         tempObj.recolorList(tempObj.recolorPos,1000)
     65                        tempObj.recolorList(tempObj.recolorPos,1000);
    6466                }
    6567                this.ajaxAdd.runAJAX('action='+(update?'update-':'add-')+what+this.inputData);
    6668                return false;
     
    123125                        for(var i=0;i<inputs[a].length;i++){
    124126                                if('action'==inputs[a][i].name)continue;
    125127                                if('text'==inputs[a][i].type||'password'==inputs[a][i].type||'hidden'==inputs[a][i].type||inputs[a][i].tagName.match(/textarea/i)){
    126                                         this.inputData+='&'+inputs[a][i].name+'='+encodeURIComponent(inputs[a][i].value);
     128                                        this.inputData+='&'+inputs[a][i].name+'='+encodeURIComponent(inputs[a][i].value);if('hidden'!=inputs[a][i].type)this.clearInputs.push(inputs[a][i].id);
    127129                                }else if(inputs[a][i].tagName.match(/select/i)){
    128                                         this.inputData+='&'+inputs[a][i].name+'='+encodeURIComponent(inputs[a][i].options[inputs[a][i].selectedIndex].value);
     130                                        this.inputData+='&'+inputs[a][i].name+'='+encodeURIComponent(inputs[a][i].options[inputs[a][i].selectedIndex].value);this.clearInputs.push(inputs[a][i].id);
    129131                                }
    130132                        }       
    131133                }
  • wp-admin/users.js

     
    1616        var roleEl = document.getElementById('role');
    1717        var role = roleEl.options[roleEl.selectedIndex].value;
    1818        if ( !theUserLists['role-' + role] ) return true;
    19         theUserLists['role-' + role].clearInputs.push('user_login', 'first_name', 'last_name', 'email', 'url', 'pass1', 'pass2', 'role');
    2019        return theUserLists['role-' + role].ajaxAdder('user', 'adduser');
    2120}
  • wp-admin/categories.php

     
    147147        </tbody>
    148148</table>
    149149
    150 <div id="ajax-response"></div>
    151 
    152150</div>
    153151
    154152<?php if ( current_user_can('manage_categories') ) : ?>
     
    159157<div class="wrap">
    160158    <h2><?php _e('Add New Category') ?></h2>
    161159    <form name="addcat" id="addcat" action="categories.php" method="post">
    162        
    163         <p><?php _e('Name:') ?><br />
     160        <div class="alignleft"><?php _e('Name:') ?><br />
    164161        <input type="text" name="cat_name" id="cat_name" value="" /></p>
    165162        <p><?php _e('Category parent:') ?><br />
    166163        <select name='category_parent' id='category_parent' class='postform'>
    167164        <option value='0'><?php _e('None') ?></option>
    168165        <?php wp_dropdown_cats(0); ?>
    169         </select></p>
     166        </select>
     167        </div>
     168        <div id="ajax-response" class="alignleft"></div>
     169        <br class="clear" />
    170170        <p><?php _e('Description: (optional)') ?> <br />
    171171        <textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
    172172        <p class="submit"><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>