Change number of comments awaiting moderation in menu when number changes. Props mdawaffe. fixes #2677

git-svn-id: http://svn.automattic.com/wordpress/trunk@3733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-04-21 04:54:01 +00:00
parent 1bdf7fb263
commit 3d4f3629d0
4 changed files with 22 additions and 17 deletions

View File

@ -43,6 +43,9 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el
<?php if ( $users_js ) { ?>
<script type="text/javascript" src="users.js"></script>
<?php } ?>
<?php if ( 'edit-comments.php' == $pagenow || ( 'edit.php' == $pagenow && 1 == $_GET['c'] ) ) { ?>
<script type="text/javascript" src="edit-comments.js"></script>
<?php } ?>
<?php if ( $dbx_js ) { ?>
<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
<script type="text/javascript">

View File

@ -1,6 +1,14 @@
function customFieldsOnComplete() {
var pidEl = document.getElementById('post_ID');
pidEl.name = 'post_ID';
pidEl.value = getNodeValue(theList.ajaxAdd.responseXML, 'postid');
var aEl = document.getElementById('hiddenaction')
if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
}
addLoadEvent(customFieldsAddIn);
function customFieldsAddIn() {
theList.showLink=0;
theList.addComplete = customFieldsOnComplete;
if (!theList.theList) return false;
inputs = theList.theList.getElementsByTagName('input');
for ( var i=0; i < inputs.length; i++ ) {
@ -13,13 +21,6 @@ function customFieldsAddIn() {
}
}
document.getElementById('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta", customFieldsOnComplete);', e); };
document.getElementById('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta", customFieldsOnComplete);', e); };
}
function customFieldsOnComplete() {
var pidEl = document.getElementById('post_ID');
pidEl.name = 'post_ID';
pidEl.value = getNodeValue(theList.ajaxAdd.responseXML, 'postid');
var aEl = document.getElementById('hiddenaction')
if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
document.getElementById('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
document.getElementById('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
}

View File

@ -38,10 +38,11 @@ function listMan(theListId){
this.ajaxRespEl=null;
this.inputData='';this.clearInputs=new Array();this.showLink=1;
this.topAdder=0;this.alt='alternate';this.recolorPos;this.reg_color='#FFFFFF';this.alt_color='#F1F1F1';
this.addComplete=null;this.delComplete=null;this.dimComplete=null;
var listType;var listItems;
self.aTrap=0;
this.ajaxAdder=function(what,where,onComplete,update){//for TR, server must wrap TR in TABLE TBODY. this.makeEl cleans it
this.ajaxAdder=function(what,where,update){//for TR, server must wrap TR in TABLE TBODY. this.makeEl cleans it
if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300);
this.ajaxAdd=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');
if(this.ajaxAdd.failed)return true;
@ -61,28 +62,28 @@ function listMan(theListId){
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>';}
else this.myResponseElement.innerHTML='';
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){}}
if(onComplete&&typeof onComplete=='function')onComplete();
if(tempObj.addComplete&&typeof tempObj.addComplete=='function')tempObj.addComplete(what,where,update);
tempObj.recolorList(tempObj.recolorPos,1000);
}
this.ajaxAdd.runAJAX('action='+(update?'update-':'add-')+what+this.inputData);
return false;
}
this.ajaxUpdater=function(what,where,onComplete){return this.ajaxAdder(what,where,onComplete,true);}
this.ajaxDelete=function(what,id,onComplete){
this.ajaxUpdater=function(what,where){return this.ajaxAdder(what,where,true);}
this.ajaxDelete=function(what,id){
if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300);
this.ajaxDel=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');
if(this.ajaxDel.failed)return true;
var tempObj=this;
this.ajaxDel.onCompletion=function(){if(this.parseAjaxResponse()){tempObj.removeListItem(what.replace('-as-spam','')+'-'+id);this.myResponseElement.innerHTML='';if(onComplete&&typeof onComplete=='function')onComplete();tempObj.recolorList(tempObj.recolorPos,1000)}};
this.ajaxDel.onCompletion=function(){if(this.parseAjaxResponse()){tempObj.removeListItem(what.replace('-as-spam','')+'-'+id);this.myResponseElement.innerHTML='';if(tempObj.delComplete&&typeof tempObj.delComplete=='function')tempObj.delComplete(what,where);tempObj.recolorList(tempObj.recolorPos,1000)}};
this.ajaxDel.runAJAX('action=delete-'+what+'&id='+id);
return false;
}
this.ajaxDimmer=function(what,id,dimClass,onComplete){
this.ajaxDimmer=function(what,id,dimClass){
if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300);
this.ajaxDim=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');
if(this.ajaxDim.failed)return true;
var tempObj=this;
this.ajaxDim.onCompletion=function(){if(this.parseAjaxResponse()){tempObj.dimItem(what+'-'+id,dimClass);this.myResponseElement.innerHTML='';if(onComplete&&typeof onComplete=='function')onComplete();}};
this.ajaxDim.onCompletion=function(){if(this.parseAjaxResponse()){tempObj.dimItem(what+'-'+id,dimClass);this.myResponseElement.innerHTML='';if(tempObj.dimComplete&&typeof tempObj.dimComplete=='function')tempObj.dimComplete(what,id,dimClass);}};
this.ajaxDim.runAJAX('action=dim-'+what+'&id='+id);
return false;
}

View File

@ -25,7 +25,7 @@ $submenu['edit.php'][10] = array(__('Pages'), 'edit_pages', 'edit-pages.php');
$submenu['edit.php'][15] = array(__('Categories'), 'manage_categories', 'categories.php');
$submenu['edit.php'][20] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), $awaiting_mod), 'edit_posts', 'moderation.php');
$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), "<span id='awaitmod'>$awaiting_mod</span>"), 'edit_posts', 'moderation.php');
$submenu['edit.php'][30] = array(__('Files'), 'edit_files', 'templates.php');
$submenu['link-manager.php'][5] = array(__('Manage Bookmarks'), 'manage_links', 'link-manager.php');