Skip to content
Snippets Groups Projects
Commit 262a978f authored by Thomas Hackl's avatar Thomas Hackl
Browse files

configure if chat should be opened in an iframe or via button click

parent 4cc5d80d
No related branches found
No related tags found
No related merge requests found
<?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
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
......
......@@ -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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment