Use a closure for the files app entry and deprecate old methods
This commit is contained in:
parent
d96b97043b
commit
9c45ab49a1
|
@ -1,32 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
\OCP\App::registerAdmin('files', 'admin');
|
||||||
|
|
||||||
|
\OC::$server->getNavigationManager()->add(function () {
|
||||||
$l = \OC::$server->getL10N('files');
|
$l = \OC::$server->getL10N('files');
|
||||||
|
return [
|
||||||
OCP\App::registerAdmin('files', 'admin');
|
'id' => 'files_index',
|
||||||
|
'order' => 0,
|
||||||
OCP\App::addNavigationEntry(array("id" => "files_index",
|
'href' => \OCP\Util::linkTo('files', 'index.php'),
|
||||||
"order" => 0,
|
'icon' => \OCP\Util::imagePath('core', 'places/files.svg'),
|
||||||
"href" => OCP\Util::linkTo("files", "index.php"),
|
'name' => $l->t('Files'),
|
||||||
"icon" => OCP\Util::imagePath("core", "places/files.svg"),
|
];
|
||||||
"name" => $l->t("Files")));
|
});
|
||||||
|
|
||||||
\OC::$server->getSearch()->registerProvider('OC\Search\Provider\File', array('apps' => array('files')));
|
\OC::$server->getSearch()->registerProvider('OC\Search\Provider\File', array('apps' => array('files')));
|
||||||
|
|
||||||
$templateManager = OC_Helper::getFileTemplateManager();
|
$templateManager = \OC_Helper::getFileTemplateManager();
|
||||||
$templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html');
|
$templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html');
|
||||||
$templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp');
|
$templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp');
|
||||||
$templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt');
|
$templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt');
|
||||||
$templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
|
$templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
|
||||||
|
|
||||||
\OCA\Files\App::getNavigationManager()->add(
|
\OCA\Files\App::getNavigationManager()->add(function () {
|
||||||
array(
|
$l = \OC::$server->getL10N('files');
|
||||||
"id" => 'files',
|
return [
|
||||||
"appname" => 'files',
|
'id' => 'files',
|
||||||
"script" => 'list.php',
|
'appname' => 'files',
|
||||||
"order" => 0,
|
'script' => 'list.php',
|
||||||
"name" => $l->t('All files')
|
'order' => 0,
|
||||||
)
|
'name' => $l->t('All files'),
|
||||||
);
|
];
|
||||||
|
});
|
||||||
|
|
||||||
\OC::$server->getActivityManager()->registerExtension(function() {
|
\OC::$server->getActivityManager()->registerExtension(function() {
|
||||||
return new \OCA\Files\Activity(
|
return new \OCA\Files\Activity(
|
||||||
|
|
|
@ -318,29 +318,6 @@ class OC_App {
|
||||||
$appManager->disableApp($app);
|
$appManager->disableApp($app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* adds an entry to the navigation
|
|
||||||
*
|
|
||||||
* @param array $data array containing the data
|
|
||||||
* @return bool
|
|
||||||
*
|
|
||||||
* This function adds a new entry to the navigation visible to users. $data
|
|
||||||
* is an associative array.
|
|
||||||
* The following keys are required:
|
|
||||||
* - id: unique id for this entry ('addressbook_index')
|
|
||||||
* - href: link to the page
|
|
||||||
* - name: Human readable name ('Addressbook')
|
|
||||||
*
|
|
||||||
* The following keys are optional:
|
|
||||||
* - icon: path to the icon of the app
|
|
||||||
* - order: integer, that influences the position of your application in
|
|
||||||
* the navigation. Lower values come first.
|
|
||||||
*/
|
|
||||||
public static function addNavigationEntry($data) {
|
|
||||||
OC::$server->getNavigationManager()->add($data);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* marks a navigation entry as active
|
* marks a navigation entry as active
|
||||||
*
|
*
|
||||||
|
@ -350,6 +327,8 @@ class OC_App {
|
||||||
* This function sets a navigation entry as active and removes the 'active'
|
* This function sets a navigation entry as active and removes the 'active'
|
||||||
* property from all other entries. The templates can use this for
|
* property from all other entries. The templates can use this for
|
||||||
* highlighting the current position of the user.
|
* highlighting the current position of the user.
|
||||||
|
*
|
||||||
|
* @deprecated Use \OC::$server->getNavigationManager()->setActiveEntry() instead
|
||||||
*/
|
*/
|
||||||
public static function setActiveNavigationEntry($id) {
|
public static function setActiveNavigationEntry($id) {
|
||||||
OC::$server->getNavigationManager()->setActiveEntry($id);
|
OC::$server->getNavigationManager()->setActiveEntry($id);
|
||||||
|
@ -380,6 +359,8 @@ class OC_App {
|
||||||
*
|
*
|
||||||
* This function returns the id of the active navigation entry (set by
|
* This function returns the id of the active navigation entry (set by
|
||||||
* setActiveNavigationEntry
|
* setActiveNavigationEntry
|
||||||
|
*
|
||||||
|
* @deprecated Use \OC::$server->getNavigationManager()->getActiveEntry() instead
|
||||||
*/
|
*/
|
||||||
public static function getActiveNavigationEntry() {
|
public static function getActiveNavigationEntry() {
|
||||||
return OC::$server->getNavigationManager()->getActiveEntry();
|
return OC::$server->getNavigationManager()->getActiveEntry();
|
||||||
|
|
|
@ -49,8 +49,6 @@ class App {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an entry to the navigation
|
* Adds an entry to the navigation
|
||||||
* @param array $data containing the data
|
|
||||||
* @return boolean
|
|
||||||
*
|
*
|
||||||
* This function adds a new entry to the navigation visible to users. $data
|
* This function adds a new entry to the navigation visible to users. $data
|
||||||
* is an associative array.
|
* is an associative array.
|
||||||
|
@ -63,9 +61,16 @@ class App {
|
||||||
* - icon: path to the icon of the app
|
* - icon: path to the icon of the app
|
||||||
* - order: integer, that influences the position of your application in
|
* - order: integer, that influences the position of your application in
|
||||||
* the navigation. Lower values come first.
|
* the navigation. Lower values come first.
|
||||||
|
*
|
||||||
|
* @param array $data containing the data
|
||||||
|
* @return boolean
|
||||||
|
*
|
||||||
|
* @deprecated Use \OC::$server->getNavigationManager()->add() instead to
|
||||||
|
* register a closure, this helps to speed up all requests against ownCloud
|
||||||
*/
|
*/
|
||||||
public static function addNavigationEntry($data) {
|
public static function addNavigationEntry($data) {
|
||||||
return \OC_App::addNavigationEntry( $data );
|
\OC::$server->getNavigationManager()->add($data);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,6 +81,8 @@ class App {
|
||||||
* This function sets a navigation entry as active and removes the 'active'
|
* This function sets a navigation entry as active and removes the 'active'
|
||||||
* property from all other entries. The templates can use this for
|
* property from all other entries. The templates can use this for
|
||||||
* highlighting the current position of the user.
|
* highlighting the current position of the user.
|
||||||
|
*
|
||||||
|
* @deprecated Use \OC::$server->getNavigationManager()->setActiveEntry() instead
|
||||||
*/
|
*/
|
||||||
public static function setActiveNavigationEntry( $id ) {
|
public static function setActiveNavigationEntry( $id ) {
|
||||||
return \OC_App::setActiveNavigationEntry( $id );
|
return \OC_App::setActiveNavigationEntry( $id );
|
||||||
|
|
Loading…
Reference in New Issue