Commit f9de577f authored by Pat Kira's avatar Pat Kira Committed by Robert Lyon
Browse files

Move userserch filter option to advanced options (bug: 1465107)

Put the right markup for no results displayed inside a table

Change-Id: I274651c90b297b43f6678892198fe6680cf16752
parent 2232fef6
......@@ -82,7 +82,6 @@ $searchParams = $search; //store search as it's about to change
list($html, $columns, $pagination, $search) = build_admin_user_search_results($search, $offset, $limit);
$js = <<<EOF
addLoadEvent(function() {
var p = {$pagination['javascript']}
......
......@@ -25,11 +25,11 @@ $enc_type = json_encode($type);
$typeform = pieform(
array(
'name' => 'usertype',
'class' => 'with-heading form-inline',
'class' => 'with-heading with-label-widthauto form-condensed',
'elements' => array(
'type' => array(
'type' => 'select',
'title' => get_string('show') . ':',
'title' => get_string('show'),
'options' => array(
'suspended' => get_string('suspendedusers', 'admin'),
'expired' => get_string('expiredusers', 'admin'),
......
......@@ -137,7 +137,14 @@ var Paginator = function(id, list, heading, script, extradata) {
paginationdata = data.data.pagination;
if (listdata === undefined || listdata.length === 0) {
listdata = '<p class="no-results">' + get_string_ajax('noresultsfound', 'mahara') + '</p>';
var noresults = get_string_ajax('noresultsfound', 'mahara');
if (self.isTable) {
var columns = $j(self.list).find('th').length;
listdata = '<tr class="no-results"><td colspan="' + columns + '">' + noresults + '</td></tr>';
} else {
listdata = '<p class="no-results">' + noresults + '</p>';
}
}
if (container) {
......
......@@ -265,3 +265,10 @@
position: absolute;
}
}
// Admin user search page (advanced options)
// limit the size of dynamic to match select box above
.loggedindate-container {
max-width: 250px;
}
{include file="header.tpl"}
<div class="form form-inline with-heading dropdown admin-user-search">
{if count($institutions) > 1}
<div class="dropdown-group js-dropdown-group form-group">
......@@ -38,158 +37,150 @@
</div>
</div>
{/if}
</div>
<div class="row">
<div class="col-md-12">
<p class="lead mtl">{str tag="usersearchinstructions" section="admin"}</p>
</div>
</div>
<div class="row">
<div class="col-md-3 prs-md">
<div class="panel panel-default">
<h3 class="panel-heading" tabindex="0">{str tag="filterresultsby"}</h3>
<div class="panel-body">
<div id="initials" class="initials">
<div id="firstnamelist">
<p class="pseudolabel" id="firstname">{str tag="firstname"}:</p>
<div class="advanced as-link link-expand-right form-group collapsible-group">
<fieldset class="pieform-fieldset advanced last as-link link-expand-right collapsible">
<legend>
<h4>
<a href="#initials" data-toggle="collapse" aria-expanded="{if $search->f || $search->l}true{else}false{/if}" aria-controls="initials" class="{if !$search->f && !$search->l}collapsed{/if}">
{str tag='moreoptions' section='view'}
<span class="icon icon-chevron-down collapse-indicator right pull-right"></span>
</a>
</h4>
</legend>
<div id="initials" class="initials collapse{if $search->f || $search->l} in{/if}" aria-expanded="{if $search->f || $search->l}true{else}false{/if}">
<h3 class="mb0" tabindex="0">{str tag="filterresultsby"}</h3>
<div class="row">
<div id="firstnamelist" class="col-md-4 mbm">
<span class="pseudolabel" id="firstname">{str tag="firstname"}:</span>
<br/>
<a class="label first-initial{if !$search->f} label-primary active{else} label-default{/if} all" aria-describedby="firstname" href="{$WWWROOT}admin/users/search.php?query={$search->query}{if $search->l}&amp;l={$search->l}{/if}{if $search->sortby}&amp;sortby={$search->sortby}{/if}{if $search->sortdir}&amp;sortdir={$search->sortdir}{/if}{if $limit}&amp;limit={$limit}{/if}">{str tag="All"}</a>
{foreach from=$alphabet item=a}
<a class="label first-initial{if $a == $search->f} label-primary active{else} label-default{/if}" aria-describedby="firstname" href="{$WWWROOT}admin/users/search.php?query={$search->query}&amp;f={$a}{if $search->l}&amp;l={$search->l}{/if}{if $search->sortby}&amp;sortby={$search->sortby}{/if}{if $search->sortdir}&amp;sortdir={$search->sortdir}{/if}{if $limit}&amp;limit={$limit}{/if}">{$a}</a>
<a class="label first-initial{if $a == $search->f} label-primary active{else} label-default{/if}" aria-describedby="firstname" href="{$WWWROOT}admin/users/search.php?query={$search->query}&amp;f={$a}{if $search->l}&amp;l={$search->l}{/if}{if $search->sortby}&amp;sortby={$search->sortby}{/if}{if $search->sortdir}&amp;sortdir={$search->sortdir}{/if}{if $limit}&amp;limit={$limit}{/if}">{$a}</a>
{/foreach}
</div>
<div class="mtl" id="lastnamelist">
<p class="pseudolabel" id="lastname">{str tag="lastname"}:</p>
<div id="lastnamelist" class="col-md-4 mbm">
<span class="pseudolabel" id="lastname">{str tag="lastname"}:</span>
<br/>
<a class="label last-initial{if !$search->l} label-primary active{else} label-default{/if} all" aria-describedby="lastname" href="{$WWWROOT}admin/users/search.php?query={$search->query}{if $search->f}&amp;f={$search->f}{/if}{if $search->sortby}&amp;sortby={$search->sortby}{/if}{if $search->sortdir}&amp;sortdir={$search->sortdir}{/if}{if $limit}&amp;limit={$limit}{/if}">{str tag="All"}</a>
{foreach from=$alphabet item=a}
<a class="label last-initial{if $a == $search->l} label-primary active{else} label-default{/if}" aria-describedby="lastname" href="{$WWWROOT}admin/users/search.php?query={$search->query}&amp;l={$a}{if $search->f}&amp;f={$search->f}{/if}{if $search->sortby}&amp;sortby={$search->sortby}{/if}{if $search->sortdir}&amp;sortdir={$search->sortdir}{/if}{if $limit}&amp;limit={$limit}{/if}">{$a}</a>
<a class="label last-initial{if $a == $search->l} label-primary active{else} label-default{/if}" aria-describedby="lastname" href="{$WWWROOT}admin/users/search.php?query={$search->query}&amp;l={$a}{if $search->f}&amp;f={$search->f}{/if}{if $search->sortby}&amp;sortby={$search->sortby}{/if}{if $search->sortdir}&amp;sortdir={$search->sortdir}{/if}{if $limit}&amp;limit={$limit}{/if}">{$a}</a>
{/foreach}
</div>
</div>
<form class="mtm pieform" action="{$WWWROOT}admin/users/search.php" method="post">
{if $search->f}
<input type="hidden" name="f" id="f" value="{$search->f}">
{/if}
{if $search->l}
<input type="hidden" name="l" id="l" value="{$search->l}">
{/if}
{if $search->sortby}
<input type="hidden" name="sortby" id="sortby" value="{$search->sortby}">
{/if}
{if $search->sortdir}
<input type="hidden" name="sortdir" id="sortdir" value="{$search->sortdir}">
{/if}
{if $limit}
<input type="hidden" name="limit" id="limit" value="{$limit}">
{/if}
<hr />
<div class="loggedin-filter mtl form-group">
<label for="loggedin">{str tag="lastlogin" section="admin"}</label>
<div class="picker">
<select class="form-control select" name="loggedin" id="loggedin">
{foreach from=$loggedintypes item=t}
<option value="{$t['name']}"{if $search->loggedin === $t['name']} selected="selected"{/if}>{$t['string']}</option>
{/foreach}
</select>
</div>
<span id="loggedindate_container"{if !($search->loggedin == 'since' || $search->loggedin == 'notsince')} class="js-hidden"{/if}>
{$loggedindate|safe}
</span>
</div>
<div class="duplicateemail-filter mtm checkbox form-group">
<input class="checkbox pull-left" type="checkbox" name="duplicateemail" id="duplicateemail" value="1"{if $search->duplicateemail} checked{/if}>
<label class="input-inline pls" for="duplicateemail">
{str tag="duplicateemailfilter1" section="admin"}
</label>
<div id="lastlogin-filter" class="col-md-4 mbm">
<form class="pieform" action="{$WWWROOT}admin/users/search.php" method="post">
{if $search->f}
<input type="hidden" name="f" id="f" value="{$search->f}">
{/if}
{if $search->l}
<input type="hidden" name="l" id="l" value="{$search->l}">
{/if}
{if $search->sortby}
<input type="hidden" name="sortby" id="sortby" value="{$search->sortby}">
{/if}
{if $search->sortdir}
<input type="hidden" name="sortdir" id="sortdir" value="{$search->sortdir}">
{/if}
{if $limit}
<input type="hidden" name="limit" id="limit" value="{$limit}">
{/if}
<div class="loggedin-filter">
<label for="loggedin">{str tag="lastlogin" section="admin"}</label>
<div class="picker">
<select class="form-control select" name="loggedin" id="loggedin">
{foreach from=$loggedintypes item=t}
<option value="{$t['name']}"{if $search->loggedin === $t['name']} selected="selected"{/if}>{$t['string']}</option>
{/foreach}
</select>
</div>
<div id="loggedindate_container" class="loggedindate-container {if !($search->loggedin == 'since' || $search->loggedin == 'notsince')}js-hidden{/if}">
{$loggedindate|safe}
</div>
</div>
<div class="duplicateemail-filter checkbox mtm">
<label class="input-inline" for="duplicateemail">
<input class="checkbox" type="checkbox" name="duplicateemail" id="duplicateemail" value="1"{if $search->duplicateemail} checked{/if}>
{str tag="duplicateemailfilter1" section="admin"}
</label>
</div>
</form>
</div>
</div>
</div>
</form>
</fieldset>
</div>
<div class="col-md-9 pls-md">
<div id="results" class="section panel panel-default">
<h2 class="panel-heading" id="resultsheading">{str tag="Results"}</h2>
{if $results}
<div class="table-responsive">
<table id="searchresults" class="table table-striped fullwidth listing">
<thead>
<tr>
{foreach from=$columns key=f item=c}
{if !$c.mergelast}
<th class="{if $c.sort}search-results-sort-column{if $f == $sortby} {$sortdir}{/if}{/if}{if $c.class} {$c.class}{/if}">
{/if}
{if $c.sort}
<a href="{$searchurl}&sortby={$f}&sortdir={if $f == $sortby && $sortdir == 'asc'}desc{else}asc{/if}">
{$c.name}
<span class="accessible-hidden sr-only">({str tag=sortby} {if $f == $sortby && $sortdir == 'asc'}{str tag=descending}{else}{str tag=ascending}{/if})</span>
</a>
{else}
{$c.name}
{if $c.accessible}
<span class="accessible-hidden sr-only">{$c.accessible}</span>
{/if}
{/if}
{if $c.help}
{$c.helplink|safe}
{/if}
{if $c.headhtml}<div class="headhtml allnone-toggles">{$c.headhtml|safe}</div>{/if}
{if !$c.mergefirst}
</th>
</div>
<p class="lead mtl">{str tag="usersearchinstructions" section="admin"}</p>
<div id="results" class="section panel panel-default">
<h2 class="panel-heading" id="resultsheading">{str tag="Results"}</h2>
{if $results}
<div class="table-responsive">
<table id="searchresults" class="table table-striped fullwidth listing">
<thead>
<tr>
{foreach from=$columns key=f item=c}
{if !$c.mergelast}
<th class="{if $c.sort}search-results-sort-column{if $f == $sortby} {$sortdir}{/if}{/if}{if $c.class} {$c.class}{/if}">
{/if}
{if $c.sort}
<a href="{$searchurl}&sortby={$f}&sortdir={if $f == $sortby && $sortdir == 'asc'}desc{else}asc{/if}">
{$c.name}
<span class="accessible-hidden sr-only">({str tag=sortby} {if $f == $sortby && $sortdir == 'asc'}{str tag=descending}{else}{str tag=ascending}{/if})</span>
</a>
{else}
{$c.name}
{if $c.accessible}
<span class="accessible-hidden sr-only">{$c.accessible}</span>
{/if}
{/foreach}
</tr>
</thead>
<tbody>
{$results|safe}
</tbody>
</table>
</div>
<div class="panel-body">
{$pagination|safe}
</div>
{else}
<div class="panel-body"><p class="no-results">{str tag="noresultsfound"}</p></div>
{/if}
{if $USER->get('admin') || $USER->is_institutional_admin() || get_config('staffreports')}
<div class="withselectedusers panel-body">
<div class="btn-group">
{if $USER->get('admin') || $USER->is_institutional_admin()}
<form class="nojs-hidden-inline form-as-button pull-left" id="bulkactions" action="{$WWWROOT}admin/users/bulk.php" method="post">
<button action="{$WWWROOT}admin/users/bulk.php" type="submit" class="btn btn-default disabled" name="edit" id="editbtn" value="{str tag=edit}">
<span class="icon icon-pencil prs"></span>
{str tag=withselectedusersedit section=admin}
</button>
</form>
{/if}
<form class="nojs-hidden-inline form-as-button pull-left" action="{$WWWROOT}admin/users/report.php" id="report" method="post">
<button action="{$WWWROOT}admin/users/report.php" type="submit" class="btn btn-default disabled" name="reports" id="reportsbtn" value="{str tag=getreports section=admin}">
<span class="icon icon-area-chart prs"></span>
{str tag=withselectedusersreports section=admin}
</button>
</form>
</div>
<div id="nousersselected" class="mtl hidden error alert alert-danger">{str tag=nousersselected section=admin}</div>
</div>
{/if}
{/if}
{if $c.help}
{$c.helplink|safe}
{/if}
{if $c.headhtml}<div class="headhtml allnone-toggles">{$c.headhtml|safe}</div>{/if}
{if !$c.mergefirst}
</th>
{/if}
{/foreach}
</tr>
</thead>
<tbody>
{$results|safe}
</tbody>
</table>
</div>
</div>
<div class="panel-body">
{$pagination|safe}
</div>
{else}
<div class="panel-body"><p class="no-results">{str tag="noresultsfound"}</p></div>
{/if}
{if $USER->get('admin') || $USER->is_institutional_admin() || get_config('staffreports')}
<div class="withselectedusers panel-body">
<div class="btn-group">
{if $USER->get('admin') || $USER->is_institutional_admin()}
<form class="nojs-hidden-inline form-as-button pull-left" id="bulkactions" action="{$WWWROOT}admin/users/bulk.php" method="post">
<button action="{$WWWROOT}admin/users/bulk.php" type="submit" class="btn btn-default disabled" name="edit" id="editbtn" value="{str tag=edit}">
<span class="icon icon-pencil prs"></span>
{str tag=withselectedusersedit section=admin}
</button>
</form>
{/if}
<form class="nojs-hidden-inline form-as-button pull-left" action="{$WWWROOT}admin/users/report.php" id="report" method="post">
<button action="{$WWWROOT}admin/users/report.php" type="submit" class="btn btn-default disabled" name="reports" id="reportsbtn" value="{str tag=getreports section=admin}">
<span class="icon icon-area-chart prs"></span>
{str tag=withselectedusersreports section=admin}
</button>
</form>
</div>
<div id="nousersselected" class="mtl hidden error alert alert-danger">{str tag=nousersselected section=admin}</div>
</div>
{/if}
</div>
{include file="footer.tpl"}
......@@ -11,6 +11,8 @@ Scenario: Turning the switches on and off on user search page (Bug 1431569)
| userA | Password1 | test01@example.com | Pete | Mc | mahara | internal | admin |
And I follow "Administration"
And I choose "User search" in "Users"
And I follow "Advanced options"
And I follow "P" in the "div#firstnamelist" "css_element"
And I follow "userA"
And I should see "Account settings: Pete Mc (userA)"
# Checking the default settings are right
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment