Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WR438262: Submission interface improvements #84

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lang/en/assignsubmission_maharaws.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$string['assign_submission_maharaws_name'] = 'Mahara Assignment submission (web services)';
$string['assign_submission_maharaws_description'] = 'Mahara functions used in Mahara assignment submission plugin.<br />Publishing this service on a Moodle site has no effect. Subscribe to this service if you want to be able to use assignments with {$a}.<br />';
$string['collectionsby'] = 'Collections by {$a}';
$string['currentsubmitted'] = 'Current submitted {$a}';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need a version bump for this string to come up.

$string['debug_help'] = 'Debug option to interupt the OAuth SSO login jump so parameters can be inspected';
$string['debug'] = 'Debug OAuth';
$string['defaultlockpages_help'] = 'Default setting to use for the "{$a}" setting in new Mahara assignments.';
Expand Down
33 changes: 28 additions & 5 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,19 +477,42 @@ public function get_form_elements_for_user($submission, MoodleQuickForm $mform,
);

foreach ($views['data'] as $view) {
$viewurl = "/view/view.php?id=" . $view['id'];
$anchor = $this->get_preview_url($view['title'], $viewurl, strip_tags($view['description']));
$mform->addElement('radio', 'viewid', '', $anchor, 'v' . $view['id']);
// If the view (page) hasn't already been submitted, add it to the options for selection.
if ($view['submissionoriginal'] == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does $view['submissionoriginal'] == 0 mean? Maybe add a comment explaining it? Same below on line 500

$viewurl = "/view/view.php?id=" . $view['id'];
$anchor = $this->get_preview_url($view['title'], $viewurl, strip_tags($view['description']));
$mform->addElement('radio', 'viewid', '', $anchor, 'v' . $view['id']);
}
if ($maharasubmission && $view['id'] == $maharasubmission->viewid) {
$currentpagesubmitted = $mform->createElement('static', 'currentsubmission',
get_string('currentsubmitted', 'assignsubmission_maharaws', 'page'), $view['displaytitle']);
Comment on lines +487 to +488
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this can can be abstracted to a method to avoid a code duplication. See pretty much same code at lines 506-507

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run out of time on this WR so can only do what's necessary to move it along I'm afraid.

}
}

if (!empty($currentpagesubmitted)) {
$mform->addElement($currentpagesubmitted);
}
}
if (!empty($views['collections']['data'])) {
$mform->addElement('static', 'collection_by',
get_string('collectionsby', 'assignsubmission_maharaws', $views['displayname'])
);
foreach ($views['collections']['data'] as $coll) {
$anchor = $this->get_preview_url($coll['name'], $coll['url'], strip_tags($coll['description']));
$mform->addElement('radio', 'viewid', '', $anchor, 'c' . $coll['id']);
// If the collection hasn't already been submitted, add it to the options for selection.
if ($coll['submissionoriginal'] == 0) {
$anchor = $this->get_preview_url($coll['name'], $coll['url'], strip_tags($coll['description']));
$mform->addElement('radio', 'viewid', '', $anchor, 'c' . $coll['id']);
}

if ($maharasubmission && $coll['id'] == $maharasubmission->viewid) {
$currentcollsubmitted = $mform->createElement('static', 'currentsubmission',
get_string('currentsubmitted', 'assignsubmission_maharaws', 'collection'), $coll['name']);
}
}
if (!empty($currentcollsubmitted)) {
$mform->addElement($currentcollsubmitted);
}

}
if (!empty($maharasubmission)) {
if ($maharasubmission->iscollection) {
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2023110900;
$plugin->release = 2023110900;
$plugin->version = 2024091300;
$plugin->release = 2024091300;
$plugin->requires = 2020061500;
$plugin->component = 'assignsubmission_maharaws';
$plugin->supported = [39, 403]; // Available as of Moodle 3.9.0 or later.
Expand Down
Loading