This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from juliushaertl/defaultapp
Redirect to first app in list after login
- Loading branch information
Showing
17 changed files
with
477 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
<?php | ||
/** | ||
* ownCloud - foobar | ||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net> | ||
* | ||
* This file is licensed under the Affero General Public License version 3 or | ||
* later. See the COPYING file. | ||
* @author Julius Härtl <jus@bitgrid.net> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* 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/>. | ||
* | ||
* @author jus <jus@bitgrid.net> | ||
* @copyright jus 2016 | ||
*/ | ||
|
||
namespace OCA\AppOrder\AppInfo; | ||
use OCA\AppOrder\AppInfo\Application; | ||
|
||
use OCP\AppFramework\App; | ||
|
||
/** | ||
* Additional autoloader registration, e.g. registering composer autoloaders | ||
*/ | ||
// require_once __DIR__ . '/../vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
<?php | ||
|
||
namespace OCA\AppOrder; | ||
$app = new AppInfo\Application(); | ||
$app->registerRoutes($this, [ | ||
return [ | ||
'routes' => [ | ||
['name' => 'app#index', 'url' => '/', 'verb' => 'GET'], | ||
['name' => 'settings#getOrder', 'url' => 'ajax/order.php', 'verb' => 'GET'], | ||
['name' => 'settings#savePersonal', 'url' => 'ajax/personal.php', 'verb' => 'GET'], | ||
['name' => 'settings#saveDefaultOrder', 'url' => 'ajax/admin.php', 'verb' => 'GET'], | ||
] | ||
]); | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net> | ||
* | ||
* @author Julius Härtl <jus@bitgrid.net> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\AppOrder\AppInfo; | ||
|
||
use \OCP\AppFramework\App; | ||
use \OCA\AppOrder\Service\ConfigService; | ||
|
||
class Application extends App { | ||
|
||
public function __construct(array $urlParams = array()) { | ||
parent::__construct('apporder', $urlParams); | ||
$container = $this->getContainer(); | ||
$container->registerService('ConfigService', function($c) { | ||
return new ConfigService( | ||
$c->query('Config'), | ||
$c->query('AppName') | ||
); | ||
}); | ||
|
||
\OCP\Util::addStyle('apporder', 'apporder'); | ||
\OCP\Util::addScript('apporder', 'apporder'); | ||
\OCP\App::registerAdmin('apporder', 'admin'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net> | ||
* | ||
* @author Julius Härtl <jus@bitgrid.net> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\AppOrder\Controller; | ||
|
||
use \OCP\AppFramework\Controller; | ||
use OCP\AppFramework\Http\RedirectResponse; | ||
use \OCP\IRequest; | ||
use \OCP\INavigationManager; | ||
use \OCA\AppOrder\Service\ConfigService; | ||
use OCA\AppOrder\Util; | ||
use OCP\IURLGenerator; | ||
|
||
class AppController extends Controller { | ||
|
||
private $userId; | ||
private $appConfig; | ||
private $urlGenerator; | ||
private $util; | ||
|
||
public function __construct($appName, IRequest $request, ConfigService $appConfig, IURLGenerator $urlGenerator, Util $util, $userId) { | ||
parent::__construct($appName, $request); | ||
$this->userId = $userId; | ||
$this->appConfig = $appConfig; | ||
$this->urlGenerator = $urlGenerator; | ||
$this->util = $util; | ||
} | ||
|
||
/** | ||
* @NoCSRFRequired | ||
* @return RedirectResponse | ||
*/ | ||
public function index() { | ||
$order = json_decode($this->util->getAppOrder()); | ||
if($order !== null && sizeof($order)>0) { | ||
$firstPage = $order[0]; | ||
} else { | ||
$appId = 'files'; | ||
if(getenv('front_controller_active') === 'true') { | ||
$firstPage = $this->urlGenerator->getAbsoluteURL('/apps/' . $appId . '/'); | ||
} else { | ||
$firstPage = $this->urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/'); | ||
} | ||
} | ||
return new RedirectResponse($firstPage); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.