From e9d95b6acd1dbae45de3fed83d7dd88b09ec8c78 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 14 Jan 2015 16:33:11 +0100 Subject: [PATCH] do not load scripts for all apps --- appinfo/app.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index 284956af..c07de097 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -5,20 +5,20 @@ * * @author Frank Karlitschek * @copyright 2013-2014 Frank Karlitschek karlitschek@kde.org - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either + * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. - * + * * 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. - * + * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see . - * + * */ OCP\App::register(array('order' => 70, 'id' => 'documents', 'name' => 'Documents')); @@ -27,26 +27,30 @@ OCP\App::register(array('order' => 70, 'id' => 'documents', 'name' => 'Documents OCP\App::registerPersonal('documents', 'personal'); OCP\App::addNavigationEntry(array( - 'id' => 'documents_index', + 'id' => 'documents_index', 'order' => 2, - 'href' => OCP\Util::linkTo('documents/', 'index.php'), + 'href' => OCP\Util::linkTo('documents/', 'index.php'), 'icon' => OCP\Util::imagePath('documents', 'documents.svg'), 'name' => OCA\Documents\Config::getL10n()->t('Documents')) ); //Script for registering file actions -OCP\Util::addScript('documents', 'viewer/viewer'); +$url = OC::$server->getRequest()->server['REQUEST_URI']; + +if (preg_match('%index.php/apps/files(/.*)?%', $url)) { + OCP\Util::addScript('documents', 'viewer/viewer'); +} if (OCA\Documents\Config::getConverter() !== 'off'){ $docFilter = new OCA\Documents\Filter\Office( array( - 'read' => + 'read' => array ( 'target' => 'application/vnd.oasis.opendocument.text', 'format' => 'odt:writer8', 'extension' => 'odt' ), - 'write' => + 'write' => array ( 'target' => 'application/msword', 'format' => 'doc', @@ -57,13 +61,13 @@ if (OCA\Documents\Config::getConverter() !== 'off'){ $docxFilter = new OCA\Documents\Filter\Office( array ( - 'read' => + 'read' => array ( 'target' => 'application/vnd.oasis.opendocument.text', 'format' => 'odt:writer8', 'extension' => 'odt' ), - 'write' => + 'write' => array ( 'target' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'format' => 'docx',