2022-07-22 11:46:55 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A plugin that adds a task menu icon linking to the Nextcloud files
|
|
|
|
*
|
|
|
|
* @author Aleksander Machniak <machniak@apheleia-it.ch>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022, Apheleia IT AG <contact@apheleia-it.ch>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nextcloud_link extends rcube_plugin
|
|
|
|
{
|
|
|
|
public $task = '?(?!login|logout).*';
|
|
|
|
|
2024-01-24 10:59:25 +01:00
|
|
|
private $rc;
|
2022-07-22 11:46:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Plugin initialization.
|
|
|
|
*/
|
2024-01-24 11:24:41 +01:00
|
|
|
public function init()
|
2022-07-22 11:46:55 +02:00
|
|
|
{
|
2024-01-25 13:47:41 +01:00
|
|
|
$this->rc = rcmail::get_instance();
|
2022-07-22 11:46:55 +02:00
|
|
|
|
2023-05-11 14:45:22 +02:00
|
|
|
if ($this->rc->output->type !== 'html' || !empty($this->rc->output->env['framed'])) {
|
2022-07-22 11:46:55 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->load_config();
|
|
|
|
|
|
|
|
$url = $this->rc->config->get('nextcloud_link_url');
|
|
|
|
|
|
|
|
if (empty($url)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->add_button([
|
|
|
|
'command' => 'nextcloud',
|
|
|
|
'class' => 'button-nextcloud',
|
|
|
|
'classsel' => 'button-nextcloud button-selected',
|
|
|
|
'innerclass' => 'button-inner',
|
|
|
|
'label' => '',
|
2024-01-24 11:24:41 +01:00
|
|
|
'type' => 'link',
|
2022-07-22 11:46:55 +02:00
|
|
|
], 'taskbar');
|
|
|
|
|
|
|
|
$this->rc->output->add_footer("
|
|
|
|
<style>#taskmenu a.button-nextcloud:before { content: \"\\f0c2\"; }</style>
|
|
|
|
<script>\$('#taskmenu a.button-nextcloud').on('click', function () { window.open('$url', '_blank'); });</script>");
|
|
|
|
}
|
|
|
|
}
|