Updated user dropdown
authorAlexander Ebert <ebert@woltlab.com>
Wed, 28 Jan 2015 23:48:22 +0000 (00:48 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 28 Jan 2015 23:48:22 +0000 (00:48 +0100)
12 files changed:
com.woltlab.wcf/package.xml
com.woltlab.wcf/templates/userPanel.tpl
com.woltlab.wcf/update_2.1.0_Alpha_4.sql [new file with mode: 0644]
com.woltlab.wcf/update_210.sql
com.woltlab.wcf/userMenu.xml
wcfsetup/install/files/acp/templates/header.tpl
wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php
wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php
wcfsetup/install/files/style/dropdown.less
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml
wcfsetup/setup/db/install.sql

index 46b756b855673c383ab18f5732e667f2ba2a4b60..50d264fc732ecc9aecb42149750bbb07e371c298 100644 (file)
@@ -96,5 +96,6 @@
                <instruction type="language" run="standalone">language/*.xml</instruction>
                
                <instruction type="option">option.xml</instruction>
+               <instruction type="userMenu">userMenu.xml</instruction>
        </instructions>
 </package>
index 0acd451452ec378576a82807b8e9683abbf3d00c..a5325212dd4a7eab66328ea8863a2f542e53caf6 100644 (file)
@@ -4,7 +4,8 @@
                <a class="framed" href="{link controller='User' object=$__wcf->user}{/link}">{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(24)} <span>{lang}wcf.user.userNote{/lang}</span></a>
                <div class="interactiveDropdown interactiveDropdownStatic interactiveDropdownUserMenu">
                        <div class="interactiveDropdownHeader">
-                               <span class="interactiveDropdownTitle">{$__wcf->user->username}</span>
+                               <span class="interactiveDropdownTitle">{lang}wcf.user.controlPanel{/lang}</span>
+                               
                                {hascontent}
                                        <ul class="interactiveDropdownLinks">
                                                {content}
                        <div class="interactiveDropdownItemsContainer">
                                <ul class="interactiveDropdownItems interactiveDropdownItemsUserMenu">
                                        <li>
-                                               <a href="{link controller='User' object=$__wcf->user}{/link}" class="box64">
+                                               <div class="box64">
                                                        <div class="framed">{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(64)}</div>
                                                        
                                                        <div class="containerHeadline">
-                                                               <h3>{$__wcf->user->username}</h3>
+                                                               <h3><a href="{link controller='User' object=$__wcf->user}{/link}">{$__wcf->user->username}</a></h3>
                                                                {if MODULE_USER_RANK && $__wcf->getUserProfileHandler()->getUserTitle()}<p><span class="badge userTitleBadge{if $__wcf->getUserProfileHandler()->getRank() && $__wcf->getUserProfileHandler()->getRank()->cssClassName} {@$__wcf->getUserProfileHandler()->getRank()->cssClassName}{/if}">{$__wcf->getUserProfileHandler()->getUserTitle()}</span></p>{/if}
-                                                               <small style="display: none;">{lang}wcf.user.myProfile{/lang}</small>
+                                                               
+                                                               <ul class="interactiveDropdownUserMenuLinkList">
+                                                                       <li><a href="{link controller='User' object=$__wcf->user}{/link}">{lang}wcf.user.myProfile{/lang}</a></li>
+                                                                       {if $__wcf->getUserProfileHandler()->canEditOwnProfile()}<li><a href="{link controller='User' object=$__wcf->user}editOnInit=true#about{/link}">{lang}wcf.user.editProfile{/lang}</a></li>{/if}
+                                                                       {if $__wcf->session->getPermission('admin.general.canUseAcp')}<li><a href="{link isACP=true}{/link}">{lang}wcf.global.acp.short{/lang}</a></li>{/if}
+                                                               </ul>
                                                        </div>
                                                </a>
+                                               </div>
                                        </li>
-                                       <li class="dropdownDivider"></li>
-                                       <li><a href="{link controller='User' object=$__wcf->user}{/link}">{lang}wcf.user.myProfile{/lang}</a></li>
-                                       {if $__wcf->getUserProfileHandler()->canEditOwnProfile()}<li><a href="{link controller='User' object=$__wcf->user}editOnInit=true#about{/link}">{lang}wcf.user.editProfile{/lang}</a></li>{/if}
-                                       <li><a href="{link controller='Settings'}{/link}">{lang}wcf.user.menu.settings{/lang}</a></li>
-                                       
-                                       {event name='userMenuItems'}
                                        
-                                       {if $__wcf->session->getPermission('admin.general.canUseAcp')}
+                                       {foreach from=$__wcf->getUserMenu()->getMenuItems('') item=menuCategory}
                                                <li class="dropdownDivider"></li>
-                                               <li><a href="{link isACP=true}{/link}">{lang}wcf.global.acp.short{/lang}</a></li>
-                                       {/if}
+                                               <li class="interactiveDropdownUserMenuItem">
+                                                       <div class="box32">
+                                                               <div><span class="icon icon32 {@$menuCategory->getIconClassName()}"></span></div>
+                                                               
+                                                               <div class="containerHeadline">
+                                                                       <h3>{lang}{$menuCategory->menuItem}{/lang}</h3>
+                                                                       
+                                                                       <ul class="interactiveDropdownUserMenuLinkList">
+                                                                               {foreach from=$__wcf->getUserMenu()->getMenuItems($menuCategory->menuItem) item=menuItem}
+                                                                                       <li><a href="{$menuItem->getProcessor()->getLink()}">{@$menuItem}</a></li>
+                                                                               {/foreach}
+                                                                       </ul>
+                                                               </div>
+                                                       </div>
+                                       {/foreach}
                                </ul>
                        </div>
                        <a class="interactiveDropdownShowAll" href="{link controller='Logout'}t={@SECURITY_TOKEN}{/link}" onclick="WCF.Dropdown.Interactive.Handler.close('userMenu'); WCF.System.Confirmation.show('{lang}wcf.user.logout.sure{/lang}', $.proxy(function (action) { if (action == 'confirm') window.location.href = $(this).attr('href'); }, this)); return false;">{lang}wcf.user.logout{/lang}</a>
diff --git a/com.woltlab.wcf/update_2.1.0_Alpha_4.sql b/com.woltlab.wcf/update_2.1.0_Alpha_4.sql
new file mode 100644 (file)
index 0000000..5fcd77b
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE wcf1_user_menu_item ADD iconClassName VARCHAR(255) NOT NULL DEFAULT '';
index ac7565348485e6ba3f12514adc0e9a3658671848..a54e8f7e0cc93e5213a6abdd3b639759c9ca400a 100644 (file)
@@ -212,6 +212,8 @@ ALTER TABLE wcf1_template_listener ADD niceValue TINYINT(3) NOT NULL DEFAULT 0;
 
 ALTER TABLE wcf1_user_group_option ADD usersOnly TINYINT(1) NOT NULL DEFAULT 0;
 
+ALTER TABLE wcf1_user_menu_item ADD iconClassName VARCHAR(255) NOT NULL DEFAULT '';
+
 /* truncate table to ensure consistency */
 DELETE FROM wcf1_user_notification;
 
index 9e2c10f48e256de521f2032e8c9845a9541b93a5..10d87f62cad34b9163373bdcabe67d3071d60bbf 100644 (file)
@@ -4,6 +4,7 @@
                <!-- profile -->
                <usermenuitem name="wcf.user.menu.profile">
                        <showorder>1</showorder>
+                       <iconclassname>fa-user</iconclassname>
                </usermenuitem>
                
                <usermenuitem name="wcf.user.menu.profile.accountManagement">
@@ -27,6 +28,7 @@
                <!-- settings -->
                <usermenuitem name="wcf.user.menu.settings">
                        <showorder>2</showorder>
+                       <iconclassname>fa-cog</iconclassname>
                </usermenuitem>
                
                <usermenuitem name="wcf.user.menu.settings.notification">
@@ -44,6 +46,7 @@
                <!-- community -->
                <usermenuitem name="wcf.user.menu.community">
                        <showorder>3</showorder>
+                       <iconclassname>fa-globe</iconclassname>
                </usermenuitem>
                
                <usermenuitem name="wcf.user.menu.community.notification">
index b3d967fa9f0e11e8f9db67bf5c32c7ceae1b0ba8..dc2dfda112f0f15d2bd59369ec44bbbd0eadb06c 100644 (file)
                                                                <a class="dropdownToggle" data-toggle="woltlab"><span class="icon icon16 icon-info-sign"></span> <span>WoltLab&reg;</span></a>
                                                                
                                                                <ul class="dropdownMenu">
-                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"http://www.woltlab.com"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.website{/lang}</a></li>
-                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"http://www.woltlab.com/forum/"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.forums{/lang}</a></li>
-                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"http://www.woltlab.com/index.php/TicketAdd/"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.tickets{/lang}</a></li>
-                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"http://www.woltlab.com/pluginstore/"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.pluginStore{/lang}</a></li>
+                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"https://www.woltlab.com"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.website{/lang}</a></li>
+                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"https://community.woltlab.com"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.forums{/lang}</a></li>
+                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"https://www.woltlab.com/ticketadd/"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.tickets{/lang}</a></li>
+                                                                       <li><a class="externalURL" href="{@$__wcf->getPath()}acp/dereferrer.php?url={"https://pluginstore.woltlab.com"|rawurlencode}"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>{lang}wcf.acp.index.woltlab.pluginStore{/lang}</a></li>
                                                                </ul>
                                                        </li>
                                                        
index 029b88a73335c1d48938fbb32e7a6b435808e826..f668fd87c77442d89c599ccd4cc44d36a684a689 100644 (file)
@@ -118,4 +118,13 @@ class UserMenuItem extends ProcessibleDatabaseObject implements ITreeMenuItem {
        public function __toString() {
                return WCF::getLanguage()->getDynamicVariable($this->menuItem);
        }
+       
+       /**
+        * Returns FontAwesome icon class name.
+        * 
+        * @return      string
+        */
+       public function getIconClassName() {
+               return ($this->iconClassName ?: 'fa-bars');
+       }
 }
index 19c91af8215e061ad587f2b92512d132825a1b1c..bdc990082da6832144ddc3108ed760df8e9754af 100644 (file)
@@ -5,7 +5,7 @@ namespace wcf\system\package\plugin;
  * Installs, updates and deletes user menu items.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2014 WoltLab GmbH
+ * @copyright  2001-2015 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.package.plugin
@@ -38,6 +38,11 @@ class UserMenuPackageInstallationPlugin extends AbstractMenuPackageInstallationP
                        $result['className'] = $data['elements']['classname'];
                }
                
+               // FontAwesome icon name
+               if (!empty($data['elements']['iconclassname']) && preg_match('~^fa\-[a-z\-]+$~', $data['elements']['iconclassname'])) {
+                       $result['iconClassName'] = $data['elements']['iconclassname'];
+               }
+               
                return $result;
        }
 }
index 17a611d6bf5361312697660058f65f6c1bbf4a43..cff6ff99a8ea448fb9cde7a4d104b1095ce94d10 100644 (file)
                        
                        &.interactiveDropdownItemsUserMenu {
                                > li {
-                                       padding: 0 !important;
+                                       &.dropdownDivider {
+                                               padding: 0 !important;
+                                       }
                                        
                                        &:not(.dropdownDivider) {
                                                border-bottom-width: 0 !important;
+                                               padding: (@wcfGapSmall + @wcfGapTiny);
+                                       }
+                                       
+                                       > .box32 > .containerHeadline {
+                                               > h3 {
+                                                       font-size: 1.1rem;
+                                               }
                                        }
                                        
-                                       > a {
-                                               display: block;
-                                               padding: @wcfGapSmall (@wcfGapSmall + @wcfGapTiny);
-                                               text-decoration: none;
+                                       > .box64 {
+                                               position: relative;
+                                               
+                                               > .containerHeadline > .interactiveDropdownUserMenuLinkList {
+                                                       bottom: 0;
+                                                       position: absolute;
+                                               }
+                                       }
+                                       
+                                       .interactiveDropdownUserMenuLinkList > li {
+                                               display: inline-block;
+                                               font-size: .85rem;
+                                               
+                                               &:after {
+                                                       content: " \2013 ";
+                                               }
+                                               
+                                               &:last-child:after {
+                                                       content: "";
+                                               }
                                        }
                                }
                        }
index e3d73440d17956c8a84a56add027782965ab4212..500baebd9f4de347d2b61c128b60a0f7fd13427d 100644 (file)
@@ -2659,6 +2659,7 @@ Fehler sind beispielsweise:
                <item name="wcf.user.confirmPassword"><![CDATA[Kennwort wiederholen]]></item>
                <item name="wcf.user.confirmEmail.error.notEqual"><![CDATA[Die eingegebenen E-Mail-Adressen sind nicht identisch.]]></item>
                <item name="wcf.user.confirmPassword.error.notEqual"><![CDATA[Die eingegebenen Kennwörter sind nicht identisch.]]></item>
+               <item name="wcf.user.controlPanel"><![CDATA[Kontrollzentrum]]></item>
                <item name="wcf.user.email"><![CDATA[E-Mail-Adresse]]></item>
                <item name="wcf.user.email.error.notUnique"><![CDATA[Diese E-Mail-Adresse ist bereits durch einen anderen Benutzer vergeben.]]></item>
                <item name="wcf.user.email.error.notValid"><![CDATA[Sie haben eine ungültige E-Mail-Adresse eingegeben.]]></item>
index 47ed134edc6bc8ff47f5c08625bb05d1bf4e5055..18925374494a3129e6a0606df6640991269a9c7e 100644 (file)
@@ -2657,6 +2657,7 @@ Errors are:
                <item name="wcf.user.confirmPassword"><![CDATA[Confirm Password]]></item>
                <item name="wcf.user.confirmEmail.error.notEqual"><![CDATA[The entered email addresses do not match.]]></item>
                <item name="wcf.user.confirmPassword.error.notEqual"><![CDATA[The entered passwords do not match.]]></item>
+               <item name="wcf.user.controlPanel"><![CDATA[Control Panel]]></item>
                <item name="wcf.user.email"><![CDATA[Email]]></item>
                <item name="wcf.user.email.error.notUnique"><![CDATA[Email is already in use.]]></item>
                <item name="wcf.user.email.error.notValid"><![CDATA[Email is invalid.]]></item>
index 645a267f1586444be8081426eca145384270e4e3..4346f645d20dd42e1c2d727effb58f64cd4e19e0 100644 (file)
@@ -1278,6 +1278,7 @@ CREATE TABLE wcf1_user_menu_item (
        permissions TEXT,
        options TEXT,
        className VARCHAR(255) NOT NULL DEFAULT '',
+       iconClassName VARCHAR(255) NOT NULL DEFAULT '',
        UNIQUE KEY menuItem (menuItem, packageID)
 );