You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Vincent Petry <pvince81@owncloud.com>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. use OCA\Files\Event\LoadAdditionalScriptsEvent;
  26. use OCA\Files\Event\LoadSidebar;
  27. use OCA\Viewer\Event\LoadViewer;
  28. use OCP\EventDispatcher\GenericEvent;
  29. // Check if we are a user
  30. OCP\User::checkLoggedIn();
  31. $config = \OC::$server->getConfig();
  32. $userSession = \OC::$server->getUserSession();
  33. $legacyEventDispatcher = \OC::$server->getEventDispatcher();
  34. /** @var \OCP\EventDispatcher\IEventDispatcher $eventDispatcher */
  35. $eventDispatcher = \OC::$server->get(OCP\EventDispatcher\IEventDispatcher::class);
  36. $showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
  37. $isIE = \OCP\Util::isIE();
  38. $tmpl = new OCP\Template('files_sharing', 'list', '');
  39. // gridview not available for ie
  40. $tmpl->assign('showgridview', $showgridview && !$isIE);
  41. // fire script events
  42. $legacyEventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts', new GenericEvent());
  43. $eventDispatcher->dispatchTyped(new LoadAdditionalScriptsEvent());
  44. $eventDispatcher->dispatchTyped(new LoadSidebar());
  45. // Load Viewer scripts
  46. if (class_exists(LoadViewer::class)) {
  47. $eventDispatcher->dispatchTyped(new LoadViewer());
  48. }
  49. $tmpl->printPage();