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

move chat iframe url to global config

parent 28245366
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,11 @@ class MatrixPlugin extends StudIPPlugin implements StandardPlugin
$navigation = new Navigation('matrix', PluginEngine::getURL($this, [], 'matrix_chat'));
$navigation->setBadgeNumber($num_entries);
$account = MatrixAccount::find(User::findCurrent()->id);
if ($account) {
//$news = MatrixClient::get()->getNews($account->getLinkedAccount());
}
if ($num_entries > 0) {
$navigation->setImage(Icon::create('consultation+new', Icon::ROLE_ATTENTION, ["title" => $text]));
} else {
......
<?php
/**
* Creates necessary database tables and other entries for Matrix matrix_chat integration.
* Class InitMatrixChat
* Creates necessary database tables and other entries for Matrix integration.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -13,12 +14,12 @@
* @category Matrix
*/
class Init extends Migration
class InitMatrixChat extends Migration
{
public function description()
{
return 'Creates necessary database tables and other entries for Matrix matrix_chat integration.';
return 'Creates necessary database tables and other entries for Matrix integration.';
}
public function up()
......@@ -47,29 +48,44 @@ class Init extends Migration
) ENGINE InnoDB ROW_FORMAT=DYNAMIC");
// Create global config entries
try {
Config::get()->create('MATRIX_SERVER_HOSTNAME', [
$entries = [
'MATRIX_SERVER_HOSTNAME' => [
'value' => '',
'type' => 'string',
'range' => 'global',
'section' => 'matrix',
'description' => 'Unter welchem Hostnamen ist der Matrixserver erreichbar?'
]);
Config::get()->create('MATRIX_SYSTEM_ACCOUNT_USERNAME', [
],
'MATRIX_SYSTEM_ACCOUNT_USERNAME' => [
'value' => '',
'type' => 'string',
'range' => 'global',
'section' => 'matrix',
'description' => 'Benutzername der Stud.IP-Matrixkennung, mit der z.B. Räume angelegt werden.'
]);
Config::get()->create('MATRIX_SYSTEM_ACCOUNT_PASSWORD', [
],
'MATRIX_SYSTEM_ACCOUNT_PASSWORD' => [
'value' => '',
'type' => 'string',
'range' => 'global',
'section' => 'matrix',
'description' => 'Passwort der Stud.IP-Matrixkennung, mit der z.B. Räume angelegt werden.'
]);
} catch (Exception $e) {}
],
'MATRIX_CHATSERVER_URL' => [
'value' => '',
'type' => 'string',
'range' => 'global',
'section' => 'matrix',
'description' => 'URL des Chatservers (z.B. Element)'
]
];
foreach ($entries as $name => $data) {
try {
Config::get()->create($name, $data);
} catch (Exception $e) {
}
}
}
public function down()
......@@ -81,6 +97,7 @@ class Init extends Migration
Config::get()->delete('MATRIX_SERVER_HOSTNAME');
Config::get()->delete('MATRIX_SYSTEM_ACCOUNT_USERNAME');
Config::get()->delete('MATRIX_SYSTEM_ACCOUNT_PASSWORD');
Config::get()->delete('MATRIX_CHATSERVER_URL');
}
}
\ No newline at end of file
......@@ -35,7 +35,9 @@ class MatrixAccount extends SimpleORMap
public function getLinkedAccount()
{
return new \Patrix\Account($this->matrix_account_id, $this->matrix_password);
$account = new \Patrix\Account($this->matrix_account_id, $this->matrix_password);
MatrixClient::get()->login($account);
return $account;
}
public static function randomPassword( $length = 14 ) {
......
libpatrix @ 56893e89
Subproject commit c05790e055ca90fe7d5867ee6dbd26fd695814ad
Subproject commit 56893e89418f3cc7bb78a73a421055ad56fc619c
......@@ -21,5 +21,5 @@
<?= Assets::img('ajax-indicator-black.svg') ?>
</div>
<? else : ?>
<iframe src="http://localhost/element" width="100%" height="100%"></iframe>
<iframe src="<?php echo htmlReady(Config::get()->MATRIX_CHATSERVER_URL) ?>" width="100%" height="100%"></iframe>
<? endif;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment