mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API CHANGE Removed MemberList, use MemberTableField
API CHANGE Removed CMSMain->getMembersByGroup() API CHANGE Removed SecurityAdmin->listmembers() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64398 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
901b285ce6
commit
62e7970a3a
@ -638,19 +638,6 @@ HTML;
|
||||
}
|
||||
}
|
||||
|
||||
function getMembersByGroup() {
|
||||
|
||||
$group = DataObject::get_by_id("Group", $this->urlParams['ID']);
|
||||
if($group){
|
||||
$memberList = new MemberList('Users', $group);
|
||||
$memberList->setController($this);
|
||||
return $memberList->renderWith('MemberList');
|
||||
}else{
|
||||
return user_error("CMSMain::getpagemembers() Cannot find Group #$group->ID", E_USER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function tasklist() {
|
||||
$tasks = DataObject::get("Page", "AssignedToID = " . Member::currentUserID(), "Created DESC");
|
||||
if($tasks) {
|
||||
|
@ -1,278 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Form field showing a list of members.
|
||||
*
|
||||
* @deprecated Use {@link MemberTableField} instead
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage security
|
||||
*/
|
||||
class MemberList extends FormField {
|
||||
protected $members;
|
||||
protected $hidePassword;
|
||||
protected $pageSize;
|
||||
|
||||
function __construct($name, $group, $members = null, $hidePassword = null, $pageLimit = 10) {
|
||||
if($group) {
|
||||
if(is_object($group)) $this->group = $group;
|
||||
else $this->group = DataObject::get_by_id('Group',$group);
|
||||
}
|
||||
|
||||
$this->pageSize = $pageLimit;
|
||||
|
||||
if($members) $this->members = $this->memberListWithGroupID($members, $group);
|
||||
|
||||
$this->hidePassword = $hidePassword;
|
||||
|
||||
parent::__construct(null);
|
||||
}
|
||||
|
||||
function memberListWithGroupID($members, $group) {
|
||||
$newMembers = new DataObjectSet();
|
||||
foreach($members as $member) {
|
||||
$newMembers->push($member->customise(array("GroupID" => $group->ID)));
|
||||
}
|
||||
return $newMembers;
|
||||
}
|
||||
|
||||
function FieldHolder() {
|
||||
return $this->renderWith("MemberList");
|
||||
}
|
||||
function setGroup($group) {
|
||||
$this->group = $group;
|
||||
}
|
||||
function setController($controller) {
|
||||
$this->controller = $controller;
|
||||
}
|
||||
|
||||
function GroupID() {
|
||||
if( $this->group )
|
||||
return $this->group->ID;
|
||||
|
||||
return '0';
|
||||
}
|
||||
|
||||
function GetControllerName() {
|
||||
return $this->controller->class;
|
||||
}
|
||||
function Members() {
|
||||
/*if($this->members)
|
||||
$members = $this->members;
|
||||
else if($this->group) {
|
||||
$members = $this->group->Members( $this->pageSize, 0 );
|
||||
$allMembers = $this->group->Members();
|
||||
|
||||
if( $allMembers )
|
||||
$total = $allMembers->Count();
|
||||
} else
|
||||
return null;*/
|
||||
|
||||
if( $this->members )
|
||||
return $this->members;
|
||||
|
||||
if( !$baseGroup )
|
||||
$baseGroup = $this->group->ID;
|
||||
|
||||
// Debug::message( $_REQUEST['MemberListOrderByField'] );
|
||||
|
||||
// construct the filter and sort
|
||||
|
||||
if( $_REQUEST['MemberListOrderByField'] )
|
||||
$sort = "`" . $_REQUEST['MemberListOrderByField'] . "`" . addslashes( $_REQUEST['MemberListOrderByOrder'] );
|
||||
|
||||
$whereClauses = array();
|
||||
|
||||
$search = addslashes( $_REQUEST['MemberListSearch'] );
|
||||
|
||||
if( is_numeric( $_REQUEST['MemberListStart'] ) )
|
||||
$limitClause = ( $_REQUEST['MemberListStart'] ) . ", {$this->pageSize}";
|
||||
else
|
||||
$limitClause = "0, {$this->pageSize}";
|
||||
|
||||
|
||||
if( !empty($_REQUEST['MemberListSearch']) )
|
||||
$whereClauses[] = "( `Email`='$search' OR `FirstName`='$search' OR `Surname`='$search' )";
|
||||
|
||||
if( is_numeric( $_REQUEST['MemberListBaseGroup'] ) )
|
||||
$baseGroup = $_REQUEST['MemberListBaseGroup'];
|
||||
|
||||
$whereClauses[] = "`GroupID`='".$baseGroup."'";
|
||||
$join = "INNER JOIN `Group_Members` ON `MemberID`=`Member`.`ID`";
|
||||
|
||||
// $_REQUEST['showqueries'] = 1;
|
||||
|
||||
$members = DataObject::get('Member', implode( ' AND ', $whereClauses ), $sort, $join, $limitClause );
|
||||
|
||||
// $_REQUEST['showqueries'] = 0;
|
||||
|
||||
if( is_numeric( $_REQUEST['MemberListGroup'] ) ) {
|
||||
$baseMembers = new DataObjectSet();
|
||||
|
||||
if( $members )
|
||||
foreach( $members as $member )
|
||||
if( $member->inGroup( $_REQUEST['MemberListGroup'] ) )
|
||||
$baseMembers->push( $member );
|
||||
} else
|
||||
$baseMembers = $members;
|
||||
|
||||
if($members){
|
||||
$members->setPageLimits( $_REQUEST['MemberListStart'], $this->pageSize, $total );
|
||||
|
||||
$this->members = $this->memberListWithGroupID($members, $this->group);
|
||||
}
|
||||
return $this->members;
|
||||
}
|
||||
|
||||
function FirstLink() {
|
||||
if( !$_REQUEST['MemberListStart'] )
|
||||
return null;
|
||||
|
||||
return "admin/security/listmembers?MemberListStart=0{$this->filterString()}";
|
||||
}
|
||||
|
||||
function filterString() {
|
||||
|
||||
foreach( $_REQUEST as $key => $value ) {
|
||||
if( strpos( $key, 'MemberList' ) === 0 && $key != 'MemberListStart' )
|
||||
$filterString .= "&$key=$value";
|
||||
}
|
||||
|
||||
if( !$_REQUEST['MemberListBaseGroup'] )
|
||||
$filterString .= '&MemberListBaseGroup=' . $this->group->ID;
|
||||
|
||||
return $filterString;
|
||||
}
|
||||
|
||||
function MemberListStart() {
|
||||
return $_REQUEST['MemberListStart'];
|
||||
}
|
||||
|
||||
function PrevLink() {
|
||||
if( !$_REQUEST['MemberListStart'] )
|
||||
return null;
|
||||
|
||||
$prevStart = $_REQUEST['MemberListStart'] - $this->pageSize;
|
||||
|
||||
if( $prevStart < 0 )
|
||||
$prevStart = 0;
|
||||
|
||||
return "admin/security/listmembers?MemberListStart=$prevStart{$this->filterString()}";
|
||||
}
|
||||
|
||||
function NextLink() {
|
||||
$total = $this->TotalMembers();
|
||||
|
||||
$lastStart = $total - ( $total % $this->pageSize );
|
||||
|
||||
if( $_REQUEST['MemberListStart'] >= $lastStart )
|
||||
return null;
|
||||
|
||||
return "admin/security/listmembers?MemberListStart={$this->pageSize}{$this->filterString()}";
|
||||
}
|
||||
|
||||
function LastLink() {
|
||||
|
||||
$total = $this->TotalMembers();
|
||||
|
||||
$lastStart = $total - ( $total % $this->pageSize );
|
||||
|
||||
if( $_REQUEST['MemberListStart'] >= $lastStart )
|
||||
return null;
|
||||
|
||||
return "admin/security/listmembers?MemberListStart=$lastStart{$this->filterString()}";
|
||||
}
|
||||
|
||||
function PageSize() {
|
||||
return $this->pageSize;
|
||||
}
|
||||
|
||||
function FirstMember() {
|
||||
return $_REQUEST['MemberListStart'] + 1;
|
||||
}
|
||||
|
||||
function LastMember() {
|
||||
return $_REQUEST['MemberListStart'] + min( $_REQUEST['MemberListStart'] + $this->pageSize, $this->TotalMembers() - $_REQUEST['MemberListStart'] );
|
||||
}
|
||||
|
||||
function TotalMembers() {
|
||||
if($this->group) $members = $this->group->Members();
|
||||
|
||||
if( !$members )
|
||||
return null;
|
||||
|
||||
return $members->TotalItems();
|
||||
}
|
||||
|
||||
function DontShowPassword(){
|
||||
if( $this->hidePassword )
|
||||
return true;
|
||||
|
||||
return $this->controller->class=='CMSMain'||$this->controller->class=='NewsletterAdmin';
|
||||
}
|
||||
|
||||
function AddRecordForm() {
|
||||
if($this->DontShowPassword())
|
||||
{
|
||||
return new TabularStyle(new Form($this->controller,'AddRecordForm',
|
||||
new FieldSet(
|
||||
new TextField("FirstName", _t('MemberList.FN', 'First Name')),
|
||||
new TextField("Surname", _t('MemberList.SN', 'Surname')),
|
||||
new TextField("Email", _t('MemberList.EMAIL', 'Email')),
|
||||
new HiddenField("GroupID", null, $this->group->ID)
|
||||
),
|
||||
new FieldSet(
|
||||
new FormAction("addmember", _t('MemberList.ADD', 'Add'))
|
||||
)
|
||||
));
|
||||
|
||||
} else {
|
||||
return new TabularStyle(new Form($this->controller,'AddRecordForm',
|
||||
new FieldSet(
|
||||
new TextField("FirstName", _t('MemberList.FN')),
|
||||
new TextField("Surname", _t('MemberList.SN')),
|
||||
new TextField("Email", _t('MemberList.EMAIL')),
|
||||
new TextField("Password", _t('MemberList.PASSWD', 'Password')),
|
||||
new HiddenField("GroupID", null, $this->group->ID)
|
||||
),
|
||||
new FieldSet(
|
||||
new FormAction("addmember", _t('MemberList.ADD'))
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
function SearchField() {
|
||||
$field = new TextField( 'MemberListSearch', _t('MemberList.SEARCH','Search') );
|
||||
return $field->FieldHolder();
|
||||
}
|
||||
|
||||
function OrderByField() {
|
||||
$fields = new FieldGroup( new DropdownField('MemberListOrderByField','', array(
|
||||
'FirstName' => _t('MemberList.FN', 'FirstName'),
|
||||
'Surname' => _t('MemberList.SN', 'Surname'),
|
||||
'Email' => _t('MemberList.EMAIL', 'Email')
|
||||
)),
|
||||
new DropdownField('MemberListOrderByOrder','',array(
|
||||
'ASC' => _t('MemberList.ASC', 'Ascending'),
|
||||
'DESC' => _t('MemberList.DESC', 'Descending')
|
||||
)));
|
||||
|
||||
$field = new FieldGroup( new LabelField(_t('MemberList.ORDERBY', 'Order by')), $fields );
|
||||
return $field->FieldHolder();
|
||||
}
|
||||
|
||||
function GroupFilter() {
|
||||
|
||||
$groups = DataObject::get('Group');
|
||||
|
||||
$groupArray = array( '' => _t('MemberList.ANYGROUP', 'Any group'));
|
||||
|
||||
foreach( $groups as $group )
|
||||
$groupArray[$group->ID] = $group->Title;
|
||||
|
||||
$field = new DropdownField('MemberListGroup',_t('MemberList.FILTERBYG','Filter by group'),$groupArray );
|
||||
return $field->FieldHolder();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -15,7 +15,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
'addmember',
|
||||
'autocomplete',
|
||||
'getmember',
|
||||
'listmembers',
|
||||
'newmember',
|
||||
'removememberfromgroup',
|
||||
'savemember',
|
||||
@ -260,65 +259,6 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
return "admin/security/$action";
|
||||
}
|
||||
|
||||
public function listmembers( $baseGroup = null ) {
|
||||
|
||||
if( !$baseGroup )
|
||||
$baseGroup = $this->urlParams['ID'];
|
||||
|
||||
// Debug::message( $_REQUEST['MemberListOrderByField'] );
|
||||
|
||||
// construct the filter and sort
|
||||
|
||||
if( $_REQUEST['MemberListOrderByField'] )
|
||||
$sort = "`" . $_REQUEST['MemberListOrderByField'] . "`" . addslashes( $_REQUEST['MemberListOrderByOrder'] );
|
||||
|
||||
$whereClauses = array();
|
||||
|
||||
$search = addslashes( $_REQUEST['MemberListSearch'] );
|
||||
|
||||
if( $_REQUEST['MemberListPage'] ) {
|
||||
$pageSize = 10;
|
||||
|
||||
$limitClause = ( $_REQUEST['MemberListPage'] ) . ", $pageSize";
|
||||
}
|
||||
|
||||
if( !empty($_REQUEST['MemberListSearch']) )
|
||||
$whereClauses[] = "( `Email`='$search' OR `FirstName`='$search' OR `Surname`='$search' )";
|
||||
|
||||
if( is_numeric( $_REQUEST['MemberListBaseGroup'] ) ) {
|
||||
$whereClauses[] = "`GroupID`='".$_REQUEST['MemberListBaseGroup']."'";
|
||||
$join = "INNER JOIN `Group_Members` ON `MemberID`=`Member`.`ID`";
|
||||
}
|
||||
|
||||
// $_REQUEST['showqueries'] = 1;
|
||||
|
||||
$members = DataObject::get('Member', implode( ' AND ', $whereClauses ), $sort, $join, $limitClause );
|
||||
|
||||
if( is_numeric( $_REQUEST['MemberListGroup'] ) ) {
|
||||
$baseMembers = new DataObjectSet();
|
||||
|
||||
if( $members )
|
||||
foreach( $members as $member )
|
||||
if( $member->inGroup( $_REQUEST['MemberListGroup'] ) )
|
||||
$baseMembers->push( $member );
|
||||
} else
|
||||
$baseMembers = $members;
|
||||
|
||||
$baseMembers = null;
|
||||
|
||||
// user_error( $_REQUEST['MemberListBaseGroup'], E_USER_ERROR );
|
||||
|
||||
$memberListField = new MemberTableField(
|
||||
$this,
|
||||
'MemberList',
|
||||
$_REQUEST['MemberListBaseGroup'],
|
||||
$baseMembers,
|
||||
$_REQUEST['MemberListDontShowPassword']
|
||||
);
|
||||
|
||||
return $memberListField->renderWith('MemberList_Table');
|
||||
}
|
||||
|
||||
function providePermissions() {
|
||||
return array(
|
||||
'EDIT_PERMISSIONS' => _t('SecurityAdmin.EDITPERMISSIONS', 'Edit permissions and IP addresses on each group'),
|
||||
|
@ -1,322 +0,0 @@
|
||||
/**
|
||||
* Auto-lookup on ajax fields
|
||||
*/
|
||||
AjaxMemberLookup = {
|
||||
initialise : function() {
|
||||
var div = document.createElement('div');
|
||||
div.id = this.id + '_ac';
|
||||
div.className = 'autocomplete';
|
||||
this.parentNode.appendChild(div);
|
||||
new Ajax.Autocompleter(this.id, div.id, 'admin/security/autocomplete/' + this.name, {
|
||||
afterUpdateElement : this.afterAutocomplete.bind(this)
|
||||
});
|
||||
},
|
||||
afterAutocomplete : function(field, selectedItem) {
|
||||
var data = selectedItem.getElementsByTagName('span')[1].innerHTML;
|
||||
var items = data.split(",");
|
||||
form = Element.ancestorOfType(field, 'form');
|
||||
|
||||
form.elements.FirstName.value = items[0];
|
||||
form.elements.Surname.value = items[1];
|
||||
form.elements.Email.value = items[2];
|
||||
if(items[3])
|
||||
form.elements.Password.value = items[3];
|
||||
|
||||
var fieldSet = field.parentNode.parentNode.getElementsByTagName('input');
|
||||
|
||||
ajaxSubmitFieldSet('admin/security/savemember?MemberListBaseGroupID='.$('MemberListBaseGroupID'), fieldSet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Member list behaviour
|
||||
*/
|
||||
|
||||
Behaviour.register({
|
||||
'#MemberList tr' : {
|
||||
onmouseover : hover_over,
|
||||
onmouseout : hover_out,
|
||||
|
||||
onclick : function() {
|
||||
if(this.className.indexOf('addrow') == -1) {
|
||||
Element.addClassName(this, 'loading');
|
||||
new Ajax.Request('admin/security/getmember', {
|
||||
method : 'post',
|
||||
postBody : 'ID=' + this.id.replace('member-','') + '&ajax=1',
|
||||
onSuccess : this.select_success.bind(this)
|
||||
});
|
||||
|
||||
} else {
|
||||
if($('Form_MemberForm'))
|
||||
$('Form_MemberForm').innerHTML = "<p>Choose a member from above.</p>";
|
||||
}
|
||||
},
|
||||
select_success : function(response) {
|
||||
Element.removeClassName(this, 'loading');
|
||||
$('Form_MemberForm').loadNewPage(response.responseText);
|
||||
|
||||
statusMessage('loaded','good');
|
||||
// for (var n in tinyMCE.instances) tinyMCE.removeMCEControl(n);
|
||||
}
|
||||
},
|
||||
|
||||
'#MemberList thead tr' : {
|
||||
onmouseover : null,
|
||||
onmouseout : null,
|
||||
onclick : null
|
||||
},
|
||||
|
||||
'#MemberList' : {
|
||||
initialise : function() {
|
||||
this.headerMap = [];
|
||||
|
||||
var i, item, headers = this.getElementsByTagName('thead')[0].getElementsByTagName('tr')[0].getElementsByTagName('td');
|
||||
for(i=0;item=headers[i];i++) {
|
||||
this.headerMap[i] = item.className;
|
||||
}
|
||||
},
|
||||
|
||||
setRecordDetails : function(id, details, groupID) {
|
||||
var row = document.getElementById('member-' + id);
|
||||
if(row) {
|
||||
var i, item, cells = row.getElementsByTagName('td');
|
||||
for(i=0;item=cells[i];i++) {
|
||||
if(details[this.headerMap[i]]) {
|
||||
item.innerHTML = details[this.headerMap[i]];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.createRecord(id, details, groupID);
|
||||
}
|
||||
},
|
||||
|
||||
createRecord : function (id, details, groupId) {
|
||||
var row = document.createElement('tr');
|
||||
row.id = 'member-' + id;
|
||||
var i, cell, cellField;
|
||||
for(i=0;cellField=this.headerMap[i];i++) {
|
||||
cell = document.createElement('td')
|
||||
if(details[cellField]) {
|
||||
cell.innerHTML = details[cellField];
|
||||
}
|
||||
row.appendChild(cell);
|
||||
}
|
||||
|
||||
// Add the delete icon
|
||||
if(typeof groupId == 'undefined')
|
||||
var groupId = $('Form_EditForm').elements.ID.value;
|
||||
cell = document.createElement('td')
|
||||
cell.innerHTML = '<a class="deletelink" href="admin/security/removememberfromgroup/' + groupId + '/' + id + '"><img src="cms/images/delete.gif" alt="delete" /></a>';
|
||||
cell.getElementsByTagName('0');
|
||||
row.appendChild(cell);
|
||||
|
||||
var tbody = this.getElementsByTagName('tbody')[0];
|
||||
var addRow = document.getElementsByClassName('addrow',tbody)[0];
|
||||
if(addRow) tbody.insertBefore(row, addRow);
|
||||
else tbody.appendChild(row);
|
||||
Behaviour.apply(row, true);
|
||||
},
|
||||
|
||||
clearAddForm : function() {
|
||||
var tbody = this.getElementsByTagName('tbody')[0];
|
||||
var addRow = document.getElementsByClassName('addrow',tbody)[0];
|
||||
if(addRow) {
|
||||
var i,field,fields = addRow.getElementsByTagName('input');
|
||||
for(i=0;field=fields[i];i++) {
|
||||
if(field.type != 'hidden' && field.type != 'submit') field.value = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
removeMember : function(memberID) {
|
||||
var record;
|
||||
if(record = $('member-' + memberID)) {
|
||||
record.parentNode.removeChild(record);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'#MemberList input' : AjaxMemberLookup,
|
||||
|
||||
'#MemberList a.deletelink' : {
|
||||
onclick : function(event) {
|
||||
if(confirm("Do you want to remove this member from the group?")) {
|
||||
this.getElementsByTagName('img')[0].src = 'cms/images/network-save.gif';
|
||||
ajaxLink(this.href);
|
||||
}
|
||||
Event.stop(event);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
'#MemberList tr.addrow' : {
|
||||
onmouseover : null,
|
||||
onmouseout : null,
|
||||
onclick : null
|
||||
},
|
||||
|
||||
'#MemberList tr.addrow td.actions input' : {
|
||||
initialise: function() {
|
||||
data = this.parentNode.parentNode.getElementsByTagName('input');
|
||||
var i,item,error = [];
|
||||
for(i=0;item=data[i];i++) {
|
||||
item.originalSerialized = Form.Element.serialize(item);
|
||||
}
|
||||
},
|
||||
|
||||
onclick : function(event) {
|
||||
data = this.parentNode.parentNode.getElementsByTagName('input');
|
||||
var i,item,error = [];
|
||||
for(i=0;item=data[i];i++) {
|
||||
if(item.name == 'Email' && !item.value) error[error.length] = "Email";
|
||||
if(item.name == 'Password' && !item.value) error[error.length] = "Password";
|
||||
}
|
||||
if(error.length > 0) {
|
||||
alert('Please enter a ' + error.join(' and a ') + ' to add a member.');
|
||||
|
||||
} else {
|
||||
ajaxSubmitFieldSet('admin/security/addmember?MemberListBaseGroupID='.$('MemberListBaseGroupID') , data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
'#Form_EditForm' : {
|
||||
changeDetection_fieldsToIgnore : {
|
||||
'MemberListBaseGroup' : true,
|
||||
'MemberListOrderByField' : true,
|
||||
'MemberListOrderByOrder' : true,
|
||||
'MemberListGroup' : true,
|
||||
'MemberListSearch' : true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MemberListFilterButton = Class.create();
|
||||
MemberListFilterButton.applyTo('div.MemberListField #MemberListFilterButton');
|
||||
MemberListFilterButton.prototype = {
|
||||
initialize: function() {
|
||||
this.inputFields = new Array();
|
||||
|
||||
var childNodes = this.parentNode.getElementsByTagName('input');
|
||||
|
||||
for( var index = 0; index < childNodes.length; index++ ) {
|
||||
if( childNodes[index].tagName ) {
|
||||
childNodes[index].resetChanged = function() { return false; }
|
||||
childNodes[index].isChanged = function() { return false; }
|
||||
this.inputFields.push( childNodes[index] );
|
||||
}
|
||||
}
|
||||
|
||||
childNodes = this.parentNode.getElementsByTagName('select');
|
||||
|
||||
for( var index = 0; index < childNodes.length; index++ ) {
|
||||
if( childNodes[index].tagName ) {
|
||||
childNodes[index].resetChanged = function() { return false; }
|
||||
childNodes[index].field_changed = function() { return false; }
|
||||
this.inputFields.push( childNodes[index] );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
isChanged: function() {
|
||||
return false;
|
||||
},
|
||||
|
||||
onclick: function(event) {
|
||||
|
||||
var baseGroup = $('MemberListBaseGroupID').value;
|
||||
|
||||
var updateURL = 'admin/security/listmembers/' + baseGroup + '?';
|
||||
|
||||
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';
|
||||
|
||||
new Ajax.Request( updateURL, {
|
||||
onSuccess: function( response ) {
|
||||
$('MemberList').innerHTML = response.responseText;
|
||||
// Behaviour.debug();
|
||||
Behaviour.apply( $('MemberList') );
|
||||
},
|
||||
onFailure: function( response ) {
|
||||
errorMessage('Could not filter results: ' + response.responseText );
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Behaviour.register({
|
||||
'div#MemberList div.PageControls a' : {
|
||||
onclick: function() {
|
||||
new Ajax.Request( this.href + '&ajax=1', {
|
||||
onSuccess: function( response ) {
|
||||
$('MemberList').innerHTML = response.responseText;
|
||||
// Behaviour.debug();
|
||||
Behaviour.apply( $('MemberList') );
|
||||
},
|
||||
onFailure: function( response ) {
|
||||
errorMessage('Could not filter results: ' + response.responseText );
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function reloadMemberList( groupID ) {
|
||||
|
||||
if( !groupID )
|
||||
groupID = $('MemberListBaseGroupID').value;
|
||||
|
||||
if($('MemberListStart')) var listStart = $('MemberListStart').value;
|
||||
else var listStart = 0;
|
||||
|
||||
new Ajax.Request( 'admin/security/listmembers?&ajax=1&MemberListBaseGroup=' + groupID + '&MemberListStart=' + listStart, {
|
||||
onSuccess: function( response ) {
|
||||
$('MemberList').innerHTML = response.responseText;
|
||||
// Behaviour.debug();
|
||||
Behaviour.apply( $('MemberList') );
|
||||
},
|
||||
onFailure: function( response ) {
|
||||
errorMessage('Could not filter results: ' + response.responseText );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Behaviour.register({
|
||||
'.MemberListFilter a.showhide' : {
|
||||
initialise: function() {
|
||||
this.open = !Element.hasClassName( this, 'closed' );
|
||||
},
|
||||
|
||||
onclick: function() {
|
||||
if( this.open )
|
||||
this.openControls();
|
||||
else
|
||||
this.closeControls();
|
||||
|
||||
this.open = !this.open;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
openControls: function() {
|
||||
Element.removeClassName( this, 'closed' );
|
||||
$('MemberListFilterControls').style.display = 'block';
|
||||
},
|
||||
|
||||
closeControls: function() {
|
||||
Element.removeClassName( this, 'closed' );
|
||||
$('MemberListFilterControls').style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
@ -277,25 +277,3 @@ MemberFilterButton.prototype = {
|
||||
Behaviour.register({
|
||||
'#Form_EditForm div.MemberTableField table.data input' : AjaxMemberLookup
|
||||
});
|
||||
|
||||
/*
|
||||
function reloadMemberTableField( groupID ) {
|
||||
|
||||
if( !groupID )
|
||||
groupID = $('MemberBaseGroupID').value;
|
||||
|
||||
if($('MemberStart')) var listStart = $('MemberStart').value;
|
||||
else var listStart = 0;
|
||||
|
||||
new Ajax.Request( 'admin/security/listmembers?&ajax=1&MemberBaseGroup=' + groupID + '&MemberStart=' + listStart, {
|
||||
onSuccess: function( response ) {
|
||||
$('MemberList').innerHTML = response.responseText;
|
||||
// Behaviour.debug();
|
||||
Behaviour.apply( $('MemberList') );
|
||||
},
|
||||
onFailure: function( response ) {
|
||||
errorMessage('Could not filter results: ' + response.responseText );
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
@ -210,18 +210,6 @@ $lang['en_US']['LeftAndMain']['HELP'] = array(
|
||||
PR_HIGH,
|
||||
'Menu title'
|
||||
);
|
||||
$lang['en_US']['MemberList']['FN'] = 'First Name';
|
||||
$lang['en_US']['MemberList']['SN'] = 'Surname';
|
||||
$lang['en_US']['MemberList']['EMAIL'] = 'Email';
|
||||
$lang['en_US']['MemberList']['ADD'] = 'Add';
|
||||
$lang['en_US']['MemberList']['PASSWD'] = 'Password';
|
||||
$lang['en_US']['MemberList']['SEARCH'] = 'Search';
|
||||
$lang['en_US']['MemberList']['FN'] = 'FirstName';
|
||||
$lang['en_US']['MemberList']['ASC'] = 'Ascending';
|
||||
$lang['en_US']['MemberList']['DESC'] = 'Descending';
|
||||
$lang['en_US']['MemberList']['ORDERBY'] = 'Order by';
|
||||
$lang['en_US']['MemberList']['ANYGROUP'] = 'Any group';
|
||||
$lang['en_US']['MemberList']['FILTERBYG'] = 'Filter by group';
|
||||
$lang['en_US']['MemberTableField']['FIRSTNAME'] = 'Firstname';
|
||||
$lang['en_US']['MemberTableField']['SURNAME'] = 'Surname';
|
||||
$lang['en_US']['MemberTableField']['EMAIL'] = 'Email';
|
||||
|
Loading…
Reference in New Issue
Block a user