<permissions>admin.attachment.canManageAttachment</permissions>
</acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.notice">
+ <parent>wcf.acp.menu.link.content</parent>
+ <showorder>6</showorder>
+ </acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.notice.list">
+ <controller><![CDATA[wcf\acp\page\NoticeListPage]]></controller>
+ <parent>wcf.acp.menu.link.notice</parent>
+ <permissions>admin.content.tag.canManageTag</permissions>
+ </acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.notice.add">
+ <controller><![CDATA[wcf\acp\form\NoticeAddForm]]></controller>
+ <parent>wcf.acp.menu.link.notice</parent>
+ <permissions>admin.content.notice.canManageNotice</permissions>
+ </acpmenuitem>
+
<acpmenuitem name="wcf.acp.menu.link.community">
<showorder>5</showorder>
</acpmenuitem>
<coreobject>
<objectname><![CDATA[wcf\system\moderation\queue\ModerationQueueManager]]></objectname>
</coreobject>
+
+ <coreobject>
+ <objectname><![CDATA[wcf\system\notice\NoticeHandler]]></objectname>
+ </coreobject>
</import>
</data>
<classname><![CDATA[wcf\page\UsersOnlineListPage]]></classname>
</type>
<!-- /pages -->
+
+ <!-- notice conditions -->
+ <type>
+ <name>com.woltlab.wcf.page.controller</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\MultiPageControllerCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.page</conditionobject>
+ </type>
+
+ <type>
+ <name>com.woltlab.wcf.user.username</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserUsernameCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.email</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserEmailCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.userGroup</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserGroupCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ <includeguests>1</includeguests>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.languages</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserLanguageCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.registrationDate</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserRegistrationDateCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.registrationDateInterval</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserRegistrationDateIntervalCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.avatar</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserAvatarCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.state</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserStateCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>general</conditiongroup>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.activityPoints</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserIntegerPropertyCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>contents</conditiongroup>
+ <propertyname>activityPoints</propertyname>
+ <minvalue>0</minvalue>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.likesReceived</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserIntegerPropertyCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>contents</conditiongroup>
+ <propertyname>likesReceived</propertyname>
+ <minvalue>0</minvalue>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.user.userOptions</name>
+ <definitionname>com.woltlab.wcf.condition.notice</definitionname>
+ <classname><![CDATA[wcf\system\condition\UserOptionsCondition]]></classname>
+ <conditionobject>com.woltlab.wcf.user</conditionobject>
+ <conditiongroup>userOptions</conditiongroup>
+ </type>
+ <!-- /user group assignment conditions -->
</import>
</data>
<definition>
<name>com.woltlab.wcf.page</name>
</definition>
+
+ <definition>
+ <name>com.woltlab.wcf.condition.notice</name>
+ <interfacename><![CDATA[wcf\system\condition\INoticeCondition]]></interfacename>
+ </definition>
</import>
</data>
WCF.Date.Picker.init();
new WCF.User.ProfilePreview();
WCF.System.FlexibleMenu.init();
+ new WCF.Notice.Dismiss();
{event name='javascriptInit'}
<p class="warning">{lang}wcf.user.register.needActivation{/lang}</p>
{/if}
+ {* todo: styling/visual appearence *}
+ {foreach from=$__wcf->getNoticeHandler()->getVisibleNotices() item='notice'}
+ <p class="info notice{if $notice->isDismissible} noticeDismissible{/if}">
+ {if $notice->isDismissible}
+ <span class="icon icon16 icon-remove pointer jsDismissNoticeButton jsTooltip" data-object-id="{$notice->noticeID}" title="{lang}wcf.notice.button.dismiss{/lang}" style="float: right;"></span>
+ {/if}
+
+ {if $notice->noticeUseHtml}{@$notice->notice|language}{else}{$notice->notice|language}{/if}
+ </p>
+ {/foreach}
+
{event name='userNotice'}
-</div>
\ No newline at end of file
+</div>
<category name="admin.content.tag">
<parent>admin.content</parent>
</category>
+ <category name="admin.content.notice">
+ <parent>admin.content</parent>
+ </category>
<category name="admin.community">
<parent>admin</parent>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
</option>
+
+ <option name="admin.content.notice.canManageNotice">
+ <categoryname>admin.content.notice</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>0</defaultvalue>
+ <admindefaultvalue>1</admindefaultvalue>
+ </option>
</options>
</import>
</data>
--- /dev/null
+{include file='header' pageTitle='wcf.acp.notice.'|concat:$action}
+
+<script data-relocate="true">
+ //<![CDATA[
+ $(function() {
+ WCF.TabMenu.init();
+ });
+ //]]>
+</script>
+
+<header class="boxHeadline">
+ <h1>{lang}wcf.acp.notice.{$action}{/lang}</h1>
+</header>
+
+{include file='formError'}
+
+{if $success|isset}
+ <p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
+{/if}
+
+<div class="contentNavigation">
+ <nav>
+ <ul>
+ <li><a href="{link controller='NoticeList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.acp.menu.link.notice.list{/lang}</span></a></li>
+
+ {event name='contentNavigationButtons'}
+ </ul>
+ </nav>
+</div>
+
+<form method="post" action="{if $action == 'add'}{link controller='NoticeAdd'}{/link}{else}{link controller='NoticeEdit' object=$notice}{/link}{/if}">
+ <div class="container containerPadding marginTop">
+ <fieldset>
+ <legend>{lang}wcf.global.form.data{/lang}</legend>
+
+ <dl{if $errorField == 'noticeName'} class="formError"{/if}>
+ <dt><label for="noticeName">{lang}wcf.global.name{/lang}</label></dt>
+ <dd>
+ <input type="text" id="noticeName" name="noticeName" value="{$noticeName}" required="required" autofocus="autofocus" class="long" />
+ {if $errorField == 'noticeName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.notice.noticeName.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+
+ <dl{if $errorField == 'notice'} class="formError"{/if}>
+ <dt><label for="notice">{lang}wcf.acp.notice.notice{/lang}</label></dt>
+ <dd>
+ <textarea id="notice" name="notice" cols="40" rows="10">{$i18nPlainValues['notice']}</textarea>
+ {if $errorField == 'notice'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {elseif $errorType == 'multilingual'}
+ {lang}wcf.global.form.error.multilingual{/lang}
+ {else}
+ {lang}wcf.acp.notice.notice.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+ {include file='multipleLanguageInputJavascript' elementIdentifier='notice' forceSelection=false}
+
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" name="noticeUseHtml" value="1"{if $noticeUseHtml} checked="checked"{/if} /> {lang}wcf.acp.notice.noticeUseHtml{/lang}</label>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" name="isDisabled" value="1"{if $isDisabled} checked="checked"{/if} /> {lang}wcf.acp.notice.isDisabled{/lang}</label>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt><label for="position">{lang}wcf.acp.notice.showOrder{/lang}</label></dt>
+ <dd>
+ <input type="number" id="showOrder" name="showOrder" value="{$showOrder}" class="tiny" min="0" />
+ <small>{lang}wcf.acp.notice.showOrder.description{/lang}</small>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" name="isDismissible" value="1"{if $isDismissible} checked="checked"{/if} /> {lang}wcf.acp.notice.isDismissible{/lang}</label>
+ <small>{lang}wcf.acp.notice.isDismissible.description{/lang}</small>
+ </dd>
+ </dl>
+
+ {if $action == 'edit' && $notice->isDismissible}
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" name="resetIsDismissed" value="1"{if $resetIsDismissed} checked="checked"{/if} /> {lang}wcf.acp.notice.resetIsDismissed{/lang}</label>
+ <small>{lang}wcf.acp.notice.resetIsDismissed.description{/lang}</small>
+ </dd>
+ </dl>
+ {/if}
+
+ {event name='dataFields'}
+ </fieldset>
+
+ {event name='fieldsets'}
+ </div>
+
+ <header class="boxHeadline boxSubHeadline">
+ <h2>{lang}wcf.acp.notice.conditions{/lang}</h2>
+ <small>{lang}wcf.acp.notice.conditions.description{/lang}</small>
+ </header>
+
+ <div class="container containerPadding marginTop">
+ <fieldset>
+ <legend>{lang}wcf.acp.notice.conditions.page{/lang}</legend>
+ <small>{lang}wcf.acp.notice.conditions.page.description{/lang}</small>
+
+ {foreach from=$groupedConditionObjectTypes['com.woltlab.wcf.page'] item='pageConditionObjectType'}
+ {@$pageConditionObjectType->getProcessor()->getHtml()}
+ {/foreach}
+ </fieldset>
+ </div>
+
+ <header class="boxHeadline boxSubHeadline">
+ <h2>{lang}wcf.acp.notice.conditions.user{/lang}</h2>
+ <small>{lang}wcf.acp.notice.conditions.user.description{/lang}</small>
+ </header>
+
+ {include file='userConditions' groupedObjectTypes=$groupedConditionObjectTypes['com.woltlab.wcf.user']}
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+ {@SECURITY_TOKEN_INPUT_TAG}
+ </div>
+</form>
+
+{include file='footer'}
--- /dev/null
+{include file='header' pageTitle='wcf.acp.notice.list'}
+
+<script data-relocate="true">
+ //<![CDATA[
+ $(function() {
+ new WCF.Action.Delete('wcf\\data\\notice\\NoticeAction', '.jsNotice');
+ new WCF.Action.Toggle('wcf\\data\\notice\\NoticeAction', '.jsNotice');
+ new WCF.Sortable.List('noticeList', 'wcf\\data\\notice\\NoticeAction', {@$startIndex});
+ });
+ //]]>
+</script>
+
+<header class="boxHeadline">
+ <h1>{lang}wcf.acp.notice.list{/lang}</h1>
+</header>
+
+<div class="contentNavigation">
+ {pages print=true assign=pagesLinks controller="NoticeList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+
+ <nav>
+ <ul>
+ <li><a href="{link controller='NoticeAdd'}{/link}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}wcf.acp.menu.link.notice.add{/lang}</span></a></li>
+
+ {event name='contentNavigationButtonsTop'}
+ </ul>
+ </nav>
+</div>
+
+{if $objects|count}
+ <div class="container containerPadding sortableListContainer marginTop" id="noticeList">
+ <ol class="sortableList" data-object-id="0" start="{@($pageNo - 1) * $itemsPerPage + 1}">
+ {foreach from=$objects item='notice'}
+ <li class="sortableNode sortableNoNesting jsNotice" data-object-id="{@$notice->noticeID}">
+ <span class="sortableNodeLabel">
+ <a href="{link controller='NoticeEdit' object=$notice}{/link}">{$notice->noticeName}</a>
+
+ <span class="statusDisplay sortableButtonContainer">
+ <span class="icon icon16 icon-check{if $notice->isDisabled}-empty{/if} jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if $notice->isDisabled}enable{else}disable{/if}{/lang}" data-object-id="{@$notice->noticeID}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}"></span>
+ <a href="{link controller='NoticeEdit' object=$notice}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 icon-pencil"></span></a>
+ <span class="icon icon16 icon-remove jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$notice->noticeID}" data-confirm-message="{lang}wcf.acp.notice.delete.confirmMessage{/lang}"></span>
+
+ {event name='itemButtons'}
+ </span>
+ </span>
+ </li>
+ {/foreach}
+ </ol>
+
+ <div class="formSubmit">
+ <button class="button" data-type="submit">{lang}wcf.global.button.saveSorting{/lang}</button>
+ </div>
+ </div>
+
+ <div class="contentNavigation">
+ {@$pagesLinks}
+
+ <nav>
+ <ul>
+ <li><a href="{link controller='NoticeAdd'}{/link}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}wcf.acp.menu.link.notice.add{/lang}</span></a></li>
+
+ {event name='contentNavigationButtonsBottom'}
+ </ul>
+ </nav>
+ </div>
+{else}
+ <p class="info">{lang}wcf.global.noItems{/lang}</p>
+{/if}
+
+{include file='footer'}
}
});
+/**
+ * Initializes WCF.Condition namespace.
+ */
+WCF.Condition = { };
+
+/**
+ * Handles displaying the a form element whose visibility depends on the selected
+ * page controllers.
+ */
+WCF.Condition.PageControllerDependence = Class.extend({
+ /**
+ * select list with the available page controllers
+ * @var jQuery
+ */
+ _pageControllerSelection: null,
+
+ /**
+ * ids of page object types that support the form element
+ * @var array<integer>
+ */
+ _supportedPageObjectTypeIDs: [],
+
+ /**
+ * Initializes a new WCF.Condition.PageControllerDependence object.
+ *
+ * @param string inputIdentifier
+ * @param array<integer> supportedPageObjectTypeIDs
+ */
+ init: function(inputIdentifier, supportedPageObjectTypeIDs) {
+ this._supportedPageObjectTypeIDs = supportedPageObjectTypeIDs;
+
+ this._pageControllerSelection = $('#pageControllers').change($.proxy(this._checkVisibility, this));
+ this._pageControllerContainer = this._pageControllerSelection.parents('dl:eq(0)');
+
+ this._input = $('#' + inputIdentifier);
+ this._inputContainer = this._input.parents('dl:eq(0)');
+
+ this._checkVisibility();
+ },
+
+ /**
+ * Checks the visibility based on the selected page controllers.
+ */
+ _checkVisibility: function() {
+ var $selectedPageIDs = this._pageControllerSelection.val() || [ ];
+
+ var $display = true;
+ if ($selectedPageIDs.length) {
+ for (var $i = 0, $length = $selectedPageIDs.length; $i < $length; $i++) {
+ if (this._supportedPageObjectTypeIDs.indexOf(parseInt($selectedPageIDs[$i])) == -1) {
+ $display = false;
+ break;
+ }
+ }
+ }
+ else {
+ $display = false;
+ }
+
+ if ($display) {
+ this._inputContainer.show();
+ this._input.enable();
+ }
+ else {
+ this._inputContainer.hide();
+ this._input.disable();
+ }
+ }
+});
+
+/**
+ * Initialize WCF.Notice namespace.
+ */
+WCF.Notice = { };
+
+/**
+ * Handles dismissing notices.
+ */
+WCF.Notice.Dismiss = Class.extend({
+ /**
+ * list with notices
+ * @var jQuery
+ */
+ _notices: { },
+
+ /**
+ * action proxy object
+ * @var WCF.Action.Proxy
+ */
+ _proxy: null,
+
+ /**
+ * Initializes a new WCF.Notice.Dismiss object.
+ */
+ init: function() {
+ this._proxy = new WCF.Action.Proxy({
+ success: $.proxy(this._success, this)
+ });
+
+ var $dismissButtons = $('.jsDismissNoticeButton').click($.proxy(this._click, this));
+
+ $dismissButtons.each($.proxy(function(index, element) {
+ this._notices[$(element).data('objectID')] = $(element).parent();
+ }, this));
+ },
+
+ /**
+ * Handles clicking on
+ */
+ _click: function(event) {
+ this._proxy.setOption('data', {
+ actionName: 'dismiss',
+ className: 'wcf\\data\\notice\\NoticeAction',
+ objectIDs: [ $(event.currentTarget).data('objectID') ]
+ });
+ this._proxy.sendRequest();
+ },
+
+ /**
+ * Handles successfull AJAX request.
+ *
+ * @param object data
+ * @param string textStatus
+ * @param jQuery jqXHR
+ */
+ _success: function(data, textStatus, jqXHR) {
+ this._notices[data.returnValues.noticeID].wcfFadeOut();
+ }
+});
+
/**
* Encapsulate eval() within an own function to prevent problems
* with optimizing and minifiny JS.
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\notice\NoticeAction;
+use wcf\data\notice\NoticeEditor;
+use wcf\form\AbstractForm;
+use wcf\system\condition\ConditionHandler;
+use wcf\system\exception\UserInputException;
+use wcf\system\language\I18nHandler;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the form to create a new notice.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.form
+ * @category Community Framework
+ */
+class NoticeAddForm extends AbstractForm {
+ /**
+ * @see \wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.notice.add';
+
+ /**
+ * grouped notice condition object types
+ * @var array
+ */
+ public $groupedConditionObjectTypes = array();
+
+ /**
+ * 1 if the notice is disabled
+ * @var integer
+ */
+ public $isDisabled = 0;
+
+ /**
+ * 1 if the notice is dismissible
+ * @var integer
+ */
+ public $isDismissible = 0;
+
+ /**
+ * @see \wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.content.notice.canManageNotice');
+
+ /**
+ * name of the notice
+ * @var string
+ */
+ public $noticeName = '';
+
+ /**
+ * 1 if html is used in the notice text
+ * @var integer
+ */
+ public $noticeUseHtml = 0;
+
+ /**
+ * order used to the show the notices
+ * @var integer
+ */
+ public $showOrder = 0;
+
+ /**
+ * @see \wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ I18nHandler::getInstance()->assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'action' => 'add',
+ 'isDisabled' => $this->isDisabled,
+ 'isDismissible' => $this->isDismissible,
+ 'groupedConditionObjectTypes' => $this->groupedConditionObjectTypes,
+ 'noticeName' => $this->noticeName,
+ 'noticeUseHtml' => $this->noticeUseHtml,
+ 'showOrder' => $this->showOrder
+ ));
+ }
+
+ /**
+ * @see \wcf\page\IPage::readData()
+ */
+ public function readData() {
+ $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.condition.notice');
+ foreach ($objectTypes as $objectType) {
+ if (!$objectType->conditionobject) continue;
+
+ if (!isset($this->groupedConditionObjectTypes[$objectType->conditionobject])) {
+ $this->groupedConditionObjectTypes[$objectType->conditionobject] = array();
+ }
+
+ if ($objectType->conditiongroup) {
+ if (!isset($this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup])) {
+ $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup] = array();
+ }
+
+ $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup][$objectType->objectTypeID] = $objectType;
+ }
+ else {
+ $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->objectTypeID] = $objectType;
+ }
+ }
+
+ parent::readData();
+ }
+
+ /**
+ * @see \wcf\form\IForm::readFormParameters()
+ */
+ public function readFormParameters() {
+ parent::readFormParameters();
+
+ I18nHandler::getInstance()->readValues();
+
+ if (isset($_POST['isDisabled'])) $this->isDisabled = 1;
+ if (isset($_POST['isDismissible'])) $this->isDismissible = 1;
+ if (isset($_POST['noticeName'])) $this->noticeName = StringUtil::trim($_POST['noticeName']);
+ if (isset($_POST['noticeUseHtml'])) $this->noticeUseHtml = 1;
+ if (isset($_POST['showOrder'])) $this->showOrder = intval($_POST['showOrder']);
+
+ foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) {
+ foreach ($groupedObjectTypes as $objectTypes) {
+ if (is_array($objectTypes)) {
+ foreach ($objectTypes as $objectType) {
+ $objectType->getProcessor()->readFormParameters();
+ }
+ }
+ else {
+ $objectTypes->getProcessor()->readFormParameters();
+ }
+ }
+ }
+ }
+
+ /**
+ * @see \wcf\page\IPage::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ I18nHandler::getInstance()->register('notice');
+ }
+
+ /**
+ * @see \wcf\form\IForm::save()
+ */
+ public function save() {
+ parent::save();
+
+ $this->objectAction = new NoticeAction(array(), 'create', array(
+ 'data' => array(
+ 'isDisabled' => $this->isDisabled,
+ 'isDismissible' => $this->isDismissible,
+ 'notice' => I18nHandler::getInstance()->isPlainValue('notice') ? I18nHandler::getInstance()->getValue('notice') : '',
+ 'noticeName' => $this->noticeName,
+ 'noticeUseHtml' => $this->noticeUseHtml,
+ 'showOrder' => $this->showOrder
+ )
+ ));
+ $returnValues = $this->objectAction->executeAction();
+
+ if (!I18nHandler::getInstance()->isPlainValue('notice')) {
+ I18nHandler::getInstance()->save('notice', 'wcf.notice.notice.notice'.$returnValues['returnValues']->noticeID, 'wcf.notice', 1);
+
+ // update notice name
+ $noticeEditor = new NoticeEditor($returnValues['returnValues']);
+ $noticeEditor->update(array(
+ 'notice' => 'wcf.notice.notice.notice'.$returnValues['returnValues']->noticeID
+ ));
+ }
+
+ // transform conditions array into one-dimensional array
+ $conditions = array();
+ foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) {
+ foreach ($groupedObjectTypes as $objectTypes) {
+ if (is_array($objectTypes)) {
+ $conditions = array_merge($conditions, $objectTypes);
+ }
+ else {
+ $conditions[] = $objectTypes;
+ }
+ }
+ }
+
+ ConditionHandler::getInstance()->createConditions($returnValues['returnValues']->noticeID, $conditions);
+
+ $this->saved();
+
+ // reset values
+ $this->isDisabled = 0;
+ $this->isDismissible = 0;
+ $this->noticeName = '';
+ $this->noticeUseHtml = 0;
+ $this->showOrder = 0;
+ I18nHandler::getInstance()->reset();
+
+ foreach ($conditions as $condition) {
+ $condition->getProcessor()->reset();
+ }
+
+ WCF::getTPL()->assign('success', true);
+ }
+
+ /**
+ * @see \wcf\form\IForm::validate()
+ */
+ public function validate() {
+ parent::validate();
+
+ if (empty($this->noticeName)) {
+ throw new UserInputException('noticeName');
+ }
+
+ if (!I18nHandler::getInstance()->validateValue('notice')) {
+ if (I18nHandler::getInstance()->isPlainValue('notice')) {
+ throw new UserInputException('notice');
+ }
+ else {
+ throw new UserInputException('notice', 'multilingual');
+ }
+ }
+
+ foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) {
+ foreach ($groupedObjectTypes as $objectTypes) {
+ if (is_array($objectTypes)) {
+ foreach ($objectTypes as $objectType) {
+ $objectType->getProcessor()->validate();
+ }
+ }
+ else {
+ $objectTypes->getProcessor()->validate();
+ }
+ }
+ }
+ }
+}
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\data\notice\Notice;
+use wcf\data\notice\NoticeAction;
+use wcf\data\notice\NoticeEditor;
+use wcf\form\AbstractForm;
+use wcf\system\condition\ConditionHandler;
+use wcf\system\language\I18nHandler;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\user\storage\UserStorageHandler;
+use wcf\system\WCF;
+
+/**
+ * Shows the form to edit an existing notice.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.form
+ * @category Community Framework
+ */
+class NoticeEditForm extends NoticeAddForm {
+ /**
+ * @see \wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.notice';
+
+ /**
+ * edited notice object
+ * @var \wcf\data\notice\Notice
+ */
+ public $notice = null;
+
+ /**
+ * id of the edited notice object
+ * @var integer
+ */
+ public $noticeID = 0;
+
+ /**
+ * 1 if the notice will be displayed for all users again
+ * @var unknown
+ */
+ public $resetIsDismissed = 0;
+
+ /**
+ * @see \wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ I18nHandler::getInstance()->assignVariables(!empty($_POST));
+
+ WCF::getTPL()->assign(array(
+ 'action' => 'edit',
+ 'notice' => $this->notice,
+ 'resetIsDismissed' => $this->resetIsDismissed
+ ));
+ }
+
+ /**
+ * @see \wcf\page\IPage::readData()
+ */
+ public function readData() {
+ parent::readData();
+
+ if (empty($_POST)) {
+ I18nHandler::getInstance()->setOptions('notice', 1, $this->notice->notice, 'wcf.notice.notice.notice\d+');
+
+ $this->isDisabled = $this->notice->isDisabled;
+ $this->isDismissible = $this->notice->isDismissible;
+ $this->noticeName = $this->notice->noticeName;
+ $this->noticeUseHtml = $this->notice->noticeUseHtml;
+ $this->showOrder = $this->notice->showOrder;
+
+ $conditions = $this->notice->getConditions();
+ $conditionsByObjectTypeID = array();
+ foreach ($conditions as $condition) {
+ $conditionsByObjectTypeID[$condition->objectTypeID] = $condition;
+ }
+
+ foreach ($this->groupedConditionObjectTypes as $objectTypes1) {
+ foreach ($objectTypes1 as $objectTypes2) {
+ if (is_array($objectTypes2)) {
+ foreach ($objectTypes2 as $objectType) {
+ if (isset($conditionsByObjectTypeID[$objectType->objectTypeID])) {
+ $conditionsByObjectTypeID[$objectType->objectTypeID]->getObjectType()->getProcessor()->setData($conditionsByObjectTypeID[$objectType->objectTypeID]);
+ }
+ }
+ }
+ else if (isset($conditionsByObjectTypeID[$objectTypes2->objectTypeID])) {
+ $conditionsByObjectTypeID[$objectTypes2->objectTypeID]->getObjectType()->getProcessor()->setData($conditionsByObjectTypeID[$objectTypes2->objectTypeID]);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @see \wcf\form\IForm::readFormParameters()
+ */
+ public function readFormParameters() {
+ parent::readFormParameters();
+
+ if (isset($_POST['resetIsDismissed'])) $this->resetIsDismissed = 1;
+ }
+
+ /**
+ * @see \wcf\page\IPage::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['id'])) $this->noticeID = intval($_REQUEST['id']);
+ $this->notice = new Notice($this->noticeID);
+ if (!$this->notice->noticeID) {
+ throw new IllegalLinkException();
+ }
+ }
+
+ /**
+ * @see \wcf\form\IForm::save()
+ */
+ public function save() {
+ AbstractForm::save();
+
+ $this->objectAction = new NoticeAction(array($this->notice), 'update', array(
+ 'data' => array(
+ 'isDisabled' => $this->isDisabled,
+ 'isDismissible' => $this->isDismissible,
+ 'notice' => I18nHandler::getInstance()->isPlainValue('notice') ? I18nHandler::getInstance()->getValue('notice') : 'wcf.notice.notice.notice'.$this->notice->noticeID,
+ 'noticeName' => $this->noticeName,
+ 'noticeUseHtml' => $this->noticeUseHtml,
+ 'showOrder' => $this->showOrder
+ )
+ ));
+ $this->objectAction->executeAction();
+
+ if (I18nHandler::getInstance()->isPlainValue('notice')) {
+ if ($this->notice->notice == 'wcf.notice.notice.notice'.$this->notice->noticeID) {
+ I18nHandler::getInstance()->remove($this->notice->notice);
+ }
+ }
+ else {
+ I18nHandler::getInstance()->save('notice', 'wcf.notice.notice.notice'.$this->notice->noticeID, 'wcf.notice', 1);
+ }
+
+ // transform conditions array into one-dimensional array
+ $conditions = array();
+ foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) {
+ foreach ($groupedObjectTypes as $objectTypes) {
+ if (is_array($objectTypes)) {
+ $conditions = array_merge($conditions, $objectTypes);
+ }
+ else {
+ $conditions[] = $objectTypes;
+ }
+ }
+ }
+
+ ConditionHandler::getInstance()->updateConditions($this->notice->noticeID, $this->notice->getConditions(), $conditions);
+
+ if ($this->resetIsDismissed) {
+ $sql = "DELETE FROM wcf".WCF_N."_notice_dismissed
+ WHERE noticeID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ $this->notice->noticeID
+ ));
+
+ $this->resetIsDismissed = 0;
+
+ UserStorageHandler::getInstance()->resetAll('dismissedNotices');
+ }
+
+ $this->saved();
+
+ // reload notice object for proper 'isDismissible' value
+ $this->notice = new Notice($this->noticeID);
+
+ WCF::getTPL()->assign('success', true);
+ }
+}
));
$returnValues = $this->objectAction->executeAction();
- ConditionHandler::getInstance()->createConditions($returnValues['returnValues']->assignmentID, $this->conditions);
+ // transform conditions array into one-dimensional array
+ $conditions = array();
+ foreach ($this->conditions as $groupedObjectTypes) {
+ $conditions = array_merge($conditions, $groupedObjectTypes);
+ }
+
+ ConditionHandler::getInstance()->createConditions($returnValues['returnValues']->assignmentID, $conditions);
$this->saved();
));
$returnValues = $this->objectAction->executeAction();
- ConditionHandler::getInstance()->updateConditions($this->assignment->assignmentID, $this->assignment->getConditions(), $this->conditions);
+ // transform conditions array into one-dimensional array
+ $conditions = array();
+ foreach ($this->conditions as $groupedObjectTypes) {
+ $conditions = array_merge($conditions, $groupedObjectTypes);
+ }
+
+ ConditionHandler::getInstance()->updateConditions($this->assignment->assignmentID, $this->assignment->getConditions(), $conditions);
$this->saved();
--- /dev/null
+<?php
+namespace wcf\acp\page;
+use wcf\page\SortablePage;
+
+/**
+ * Lists the available notices.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.page
+ * @category Community Framework
+ */
+class NoticeListPage extends SortablePage {
+ /**
+ * @see \wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.notice.list';
+
+ /**
+ * @see \wcf\page\SortablePage::$defaultSortField
+ */
+ public $defaultSortField = 'showOrder';
+
+ /**
+ * @see \wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.content.notice.canManageNotice');
+
+ /**
+ * @see \wcf\page\MultipleLinkPage::$objectListClassName
+ */
+ public $objectListClassName = 'wcf\data\notice\NoticeList';
+
+ /**
+ * @see \wcf\page\SortablePage::$objectListClassName
+ */
+ public $validSortFields = array('noticeID', 'noticeName', 'showOrder');
+}
--- /dev/null
+<?php
+namespace wcf\data\notice;
+use wcf\data\DatabaseObject;
+use wcf\system\condition\ConditionHandler;
+use wcf\system\request\IRouteController;
+use wcf\system\user\storage\UserStorageHandler;
+use wcf\system\WCF;
+
+/**
+ * Represents a notice.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage data.notice
+ * @category Community Framework
+ */
+class Notice extends DatabaseObject implements IRouteController {
+ /**
+ * true if the active user has dismissed the notice
+ * @var boolean
+ */
+ protected $isDismissed = null;
+
+ /**
+ * @see \wcf\data\DatabaseObject::$databaseTableName
+ */
+ protected static $databaseTableName = 'notice';
+
+ /**
+ * @see \wcf\data\DatabaseObject::$databaseIndexName
+ */
+ protected static $databaseTableIndexName = 'noticeID';
+
+ /**
+ * Returns the conditions of the notice.
+ *
+ * @return array<\wcf\data\condition\Condition>
+ */
+ public function getConditions() {
+ return ConditionHandler::getInstance()->getConditions('com.woltlab.wcf.condition.notice', $this->noticeID);
+ }
+
+ /**
+ * @see \wcf\data\ITitledObject::getTitle()
+ */
+ public function getTitle() {
+ return $this->noticeName;
+ }
+
+ /**
+ * Returns true if the active user has dismissed the notice.
+ *
+ * @return boolean
+ */
+ public function isDismissed() {
+ if (!$this->isDismissible) return false;
+
+ if ($this->isDismissed === null) {
+ if (WCF::getUser()->userID) {
+ UserStorageHandler::getInstance()->loadStorage(array(WCF::getUser()->userID));
+ $dismissedNotices = UserStorageHandler::getInstance()->getStorage(array(WCF::getUser()->userID), 'dismissedNotices');
+ if ($dismissedNotices[WCF::getUser()->userID] === null) {
+ $sql = "SELECT noticeID
+ FROM wcf".WCF_N."_notice_dismissed
+ WHERE userID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ WCF::getUser()->userID
+ ));
+
+ $noticeIDs = array();
+ while ($noticeID = $statement->fetchColumn()) {
+ $noticeIDs[] = $noticeID;
+
+ if ($noticeID == $this->noticeID) {
+ $this->isDismissed = true;
+ }
+ }
+
+ UserStorageHandler::getInstance()->update(WCF::getUser()->userID, 'dismissedNotices', serialize($noticeIDs));
+ }
+ else {
+ $dismissedNoticeIDs = @unserialize($dismissedNotices[WCF::getUser()->userID]);
+ $this->isDismissed = isset($dismissedNoticeIDs[$this->noticeID]);
+ }
+ }
+ else {
+ $dismissedNotices = WCF::getSession()->getVar('dismissedNotices');
+ if ($dismissedNotices !== null) {
+ $dismissedNotices = @unserialize($dismissedNotices);
+ $this->isDismissed = in_array($this->noticeID, $dismissedNotices);
+ }
+ else {
+ $this->isDismissed = false;
+ }
+ }
+ }
+
+ return $this->isDismissed;
+ }
+}
--- /dev/null
+<?php
+namespace wcf\data\notice;
+use wcf\data\AbstractDatabaseObjectAction;
+use wcf\data\ISortableAction;
+use wcf\data\IToggleAction;
+use wcf\system\exception\UserInputException;
+use wcf\system\user\storage\UserStorageHandler;
+use wcf\system\WCF;
+
+/**
+ * Executes notice-related actions.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage data.notice
+ * @category Community Framework
+ */
+class NoticeAction extends AbstractDatabaseObjectAction implements ISortableAction, IToggleAction {
+ /**
+ * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess
+ */
+ protected $allowGuestAccess = array('dismiss');
+
+ /**
+ * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
+ */
+ protected $permissionsDelete = array('admin.content.notice.canManageNotice');
+
+ /**
+ * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
+ */
+ protected $permissionsUpdate = array('admin.content.notice.canManageNotice');
+
+ /**
+ * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP
+ */
+ protected $requireACP = array('create', 'delete', 'toggle', 'update', 'updatePosition');
+
+ /**
+ * @see \wcf\data\AbstractDatabaseObjectAction::create()
+ */
+ public function create() {
+ $showOrder = 0;
+ if (isset($this->parameters['data']['showOrder'])) {
+ $showOrder = $this->parameters['data']['showOrder'];
+ unset($this->parameters['data']['showOrder']);
+ }
+
+ $notice = parent::create();
+ $noticeEditor = new NoticeEditor($notice);
+ $noticeEditor->setShowOrder($showOrder);
+
+ return new Notice($notice->noticeID);
+ }
+
+ /**
+ * Dismisses a certain notice.
+ *
+ * @return array<integer>
+ */
+ public function dismiss() {
+ if (WCF::getUser()->userID) {
+ $sql = "INSERT INTO wcf".WCF_N."_notice_dismissed
+ (noticeID, userID)
+ VALUES (?, ?)";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ reset($this->objectIDs),
+ WCF::getUser()->userID
+ ));
+
+ UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'dismissedNotices');
+ }
+ else {
+ $dismissedNotices = WCF::getSession()->getVar('dismissedNotices');
+ if ($dismissedNotices !== null) {
+ $dismissedNotices = @unserialize($dismissedNotices);
+ $dismissedNotices[] = reset($this->objectIDs);
+ }
+ else {
+ $dismissedNotices = array(
+ reset($this->objectIDs)
+ );
+ }
+
+ WCF::getSession()->register('dismissedNotices', serialize($dismissedNotices));
+ }
+
+ return array(
+ 'noticeID' => reset($this->objectIDs)
+ );
+ }
+
+ /**
+ * @see \wcf\data\IToggleAction::toggle()
+ */
+ public function toggle() {
+ foreach ($this->objects as $notice) {
+ $notice->update(array(
+ 'isDisabled' => $notice->isDisabled ? 0 : 1
+ ));
+ }
+ }
+
+ /**
+ * Validates the 'dismiss' action.
+ */
+ public function validateDismiss() {
+ $this->getSingleObject();
+ }
+
+ /**
+ * @see \wcf\data\IToggleAction::validateToggle()
+ */
+ public function validateToggle() {
+ parent::validateUpdate();
+ }
+
+ /**
+ * @see \wcf\data\ISortableAction::validateUpdatePosition()
+ */
+ public function validateUpdatePosition() {
+ WCF::getSession()->checkPermissions($this->permissionsUpdate);
+
+ if (!isset($this->parameters['data']['structure']) || !is_array($this->parameters['data']['structure'])) {
+ throw new UserInputException('structure');
+ }
+
+ $noticeList = new NoticeList();
+ $noticeList->getConditionBuilder()->add('notice.noticeID IN (?)', array($this->parameters['data']['structure'][0]));
+ if ($noticeList->countObjects() != count($this->parameters['data']['structure'][0])) {
+ throw new UserInputException('structure');
+ }
+
+ $this->readInteger('offset', true, 'data');
+ }
+
+ /**
+ * @see \wcf\data\AbstractDatabaseObjectAction::update()
+ */
+ public function update() {
+ parent::update();
+
+ if (count($this->objects) == 1 && isset($this->parameters['data']['showOrder']) && $this->parameters['data']['showOrder'] != reset($this->objects)->showOrder) {
+ reset($this->objects)->setShowOrder($this->parameters['data']['showOrder']);
+ }
+ }
+
+ /**
+ * @see \wcf\data\ISortableAction::updatePosition()
+ */
+ public function updatePosition() {
+ $sql = "UPDATE wcf".WCF_N."_notice
+ SET showOrder = ?
+ WHERE noticeID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+
+ $showOrder = $this->parameters['data']['offset'];
+ WCF::getDB()->beginTransaction();
+ foreach ($this->parameters['data']['structure'][0] as $noticeID) {
+ $statement->execute(array(
+ $showOrder++,
+ $noticeID
+ ));
+ }
+ WCF::getDB()->commitTransaction();
+ }
+}
--- /dev/null
+<?php
+namespace wcf\data\notice;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\DatabaseObjectEditor;
+use wcf\data\IEditableCachedObject;
+use wcf\system\cache\builder\ConditionCacheBuilder;
+use wcf\system\cache\builder\NoticeCacheBuilder;
+use wcf\system\WCF;
+
+/**
+ * Provides functions to edit notices.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage data.notice
+ * @category Community Framework
+ */
+class NoticeEditor extends DatabaseObjectEditor implements IEditableCachedObject {
+ /**
+ * @see \wcf\data\DatabaseObjectDecorator::$baseClass
+ */
+ protected static $baseClass = 'wcf\data\notice\Notice';
+
+ /**
+ * Sets the show order of the notice.
+ *
+ * @param integer $showOrder
+ */
+ public function setShowOrder($showOrder = 0) {
+ $newShowOrder = 1;
+
+ $sql = "SELECT MAX(showOrder)
+ FROM wcf".WCF_N."_notice";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute();
+ $maxShowOrder = $statement->fetchColumn();
+ if (!$maxShowOrder) $maxShowOrder = 0;
+
+ if (!$showOrder || $showOrder > $maxShowOrder) {
+ $newShowOrder = $maxShowOrder + 1;
+ }
+ else {
+ // shift other notices
+ $sql = "UPDATE wcf".WCF_N."_notice
+ SET showOrder = showOrder + 1
+ WHERE showOrder >= ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ $showOrder
+ ));
+
+ $newShowOrder = $showOrder;
+ }
+
+ $this->update(array(
+ 'showOrder' => $newShowOrder
+ ));
+ }
+
+ /**
+ * @see \wcf\data\IEditableCachedObject::resetCache()
+ */
+ public static function resetCache() {
+ NoticeCacheBuilder::getInstance()->reset();
+ ConditionCacheBuilder::getInstance()->reset(array(
+ 'definitionID' => ObjectTypeCache::getInstance()->getDefinitionByName('com.woltlab.wcf.condition.notice')->definitionID
+ ));
+ }
+}
--- /dev/null
+<?php
+namespace wcf\data\notice;
+use wcf\data\DatabaseObjectList;
+
+/**
+ * Represents a list of notices.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage data.notice
+ * @category Community Framework
+ */
+class NoticeList extends DatabaseObjectList { }
--- /dev/null
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\notice\NoticeList;
+
+/**
+ * Caches the enabled notices.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category Community Framework
+ */
+class NoticeCacheBuilder extends AbstractCacheBuilder {
+ /**
+ * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
+ */
+ protected function rebuild(array $parameters) {
+ $noticeList = new NoticeList();
+ $noticeList->getConditionBuilder()->add('isDisabled = ?', array(0));
+ $noticeList->sqlOrderBy = 'showOrder ASC';
+ $noticeList->readObjects();
+
+ return $noticeList->getObjects();
+ }
+}
--- /dev/null
+<?php
+namespace wcf\system\condition;
+use wcf\data\condition\Condition;
+use wcf\system\exception\UserInputException;
+use wcf\system\WCF;
+use wcf\util\ArrayUtil;
+
+/**
+ * Abstract implementation of a condition with multi select options.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.condition
+ * @category Community Framework
+ */
+abstract class AbstractMultiSelectCondition extends AbstractSelectCondition {
+ /**
+ * @see \wcf\system\condition\AbstractSelectCondition::$fieldValue
+ */
+ protected $fieldValue = array();
+
+ /**
+ * @see \wcf\system\condition\ICondition::getData()
+ */
+ public function getData() {
+ if (!empty($this->fieldValue)) {
+ return array(
+ $this->fieldName => $this->fieldValue
+ );
+ }
+
+ return null;
+ }
+
+ /**
+ * @see \wcf\system\condition\AbstractSingleFieldCondition::getFieldElement()
+ */
+ protected function getFieldElement() {
+ $options = $this->getOptions();
+
+ $fieldElement = '<select name="'.$this->fieldName.'[]" id="'.$this->fieldName.'" multiple="multiple" size="'.(count($options) > 10 ? 10 : count($options)).'">';
+ foreach ($options as $value => $label) {
+ $fieldElement .= '<option value="'.$value.'"'.(in_array($value, $this->fieldValue) ? ' selected="selected"' : '').'>'.WCF::getLanguage()->get($label).'</option>';
+ }
+ $fieldElement .= "</select>";
+
+ return $fieldElement;
+ }
+
+ /**
+ * @see \wcf\system\condition\ICondition::readFormParameters()
+ */
+ public function readFormParameters() {
+ if (isset($_POST[$this->fieldName]) && is_array($_POST[$this->fieldName])) $this->fieldValue = ArrayUtil::toIntegerArray($_POST[$this->fieldName]);
+ }
+
+ /**
+ * @see \wcf\system\condition\ICondition::validate()
+ */
+ public function reset() {
+ $this->fieldValue = array();
+ }
+
+ /**
+ * @see \wcf\system\condition\ICondition::validate()
+ */
+ public function validate() {
+ $options = $this->getOptions();
+ foreach ($this->fieldValue as $value) {
+ if (!isset($options[$value])) {
+ $this->errorMessage = 'wcf.global.form.error.noValidSelection';
+
+ throw new UserInputException($this->fieldName, 'noValidSelection');
+ }
+ }
+ }
+}
* Creates condition objects for the object with the given id and based
* on the given condition object types.
*
- * @param integer $objectID
- * @param array $conditionObjectTypes
+ * @param integer $objectID
+ * @param array<\wcf\data\object\type\ObjectType> $conditionObjectTypes
*/
public function createConditions($objectID, array $conditionObjectTypes) {
- foreach ($conditionObjectTypes as $objectTypes) {
- foreach ($objectTypes as $objectType) {
- $conditionData = $objectType->getProcessor()->getData();
- if ($conditionData !== null) {
- $conditionAction = new ConditionAction(array(), 'create', array(
- 'data' => array(
- 'conditionData' => serialize($conditionData),
- 'objectID' => $objectID,
- 'objectTypeID' => $objectType->objectTypeID
- )
- ));
- $conditionAction->executeAction();
- }
+ foreach ($conditionObjectTypes as $objectType) {
+ $conditionData = $objectType->getProcessor()->getData();
+ if ($conditionData !== null) {
+ $conditionAction = new ConditionAction(array(), 'create', array(
+ 'data' => array(
+ 'conditionData' => serialize($conditionData),
+ 'objectID' => $objectID,
+ 'objectTypeID' => $objectType->objectTypeID
+ )
+ ));
+ $conditionAction->executeAction();
}
}
}
return $this->conditions[$definition->definitionID][$objectID];
}
- return null;
+ return array();
}
/**
*
* @param integer $objectID
* @param array<\wcf\data\condition\Condition> $oldConditions
- * @param array $conditionObjectTypes
+ * @param array<\wcf\data\object\type\ObjectType> $conditionObjectTypes
*/
public function updateConditions($objectID, array $oldConditions, array $conditionObjectTypes) {
// delete old conditions first
--- /dev/null
+<?php
+namespace wcf\system\condition;
+use wcf\data\condition\Condition;
+
+/**
+ * Every implementation for notice conditions needs to implements this interface.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.condition
+ * @category Community Framework
+ */
+interface INoticeCondition extends ICondition {
+ /**
+ * Returns true if a notice with the given condition will be shown.
+ *
+ * All necessary data to check the condition needs to be globally available
+ * like the active user object via WCF::getUser().
+ *
+ * @param \wcf\data\condition\Condition $condition
+ * @return boolean
+ */
+ public function showNotice(Condition $condition);
+}
--- /dev/null
+<?php
+namespace wcf\system\condition;
+use wcf\data\condition\Condition;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\page\PageManager;
+use wcf\system\request\RequestHandler;
+
+/**
+ * Condition implementation for selecting multiple page controllers.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.condition
+ * @category Community Framework
+ */
+class MultiPageControllerCondition extends AbstractMultiSelectCondition implements INoticeCondition {
+ /**
+ * @see \wcf\system\condition\AbstractSingleFieldCondition::$label
+ */
+ protected $description = 'wcf.global.multiSelect';
+
+ /**
+ * @see \wcf\system\condition\AbstractSelectCondition::$fieldName
+ */
+ protected $fieldName = 'pageControllers';
+
+ /**
+ * @see \wcf\system\condition\AbstractSingleFieldCondition::$label
+ */
+ protected $label = 'wcf.page.requestedPage';
+
+ /**
+ * @see \wcf\system\condition\AbstractSelectCondition::getOptions()
+ */
+ protected function getOptions() {
+ return PageManager::getInstance()->getSelection();
+ }
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ $requestClassName = RequestHandler::getInstance()->getActiveRequest()->getClassName();
+ $pageControllers = $condition->pageControllers;
+ foreach ($pageControllers as $objectTypeID) {
+ $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID);
+ if ($objectType === null) return false;
+
+ if ($requestClassName == $objectType->className) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
* @subpackage system.condition
* @category Community Framework
*/
-class UserAvatarCondition extends AbstractSelectCondition implements IUserCondition {
+class UserAvatarCondition extends AbstractSelectCondition implements INoticeCondition, IUserCondition {
/**
* @see wcf\system\condition\AbstractSelectCondition::$fieldName
*/
self::GRAVATAR => 'wcf.user.condition.avatar.gravatar'
);
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
use wcf\data\condition\Condition;
use wcf\data\user\User;
use wcf\data\user\UserList;
+use wcf\system\WCF;
/**
* Condition implementation for the email address of a user.
* @subpackage system.condition
* @category Community Framework
*/
-class UserEmailCondition extends AbstractTextCondition implements IUserCondition {
+class UserEmailCondition extends AbstractTextCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractTextCondition::$fieldName
*/
public function checkUser(Condition $condition, User $user) {
return mb_strpos($user->email, $condition->email) !== false;
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
use wcf\data\user\User;
use wcf\data\user\UserList;
use wcf\system\exception\UserInputException;
+use wcf\system\WCF;
use wcf\util\ArrayUtil;
/**
* @subpackage system.condition
* @category Community Framework
*/
-class UserGroupCondition extends AbstractMultipleFieldsCondition implements IUserCondition {
+class UserGroupCondition extends AbstractMultipleFieldsCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractMultipleFieldsCondition::$descriptions
*/
*/
public function checkUser(Condition $condition, User $user) {
$groupIDs = $user->getGroupIDs();
- if (!empty($condition->groupIDs) && count(array_diff($condition->groupIDs, $groupIDs))) {
+ if (!empty($condition->conditionData['groupIDs']) && count(array_diff($condition->conditionData['groupIDs'], $groupIDs))) {
return false;
}
- if (!empty($condition->notGroupIDs) && count(array_intersect($condition->notGroupIDs, $groupIDs))) {
+ if (!empty($condition->conditionData['notGroupIDs']) && count(array_intersect($condition->conditionData['notGroupIDs'], $groupIDs))) {
return false;
}
*/
protected function getUserGroups() {
if ($this->userGroups == null) {
- $this->userGroups = UserGroup::getGroupsByType(array(UserGroup::OTHER));
+ $groupTypes = array(UserGroup::OTHER);
+ if ($this->includeguests) {
+ $groupTypes[] = UserGroup::GUESTS;
+ }
+
+ $this->userGroups = UserGroup::getGroupsByType($groupTypes);
foreach ($this->userGroups as $key => $userGroup) {
if (!$userGroup->isAccessible()) {
unset($this->userGroups[$key]);
throw new UserInputException('notGroupIDs', 'groupIDsIntersection');
}
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserIntegerPropertyCondition extends AbstractIntegerCondition implements IUserCondition {
+class UserIntegerPropertyCondition extends AbstractIntegerCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractIntegerCondition::$maxValueErrorMessage
*/
protected function getLabel($identifier) {
return WCF::getLanguage()->get('wcf.user.condition.'.$this->getDecoratedObject()->propertyname.'.'.$identifier);
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserLanguageCondition extends AbstractSingleFieldCondition implements IUserCondition {
+class UserLanguageCondition extends AbstractSingleFieldCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractSingleFieldCondition::$label
*/
* @see \wcf\system\condition\IUserCondition::checkUser()
*/
public function checkUser(Condition $condition, User $user) {
- if (!empty($condition->languageIDs) && !in_array($user->languageID, $condition->languageIDs)) {
+ if (!empty($condition->conditionData['languageIDs']) && !in_array($user->languageID, $condition->languageIDs)) {
return false;
}
}
}
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserOptionsCondition extends AbstractMultipleFieldsCondition implements IUserCondition {
+class UserOptionsCondition extends AbstractMultipleFieldsCondition implements INoticeCondition, IUserCondition {
/**
* user option handler object
* @var \wcf\system\option\user\UserOptionHandler
public function setData(Condition $condition) {
$this->optionHandler->setOptionValues($condition->conditionData['optionValues']);
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserRegistrationDateCondition extends AbstractSingleFieldCondition implements IUserCondition {
+class UserRegistrationDateCondition extends AbstractSingleFieldCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractSingleFieldCondition::$label
*/
throw new UserInputException($this->fieldName, 'endBeforeStart');
}
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserRegistrationDateIntervalCondition extends AbstractIntegerCondition implements IUserCondition {
+class UserRegistrationDateIntervalCondition extends AbstractIntegerCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractMultipleFieldsCondition::$languageItemPrefix
*/
protected function getLabel($identifier) {
return WCF::getLanguage()->get('wcf.user.condition.registrationDateInterval.'.$identifier);
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserStateCondition extends AbstractSingleFieldCondition implements IUserCondition {
+class UserStateCondition extends AbstractSingleFieldCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractSingleFieldCondition::$label
*/
throw new UserInputException('userisEnabled', 'conflict');
}
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
* @subpackage system.condition
* @category Community Framework
*/
-class UserUsernameCondition extends AbstractTextCondition implements IUserCondition {
+class UserUsernameCondition extends AbstractTextCondition implements INoticeCondition, IUserCondition {
/**
* @see \wcf\system\condition\AbstractTextCondition::$fieldName
*/
public function checkUser(Condition $condition, User $user) {
return mb_strpos($user->username, $condition->username) !== false;
}
+
+ /**
+ * @see \wcf\system\condition\INoticeCondition::showNotice()
+ */
+ public function showNotice(Condition $condition) {
+ if (!WCF::getUser()->userID) return;
+
+ return $this->checkUser($condition, WCF::getUser());
+ }
}
--- /dev/null
+<?php
+namespace wcf\system\notice;
+use wcf\system\cache\builder\NoticeCacheBuilder;
+use wcf\system\SingletonFactory;
+
+/**
+ * Handles notice-related matters.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.notice
+ * @category Community Framework
+ */
+class NoticeHandler extends SingletonFactory {
+ /**
+ * list with all enabled notices
+ * @var array<\wcf\data\notice\Notice>
+ */
+ protected $notices = array();
+
+ /**
+ * @see \wcf\system\SingletonFacetory::init()
+ */
+ protected function init() {
+ $this->notices = NoticeCacheBuilder::getInstance()->getData();
+ }
+
+ /**
+ * Returns the notices which are visible for the active user.
+ *
+ * @return array<\wcf\data\notice\Notice>
+ */
+ public function getVisibleNotices() {
+ $notices = array();
+ foreach ($this->notices as $notice) {
+ $checkFailed = false;
+ $conditions = $notice->getConditions();
+ foreach ($conditions as $condition) {
+ if (!$condition->getObjectType()->getProcessor()->showNotice($condition)) {
+ $checkFailed = true;
+ break;
+ }
+ }
+
+ if (!$checkFailed && !$notice->isDismissed()) {
+ $notices[$notice->noticeID] = $notice;
+ }
+ }
+
+ return $notices;
+ }
+}
<item name="wcf.acp.group.assignment.list"><![CDATA[Automatische Benutzergruppen-Zuordnungen]]></item>
<item name="wcf.acp.group.assignment.userGroup"><![CDATA[Benutzergruppe]]></item>
<item name="wcf.acp.group.assignment.isDisabled"><![CDATA[Automatische Zuordnung deaktivieren]]></item>
+ <item name="wcf.acp.group.option.category.admin.content.notice"><![CDATA[Hinweise]]></item>
+ <item name="wcf.acp.group.option.admin.content.notice.canManageNotice"><![CDATA[Kann Hinweise verwalten]]></item>
<item name="wcf.acp.group.option.user.profile.aboutMeMaxLength"><![CDATA[Maximallänge „Über mich“]]></item>
<item name="wcf.acp.group.option.user.profile.canReportContent"><![CDATA[Kann Inhalte melden]]></item>
</category>
<item name="wcf.acp.menu.link.maintenance.rebuildData"><![CDATA[Anzeigen aktualisieren]]></item>
<item name="wcf.acp.menu.link.log.stat"><![CDATA[Statistiken]]></item>
<item name="wcf.acp.menu.link.group.assignment"><![CDATA[Automatische Zuordnungen]]></item>
+ <item name="wcf.acp.menu.link.notice"><![CDATA[Hinweise]]></item>
+ <item name="wcf.acp.menu.link.notice.add"><![CDATA[Hinweis hinzufügen]]></item>
+ <item name="wcf.acp.menu.link.notice.list"><![CDATA[Hinweise auflisten]]></item>
+ </category>
+
+ <category name="wcf.acp.notice">
+ <item name="wcf.acp.notice.add"><![CDATA[Hinweis hinzufügen]]></item>
+ <item name="wcf.acp.notice.conditions"><![CDATA[Bedingungen]]></item>
+ <item name="wcf.acp.notice.conditions.description"><![CDATA[Werden keine Bedingungen ausgewählt, wird der Hinweis für jeden Benutzer auf allen Seiten angezeigt.]]></item>
+ <item name="wcf.acp.notice.conditions.page"><![CDATA[Seite]]></item>
+ <item name="wcf.acp.notice.conditions.page.description"><![CDATA[Die vom Benutzer aufgerufene Seite muss folgende Bedingungen erfüllen, damit der Hinweis angezeigt wird.]]></item>
+ <item name="wcf.acp.notice.conditions.user"><![CDATA[Aktiver Benutzer]]></item>
+ <item name="wcf.acp.notice.conditions.user.description"><![CDATA[Der aktive Benutzer muss die folgenden Bedingungen erfüllen, damit der Hinweis angezeigt wird.]]></item>
+ <item name="wcf.acp.notice.delete.confirmMessage"><![CDATA[Wollen Sie diesen Hinweis wirklich löschen?]]></item>
+ <item name="wcf.acp.notice.edit"><![CDATA[Hinweis bearbeiten]]></item>
+ <item name="wcf.acp.notice.isDisabled"><![CDATA[Hinweis deaktivieren]]></item>
+ <item name="wcf.acp.notice.isDismissible"><![CDATA[Benutzer kann Hinweis ausblenden]]></item>
+ <item name="wcf.acp.notice.isDismissible.description"><![CDATA[Ein einmal von einem Benutzer ausgeblender Hinweis wird bei erneutem Seitenaufruf nicht mehr angezeigt.]]></item>
+ <item name="wcf.acp.notice.list"><![CDATA[Hinweise]]></item>
+ <item name="wcf.acp.notice.notice"><![CDATA[Hinweis]]></item>
+ <item name="wcf.acp.notice.noticeUseHtml"><![CDATA[HTML im Hinweis verwenden]]></item>
+ <item name="wcf.acp.notice.resetIsDismissed"><![CDATA[Ausgeblendete Hinweise erneut anzeigen]]></item>
+ <item name="wcf.acp.notice.resetIsDismissed.description"><![CDATA[Der Hinweis wird jenen Benutzern wieder angezeigt, die die ursprüngliche Version bereits ausgeblendet haben. Gästen, die den Hinweis bereits ausgeblendet haben, wird dieser nur in einer neuen Session erneut angezeigt.]]></item>
+ <item name="wcf.acp.notice.showOrder"><![CDATA[Position]]></item>
+ <item name="wcf.acp.notice.showOrder.description"><![CDATA[Legt die Reihenfolge fest, in der die Hinweise angezeigt werden.]]></item>
</category>
<category name="wcf.acp.option">
<item name="wcf.moderation.report.success"><![CDATA[Der Inhalt wurde den Moderatoren gemeldet.]]></item>
</category>
+ <category name="wcf.notice">
+ <item name="wcf.notice.button.dismiss"><![CDATA[Hinweis dauerhaft ausblenden]]></item>
+ </category>
+
<category name="wcf.page">
<item name="wcf.page.pageNo"><![CDATA[Seite {#$pageNo}]]></item>
<item name="wcf.page.offline"><![CDATA[Die Seite befindet sich zurzeit {if OFFLINE_MESSAGE != ''}aus folgenden Gründen im Wartungsmodus:{else}im Wartungsmodus.{/if}]]></item>
<item name="wcf.page.pagePosition"><![CDATA[Seite {#$pageNo} von {#$pages}]]></item>
<item name="wcf.page.sitemap.userAccount"><![CDATA[Benutzerkonto]]></item>
<item name="wcf.page.javascriptDisabled"><![CDATA[In Ihrem Webbrowser ist JavaScript deaktiviert. Um alle Funktionen dieser Webseite nutzen zu können, muss JavaScript aktiviert sein.]]></item>
+ <item name="wcf.page.requestedPage"><![CDATA[Aufgerufene Seite]]></item>
<item name="wcf.page.privacyPolicy"><![CDATA[Datenschutzerklärung]]></item>
<item name="wcf.page.privacyPolicy.text"><![CDATA[<h2>Datenschutz</h2>
<p>Die Nutzung unserer Webseite ist in der Regel ohne Angabe personenbezogener Daten möglich. Soweit auf unseren Seiten personenbezogene Daten (beispielsweise Name,
additionalData MEDIUMTEXT
);
+DROP TABLE IF EXISTS wcf1_notice;
+CREATE TABLE wcf1_notice (
+ noticeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ noticeName VARCHAR(255) NOT NULL,
+ notice MEDIUMTEXT,
+ noticeUseHtml TINYINT(1) NOT NULL DEFAULT 0,
+ showOrder INT(10) NOT NULL DEFAULT 0,
+ isDisabled TINYINT(1) NOT NULL DEFAULT 0,
+ isDismissible TINYINT(1) NOT NULL DEFAULT 0
+);
+
+DROP TABLE IF EXISTS wcf1_notice_dismissed;
+CREATE TABLE wcf1_notice_dismissed (
+ noticeID INT(10) NOT NULL,
+ userID INT(10) NOT NULL,
+ PRIMARY KEY (noticeID, userID)
+);
+
DROP TABLE IF EXISTS wcf1_object_type;
CREATE TABLE wcf1_object_type (
objectTypeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
ALTER TABLE wcf1_poll_option_vote ADD FOREIGN KEY (optionID) REFERENCES wcf1_poll_option (optionID) ON DELETE CASCADE;
ALTER TABLE wcf1_poll_option_vote ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
+ALTER TABLE wcf1_notice_dismissed ADD FOREIGN KEY (noticeID) REFERENCES wcf1_notice (noticeID) ON DELETE CASCADE;
+ALTER TABLE wcf1_notice_dismissed ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
+
/* SQL_PARSER_OFFSET */
/* default inserts */