diff --git a/migrations/03_use_matrix_chat_iframe.php b/migrations/03_use_matrix_chat_iframe.php new file mode 100644 index 0000000000000000000000000000000000000000..14bcd92dbfe3ab95c9c3a44436b9ac149f64a85c --- /dev/null +++ b/migrations/03_use_matrix_chat_iframe.php @@ -0,0 +1,47 @@ +<?php + +/** + * Class UseMatrixChatIframe + * Configure whether to use an iFrame for Matrix chat. + * instead of a password. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * @author Thomas Hackl <hackl@data-quest.de> + * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 + * @category Matrix + */ + +class UseMatrixChatIframe extends Migration +{ + + public function description() + { + return 'Configure whether to use an iFrame for Matrix chat.'; + } + + public function up() + { + try { + Config::get()->create('MATRIX_USE_CHAT_IFRAME', [ + 'value' => '', + 'type' => 'boolean', + 'range' => 'global', + 'section' => 'matrix', + 'description' => 'Soll der Matrixchat in einem iFrame in Stud.IP geöffnet werden?' + ]); + } catch (Exception $e) { + } + + } + + public function down() + { + // Remove config entry. + Config::get()->delete('MATRIX_USE_CHAT_IFRAME'); + } + +} \ No newline at end of file diff --git a/plugin.manifest b/plugin.manifest index 43de2ca86e881555b93f173a357011e177cf2362..251380b3f3529accc5b186fa33171f5ed73327e7 100644 --- a/plugin.manifest +++ b/plugin.manifest @@ -1,7 +1,7 @@ pluginname=Matrix-Chat pluginclassname=MatrixPlugin origin=data-quest -version=0.96 +version=1.0 screenshot=assets/images/matrix_logo.png description=Matrix chat for Stud.IP courses studipMinVersion=4.5 diff --git a/views/matrix_chat/index.php b/views/matrix_chat/index.php index 6eef61a56e637b1ff6f471aae359151303e16e23..c5eb6c38853a8a282b173427084ce56aee053506 100644 --- a/views/matrix_chat/index.php +++ b/views/matrix_chat/index.php @@ -45,11 +45,15 @@ <?= Assets::img('ajax-indicator-black.svg') ?> </div> <? elseif (!$noChat) : ?> - <div class="matrix-chat-button"> - <?= Studip\LinkButton::create( - dgettext('matrix', 'Chat öffnen'), - Config::get()->MATRIX_CHATSERVER_URL, - ['target' => '_blank'] - ) ?> - </div> + <? if (!Config::get()->MATRIX_USE_CHAT_IFRAME) : ?> + <iframe src="<?= Config::get()->MATRIX_CHATSERVER_URL ?>" width="100%" height="100%"></iframe> + <? else : ?> + <div class="matrix-chat-button"> + <?= Studip\LinkButton::create( + dgettext('matrix', 'Chat öffnen'), + Config::get()->MATRIX_CHATSERVER_URL, + ['target' => '_blank'] + ) ?> + </div> + <? endif ?> <? endif;