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
[WIP] Redirect to first app in list after login #16
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw should also work without this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, thanks. 👍