Add reaction type list
authorJoshua Rüsweg <josh@bastelstu.be>
Tue, 10 Apr 2018 14:17:36 +0000 (16:17 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Tue, 10 Apr 2018 14:17:36 +0000 (16:17 +0200)
See #2508

com.woltlab.wcf/acpMenu.xml
wcfsetup/install/files/acp/templates/reactionTypeList.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/acp/page/ReactionTypeListPage.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 6f6cce24ff25a0b00fe87c10e712b70895554b40..9ae170c1c44a18bdaeaa3a801f8201e7be61e12d 100644 (file)
                                <icon>fa-plus</icon>
                        </acpmenuitem>
                        <!-- /ad -->
+                       
+                       <!-- reactions -->
+                       <acpmenuitem name="wcf.acp.menu.link.reactionType">
+                               <parent>wcf.acp.menu.link.customization</parent>
+                               <options>module_like</options>
+                               <showorder>6</showorder>
+                       </acpmenuitem>
+                       
+                       <acpmenuitem name="wcf.acp.menu.link.reactionType.list">
+                               <controller>wcf\acp\page\ReactionTypeListPage</controller>
+                               <parent>wcf.acp.menu.link.reactionType</parent>
+                               <permissions>admin.content.reaction.canManageReactionType</permissions>
+                       </acpmenuitem>
+                       <acpmenuitem name="wcf.acp.menu.link.reactionType.add">
+                               <controller>wcf\acp\form\ReactionTypeAddForm</controller>
+                               <parent>wcf.acp.menu.link.reactionType.list</parent>
+                               <permissions>admin.content.reaction.canManageReactionType</permissions>
+                               <icon>fa-plus</icon>
+                       </acpmenuitem>
+                       <!-- /reactions -->
                
                <!-- /customization -->
                
diff --git a/wcfsetup/install/files/acp/templates/reactionTypeList.tpl b/wcfsetup/install/files/acp/templates/reactionTypeList.tpl
new file mode 100644 (file)
index 0000000..e7eb1a8
--- /dev/null
@@ -0,0 +1,87 @@
+{include file='header' pageTitle='wcf.acp.menu.link.reactionType.list'}
+
+{if $objects|count}
+       <script data-relocate="true">
+               require(['WoltLabSuite/Core/Ui/Sortable/List'], function (UiSortableList) {
+                       new UiSortableList({
+                               containerId: 'reactionTypeList',
+                               className: 'wcf\\data\\reaction\\type\\ReactionTypeAction',
+                               offset: {@$startIndex}
+                       });
+               });
+               
+               $(function() {
+                       new WCF.Action.Delete('wcf\\data\\reaction\\type\\ReactionTypeAction', $('.reactionTypeRow'));
+               });
+       </script>
+{/if}
+
+<header class="contentHeader">
+       <div class="contentHeaderTitle">
+               <h1 class="contentTitle">{lang}wcf.acp.menu.link.reactionType.list{/lang}{if $items} <span class="badge badgeInverse">{#$items}</span>{/if}</h1>
+       </div>
+       
+       <nav class="contentHeaderNavigation">
+               <ul>
+                       <li><a href="{link controller='ReactionTypeAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.reactionType.add{/lang}</span></a></li>
+                       
+                       {event name='contentHeaderNavigation'}
+               </ul>
+       </nav>
+</header>
+
+{hascontent}
+       <div class="paginationTop">
+               {content}{pages print=true assign=pagesLinks controller="ReactionTypeList" link="pageNo=%d"}{/content}
+       </div>
+{/hascontent}
+
+{if $objects|count}
+       <div class="section">
+               <section id="reactionTypeList" class="sortableListContainer">
+                       <ol class="sortableList" data-object-id="0" start="{@($pageNo - 1) * $itemsPerPage + 1}">
+                               {foreach from=$objects item=reactionType}
+                                       <li class="sortableNode sortableNoNesting reactionTypeRow" data-object-id="{@$reactionType->reactionTypeID}">
+                                               <span class="sortableNodeLabel">
+                                                       <a href="{link controller='ReactionTypeEdit' id=$reactionType->reactionTypeID}{/link}">{@$reactionType->renderIcon()} {$reactionType->getTitle()}</a>
+                                                       
+                                                       <span class="statusDisplay sortableButtonContainer">
+                                                               <span class="icon icon16 fa-arrows sortableNodeHandle"></span>
+                                                               <a href="{link controller='ReactionTypeEdit' id=$reactionType->reactionTypeID}{/link}"><span title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip icon icon16 fa-pencil"></span></a>
+                                                               <span title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton pointer jsTooltip icon icon16 fa-times" data-object-id="{@$reactionType->reactionTypeID}" data-confirm-message-html="{lang __encode=true}wcf.acp.reactionType.delete.sure{/lang}"></span>
+                                                               
+                                                               {event name='itemButtons'}
+                                                       </span>
+                                               </span>
+                                               <ol class="sortableList" data-object-id="{@$reactionType->reactionTypeID}"></ol>
+                                       </li>
+                               {/foreach}
+                       </ol>
+                       <div class="formSubmit">
+                               <button class="button" data-type="submit">{lang}wcf.global.button.submit{/lang}</button>
+                       </div>
+               </section>
+       </div>
+       
+       <footer class="contentFooter">
+               {hascontent}
+                       <div class="paginationBottom">
+                               {content}{@$pagesLinks}{/content}
+                       </div>
+               {/hascontent}
+               
+               {hascontent}
+                       <nav class="contentFooterNavigation">
+                               <ul>
+                                       {content}
+                                               {event name='contentFooterNavigation'}
+                                       {/content}
+                               </ul>
+                       </nav>
+               {/hascontent}
+       </footer>
+{else}
+       <p class="info">{lang}wcf.global.noItems{/lang}</p>
+{/if}
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/lib/acp/page/ReactionTypeListPage.class.php b/wcfsetup/install/files/lib/acp/page/ReactionTypeListPage.class.php
new file mode 100644 (file)
index 0000000..81efc04
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+declare(strict_types=1);
+namespace wcf\acp\page;
+use wcf\data\reaction\type\ReactionTypeList;
+use wcf\page\MultipleLinkPage;
+
+/**
+ * Shows the list of reaction types.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2018 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Acp\Page
+ *
+ * @property   ReactionTypeList        $objectList
+ */
+class ReactionTypeListPage extends MultipleLinkPage {
+       /**
+        * @inheritDoc
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.reactionType.list';
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededModules = ['MODULE_LIKE'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededPermissions = ['admin.content.reaction.canManageReactionType'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $sqlOrderBy = 'showOrder ASC, reactionTypeID ASC';
+       
+       /**
+        * @inheritDoc
+        */
+       public $objectListClassName = ReactionTypeList::class;
+}
index b6da1bece5d4d6880285a944475731853b5bd158..d7ef6549fd4dd7f50210d218f21c7c75c1c9b3e7 100644 (file)
                <item name="wcf.acp.menu.link.devtools.project.add"><![CDATA[Projekt hinzufügen]]></item>
                <item name="wcf.acp.menu.link.devtools.project.list"><![CDATA[Projekte]]></item>
                <item name="wcf.acp.menu.link.devtools.notificationTest"><![CDATA[Benachrichtigungstest]]></item>
+               <item name="wcf.acp.menu.link.reactionType"><![CDATA[Reaktionen]]></item>
+               <!-- @TODO maybe use "Reaktion" instead of "Reaktions-Typ", because its more comprehensible for users -->
+               <item name="wcf.acp.menu.link.reactionType.list"><![CDATA[Reaktions-Typen]]></item>
+               <item name="wcf.acp.menu.link.reactionType.add"><![CDATA[Reaktions-Typ hinzufügen]]></item>
+               <item name="wcf.acp.menu.link.reactionType.edit"><![CDATA[Reaktions-Typ bearbeiten]]></item>
        </category>
        
        <category name="wcf.acp.notice">
@@ -1732,6 +1737,10 @@ Als Benachrichtigungs-URL in der Konfiguration der sofortigen Zahlungsbestätigu
                <item name="wcf.acp.pluginStore.purchasedItems.wcfMajorRelease"><![CDATA[Paket-Server für „{$wcfMajorRelease}“]]></item>
        </category>
        
+       <category name="wcf.acp.reactionType">
+               <item name="wcf.acp.reactionType.delete.sure"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} den Reaktions-Typen <span class="confirmationObject">{$reactionType->getTitle()}</span> wirklich löschen?]]></item>
+       </category>
+       
        <category name="wcf.acp.rebuildData">
                <item name="wcf.acp.rebuildData"><![CDATA[Anzeigen aktualisieren]]></item>
                <item name="wcf.acp.rebuildData.description"><![CDATA[Für eine vollständige Aktualisierung aller Daten (z.B. nach einem Datenimport) {if LANGUAGE_USE_INFORMAL_VARIANT}führst du{else}führen Sie{/if} die Aktionen bitte in der hier angegebenen Reihenfolge durch.]]></item>
index a2a887c1b3cdf29fec5802c2ab545e650790b0f3..8011641425bb90dd56e212a3781c8c666b83d5f6 100644 (file)
                <item name="wcf.acp.menu.link.devtools.project.add"><![CDATA[Add Project]]></item>
                <item name="wcf.acp.menu.link.devtools.project.list"><![CDATA[Projects]]></item>
                <item name="wcf.acp.menu.link.devtools.notificationTest"><![CDATA[Notification Test]]></item>
+               <item name="wcf.acp.menu.link.reactionType"><![CDATA[Reaction]]></item>
+               <!-- @TODO maybe use "Reactions" instead of "Reaction Types", because its more comprehensible for users -->
+               <item name="wcf.acp.menu.link.reactionType.list"><![CDATA[Reaktion Types]]></item>
+               <item name="wcf.acp.menu.link.reactionType.add"><![CDATA[Add Reaction Type]]></item>
+               <item name="wcf.acp.menu.link.reactionType.edit"><![CDATA[Edit Reaction Type]]></item>
        </category>
        
        <category name="wcf.acp.notice">
@@ -1672,6 +1677,10 @@ When prompted for the notification URL for the instant payment notifications, pl
                <item name="wcf.acp.pluginStore.purchasedItems.wcfMajorRelease"><![CDATA[Update-Server for “{$wcfMajorRelease}”]]></item>
        </category>
        
+       <category name="wcf.acp.reactionType">
+               <item name="wcf.acp.reactionType.delete.sure"><![CDATA[Do you really want to delete the reaction type <span class="confirmationObject">{$reactionType->getTitle()}</span>?]]></item>
+       </category>
+       
        <category name="wcf.acp.rebuildData">
                <item name="wcf.acp.rebuildData"><![CDATA[Rebuild Data]]></item>
                <item name="wcf.acp.rebuildData.description"><![CDATA[In order to ensure consistency, e.g. after a data import, it is highly recommended to perform all the actions below in their respective order, starting from top to bottom.]]></item>