Skip to content

Commit

Permalink
MDL-46570 gradereport_history: Reworked search and load more mechanism
Browse files Browse the repository at this point in the history
Part of MDL-46191
  • Loading branch information
Frederic Massart authored and ankitagarwal committed Aug 22, 2014
1 parent 234f962 commit 855e137
Show file tree
Hide file tree
Showing 9 changed files with 520 additions and 337 deletions.
2 changes: 1 addition & 1 deletion grade/report/history/classes/filter_form.php
Expand Up @@ -52,7 +52,7 @@ public function definition() {
$userbutton = $this->_customdata['userbutton'];
$names = \html_writer::span('', 'selectednames');

$mform->addElement('static', 'userselect', get_string('selectuser', 'gradereport_history'), $userbutton);
$mform->addElement('static', 'userselect', get_string('selectusers', 'gradereport_history'), $userbutton);
$mform->addElement('static', 'selectednames', get_string('selectedusers', 'gradereport_history'), $names);

$mform->addElement('select', 'itemid', get_string('gradeitem', 'gradereport_history'), $itemids);
Expand Down
4 changes: 4 additions & 0 deletions grade/report/history/lang/en/gradereport_history.php
Expand Up @@ -29,8 +29,11 @@
$string['datetill'] = 'Date till';
$string['datetime'] = 'Date and time';
$string['deleteditemid'] = 'Delete item with id {$a}';
$string['errajaxsearch'] = 'Error when searching users';
$string['eventgradereportviewed'] = 'Grade history report viewed';
$string['excluded'] = 'Excluded from calculations';
$string['foundoneuser'] = '1 user found';
$string['foundnusers'] = '{$a} users found';
$string['feedbacktext'] = 'Feedback text';
$string['finishselectingusers'] = 'Finish selecting users';
$string['gradeitem'] = 'Grade item';
Expand All @@ -40,6 +43,7 @@
$string['history:view'] = 'View the grade history';
$string['historyperpage'] = 'History entries per page';
$string['historyperpage_help'] = 'This setting determines the number of history entries displayed per page in the history report.';
$string['loadmoreusers'] = 'Load more users...';
$string['locked'] = 'Locked';
$string['no'] = 'N';
$string['overridden'] = 'Overridden';
Expand Down
16 changes: 7 additions & 9 deletions grade/report/history/lib.php
Expand Up @@ -654,7 +654,7 @@ public function get_sort_arrows(array $extrafields = array()) {
*/
public static function get_user_select_button($courseid, $currentusers = array()) {
global $PAGE;
$button = new gradereport_history_user_button($PAGE->url, get_string('selectuser', 'gradereport_history'), 'get');
$button = new gradereport_history_user_button($PAGE->url, get_string('selectusers', 'gradereport_history'), 'get');
$button->class .= ' gradereport_history_plugin';

$modules = array('moodle-gradereport_history-userselector');
Expand All @@ -668,21 +668,19 @@ public static function get_user_select_button($courseid, $currentusers = array()
$function = 'Y.M.gradereport_history.UserSelector.init';
$button->require_yui_module($modules, $function, array($arguments));
$button->strings_for_js(array(
'ajaxoneuserfound',
'ajaxxusersfound',
'ajaxnext25',
'errajaxsearch',
'none',
'usersearch'), 'enrol');
$button->strings_for_js(array(
'selectusers',
'finishselectingusers',
'foundoneuser',
'foundnusers',
'loadmoreusers',
'selectusers',
), 'gradereport_history');
$button->strings_for_js(array(
'loading'
), 'admin');
$button->strings_for_js(array(
'select'
'noresults',
'search'
));

return $button;
Expand Down
96 changes: 65 additions & 31 deletions grade/report/history/styles.css
Expand Up @@ -17,54 +17,88 @@ table#gradestable th.header.selected {
overflow-x: scroll;
}

.path-grade-report-history .singlebutton div {
margin-bottom: 0;
}

.path-grade-report-history .singlebutton div,
.path-grade-report-history .singlebutton div input[type="button"] {
margin-bottom: 0;
margin: 0;
}

/* User Selector */
.yui3-gradereport_history_usp-hidden {display:none;}

.gradereport_history_usp .usp-content {
position: relative;
}
.gradereport_history_usp .usp-ajax-content {
height: 375px;
overflow: auto;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
.gradereport_history_usp .usp-search-results .totalusers {
text-align: center;
font-size: .8em;
font-weight: bold;
.gradereport_history_usp .usp-ajax-content,
.gradereport_history_usp .usp-loading-lightbox {
height: 375px;
}
.gradereport_history_usp .user {width:100%;text-align:left;font-size:9pt;border-bottom:1px solid #ddd;border-top:1px solid #eee;}
.gradereport_history_usp .user:nth-child(odd) {border-bottom:1px solid #ddd;border-top:1px solid #eee;background-color:#f9f9f9;}
.gradereport_history_usp .usp-checkbox {width:20px;float:left;font-size:7pt;line-height:41px;border-right:1px solid #ddd;background-color:#EEE;text-align:right;padding:2px;}
.gradereport_history_usp .user .picture {width:45px;float:left;margin:3px;}
.gradereport_history_usp .user .details {width:250px;float:left;margin:3px;}
.gradereport_history_usp .user .options {padding-right:7px;font-size:8pt;margin:3px;}
.gradereport_history_usp .user .options .deselect {margin:3px;float:right;cursor:pointer;display: none;}
.gradereport_history_usp .user .options .select {margin:3px;float:right;cursor:pointer;}
.gradereport_history_usp .user.selected .checkbox {width:40px;color:#eee;}
.gradereport_history_usp .user.selected .select { display: none; }
.gradereport_history_usp .user.selected .deselect { display: block; }
.gradereport_history_usp .usp-more-results {background-color:#eee;padding:5px;border-top:1px solid #BBB;}

.gradereport_history_usp .usp-loading-lightbox {
background-color: #fff;
opacity: .5;
position: absolute;
text-align: center;
width: 100%;
top: 0;
left: 0;
}
.gradereport_history_usp .usp-loading-lightbox .loading-icon {
margin: 2em;
.gradereport_history_usp .usp-loading-lightbox img {
margin-top: 100px;
opacity: 1;
}

.gradereport_history_usp .usp-search {
text-align: center;
}

.gradereport_history_usp .usp-footer {
padding: 3px;
.gradereport_history_usp .user {
width: 100%;
text-align: left;
border-top: 1px solid #eee;
}
.gradereport_history_usp .user:nth-child(odd) {
background-color: #f9f9f9;
}
.gradereport_history_usp .usp-first-added {
border-top: 1px solid #bbb;
}
.gradereport_history_usp .usp-checkbox {
text-align: center;
float: left;
padding: 11px 6px 0 6px;
}
.gradereport_history_usp .usp-checkbox input {
margin: 0;
}
.gradereport_history_usp .usp-picture {
margin: 6px 3px 0 3px;
float: left;
}
.gradereport_history_usp .userpicture{
cursor: pointer;
}
.gradereport_history_usp .user .details {
margin-left: 67px;
padding: 3px 6px 0 6px;
}
.gradereport_history_usp .user .details label {
margin: 0;
}
.gradereport_history_usp .usp-more-results {
padding: 5px;
border-top: 1px solid #bbb;
}
.gradereport_history_usp .usp-finish {
padding-top: 1em;
text-align: center;
}
.gradereport_history_usp .usp-search {margin:3px;}
.gradereport_history_usp .usp-search label {padding-right:8px;}
.gradereport_history_usp .usp-search input {width:50%;}
.gradereport_history_usp .usp-search input.usp-search-btn {width:20%;}
.gradereport_history_usp .usp-finish input {
margin: 0;
}

.dir-rtl .gradereport_history_usp .usp-search-results .user { text-align: right;}
.dir-rtl .gradereport_history_usp .usp-content .usp-controls { text-align: right;}
Expand Down

0 comments on commit 855e137

Please sign in to comment.