Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit desktop notifications to a single domain for multi-domain envir…
…onments Closes #2411
- Loading branch information
Showing
12 changed files
with
133 additions
and
4 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 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
19 changes: 19 additions & 0 deletions
19
wcfsetup/install/files/acp/templates/desktopNotificationApplicationSelectOptionType.tpl
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,19 @@ | ||
{if $isMultiDomainSetup} | ||
<select name="values[{$option->optionName}]" id="{$option->optionName}"> | ||
{foreach from=$applications item=application} | ||
<option value="{@$application->packageID}"{if $application->packageID == $value} selected{/if}>{$application->getPackage()}</option> | ||
{/foreach} | ||
</select> | ||
{else} | ||
{* TODO: hide *} | ||
<input type="hidden" name="values[{$option->optionName}]" value="1"> | ||
<script> | ||
(function() { | ||
{* pretend that this option does not exist *} | ||
var container = elBySel('.{$option->optionName}Input'); | ||
container.style.setProperty('margin', '0', 'important'); | ||
container.style.setProperty('max-height', '0', 'important'); | ||
container.style.setProperty('overflow', 'hidden', 'important'); | ||
})(); | ||
</script> | ||
{/if} |
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 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
40 changes: 40 additions & 0 deletions
40
.../install/files/lib/system/option/DesktopNotificationApplicationSelectOptionType.class.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,40 @@ | ||
<?php | ||
namespace wcf\system\option; | ||
use wcf\data\option\Option; | ||
use wcf\system\application\ApplicationHandler; | ||
use wcf\system\exception\UserInputException; | ||
use wcf\system\WCF; | ||
|
||
/** | ||
* Option type implementation for the desktop notification application selection. This | ||
* option is intentionally designed to be invisible at most times. | ||
* | ||
* @author Alexander Ebert | ||
* @copyright 2001-2017 WoltLab GmbH | ||
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
* @package WoltLabSuite\Core\System\Option | ||
*/ | ||
class DesktopNotificationApplicationSelectOptionType extends AbstractOptionType { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getFormElement(Option $option, $value) { | ||
return WCF::getTPL()->fetch('desktopNotificationApplicationSelectOptionType', 'wcf', [ | ||
'applications' => ApplicationHandler::getInstance()->getApplications(), | ||
'isMultiDomainSetup' => ApplicationHandler::getInstance()->isMultiDomainSetup(), | ||
'option' => $option, | ||
'value' => $value | ||
]); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function validate(Option $option, $newValue) { | ||
if (ApplicationHandler::getInstance()->isMultiDomainSetup()) { | ||
if (ApplicationHandler::getInstance()->getApplicationByID($newValue) === null) { | ||
throw new UserInputException($option->optionName, 'validationFailed'); | ||
} | ||
} | ||
} | ||
} |
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 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