Skip to content

Commit

Permalink
MDL-72119 admin: Move Enable WS for mobile to Advanced features
Browse files Browse the repository at this point in the history
The "Enable web services for mobile devices" setting has been moved
from the "Mobile app settings" page to "Advanced features".
Besides, the "Mobile app" section and the "Mobile settings" page
won't be displayed if WS for mobile devices setting is disabled.
  • Loading branch information
sarjona committed Sep 13, 2021
1 parent 1d8fe9b commit 78c8d6f
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions admin/tool/mobile/settings.php
Expand Up @@ -30,21 +30,30 @@

if ($hassiteconfig) {

$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.
if (!during_initial_install()) {
$enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services'));
$enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation'));
$default = is_https() ? 1 : 0;
$temp->add(new admin_setting_enablemobileservice('enablemobilewebservice',
$optionalsubsystems = $ADMIN->locate('optionalsubsystems');
$optionalsubsystems->add(new admin_setting_enablemobileservice('enablemobilewebservice',
new lang_string('enablemobilewebservice', 'admin'),
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default));
}

$ismobilewsdisabled = empty($CFG->enablemobilewebservice);
$ADMIN->add('root',
new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile'), $ismobilewsdisabled),
'development'
);

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

$temp->add(new admin_setting_configtext('tool_mobile/apppolicy', new lang_string('apppolicy', 'tool_mobile'),
new lang_string('apppolicy_help', 'tool_mobile'), '', PARAM_URL));

Expand All @@ -60,8 +69,8 @@
$featuresnotice = $OUTPUT->render($notify);
}

$hideappsubscription = empty($CFG->enablemobilewebservice);
$hideappsubscription = $hideappsubscription || (isset($CFG->disablemobileappsubscription) && !empty($CFG->disablemobileappsubscription));
$hideappsubscription = (isset($CFG->disablemobileappsubscription) && !empty($CFG->disablemobileappsubscription));
$hideappsubscription = $ismobilewsdisabled || $hideappsubscription;

$ADMIN->add(
'mobileapp',
Expand All @@ -79,7 +88,7 @@
'mobileauthentication',
new lang_string('mobileauthentication', 'tool_mobile'),
'moodle/site:config',
empty($CFG->enablemobilewebservice)
$ismobilewsdisabled
);

$temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeaturesauth', '', $featuresnotice));
Expand Down Expand Up @@ -123,7 +132,7 @@
'mobileappearance',
new lang_string('mobileappearance', 'tool_mobile'),
'moodle/site:config',
empty($CFG->enablemobilewebservice)
$ismobilewsdisabled
);

if (!empty($featuresnotice)) {
Expand Down Expand Up @@ -164,7 +173,7 @@
'mobilefeatures',
new lang_string('mobilefeatures', 'tool_mobile'),
'moodle/site:config',
empty($CFG->enablemobilewebservice)
$ismobilewsdisabled
);

if (!empty($featuresnotice)) {
Expand Down

0 comments on commit 78c8d6f

Please sign in to comment.