mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
BUGFIX: Removed use of deprecated TableListField_Item::BaseLink() And TableListField::ajax_refresh() from CommentTableField and MemberTableField
BUGFIX: Fixed styling, searching, and pagination of CommentTableField git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@61686 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9222af6829
commit
b4e681dc83
@ -172,15 +172,15 @@ class CommentTableField_Item extends ComplexTableField_Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SpamLink() {
|
function SpamLink() {
|
||||||
return $this->BaseLink() . "&methodName=spam";
|
return Controller::join_links($this->Link(), "?methodName=spam");
|
||||||
}
|
}
|
||||||
|
|
||||||
function HamLink() {
|
function HamLink() {
|
||||||
return $this->BaseLink() . "&methodName=ham";
|
return Controller::join_links($this->Link(), "?methodName=ham");
|
||||||
}
|
}
|
||||||
|
|
||||||
function ApproveLink() {
|
function ApproveLink() {
|
||||||
return $this->BaseLink() . "&methodName=approve";
|
return Controller::join_links($this->Link(), "?methodName=approve");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,13 +14,10 @@ CommentTableField.prototype = {
|
|||||||
rules['#'+this.id+' table.data a.hamlink'] = {
|
rules['#'+this.id+' table.data a.hamlink'] = {
|
||||||
onclick: this.removeRowAfterAjax.bind(this)
|
onclick: this.removeRowAfterAjax.bind(this)
|
||||||
};
|
};
|
||||||
|
|
||||||
rules['#Form_EditForm div.CommentFilter input'] = {
|
rules['#Form_EditForm div.CommentFilter input'] = {
|
||||||
onkeypress : this.prepareSearch.bind(this)
|
onkeypress : this.prepareSearch.bind(this)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rules['#Form_EditForm'] = {
|
rules['#Form_EditForm'] = {
|
||||||
changeDetection_fieldsToIgnore : {
|
changeDetection_fieldsToIgnore : {
|
||||||
'ctf[start]' : true,
|
'ctf[start]' : true,
|
||||||
@ -76,7 +73,7 @@ CommentTableField.prototype = {
|
|||||||
CommentTableField.applyTo('div.CommentTableField');
|
CommentTableField.applyTo('div.CommentTableField');
|
||||||
|
|
||||||
CommentFilterButton = Class.create();
|
CommentFilterButton = Class.create();
|
||||||
CommentFilterButton.applyTo('#Form_EditForm #CommentFilterButton');
|
CommentFilterButton.applyTo('#CommentFilterButton');
|
||||||
CommentFilterButton.prototype = {
|
CommentFilterButton.prototype = {
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.inputFields = new Array();
|
this.inputFields = new Array();
|
||||||
@ -107,28 +104,30 @@ CommentFilterButton.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
//if(!$('ctf-ID') || !$('CommentFieldName')) {
|
try {
|
||||||
// return false;
|
var form = Event.findElement(e,"form");
|
||||||
//}
|
var fieldName = $('CommentFieldName').value;
|
||||||
|
var fieldID = form.id + '_' + fieldName;
|
||||||
var updateURL = "";
|
|
||||||
updateURL += Event.findElement(e,"form").action;
|
var updateURL = form.action + '/field/' + fieldName + '?ajax=1';
|
||||||
// we can't set "fieldName" as a HiddenField because there might be multiple ComplexTableFields in a single EditForm-container
|
for( var index = 0; index < this.inputFields.length; index++ ) {
|
||||||
updateURL += "&fieldName="+$('CommentFieldName').value;
|
if( this.inputFields[index].tagName ) {
|
||||||
updateURL += "&action_callfieldmethod&&methodName=ajax_refresh&";
|
updateURL += '&' + this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value );
|
||||||
for( var index = 0; index < this.inputFields.length; index++ ) {
|
}
|
||||||
if( this.inputFields[index].tagName ) {
|
}
|
||||||
updateURL += this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value ) + '&';
|
updateURL += ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
||||||
}
|
|
||||||
}
|
|
||||||
updateURL += 'ajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
|
||||||
|
|
||||||
new Ajax.Request( updateURL, {
|
new Ajax.Updater( fieldID, updateURL, {
|
||||||
onSuccess: Ajax.Evaluator,
|
onSuccess: function() {
|
||||||
onFailure: function( response ) {
|
Behaviour.apply(fieldID, true);
|
||||||
errorMessage('Could not filter results: ' + response.responseText );
|
},
|
||||||
}.bind(this)
|
onFailure: function( response ) {
|
||||||
});
|
errorMessage('Could not filter results: ' + response.responseText );
|
||||||
|
}.bind(this)
|
||||||
|
});
|
||||||
|
} catch(er) {
|
||||||
|
errorMessage('Error searching');
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -243,24 +243,32 @@ MemberFilterButton.prototype = {
|
|||||||
if(!$('ctf-ID') || !$('MemberFieldName')) {
|
if(!$('ctf-ID') || !$('MemberFieldName')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var updateURL = "";
|
|
||||||
updateURL += Event.findElement(e,"form").action;
|
|
||||||
updateURL += '/field/' + $('MemberFieldName').value + '/ajax_refresh?ajax=1&';
|
|
||||||
for( var index = 0; index < this.inputFields.length; index++ ) {
|
|
||||||
if( this.inputFields[index].tagName ) {
|
|
||||||
updateURL += this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value ) + '&';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateURL += 'ajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
|
||||||
|
|
||||||
new Ajax.Request( updateURL, {
|
try {
|
||||||
onSuccess: Ajax.Evaluator,
|
var form = Event.findElement(e,"form");
|
||||||
onFailure: function( response ) {
|
var fieldName = $('MemberFieldName').value;
|
||||||
errorMessage('Could not filter results: ' + response.responseText );
|
var fieldID = form.id + '_' + fieldName;
|
||||||
}.bind(this)
|
|
||||||
});
|
var updateURL = form.action + '/field/' + fieldName + '?ajax=1';
|
||||||
|
for( var index = 0; index < this.inputFields.length; index++ ) {
|
||||||
|
if( this.inputFields[index].tagName ) {
|
||||||
|
updateURL += '&' + this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateURL += ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
||||||
|
|
||||||
|
new Ajax.Updater( fieldID, updateURL, {
|
||||||
|
onSuccess: function() {
|
||||||
|
Behaviour.apply(fieldID, true);
|
||||||
|
},
|
||||||
|
onFailure: function( response ) {
|
||||||
|
errorMessage('Could not filter results: ' + response.responseText );
|
||||||
|
}.bind(this)
|
||||||
|
});
|
||||||
|
} catch(er) {
|
||||||
|
errorMessage('Error searching');
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div id="$id" class="$Classes">
|
<div id="$id" class="$CSSClasses">
|
||||||
<div class="CommentFilter">
|
<div class="CommentFilter">
|
||||||
$SearchForm
|
$SearchForm
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user