Add trophy list page
authorJoshua Rüsweg <josh@bastelstu.be>
Wed, 5 Jul 2017 19:51:59 +0000 (21:51 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Wed, 5 Jul 2017 19:51:59 +0000 (21:51 +0200)
See #2315

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

index 7e221ac89d136ddfdfc386f9dba0d02a0c115ff8..f8395b3ca23469f8be14d4de6c19f958b9882852 100644 (file)
                                <options>module_trophy</options>
                                <icon>fa-plus</icon>
                        </acpmenuitem>
+                       <acpmenuitem name="wcf.acp.menu.link.trophy.list">
+                               <controller>wcf\acp\page\TrophyListPage</controller>
+                               <parent>wcf.acp.menu.link.trophy</parent>
+                               <permissions>admin.trophy.canManageTrophy</permissions>
+                               <options>module_trophy</options>
+                       </acpmenuitem>
                        <!-- /trophy -->
                
                <!-- /user -->
diff --git a/wcfsetup/install/files/acp/templates/trophyList.tpl b/wcfsetup/install/files/acp/templates/trophyList.tpl
new file mode 100644 (file)
index 0000000..5f42ba7
--- /dev/null
@@ -0,0 +1,87 @@
+{include file='header' pageTitle='wcf.acp.menu.link.trophy.list'}
+
+<script data-relocate="true">
+       //<![CDATA[
+       $(function() {
+               new WCF.Action.Delete('wcf\\data\\trophy\\TrophyAction', '.trophyRow');
+               new WCF.Action.Toggle('wcf\\data\\trophy\\TrophyAction', '.trophyRow');
+       });
+       //]]>
+</script>
+
+<header class="contentHeader">
+       <div class="contentHeaderTitle">
+               <h1 class="contentTitle">{lang}wcf.acp.menu.link.trophy.list{/lang}</h1>
+       </div>
+
+       <nav class="contentHeaderNavigation">
+               <ul>
+                       <li><a href="{link controller='TrophyAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.trophy.add{/lang}</span></a></li>
+
+                       {event name='contentHeaderNavigation'}
+               </ul>
+       </nav>
+</header>
+{hascontent}
+       <div class="paginationTop">
+               {content}
+                       {pages print=true assign=pagesLinks controller='TrophyList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+               {/content}
+       </div>
+{/hascontent}
+
+{if $objects|count}
+       <div class="section tabularBox">
+
+               <table class="table">
+                       <thead>
+                       <tr>
+                               <th class="columnID columnTrophyID{if $sortField == 'trophyID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='TrophyList'}pageNo={@$pageNo}&sortField=trophyID&sortOrder={if $sortField == 'trophyID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
+                               <th class="columnTitle{if $sortField == 'title'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='TrophyList'}pageNo={@$pageNo}&sortField=title&sortOrder={if $sortField == 'title' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.title{/lang}</a></th>
+                               <th class="columnText columnCategory{if $sortField == 'categoryID'} active {@$sortOrder}{/if}"><a href="{link controller='TrophyList'}pageNo={@$pageNo}&sortField=categoryID&sortOrder={if $sortField == 'categoryID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.trophy.category{/lang}</a></th>
+
+                               {event name='columnHeads'}
+                       </tr>
+                       </thead>
+
+                       <tbody>
+                       {foreach from=$objects item=trophy}
+                               <tr class="trophyRow">
+                                       <td class="columnIcon">
+                                               <span class="icon icon16 fa-{if !$trophy->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$trophy->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$trophy->getObjectID()}"></span>
+                                               <a href="{link controller='TrophyEdit' id=$trophy->getObjectID()}{/link}" data-tooltip="{lang}wcf.global.edit{/lang}"><span class="icon icon16 fa-pencil"></span></a>
+                                               <span class="icon icon16 fa-times pointer jsDeleteButton" data-confirm-message-html="{lang __encode=true}wcf.acp.trophy.delete.confirmMessage{/lang}" data-object-id="{@$trophy->getObjectID()}" data-tooltip="{lang}wcf.global.delete{/lang}"></span>
+                                       </td>
+                                       <td class="columnID columnTrophyID">{@$trophy->trophyID}</td>
+                                       <td class="columnIcon">{@$trophy->renderTrophy(32)}</td>
+                                       <td class="columnTitle columnTrophyTitle"><a href="{link controller='TrophyEdit' id=$trophy->getObjectID()}{/link}" data-tooltip="{lang}wcf.global.edit{/lang}">{$trophy->getTitle()}</a></td>
+                                       <td class="columnText columnCategory">{$trophy->getCategory()->getTitle()}</td>
+                                       
+                                       {event name='columns'}
+                               </tr>
+                       {/foreach}
+                       </tbody>
+               </table>
+
+       </div>
+       
+       <footer class="contentFooter">
+               {hascontent}
+                       <div class="paginationBottom">
+                               {content}{@$pagesLinks}{/content}
+                       </div>
+               {/hascontent}
+
+               <nav class="contentFooterNavigation">
+                       <ul>
+                               <li><a href="{link controller='TrophyAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.trophy.add{/lang}</span></a></li>
+
+                               {event name='contentHeaderNavigation'}
+                       </ul>
+               </nav>
+       </footer>
+{else}
+       <p class="info">{lang}wcf.global.noItems{/lang}</p>
+{/if}
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/lib/acp/page/TrophyListPage.class.php b/wcfsetup/install/files/lib/acp/page/TrophyListPage.class.php
new file mode 100644 (file)
index 0000000..9a93bc9
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+namespace wcf\acp\page;
+use wcf\data\trophy\TrophyList;
+use wcf\page\SortablePage;
+
+/**
+ * Trophy list page.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2017 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Acp\Page
+ * @since      3.1
+ */
+class TrophyListPage extends SortablePage {
+       /**
+        * @inheritDoc
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.trophy.list';
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededModules = ['MODULE_TROPHY'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededPermissions = ['admin.trophy.canManageTrophy'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $defaultSortField = 'trophyID';
+       
+       /**
+        * @inheritDoc
+        */
+       public $defaultSortOrder = 'DESC';
+       
+       /**
+        * @inheritDoc
+        */
+       public $objectListClassName = TrophyList::class;
+       
+       /**
+        * @inheritDoc
+        */
+       public $validSortFields = ['trophyID', 'title', 'categoryID'];
+}
index e3aec1dfd10ce686e4f7dce8775ad90991510500..e183d78b4613ef8a06edd23e0c4fcfe6ef886f6c 100644 (file)
                <item name="wcf.acp.menu.link.trophy"><![CDATA[Trophäen]]></item>
                <item name="wcf.acp.menu.link.trophy.category.list"><![CDATA[Kategorien]]></item>
                <item name="wcf.acp.menu.link.trophy.category.add"><![CDATA[Kategorie hinzufügen]]></item>
+               <item name="wcf.acp.menu.link.trophy.list"><![CDATA[Trophäen]]></item>
        </category>
        
        <category name="wcf.acp.notice">
@@ -3576,6 +3577,11 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email}
 <p><small><em>Quelle: <a href="http://www.mustervorlage.net/disclaimer-muster" class="externalURL">Mustervorlage.net</a></em></small></p>]]></item>
        </category>
        
+       <category name="wcf.acp.trophy">
+               <item name="wcf.acp.trophy.category"><![CDATA[Kategorie]]></item>
+               <item name="wcf.acp.trophy.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} die Trophäe <span class="confirmationObject">{trophy->getTitle()}</span> wirklich löschen?]]></item>
+       </category>
+       
        <category name="wcf.user.usersOnline">
                <item name="wcf.user.usersOnline"><![CDATA[Benutzer online]]></item>
                <item name="wcf.user.usersOnline.detail"><![CDATA[
index 3b48bda7828181686119e4d741ad934f618394ad..2a7829a08c756c4cd66f6540992b9495152acf07 100644 (file)
                <item name="wcf.acp.menu.link.trophy"><![CDATA[Trophies]]></item>
                <item name="wcf.acp.menu.link.trophy.category.list"><![CDATA[Categories]]></item>
                <item name="wcf.acp.menu.link.trophy.category.add"><![CDATA[Add Category]]></item>
+               <item name="wcf.acp.menu.link.trophy.list"><![CDATA[Trophies]]></item>
        </category>
        
        <category name="wcf.acp.notice">
@@ -3563,6 +3564,11 @@ Open the link below to access the user profile:
 <p><small><em>Source: <a href="http://www.mustervorlage.net/disclaimer-muster" class="externalURL">Mustervorlage.net</a></em></small></p>]]></item>
        </category>
        
+       <category name="wcf.acp.trophy">
+               <item name="wcf.acp.trophy.category"><![CDATA[Category]]></item>
+               <item name="wcf.acp.trophy.delete.confirmMessage"><![CDATA[Do you really want to delete the trophy <span class="confirmationObject">{$trophy->getTitle()}</span>?]]></item>
+       </category>
+       
        <category name="wcf.user.usersOnline">
                <item name="wcf.user.usersOnline"><![CDATA[Users Online]]></item>
                <item name="wcf.user.usersOnline.detail"><![CDATA[