Make WordPress Core

Changeset 3684


Ignore:
Timestamp:
04/04/2006 12:16:27 AM (20 years ago)
Author:
ryan
Message:

List manip improvements from mdawaffe. fixes #2633

Location:
trunk/wp-admin
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/cat-js.php

    r3669 r3684  
    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() {
  • trunk/wp-admin/categories.js

    r3660 r3684  
    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}
  • trunk/wp-admin/categories.php

    r3675 r3684  
    148148</table>
    149149
    150 <div id="ajax-response"></div>
    151 
    152150</div>
    153151
     
    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 />
     
    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>
  • trunk/wp-admin/custom-fields.js

    r3660 r3684  
    11addLoadEvent(customFieldsAddIn);
    22function customFieldsAddIn() {
     3    theList.showLink=0;
    34    if (!theList.theList) return false;
    45    inputs = theList.theList.getElementsByTagName('input');
     
    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() {
  • trunk/wp-admin/edit-link-form.php

    r3570 r3684  
    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
  • trunk/wp-admin/list-manipulation-js.php

    r3677 r3684  
    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    }
     
    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;
     
    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);
     
    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            }   
  • trunk/wp-admin/users.js

    r3680 r3684  
    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}
  • trunk/wp-admin/wp-admin.css

    r3660 r3684  
    628628}
    629629
    630 #templateside h3, #postcustom p {
     630#templateside h3, #postcustom p.submit {
    631631    margin: 0;
    632632}
     
    969969    padding: 0;
    970970}
     971#ajax-response.alignleft {
     972    margin-left: 2em;
     973}
Note: See TracChangeset for help on using the changeset viewer.