-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remember the UI that was last selected via the application switcher
- Loading branch information
1 parent
7647b32
commit 37b5650
Showing
7 changed files
with
129 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ | |
*/ | ||
|
||
$app = new OCA\Web\Application(); | ||
$app->boot(); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$(document).ready(function () { | ||
$('#apps') | ||
.find('li[data-id=web]') | ||
.click(function () { | ||
$.post(OC.generateUrl('/apps/web/settings/default'), { isDefault: true }) | ||
}) | ||
}) |
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
84 changes: 84 additions & 0 deletions
84
packages/web-integration-oc10/lib/Controller/SettingsController.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/** | ||
* @author Jannik Stehle <[email protected]> | ||
* @author Jan Ackermann <[email protected]> | ||
* | ||
* @copyright Copyright (c) 2021, ownCloud GmbH | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* 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, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\Web\Controller; | ||
|
||
use OCP\AppFramework\Controller; | ||
use OCP\AppFramework\Http\JSONResponse; | ||
use OCP\IConfig; | ||
use OCP\IRequest; | ||
use OCP\IUserSession; | ||
|
||
/** | ||
* Class SettingsController | ||
* | ||
* @package OCA\Web\Controller | ||
*/ | ||
class SettingsController extends Controller { | ||
|
||
/** | ||
* @var IConfig | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @var IUserSession | ||
*/ | ||
private $userSession; | ||
|
||
/** | ||
* @param string $appName | ||
* @param IRequest $request an instance of the request | ||
* @param IUserSession $userSession | ||
* @param IConfig $config | ||
*/ | ||
public function __construct( | ||
$appName, | ||
IRequest $request, | ||
IUserSession $userSession, | ||
IConfig $config | ||
) { | ||
parent::__construct($appName, $request); | ||
$this->config = $config; | ||
$this->userSession = $userSession; | ||
} | ||
|
||
/** | ||
* Set the web default config. | ||
* | ||
* @NoAdminRequired | ||
* | ||
* @return JSONResponse | ||
*/ | ||
public function setWebDefaultConfig() { | ||
$value = \filter_var($this->request->getParam('isDefault'), FILTER_VALIDATE_BOOLEAN); | ||
$user = $this->userSession->getUser(); | ||
$configToSet = $value === true ? 'web' : null; | ||
if (!$configToSet) { | ||
$this->config->deleteUserValue($user->getUID(), 'core', 'defaultapp'); | ||
} else { | ||
$this->config->setUserValue($user->getUID(), 'core', 'defaultapp', $configToSet); | ||
} | ||
|
||
return new JSONResponse([]); | ||
} | ||
} |
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