94 lines
2.5 KiB
PHP
Raw Normal View History

2013-06-30 20:53:42 +02:00
<?php
/**
2013-08-28 12:02:27 +02:00
* ownCloud - Documents App
2013-06-30 20:53:42 +02:00
*
* @author Frank Karlitschek
2014-04-09 19:04:33 +03:00
* @copyright 2013-2014 Frank Karlitschek karlitschek@kde.org
2015-01-14 16:33:11 +01:00
*
2013-06-30 20:53:42 +02:00
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
2015-01-14 16:33:11 +01:00
* License as published by the Free Software Foundation; either
2013-06-30 20:53:42 +02:00
* version 3 of the License, or any later version.
2015-01-14 16:33:11 +01:00
*
2013-06-30 20:53:42 +02:00
* This library 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.
2015-01-14 16:33:11 +01:00
*
2014-05-17 15:29:51 -04:00
* You should have received a copy of the GNU Affero General Public
2013-06-30 20:53:42 +02:00
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
2015-01-14 16:33:11 +01:00
*
2013-06-30 20:53:42 +02:00
*/
2015-06-16 19:32:25 +03:00
namespace OCA\Documents\AppInfo;
use OCA\Documents\Filter\Office;
use OCA\Documents\Config;
$app = new Application();
$c = $app->getContainer();
2014-03-31 20:27:07 +03:00
\OCP\App::registerAdmin('documents', 'admin');
2015-06-16 19:32:25 +03:00
\OCP\App::registerPersonal('documents', 'personal');
2013-06-30 20:53:42 +02:00
2015-06-16 19:32:25 +03:00
$navigationEntry = function () use ($c) {
return [
'id' => 'documents_index',
'order' => 2,
2015-08-26 19:09:34 +03:00
'href' => $c->query('ServerContainer')->getURLGenerator()->linkToRoute('documents.document.index'),
'icon' => $c->query('ServerContainer')->getURLGenerator()->imagePath('documents', 'documents.svg'),
2015-10-23 14:00:36 +02:00
'name' => $c->query('L10N')->t('Collabora CloudSuite')
2015-06-16 19:32:25 +03:00
];
};
$c->getServer()->getNavigationManager()->add($navigationEntry);
2013-07-01 21:48:49 +03:00
2013-10-20 21:51:03 +03:00
//Script for registering file actions
$request = \OC::$server->getRequest();
if (isset($request->server['REQUEST_URI'])) {
$url = $request->server['REQUEST_URI'];
2015-01-14 16:33:11 +01:00
if (preg_match('%index.php/apps/files(/.*)?%', $url)) {
\OCP\Util::addScript('documents', 'viewer/viewer');
}
2015-01-14 16:33:11 +01:00
}
2013-10-20 21:51:03 +03:00
2015-09-18 22:10:27 +03:00
if ($c->query('AppConfig')->isConverterEnabled()){
2015-06-16 19:32:25 +03:00
$docFilter = new Office(
[
'read' =>
[
'target' => 'application/vnd.oasis.opendocument.text',
'format' => 'odt:writer8',
'extension' => 'odt'
],
'write' =>
[
'target' => 'application/msword',
'format' => 'doc',
'extension' => 'doc'
]
]
);
2014-03-28 22:14:51 +03:00
2015-06-16 19:32:25 +03:00
$docxFilter = new Office(
[
'read' =>
[
'target' => 'application/vnd.oasis.opendocument.text',
'format' => 'odt:writer8',
'extension' => 'odt'
],
'write' =>
[
'target' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'format' => 'docx',
'extension' => 'docx'
]
]
);
}
2014-03-28 22:14:51 +03:00
//Listen to delete file signal
2015-06-16 19:32:25 +03:00
\OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Documents\Storage", "onDelete");