Changeset 3684 for trunk/wp-admin/list-manipulation-js.php
- Timestamp:
- 04/04/2006 12:16:27 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/list-manipulation-js.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/list-manipulation-js.php
r3677 r3684 8 8 9 9 function 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; } 11 11 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;} 13 13 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;} 16 16 return true; 17 17 } 18 18 this.parseAjaxResponseXML=function(){ 19 19 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;} 21 21 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>";} 24 24 return false; 25 25 } … … 37 37 this.theList=null; 38 38 this.ajaxRespEl=null; 39 this.inputData='';this.clearInputs=new Array(); 39 this.inputData='';this.clearInputs=new Array();this.showLink=1; 40 40 this.topAdder=0;this.alt='alternate';this.recolorPos;this.reg_color='#FFFFFF';this.alt_color='#F1F1F1'; 41 41 var listType;var listItems; … … 58 58 else tempObj.addListItem(getNodeValue(newItems[c],'newitem'),newItems.length); 59 59 }} 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=''; 61 63 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){}} 62 64 if(onComplete&&typeof onComplete=='function')onComplete(); 63 tempObj.recolorList(tempObj.recolorPos,1000) 65 tempObj.recolorList(tempObj.recolorPos,1000); 64 66 } 65 67 this.ajaxAdd.runAJAX('action='+(update?'update-':'add-')+what+this.inputData); … … 124 126 if('action'==inputs[a][i].name)continue; 125 127 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); 127 129 }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); 129 131 } 130 132 }
Note: See TracChangeset
for help on using the changeset viewer.