Permalink
Browse files

Merge branch 'master' into install_master

  • Loading branch information...
2 parents 4b5cc94 + 1e374df commit a1327196eedd7223fe60eec6bbfbe74a15be6ad8 AMOS bot committed May 14, 2013
Showing with 252 additions and 216 deletions.
  1. +21 −21 admin/tool/installaddon/lang/en/tool_installaddon.php
  2. +31 −12 badges/award.php
  3. +14 −10 badges/backpack.js
  4. +3 −0 badges/criteria.php
  5. +3 −0 badges/edit.php
  6. +4 −0 badges/index.php
  7. +4 −0 badges/newbadge.php
  8. +3 −0 badges/overview.php
  9. +3 −0 badges/recipients.php
  10. +4 −0 badges/view.php
  11. +1 −1 blocks/badges/lang/en/block_badges.php
  12. +1 −1 blocks/glossary_random/lang/en/block_glossary_random.php
  13. +1 −1 blocks/mentees/lang/en/block_mentees.php
  14. +1 −1 blocks/news_items/lang/en/block_news_items.php
  15. +1 −1 blocks/online_users/lang/en/block_online_users.php
  16. +1 −1 cache/stores/mongodb/lang/en/cachestore_mongodb.php
  17. +3 −0 course/editsection_form.php
  18. +1 −1 grade/edit/tree/calculation.php
  19. +1 −1 grade/grading/form/rubric/lang/en/gradingform_rubric.php
  20. +1 −0 grade/import/xml/grade_import_form.php
  21. +14 −14 lang/en/admin.php
  22. +1 −1 lang/en/backup.php
  23. +19 −21 lang/en/badges.php
  24. +3 −3 lang/en/condition.php
  25. +1 −1 lang/en/hub.php
  26. +3 −5 lang/en/moodle.php
  27. +3 −3 lang/en/plugin.php
  28. +11 −3 lib/form/yui/dateselector/dateselector.js
  29. +1 −1 lib/navigationlib.php
  30. +6 −0 lib/upgradelib.php
  31. +1 −1 mod/assignment/lang/en/assignment.php
  32. +1 −1 mod/chat/lang/en/chat.php
  33. +1 −1 mod/feedback/lang/en/feedback.php
  34. +1 −3 mod/forum/lang/en/forum.php
  35. +18 −39 mod/lti/lang/en/lti.php
  36. +1 −1 mod/page/lang/en/page.php
  37. +1 −1 mod/resource/lang/en/resource.php
  38. +40 −41 mod/scorm/lang/en/scorm.php
  39. +1 −1 mod/scorm/report/basic/lang/en/scormreport_basic.php
  40. +1 −1 mod/scorm/report/interactions/lang/en/scormreport_interactions.php
  41. +0 −1 mod/url/lang/en/url.php
  42. +1 −0 mod/url/mod_form.php
  43. +1 −0 question/type/calculated/datasetitems_form.php
  44. +7 −7 question/type/numerical/edit_numerical_form.php
  45. +6 −8 repository/boxnet/lang/en/repository_boxnet.php
  46. +2 −2 theme/bootstrapbase/renderers.php
  47. 0 theme/bootstrapbase/renderers/{core.php → core_renderer.php}
  48. +1 −1 theme/bootstrapbase/version.php
  49. +2 −2 theme/formal_white/lang/en/theme_formal_white.php
  50. +2 −2 version.php
@@ -29,36 +29,36 @@
$string['acknowledgement'] = 'Acknowledgement';
$string['acknowledgementmust'] = 'You must acknowledge this';
$string['acknowledgementtext'] = 'I understand that it is my responsibility to have full backups of this site prior to installing add-ons. I accept and understand that add-ons (especially but not only those originating in unofficial sources) may contain security holes, can make the site unavailable, or cause private data leaks or loss.';
-$string['featuredisabled'] = 'Add-on installer is disabled at this site.';
+$string['featuredisabled'] = 'The add-on installer is disabled on this site.';
$string['installaddon'] = 'Install add-on!';
$string['installaddons'] = 'Install add-ons';
-$string['installexception'] = 'Oops... An error occured while trying to install the add-on. Turn debugging mode on to see more details about the error.';
-$string['installfromrepo'] = 'Install add-ons from Moodle plugins directory';
-$string['installfromrepo_help'] = 'You will be redirected to the Moodle plugins directory to search for and install an add-on. Note that your site fullname, URL and major version will be sent as well, to make the installation process easier for you.';
-$string['installfromzip'] = 'Install add-on from the ZIP file';
-$string['installfromzip_help'] = 'Alternatively to installing add-ons directly from the Moodle plugins directory, you can install add-ons from manually uploaded ZIP packages. Such ZIP packages are expected to have same structure as the ones available in the Moodle plugins directory.';
+$string['installexception'] = 'Oops... An error occurred while trying to install the add-on. Turn debugging mode on to see details of the error.';
+$string['installfromrepo'] = 'Install add-ons from the Moodle plugins directory';
+$string['installfromrepo_help'] = 'You will be redirected to the Moodle plugins directory to search for and install an add-on. Note that your site full name, URL and Moodle version will be sent as well, to make the installation process easier for you.';
+$string['installfromzip'] = 'Install add-on from ZIP file';
+$string['installfromzip_help'] = 'An alternative to installing an add-on directly from the Moodle plugins directory is to upload a ZIP package of the add-on. The ZIP package should have the same structure as a package downloaded from the Moodle plugins directory.';
$string['installfromzipfile'] = 'ZIP package';
-$string['installfromzipfile_help'] = 'The plugin ZIP package must contain just one directory with the name of the plugin. The ZIP will be extracted into the appropriate location for the given plugin type. Packages downloaded from the Moodle plugins directory have this format.';
+$string['installfromzipfile_help'] = 'The plugin ZIP package must contain just one directory, named to match the plugin. The ZIP will be extracted into an appropriate location for the plugin type. If the package has been downloaded from the Moodle plugins directory then it will have this structure.';
$string['installfromziprootdir'] = 'Rename the root directory';
-$string['installfromziprootdir_help'] = 'Some ZIP packages, such as those generated by Github, may contain incorrect name of the root directory. You can rename the root directory of the extracted package to the correct value defined in this field.';
+$string['installfromziprootdir_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. If so, the correct name may be entered here.';
$string['installfromzipsubmit'] = 'Install add-on from the ZIP file';
$string['installfromziptype'] = 'Plugin type';
-$string['installfromziptype_help'] = 'Choose the correct type of plugin you are about to install. The installation procedure may fail badly when incorrect plugin type is provided.';
-$string['permcheck'] = 'Make sure the plugin type root location is writable by the web server process';
+$string['installfromziptype_help'] = 'Choose the correct type of plugin you are about to install. Warning: The installation procedure can fail badly if an incorrect plugin type is specified.';
+$string['permcheck'] = 'Make sure the plugin type root location is writable by the web server process.';
$string['permcheckerror'] = 'Error while checking for write permission';
$string['permcheckprogress'] = 'Checking for write permission ...';
-$string['permcheckresultno'] = 'Plugin type location <em>{$a->path}</em> not writable';
+$string['permcheckresultno'] = 'Plugin type location <em>{$a->path}</em> is not writable';
$string['permcheckresultyes'] = 'Plugin type location <em>{$a->path}</em> is writable';
$string['pluginname'] = 'Add-on installer';
-$string['remoterequestalreadyinstalled'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory to this site. This plugin is <strong>already installed</strong> at this site.';
-$string['remoterequestconfirm'] = 'There is a request to install add-on <strong>{$a->name}</strong> ({$a->component}) version {$a->version} from the Moodle plugins directory to this site. If you continue, the add-on ZIP package will be downloaded for validation. Nothing will be installed yet.';
-$string['remoterequestinvalid'] = 'There is a request to install add-on from the Moodle plugins directory to this site. Unfortunately, the request is not valid. The add-on cannot be installed.';
-$string['remoterequestpermcheck'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory to this site. The plugin type location <strong>{$a->typepath}</strong> is <strong>not writable</strong> though. You need to give the write access for the web server user to the plugin type location now. Once the write access is granted, press the continue button to repeat the check.';
-$string['remoterequestpluginfoexception'] = 'Oops... An error occured while trying to obtain information about the add-on {$a->name} ({$a->component}) version {$a->version}. The add-on cannot be installed. Turn debugging mode on to see more details about the error.';
+$string['remoterequestalreadyinstalled'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, this plugin is <strong>already installed</strong> on the site.';
+$string['remoterequestconfirm'] = 'There is a request to install add-on <strong>{$a->name}</strong> ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. If you continue, the add-on ZIP package will be downloaded for validation. Nothing will be installed yet.';
+$string['remoterequestinvalid'] = 'There is a request to install an add-on from the Moodle plugins directory on this site. Unfortunately the request is not valid and so the add-on cannot be installed.';
+$string['remoterequestpermcheck'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, the plugin type location <strong>{$a->typepath}</strong> is <strong>not writable</strong>. You need to give write access for the web server user to the plugin type location, then press the continue button to repeat the check.';
+$string['remoterequestpluginfoexception'] = 'Oops... An error occurred while trying to obtain information about the add-on {$a->name} ({$a->component}) version {$a->version}. The add-on cannot be installed. Turn debugging mode on to see details of the error.';
$string['validation'] = 'Add-on package validation';
$string['validationmsg_componentmatch'] = 'Full component name';
$string['validationmsg_componentmismatchname'] = 'Add-on name mismatch';
-$string['validationmsg_componentmismatchname_help'] = 'Some ZIP packages, such as those generated by Github, may contain incorrect name of the root directory. You have to fix the name of the root directory to match the declared add-on name.';
+$string['validationmsg_componentmismatchname_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the declared add-on name.';
$string['validationmsg_componentmismatchname_info'] = 'The add-on declares its name is \'{$a}\' but that does not match the name of the root directory.';
$string['validationmsg_componentmismatchtype'] = 'Add-on type mismatch';
$string['validationmsg_componentmismatchtype_info'] = 'You have selected the type \'{$a->expected}\' but the add-on declares its type is \'{$a->found}\'.';
@@ -69,7 +69,7 @@
$string['validationmsg_maturity'] = 'Declared maturity level';
$string['validationmsg_maturity_help'] = 'The add-on can declare its maturity level. If the maintainer considers the add-on stable, the declared maturity level will read MATURITY_STABLE. All other maturity levels (such as alpha or beta) should be considered unstable and a warning is raised.';
$string['validationmsg_missingexpectedlangenfile'] = 'English language file name mismatch';
-$string['validationmsg_missingexpectedlangenfile_info'] = 'The given add-on type would need to provide the English language file {$a}.';
+$string['validationmsg_missingexpectedlangenfile_info'] = 'The given add-on type is missing the expected English language file {$a}.';
$string['validationmsg_missinglangenfile'] = 'No English language file found';
$string['validationmsg_missinglangenfolder'] = 'Missing English language folder';
$string['validationmsg_missingversion'] = 'Add-on does not declare its version';
@@ -83,8 +83,8 @@
$string['validationmsg_requiresmoodle'] = 'Required Moodle version';
$string['validationmsg_rootdir'] = 'Name of the add-on to be installed';
$string['validationmsg_rootdir_help'] = 'The name of the root directory in the ZIP package forms the name of the add-on to be installed. If the name is not correct, you may wish to rename the root directory in the ZIP prior to installing the add-on.';
-$string['validationmsg_rootdirinvalid'] = 'Invalid name of the add-on';
-$string['validationmsg_rootdirinvalid_help'] = 'The name of the root directory in the ZIP package violates formal syntax requirements. Some ZIP packages, such as those generated by Github, may contain incorrect name of the root directory. You have to fix the name of the root directory to match the add-on name.';
+$string['validationmsg_rootdirinvalid'] = 'Invalid add-on name';
+$string['validationmsg_rootdirinvalid_help'] = 'The name of the root directory in the ZIP package violates formal syntax requirements. Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the add-on name.';
$string['validationmsg_targetexists'] = 'Target location already exists';
$string['validationmsg_targetexists_help'] = 'The directory that the add-on is to be installed to, must not exist yet.';
$string['validationmsg_unknowntype'] = 'Unknown plugin type';
@@ -93,7 +93,7 @@
$string['validationmsglevel_info'] = 'OK';
$string['validationmsglevel_warning'] = 'Warning';
$string['validationresult0'] = 'Validation failed!';
-$string['validationresult0_help'] = 'Some serious problem was detected. It is not safe to install the add-on. See the validation log messages for more details.';
+$string['validationresult0_help'] = 'A serious problem was detected and so it is not safe to install the add-on. See the validation log messages for details.';
$string['validationresult1'] = 'Validation passed!';
$string['validationresult1_help'] = 'No serious problems were detected. You can continue with the add-on installation. See the validation log messages for more details and eventual warnings.';
$string['validationresult1_help'] = 'The add-on package has been validated and no serious problems were detected.';
View
@@ -30,6 +30,7 @@
$badgeid = required_param('id', PARAM_INT);
$role = optional_param('role', 0, PARAM_INT);
+$award = optional_param('award', false, PARAM_BOOL);
require_login();
@@ -44,6 +45,9 @@
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
if ($badge->type == BADGE_TYPE_COURSE) {
+ if (empty($CFG->badges_allowcoursebadges)) {
+ print_error('coursebadgesdisabled', 'badges');
+ }
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
@@ -72,37 +76,52 @@
$output = $PAGE->get_renderer('core', 'badges');
// Roles that can award this badge.
-$accepted_roles = array_keys($badge->criteria[BADGE_CRITERIA_TYPE_MANUAL]->params);
+$acceptedroles = array_keys($badge->criteria[BADGE_CRITERIA_TYPE_MANUAL]->params);
-// If site admin, select a role to award a badge.
-if ($isadmin) {
- list($usertest, $userparams) = $DB->get_in_or_equal($accepted_roles, SQL_PARAMS_NAMED, 'existing', true);
+if (count($acceptedroles) > 1) {
+ // If there is more than one role that can award a badge, prompt user to make a selection.
+ // If it is an admin, include all accepted roles, otherwise only the ones that current user has in this context.
+ if ($isadmin) {
+ $selection = $acceptedroles;
+ } else {
+ // Get all the roles that user has and use the ones required by this badge.
+ $roles = get_user_roles($context, $USER->id);
+ $roleids = array_map(create_function('$o', 'return $o->roleid;'), $roles);
+ $selection = array_intersect($acceptedroles, $roleids);
+ }
+ list($usertest, $userparams) = $DB->get_in_or_equal($selection, SQL_PARAMS_NAMED, 'existing', true);
$options = $DB->get_records_sql('SELECT * FROM {role} WHERE id ' . $usertest, $userparams);
foreach ($options as $p) {
$select[$p->id] = role_get_name($p);
}
if (!$role) {
+ $pageurl = new moodle_url('/badges/award.php', array('id' => $badgeid));
echo $OUTPUT->header();
- echo $OUTPUT->box(get_string('adminaward', 'badges') . $OUTPUT->single_select(new moodle_url($PAGE->url), 'role', $select));
+ echo $OUTPUT->box(get_string('selectaward', 'badges') . $OUTPUT->single_select(new moodle_url($pageurl), 'role', $select));
echo $OUTPUT->footer();
die();
} else {
+ $pageurl = new moodle_url('/badges/award.php', array('id' => $badgeid));
$issuerrole = new stdClass();
$issuerrole->roleid = $role;
- $roleselect = get_string('adminaward', 'badges') . $OUTPUT->single_select(new moodle_url($PAGE->url), 'role', $select, $role);
+ $roleselect = get_string('selectaward', 'badges') . $OUTPUT->single_select(new moodle_url($pageurl), 'role', $select, $role);
}
} else {
- // Current user's role.
- $roles = get_user_roles($context, $USER->id);
- $issuerrole = array_shift($roles);
- if (!isset($issuerrole->roleid) || !in_array($issuerrole->roleid, $accepted_roles)) {
+ // User has to be an admin or the one with the required role.
+ $users = get_role_users($acceptedroles[0], $context, false, 'u.id', 'u.id ASC');
+ $usersids = array_keys($users);
+ if (!$isadmin && !in_array($USER->id, $usersids)) {
echo $OUTPUT->header();
$rlink = html_writer::link(new moodle_url('recipients.php', array('id' => $badge->id)), get_string('recipients', 'badges'));
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $rlink));
echo $OUTPUT->footer();
die();
+ } else {
+ $issuerrole = new stdClass();
+ $issuerrole->roleid = $acceptedroles[0];
}
}
+
$options = array(
'badgeid' => $badge->id,
'context' => $context,
@@ -113,7 +132,7 @@
$recipientselector = new badge_potential_users_selector('potentialrecipients', $options);
$recipientselector->set_existing_recipients($existingselector->find_users(''));
-if (optional_param('award', false, PARAM_BOOL) && data_submitted() && has_capability('moodle/badges:awardbadge', $context)) {
+if ($award && data_submitted() && has_capability('moodle/badges:awardbadge', $context)) {
require_sesskey();
$users = $recipientselector->get_selected_users();
foreach ($users as $user) {
@@ -136,7 +155,7 @@
echo $OUTPUT->header();
echo $OUTPUT->heading($strrecipients);
-if ($isadmin) {
+if (count($acceptedroles) > 1) {
echo $OUTPUT->box($roleselect);
}
View
@@ -10,19 +10,23 @@ function addtobackpack(event, args) {
*/
function check_site_access() {
var add = Y.one('#check_connection');
+
var callback = {
- success: function(o) {
- var data = Y.JSON.parse(o.responseText);
- if (data.code == 'http-unreachable') {
- add.setHTML(data.response);
- add.removeClass('hide');
+ method: "GET",
+ on: {
+ success: function(id, o, args) {
+ var data = Y.JSON.parse(o.responseText);
+ if (data.code == 'http-unreachable') {
+ add.setHTML(data.response);
+ add.removeClass('hide');
+ }
+ },
+ failure: function(o) { }
}
- },
- failure: function(o) { }
- };
+ };
- YUI().use('yui2-connection', function (Y) {
- Y.YUI2.util.Connect.asyncRequest('GET', 'ajax.php', callback, null);
+ Y.use('io-base', function(Y) {
+ Y.io('ajax.php', callback);
});
return false;
View
@@ -41,6 +41,9 @@
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
if ($badge->type == BADGE_TYPE_COURSE) {
+ if (empty($CFG->badges_allowcoursebadges)) {
+ print_error('coursebadgesdisabled', 'badges');
+ }
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
View
@@ -44,6 +44,9 @@
require_capability('moodle/badges:configuredetails', $context);
if ($badge->type == BADGE_TYPE_COURSE) {
+ if (empty($CFG->badges_allowcoursebadges)) {
+ print_error('coursebadgesdisabled', 'badges');
+ }
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
View
@@ -56,6 +56,10 @@
print_error('badgesdisabled', 'badges');
}
+if (empty($CFG->badges_allowcoursebadges) && ($type == BADGE_TYPE_COURSE)) {
+ print_error('coursebadgesdisabled', 'badges');
+}
+
$err = '';
$urlparams = array('sort' => $sortby, 'dir' => $sorthow, 'page' => $page);
View
@@ -37,6 +37,10 @@
print_error('badgesdisabled', 'badges');
}
+if (empty($CFG->badges_allowcoursebadges) && ($type == BADGE_TYPE_COURSE)) {
+ print_error('coursebadgesdisabled', 'badges');
+}
+
$title = get_string('create', 'badges');
if (($type == BADGE_TYPE_COURSE) && ($course = $DB->get_record('course', array('id' => $courseid)))) {
View
@@ -41,6 +41,9 @@
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
if ($badge->type == BADGE_TYPE_COURSE) {
+ if (empty($CFG->badges_allowcoursebadges)) {
+ print_error('coursebadgesdisabled', 'badges');
+ }
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
View
@@ -56,6 +56,9 @@
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
if ($badge->type == BADGE_TYPE_COURSE) {
+ if (empty($CFG->badges_allowcoursebadges)) {
+ print_error('coursebadgesdisabled', 'badges');
+ }
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
}
View
@@ -39,6 +39,10 @@
print_error('badgesdisabled', 'badges');
}
+if (empty($CFG->badges_allowcoursebadges) && $courseid != 0) {
+ print_error('coursebadgesdisabled', 'badges');
+}
+
if (!in_array($sortby, array('name', 'dateissued'))) {
$sortby = 'name';
}
Oops, something went wrong.

0 comments on commit a132719

Please sign in to comment.