Merge branch 'MDL-33431' of git://github.com/netspotau/moodle-mod_assign
This commit is contained in:
+7
-3
@@ -451,9 +451,13 @@ class flexible_table {
|
||||
$this->sess->sortby = array_slice($this->sess->sortby, 0, $this->maxsortkeys);
|
||||
}
|
||||
|
||||
// If we didn't sort just now, then use the default sort order if one is defined and the column exists
|
||||
if (empty($this->sess->sortby) && !empty($this->sort_default_column)) {
|
||||
$this->sess->sortby = array ($this->sort_default_column => ($this->sort_default_order == SORT_DESC ? SORT_DESC : SORT_ASC));
|
||||
// MDL-35375 - If a default order is defined and it is not in the current list of order by columns, add it at the end.
|
||||
// This prevents results from being returned in a random order if the only order by column contains equal values.
|
||||
if (!empty($this->sort_default_column)) {
|
||||
if (!array_key_exists($this->sort_default_column, $this->sess->sortby)) {
|
||||
$defaultsort = array($this->sort_default_column => $this->sort_default_order);
|
||||
$this->sess->sortby = array_merge($this->sess->sortby, $defaultsort);
|
||||
}
|
||||
}
|
||||
|
||||
$ilast = optional_param($this->request[TABLE_VAR_ILAST], null, PARAM_RAW);
|
||||
|
||||
@@ -162,8 +162,8 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
get_string('selectall') .
|
||||
'"/></div>';
|
||||
|
||||
// Edit links.
|
||||
$columns[] = 'edit';
|
||||
// We have to call this column userid so we can use userid as a default sortable column.
|
||||
$columns[] = 'userid';
|
||||
$headers[] = get_string('edit');
|
||||
}
|
||||
|
||||
@@ -281,8 +281,11 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
// set the columns
|
||||
$this->define_columns($columns);
|
||||
$this->define_headers($headers);
|
||||
// We require at least one unique column for the sort.
|
||||
$this->sortable(true, 'userid');
|
||||
$this->no_sorting('recordid');
|
||||
$this->no_sorting('finalgrade');
|
||||
$this->no_sorting('edit');
|
||||
$this->no_sorting('userid');
|
||||
$this->no_sorting('select');
|
||||
$this->no_sorting('outcomes');
|
||||
|
||||
@@ -291,14 +294,17 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
$this->no_sorting('teamstatus');
|
||||
}
|
||||
|
||||
$plugincolumnindex = 0;
|
||||
foreach ($this->assignment->get_submission_plugins() as $plugin) {
|
||||
if ($plugin->is_visible() && $plugin->is_enabled() && $plugin->has_user_summary()) {
|
||||
$this->no_sorting('assignsubmission_' . $plugin->get_type());
|
||||
$submissionpluginindex = 'plugin' . $plugincolumnindex++;
|
||||
$this->no_sorting($submissionpluginindex);
|
||||
}
|
||||
}
|
||||
foreach ($this->assignment->get_feedback_plugins() as $plugin) {
|
||||
if ($plugin->is_visible() && $plugin->is_enabled() && $plugin->has_user_summary()) {
|
||||
$this->no_sorting('assignfeedback_' . $plugin->get_type());
|
||||
$feedbackpluginindex = 'plugin' . $plugincolumnindex++;
|
||||
$this->no_sorting($feedbackpluginindex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,7 +675,7 @@ class assign_grading_table extends table_sql implements renderable {
|
||||
* @param stdClass $row
|
||||
* @return string
|
||||
*/
|
||||
function col_edit(stdClass $row) {
|
||||
function col_userid(stdClass $row) {
|
||||
$edit = '';
|
||||
if ($this->rownum < 0) {
|
||||
$this->rownum = $this->currpage * $this->pagesize;
|
||||
|
||||
@@ -309,6 +309,8 @@ $string['viewownsubmissionform'] = 'View own submit assignment page.';
|
||||
$string['viewownsubmissionstatus'] = 'View own submission status page.';
|
||||
$string['viewsubmissionforuser'] = 'View submission for user: {$a}';
|
||||
$string['viewsubmission'] = 'View submission';
|
||||
$string['viewfull'] = 'View full';
|
||||
$string['viewsummary'] = 'View summary';
|
||||
$string['viewsubmissiongradingtable'] = 'View submission grading table.';
|
||||
$string['viewrevealidentitiesconfirm'] = 'View reveal student identities confirmation page.';
|
||||
|
||||
|
||||
+60
-1
@@ -86,7 +86,6 @@ M.mod_assign.init_grading_table = function(Y) {
|
||||
} else {
|
||||
confirmmessage = eval('M.str.assign.batchoperationconfirm' + operation.get('value'));
|
||||
}
|
||||
console.log(confirmmessage);
|
||||
if (!confirm(confirmmessage)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
@@ -151,3 +150,63 @@ M.mod_assign.init_grade_change = function(Y) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
M.mod_assign.init_plugin_summary = function(Y, subtype, type, submissionid) {
|
||||
suffix = subtype + '_' + type + '_' + submissionid;
|
||||
classname = 'contract_' + suffix;
|
||||
contract = Y.one('.' + classname);
|
||||
if (contract) {
|
||||
contract.on('click', function(e) {
|
||||
img = e.target;
|
||||
imgclasses = img.getAttribute('class').split(' ');
|
||||
for (i = 0; i < imgclasses.length; i++) {
|
||||
classname = imgclasses[i];
|
||||
if (classname.indexOf('contract_') == 0) {
|
||||
thissuffix = classname.substr(9);
|
||||
}
|
||||
}
|
||||
fullclassname = 'full_' + thissuffix;
|
||||
full = Y.one('.' + fullclassname);
|
||||
if (full) {
|
||||
full.hide(true);
|
||||
}
|
||||
summaryclassname = 'summary_' + thissuffix;
|
||||
summary = Y.one('.' + summaryclassname);
|
||||
if (summary) {
|
||||
summary.show(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
classname = 'expand_' + suffix;
|
||||
expand = Y.one('.' + classname);
|
||||
|
||||
full = Y.one('.full_' + suffix);
|
||||
if (full) {
|
||||
full.hide();
|
||||
full.toggleClass('hidefull');
|
||||
}
|
||||
if (expand) {
|
||||
expand.on('click', function(e) {
|
||||
img = e.target;
|
||||
imgclasses = img.getAttribute('class').split(' ');
|
||||
for (i = 0; i < imgclasses.length; i++) {
|
||||
classname = imgclasses[i];
|
||||
if (classname.indexOf('expand_') == 0) {
|
||||
thissuffix = classname.substr(7);
|
||||
}
|
||||
}
|
||||
summaryclassname = 'summary_' + thissuffix;
|
||||
summary = Y.one('.' + summaryclassname);
|
||||
if (summary) {
|
||||
summary.hide(true);
|
||||
}
|
||||
fullclassname = 'full_' + thissuffix;
|
||||
full = Y.one('.' + fullclassname);
|
||||
if (full) {
|
||||
full.show(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+63
-6
@@ -632,12 +632,28 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
$o = '';
|
||||
|
||||
if ($submissionplugin->view == assign_submission_plugin_submission::SUMMARY) {
|
||||
$icon = $this->output->pix_icon('t/preview', get_string('view' . substr($submissionplugin->plugin->get_subtype(), strlen('assign')), 'mod_assign'));
|
||||
$link = '';
|
||||
$showviewlink = false;
|
||||
$summary = $submissionplugin->plugin->view_summary($submissionplugin->submission, $showviewlink);
|
||||
|
||||
$classsuffix = $submissionplugin->plugin->get_subtype() . '_' . $submissionplugin->plugin->get_type() . '_' . $submissionplugin->submission->id;
|
||||
$o .= $this->output->box_start('boxaligncenter plugincontentsummary summary_' . $classsuffix);
|
||||
|
||||
$link = '';
|
||||
if ($showviewlink) {
|
||||
$link = $this->output->action_link(
|
||||
$previewstr = get_string('viewsubmission', 'assign');
|
||||
$icon = $this->output->pix_icon('t/preview', $previewstr);
|
||||
|
||||
$expandstr = get_string('viewfull', 'assign');
|
||||
$classes = 'expandsummaryicon expand_' . $classsuffix;
|
||||
$o .= $this->output->pix_icon('t/switch_plus', $expandstr, null, array('class'=>$classes));
|
||||
|
||||
$jsparams = array($submissionplugin->plugin->get_subtype(),
|
||||
$submissionplugin->plugin->get_type(),
|
||||
$submissionplugin->submission->id);
|
||||
$this->page->requires->js_init_call('M.mod_assign.init_plugin_summary', $jsparams);
|
||||
|
||||
$link .= '<noscript>';
|
||||
$link .= $this->output->action_link(
|
||||
new moodle_url('/mod/assign/view.php',
|
||||
array('id' => $submissionplugin->coursemoduleid,
|
||||
'sid'=>$submissionplugin->submission->id,
|
||||
@@ -646,11 +662,23 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
'returnaction'=>$submissionplugin->returnaction,
|
||||
'returnparams'=>http_build_query($submissionplugin->returnparams))),
|
||||
$icon);
|
||||
$link .= '</noscript>';
|
||||
|
||||
$link .= $this->output->spacer(array('width'=>15));
|
||||
}
|
||||
|
||||
$o .= $link . $summary;
|
||||
$o .= $this->output->box_end();
|
||||
if ($showviewlink) {
|
||||
$o .= $this->output->box_start('boxaligncenter hidefull full_' . $classsuffix);
|
||||
$classes = 'expandsummaryicon contract_' . $classsuffix;
|
||||
$o .= $this->output->pix_icon('t/switch_minus',
|
||||
get_string('viewsummary', 'assign'),
|
||||
null,
|
||||
array('class'=>$classes));
|
||||
$o .= $submissionplugin->plugin->view($submissionplugin->submission);
|
||||
$o .= $this->output->box_end();
|
||||
}
|
||||
} else if ($submissionplugin->view == assign_submission_plugin_submission::FULL) {
|
||||
$o .= $this->output->box_start('boxaligncenter submissionfull');
|
||||
$o .= $submissionplugin->plugin->view($submissionplugin->submission);
|
||||
@@ -699,12 +727,28 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
$o = '';
|
||||
|
||||
if ($feedbackplugin->view == assign_feedback_plugin_feedback::SUMMARY) {
|
||||
$icon = $this->output->pix_icon('t/preview', get_string('view' . substr($feedbackplugin->plugin->get_subtype(), strlen('assign')), 'mod_assign'));
|
||||
$link = '';
|
||||
$showviewlink = false;
|
||||
$summary = $feedbackplugin->plugin->view_summary($feedbackplugin->grade, $showviewlink);
|
||||
|
||||
$classsuffix = $feedbackplugin->plugin->get_subtype() . '_' . $feedbackplugin->plugin->get_type() . '_' . $feedbackplugin->grade->id;
|
||||
$o .= $this->output->box_start('boxaligncenter plugincontentsummary summary_' . $classsuffix);
|
||||
|
||||
$link = '';
|
||||
if ($showviewlink) {
|
||||
$link = $this->output->action_link(
|
||||
$previewstr = get_string('viewfeedback', 'assign');
|
||||
$icon = $this->output->pix_icon('t/preview', $previewstr);
|
||||
|
||||
$expandstr = get_string('viewfull', 'assign');
|
||||
$classes = 'expandsummaryicon expand_' . $classsuffix;
|
||||
$o .= $this->output->pix_icon('t/switch_plus', $expandstr, null, array('class'=>$classes));
|
||||
|
||||
$jsparams = array($feedbackplugin->plugin->get_subtype(),
|
||||
$feedbackplugin->plugin->get_type(),
|
||||
$feedbackplugin->grade->id);
|
||||
$this->page->requires->js_init_call('M.mod_assign.init_plugin_summary', $jsparams);
|
||||
|
||||
$link .= '<noscript>';
|
||||
$link .= $this->output->action_link(
|
||||
new moodle_url('/mod/assign/view.php',
|
||||
array('id' => $feedbackplugin->coursemoduleid,
|
||||
'gid'=>$feedbackplugin->grade->id,
|
||||
@@ -713,10 +757,23 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
'returnaction'=>$feedbackplugin->returnaction,
|
||||
'returnparams'=>http_build_query($feedbackplugin->returnparams))),
|
||||
$icon);
|
||||
$link .= '</noscript>';
|
||||
|
||||
$link .= $this->output->spacer(array('width'=>15));
|
||||
}
|
||||
|
||||
$o .= $link . $summary;
|
||||
$o .= $this->output->box_end();
|
||||
if ($showviewlink) {
|
||||
$o .= $this->output->box_start('boxaligncenter hidefull full_' . $classsuffix);
|
||||
$classes = 'expandsummaryicon contract_' . $classsuffix;
|
||||
$o .= $this->output->pix_icon('t/switch_minus',
|
||||
get_string('viewsummary', 'assign'),
|
||||
null,
|
||||
array('class'=>$classes));
|
||||
$o .= $feedbackplugin->plugin->view($feedbackplugin->grade);
|
||||
$o .= $this->output->box_end();
|
||||
}
|
||||
} else if ($feedbackplugin->view == assign_feedback_plugin_feedback::FULL) {
|
||||
$o .= $this->output->box_start('boxaligncenter feedbackfull');
|
||||
$o .= $feedbackplugin->plugin->view($feedbackplugin->grade);
|
||||
|
||||
@@ -134,3 +134,16 @@ div.earlysubmission {
|
||||
td.submissioneditable {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.expandsummaryicon {
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jsenabled .expandsummaryicon {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.hidefull {
|
||||
display: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user