From da868a1e323386bd027e7d409a8c2bd8d0cb46d2 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Wed, 28 Nov 2018 12:34:02 +0800 Subject: [PATCH] MDL-64227 nextcloud: Small layout for login links When we need to show a login link, we don't want the normal page layout because we are in an iframe already. Use the embedded layout to reduce the clutter of the page. --- repository/nextcloud/lib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/repository/nextcloud/lib.php b/repository/nextcloud/lib.php index d643bb2d73f..f9c6b645a3c 100644 --- a/repository/nextcloud/lib.php +++ b/repository/nextcloud/lib.php @@ -428,7 +428,7 @@ class repository_nextcloud extends repository { } if (!$this->client->is_logged_in()) { - $this->print_login_popup(['style' => 'margin-top: 250px']); + $this->print_login_popup(['style' => 'margin-top: 250px'], $options['embed']); return; } @@ -803,8 +803,12 @@ class repository_nextcloud extends repository { * * @param array|null $attr Custom attributes to be applied to popup div. */ - private function print_login_popup($attr = null) { - global $OUTPUT; + private function print_login_popup($attr = null, $embed = false) { + global $OUTPUT, $PAGE; + + if ($embed) { + $PAGE->set_pagelayout('embedded'); + } $this->client = $this->get_user_oauth_client(); $url = new moodle_url($this->client->get_login_url());