Skip to content

Commit

Permalink
Merge branch 'MDL-56607-master' of git://github.com/jleyva/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Nov 9, 2016
2 parents 6c5ee65 + 9d92a3a commit 43bdbbf
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 47 deletions.
6 changes: 6 additions & 0 deletions admin/tool/mobile/lang/en/tool_mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$string['autologinkeygenerationlockout'] = 'Auto-login key generation is locked out, too much requests in an hour.';
$string['autologinnotallowedtoadmins'] = 'Auto-login is not allowed to site admins';
$string['clickheretolaunchtheapp'] = 'Click here if the app does not open automatically.';
$string['configmobilecssurl'] = 'A CSS file to customise your mobile app interface.';
$string['enablesmartappbanners'] = 'Enable Smart App Banners';
$string['enablesmartappbanners_desc'] = 'This will display a banner promoting the Moodle Mobile app when visiting the site in Mobile Safari.';
$string['forcedurlscheme'] = 'If you want to allow only your custom branded app to be opened via a browser window, then specify its URL scheme here; otherwise leave the field empty.';
Expand All @@ -36,6 +37,11 @@
$string['loginintheapp'] = 'Via the app';
$string['logininthebrowser'] = 'Via a browser window (for SSO plugins)';
$string['loginintheembeddedbrowser'] = 'Via an embedded browser (for SSO plugins)';
$string['mobileapp'] = 'Mobile app';
$string['mobileappearance'] = 'Mobile appearance';
$string['mobileauthentication'] = 'Mobile authentication';
$string['mobilecssurl'] = 'CSS';
$string['mobilesettings'] = 'Mobile settings';
$string['pluginname'] = 'Moodle Mobile tools';
$string['smartappbanners'] = 'Smart App Banners (iOS only)';
$string['pluginnotenabledorconfigured'] = 'Plugin not enabled or configured.';
Expand Down
59 changes: 36 additions & 23 deletions admin/tool/mobile/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

if ($hassiteconfig) {

$temp = new admin_settingpage('mobile', new lang_string('mobile', 'admin'), 'moodle/site:config', false);
$ADMIN->add('root', new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile')), 'development');

$temp = new admin_settingpage('mobilesettings', new lang_string('mobilesettings', 'tool_mobile'), 'moodle/site:config', false);

// We should wait to the installation to finish since we depend on some configuration values that are set once
// the admin user profile is configured.
Expand All @@ -41,32 +43,43 @@
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default));
}

$temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'admin'),
new lang_string('configmobilecssurl', 'admin'), '', PARAM_URL));
$ADMIN->add('mobileapp', $temp);

// Show only mobile settings if the mobile service is enabled.
if (!empty($CFG->enablemobilewebservice)) {
// Type of login.
$temp = new admin_settingpage('mobileauthentication', new lang_string('mobileauthentication', 'tool_mobile'));
$options = array(
tool_mobile\api::LOGIN_VIA_APP => new lang_string('loginintheapp', 'tool_mobile'),
tool_mobile\api::LOGIN_VIA_BROWSER => new lang_string('logininthebrowser', 'tool_mobile'),
tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER => new lang_string('loginintheembeddedbrowser', 'tool_mobile'),
);
$temp->add(new admin_setting_configselect('tool_mobile/typeoflogin',
new lang_string('typeoflogin', 'tool_mobile'),
new lang_string('typeoflogin_desc', 'tool_mobile'), 1, $options));

$temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme',
new lang_string('forcedurlscheme_key', 'tool_mobile'),
new lang_string('forcedurlscheme', 'tool_mobile'), '', PARAM_NOTAGS));

// Type of login.
$options = array(
tool_mobile\api::LOGIN_VIA_APP => new lang_string('loginintheapp', 'tool_mobile'),
tool_mobile\api::LOGIN_VIA_BROWSER => new lang_string('logininthebrowser', 'tool_mobile'),
tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER => new lang_string('loginintheembeddedbrowser', 'tool_mobile'),
);
$temp->add(new admin_setting_configselect('tool_mobile/typeoflogin',
new lang_string('typeoflogin', 'tool_mobile'),
new lang_string('typeoflogin_desc', 'tool_mobile'), 1, $options));
$ADMIN->add('mobileapp', $temp);

$temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme',
new lang_string('forcedurlscheme_key', 'tool_mobile'),
new lang_string('forcedurlscheme', 'tool_mobile'), '', PARAM_NOTAGS));
// Appearance related settings.
$temp = new admin_settingpage('mobileappearance', new lang_string('mobileappearance', 'tool_mobile'));

$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
new lang_string('smartappbanners', 'tool_mobile'), ''));
$temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'tool_mobile'),
new lang_string('configmobilecssurl', 'tool_mobile'), '', PARAM_URL));

$temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
new lang_string('enablesmartappbanners', 'tool_mobile'),
new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));
$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
new lang_string('smartappbanners', 'tool_mobile'), ''));

$temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));
$temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
new lang_string('enablesmartappbanners', 'tool_mobile'),
new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));

$ADMIN->add('webservicesettings', $temp);
$temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));

$ADMIN->add('mobileapp', $temp);
}
}
5 changes: 2 additions & 3 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@
$string['configminpasswordlower'] = 'Passwords must have at least these many lower case letters.';
$string['configminpasswordnonalphanum'] = 'Passwords must have at least these many non-alphanumeric characters.';
$string['configminpasswordupper'] = 'Passwords must have at least these many upper case letters.';
$string['configmobilecssurl'] = 'A CSS file to customise your mobile app interface.';
$string['configmodchooserdefault'] = 'Should the activity chooser be presented to users by default?';
$string['configmycoursesperpage'] = 'Maximum number of courses to display in any list of a user\'s own courses';
$string['configmymoodleredirect'] = 'This setting forces redirects to /my on login for non-admins and replaces the top level site navigation with /my';
Expand Down Expand Up @@ -745,8 +744,6 @@
$string['mnetrestore_extusers_mismatch'] = '<strong>Note:</strong> This backup file apparently originates from a different Moodle installation and contains remote Moodle Network user accounts that may fail to restore. This operation is unsupported. If you are certain that it was created on this Moodle installation, or you can ensure that all the needed Moodle Network Hosts are configured, you may want to still try the restore.';
$string['mnetrestore_extusers_noadmin'] = '<strong>Note:</strong> This backup file seems to come from a different Moodle installation and contains remote Moodle Network user accounts. You are not allowed to execute this type of restore. Contact the administrator of the site or, alternatively, restore this course without any user information (modules, files...)';
$string['mnetrestore_extusers_switchuserauth'] = 'Remote Moodle Network user {$a->username} (coming from {$a->mnethosturl}) switched to local {$a->auth} authenticated user.';
$string['mobile'] = 'Mobile';
$string['mobilecssurl'] = 'CSS';
$string['modchooserdefault'] = 'Activity chooser default';
$string['modeditdefaults'] = 'Default values for activity settings';
$string['modsettings'] = 'Manage activities';
Expand Down Expand Up @@ -1240,3 +1237,5 @@
$string['cachesessionhelp'] = 'User specific cache that expires when the user\'s session ends. Designed to alleviate session bloat/strain.';
$string['cacheapplication'] = 'Application cache';
$string['cacheapplicationhelp'] = 'Cached items are shared among all users and expire by a determined time to live (ttl).';
// Deprecated since Moodle 3.2.
$string['mobile'] = 'Mobile';
1 change: 1 addition & 0 deletions lang/en/deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ revealpassword,core_form
mediasettings,core_media
legacyheading,core_media
legacyheading_desc,core_media
mobile,core_admin
3 changes: 0 additions & 3 deletions lang/en/webservice.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
$string['enabled'] = 'Enabled';
$string['enabledocumentation'] = 'Enable developer documentation';
$string['enabledocumentationdescription'] = 'Detailed web services documentation is available for enabled protocols.';
$string['enablemobilewsoverview'] = 'Go to {$a->manageservicelink} administration page, check the "{$a->enablemobileservice}" setting and Save. Everything will be setup for you and all site\'s users will be able to use the offical Moodle app. Current status: {$a->wsmobilestatus}';
$string['enableprotocols'] = 'Enable protocols';
$string['enableprotocolsdescription'] = 'At least one protocol should be enabled. For security reasons, only protocols that are to be used should be enabled.';
$string['enablews'] = 'Enable web services';
Expand Down Expand Up @@ -125,8 +124,6 @@
$string['missingrequiredcapability'] = 'The capability {$a} is required.';
$string['missingusername'] = 'Missing username';
$string['missingversionfile'] = 'Coding error: version.php file is missing for the component {$a}';
$string['mobilewsdisabled'] = 'Disabled';
$string['mobilewsenabled'] = 'Enabled';
$string['nameexists'] = 'This name is already in use by another service';
$string['nocapabilitytouseparameter'] = 'The user does not have the required capability to use the parameter {$a}';
$string['nofunctions'] = 'This service has no functions.';
Expand Down
16 changes: 0 additions & 16 deletions lib/adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -8807,22 +8807,6 @@ public function output_html($data, $query='') {
$return = "";
$brtag = html_writer::empty_tag('br');

// Enable mobile web service
$enablemobile = new admin_setting_enablemobileservice('enablemobilewebservice',
get_string('enablemobilewebservice', 'admin'),
get_string('configenablemobilewebservice',
'admin', ''), 0); //we don't want to display it but to know the ws mobile status
$manageserviceurl = new moodle_url("/admin/settings.php?section=mobile");
$wsmobileparam = new stdClass();
$wsmobileparam->enablemobileservice = get_string('enablemobilewebservice', 'admin');
$wsmobileparam->manageservicelink = html_writer::link($manageserviceurl,
get_string('mobile', 'admin'));
$mobilestatus = $enablemobile->get_setting()?get_string('mobilewsenabled', 'webservice'):get_string('mobilewsdisabled', 'webservice');
$wsmobileparam->wsmobilestatus = html_writer::tag('strong', $mobilestatus);
$return .= $OUTPUT->heading(get_string('enablemobilewebservice', 'admin'), 3, 'main');
$return .= $brtag . get_string('enablemobilewsoverview', 'webservice', $wsmobileparam)
. $brtag . $brtag;

/// One system controlling Moodle with Token
$return .= $OUTPUT->heading(get_string('onesystemcontrolling', 'webservice'), 3, 'main');
$table = new html_table();
Expand Down
2 changes: 1 addition & 1 deletion webservice/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function get_site_info($serviceshortnames = array()) {
$siteinfo['functions'] = $availablefunctions;

// Mobile CSS theme and alternative login url.
$siteinfo['mobilecssurl'] = $CFG->mobilecssurl;
$siteinfo['mobilecssurl'] = !empty($CFG->mobilecssurl) ? $CFG->mobilecssurl : '';

// Retrieve some advanced features. Only enable/disable ones (bool).
$advancedfeatures = array("usecomments", "usetags", "enablenotes", "messaging", "enableblogs",
Expand Down
2 changes: 1 addition & 1 deletion webservice/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function test_get_site_info() {
$this->assertEquals(true, $siteinfo['downloadfiles']);
$this->assertEquals($CFG->release, $siteinfo['release']);
$this->assertEquals($CFG->version, $siteinfo['version']);
$this->assertEquals($CFG->mobilecssurl, $siteinfo['mobilecssurl']);
$this->assertEquals('', $siteinfo['mobilecssurl']);
$this->assertEquals(count($siteinfo['functions']), 1);
$function = array_pop($siteinfo['functions']);
$this->assertEquals($function['name'], 'core_course_get_contents');
Expand Down

0 comments on commit 43bdbbf

Please sign in to comment.