Fixed word-wrap issues
authorMarcel Werk <burntime@woltlab.com>
Tue, 6 Aug 2013 22:07:36 +0000 (00:07 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 6 Aug 2013 22:07:36 +0000 (00:07 +0200)
com.woltlab.wcf/templates/moderationList.tpl
wcfsetup/install/files/acp/templates/acpSessionLog.tpl
wcfsetup/install/files/acp/templates/acpSessionLogList.tpl
wcfsetup/install/files/acp/templates/attachmentList.tpl
wcfsetup/install/files/acp/templates/tagList.tpl
wcfsetup/install/files/acp/templates/userList.tpl
wcfsetup/install/files/lib/system/template/plugin/TableWordwrapModifierTemplatePlugin.class.php [new file with mode: 0644]
wcfsetup/install/files/style/global.less

index 5a6531339336806e3d46da793b825cf3b3a638e5..5e3d8ba5a8ef71840b04b090d82c64f46a0bc6ea 100644 (file)
                                                <td class="columnText columnSubject">
                                                        <h3>
                                                                <span class="badge label">{lang}wcf.moderation.type.{@$definitionNames[$entry->objectTypeID]}{/lang}</span>
-                                                               <a href="{$entry->getLink()}" class="messageGroupLink">{$entry->getTitle()}</a>
+                                                               <a href="{$entry->getLink()}" class="messageGroupLink">{$entry->getTitle()|tableWordwrap}</a>
                                                        </h3>
                                                        <small>{if $entry->getAffectedObject()->getUserID()}<a href="{link controller='User' id=$entry->getAffectedObject()->getUserID()}{/link}" class="userLink" data-user-id="{@$entry->userID}">{$entry->getAffectedObject()->getUsername()}</a>{else}{$entry->getAffectedObject()->getUsername()}{/if} - {@$entry->getAffectedObject()->getTime()|time} - {lang}wcf.moderation.type.{@$entry->getObjectTypeName()}{/lang}</small>  
                                                </td>
index 9ae12863b3b1ad392064698a62b15d07eb3dc167..7bcc6f3cea78cd9d67fde098e0f9ffbf64316d55 100644 (file)
@@ -44,7 +44,7 @@
                                                        <td class="columnURL columnIpAddress{if $sessionAccessLog->ipAddress != $sessionLog->ipAddress} hot{/if}">{$sessionAccessLog->getIpAddress()}</td>
                                                        <td class="columnDate columnTime">{@$sessionAccessLog->time|time}</td>
                                                        <td class="columnText columnClassName">{$sessionAccessLog->className}</td>
-                                                       <td class="columnURL columnRequestURI" title="{$sessionAccessLog->requestURI}">{if !$sessionAccessLog->hasProtectedURI()}<a href="{$sessionAccessLog->requestURI}{@SID_ARG_2ND}">{$sessionAccessLog->requestURI|truncate:50}</a>{else}{$sessionAccessLog->requestURI|truncate:50}{/if}</td>
+                                                       <td class="columnURL columnRequestURI" title="{$sessionAccessLog->requestURI}">{if !$sessionAccessLog->hasProtectedURI()}<a href="{$sessionAccessLog->requestURI}{@SID_ARG_2ND}">{$sessionAccessLog->requestURI|truncate:50|tableWordwrap}</a>{else}{$sessionAccessLog->requestURI|truncate:50|tableWordwrap}{/if}</td>
                                                        <td class="columnText columnRequestMethod">{$sessionAccessLog->requestMethod}</td>
                                                        
                                                        {event name='columns'}
index 921149b819945ce9cb7e43f15067b2b4561aee77..e76736502bfc2d15f861846507e414dddba1ecf5 100644 (file)
@@ -45,7 +45,7 @@
                                                <td class="columnID columnSessionLogID">{@$sessionLog->sessionLogID}</td>
                                                <td class="columnTitle columnUsername"><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->username}</a></td>
                                                <td class="columnSmallText columnIpAddress"><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->getIpAddress()}</a>{if $sessionLog->hostname != $sessionLog->ipAddress}<br /><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->hostname}</a>{/if}</td>
-                                               <td class="columnSmallText columnUserAgent" title="{$sessionLog->userAgent}"><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->userAgent|truncate:75}</a></td>
+                                               <td class="columnSmallText columnUserAgent" title="{$sessionLog->userAgent}"><a href="{link controller='ACPSessionLog' id=$sessionLog->sessionLogID}{/link}">{$sessionLog->userAgent|truncate:75|tableWordwrap}</a></td>
                                                <td class="columnDate columnTime">{@$sessionLog->time|time}</td>
                                                <td class="columnDate columnLastActivityTime">{@$sessionLog->lastActivityTime|time}</td>
                                                <td class="columnDigits columnAccesses">{#$sessionLog->accesses}</td>
index 06761d535c38fbec1ba89639f6c4eb2e6592228e..73be4e05cac1289d4362d47455ded7c122cacc1e 100644 (file)
                                                                </a>
                                                                
                                                                <div>
-                                                                       <p><a href="{link controller='Attachment' id=$attachment->attachmentID}{/link}">{$attachment->filename}</a></p>
+                                                                       <p><a href="{link controller='Attachment' id=$attachment->attachmentID}{/link}">{$attachment->filename|tableWordwrap}</a></p>
                                                                        <p><small>{if $attachment->userID}<a href="{link controller='UserEdit' id=$attachment->userID}{/link}">{$attachment->username}</a>{else}{lang}wcf.user.guest{/lang}{/if}</small></p>
-                                                                       {if $attachment->getContainerObject()}<p><small><a href="{$attachment->getContainerObject()->getLink()}">{$attachment->getContainerObject()->getTitle()}</a></small></p>{/if}
+                                                                       {if $attachment->getContainerObject()}<p><small><a href="{$attachment->getContainerObject()->getLink()}">{$attachment->getContainerObject()->getTitle()|tableWordwrap}</a></small></p>{/if}
                                                                </div>
                                                        </div>
                                                </td>
index 890f175314a367cbeeb83ab949039d539fe9a483..29309338d53013ef5a956eadc76c19d262641e93 100644 (file)
@@ -75,7 +75,7 @@
                                                        {event name='rowButtons'}
                                                </td>
                                                <td class="columnID">{#$tag->tagID}</td>
-                                               <td class="columnTitle columnName"><a href="{link controller='TagEdit' object=$tag}{/link}" class="badge tag">{$tag->name}</a></td>
+                                               <td class="columnTitle columnName"><a href="{link controller='TagEdit' object=$tag}{/link}" class="badge tag">{$tag->name|tableWordwrap}</a></td>
                                                <td class="columnDigits columnUsageCount">{if $tag->synonymFor === null}{#$tag->usageCount}{/if}</td>
                                                <td class="columnText columnLanguage">{if $tag->languageName !== null}{$tag->languageName} ({$tag->languageCode}){/if}</td>
                                                <td class="columnText columnSynonymFor">{if $tag->synonymFor !== null}<a href="{link controller='TagList'}search={@$tag->synonymName|rawurlencode}{/link}" class="badge tag">{$tag->synonymName}</a>{/if}</td>
index bd8c93e381bed761cb619126b390ecc95bce495f..cb8fb360ee949a2a5cf6cd46f273a989a5a1ccdf 100644 (file)
                                                <td class="columnTitle columnUsername">{if $user->editable}<a title="{lang}wcf.acp.user.edit{/lang}" href="{link controller='UserEdit' id=$user->userID}{/link}">{$user->username}</a>{else}{$user->username}{/if}</td>
                                                
                                                {foreach from=$columnHeads key=column item=columnLanguageVariable}
-                                                       <td class="column{$column|ucfirst}">{if $columnValues[$user->userID][$column]|isset}{@$columnValues[$user->userID][$column]}{/if}</td>
+                                                       <td class="column{$column|ucfirst}">{if $columnValues[$user->userID][$column]|isset}{@$columnValues[$user->userID][$column]|tableWordwrap}{/if}</td>
                                                {/foreach}
                                                
                                                {event name='columns'}
diff --git a/wcfsetup/install/files/lib/system/template/plugin/TableWordwrapModifierTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/TableWordwrapModifierTemplatePlugin.class.php
new file mode 100644 (file)
index 0000000..e2599ba
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+namespace wcf\system\template\plugin;
+use wcf\system\template\TemplateEngine;
+use wcf\util\StringUtil;
+
+/**
+ * Template modifier plugin which wordwraps a string.
+ * 
+ * Usage:
+ *     {$foo|tableWordwrap}
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2013 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.template.plugin
+ * @category   Community Framework
+ */
+class TableWordwrapModifierTemplatePlugin implements IModifierTemplatePlugin {
+       /**
+        * @see wcf\system\template\IModifierTemplatePlugin::execute()
+        */
+       public function execute($tagArgs, TemplateEngine $tplObj) {
+               // values
+               $width = 30;
+               $break = "\xE2\x80\x8B";
+               $string = $tagArgs[0];
+               
+               $result = '';
+               $substrings = explode(' ', $string);
+               
+               foreach ($substrings as $substring) {
+                       if (!empty($result)) $result .= ' ';
+                       
+                       $length = StringUtil::length($substring);
+                       if ($length > $width) {
+                               $j = ceil($length / $width);
+               
+                               for ($i = 0; $i < $j; $i++) {
+                                       if ($i) $result .= $break;
+                                       if ($width * ($i + 1) > $length) $result .= StringUtil::substring($substring, $width * $i);
+                                       else $result .= StringUtil::substring($substring, $width * $i, $width);
+                               }
+                       }
+                       else {
+                               $result .= $substring;
+                       }
+               }
+               
+               return $result;
+       }
+}
index 38c21ba00aecdc306b6c2776dd8ca3848ab879a2..70105f32aadb8d4c99d58805a868b8c71c1b61c6 100644 (file)
@@ -5,7 +5,7 @@ body {
        font-family: @wcfBaseFontFamily;
        font-size: @wcfBaseFontSize;
        line-height: @wcfBaseLineHeight;
-       word-break: break-all;
+       word-wrap: break-word;
 }
 
 small {