Merged com.woltlab.wcf.acp.language
authorAlexander Ebert <ebert@woltlab.com>
Tue, 1 Jan 2013 23:48:03 +0000 (00:48 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 1 Jan 2013 23:48:03 +0000 (00:48 +0100)
15 files changed:
com.woltlab.wcf/acpMenu.xml
wcfsetup/install/files/acp/templates/languageAdd.tpl [new file with mode: 0644]
wcfsetup/install/files/acp/templates/languageExport.tpl [new file with mode: 0644]
wcfsetup/install/files/acp/templates/languageList.tpl [new file with mode: 0644]
wcfsetup/install/files/acp/templates/languageMultilingualism.tpl [new file with mode: 0644]
wcfsetup/install/files/acp/templates/languageServerAdd.tpl [new file with mode: 0644]
wcfsetup/install/files/acp/templates/languageServerList.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/LanguageServerAddForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/LanguageServerEditForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/page/LanguageServerListPage.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml

index e46669698cd226026e9ace0c72ea3287d5a1279f..e54538c9855f1d09fc7e8134b5bed31aff90daff 100644 (file)
                        <showorder>3</showorder>
                </acpmenuitem>
                
+               <!-- language management -->
+               <acpmenuitem name="wcf.acp.menu.link.language">
+                       <parent>wcf.acp.menu.link.display</parent>
+               </acpmenuitem>
+               
+               <acpmenuitem name="wcf.acp.menu.link.language.list">
+                       <parent>wcf.acp.menu.link.language</parent>
+                       <controller><![CDATA[wcf\acp\page\LanguageListPage]]></controller>
+                       <permissions>admin.language.canEditLanguage,admin.language.canDeleteLanguage</permissions>
+               </acpmenuitem>
+               
+               <acpmenuitem name="wcf.acp.menu.link.language.add">
+                       <parent>wcf.acp.menu.link.language</parent>
+                       <controller><![CDATA[wcf\acp\form\LanguageAddForm]]></controller>
+                       <permissions>admin.language.canAddLanguage</permissions>
+               </acpmenuitem>
+               
+               <acpmenuitem name="wcf.acp.menu.link.language.multilingualism">
+                       <parent>wcf.acp.menu.link.language</parent>
+                       <controller><![CDATA[wcf\acp\form\LanguageMultilingualismForm]]></controller>
+                       <permissions>admin.language.canEditLanguage</permissions>
+               </acpmenuitem>
+               
+               <acpmenuitem name="wcf.acp.menu.link.language.server">
+                       <parent>wcf.acp.menu.link.language</parent>
+               </acpmenuitem>
+               
+               <acpmenuitem name="wcf.acp.menu.link.language.server.list">
+                       <controller><![CDATA[wcf\acp\page\LanguageServerListPage]]></controller>
+                       <parent>wcf.acp.menu.link.language.server</parent>
+                       <permissions>admin.language.canEditServer,admin.language.canDeleteServer</permissions>
+               </acpmenuitem>
+               
+               <acpmenuitem name="wcf.acp.menu.link.language.server.add">
+                       <controller><![CDATA[wcf\acp\form\LanguageServerAddForm]]></controller>
+                       <parent>wcf.acp.menu.link.language.server</parent>
+                       <permissions>admin.language.canAddServer</permissions>
+               </acpmenuitem>
+               <!-- /language management -->
+               
                <!-- page menu -->
                <acpmenuitem name="wcf.acp.menu.link.pageMenu">
                        <parent>wcf.acp.menu.link.display</parent>
diff --git a/wcfsetup/install/files/acp/templates/languageAdd.tpl b/wcfsetup/install/files/acp/templates/languageAdd.tpl
new file mode 100644 (file)
index 0000000..507ce64
--- /dev/null
@@ -0,0 +1,137 @@
+{include file='header' pageTitle='wcf.acp.language.add'}
+
+<script type="text/javascript">
+       //<![CDATA[
+       $(function() {
+               new WCF.ToggleOptions('import', [ 'importDiv' ], [ 'copyDiv' ]);
+               new WCF.ToggleOptions('copy', [ 'copyDiv' ], [ 'importDiv' ]);
+       });
+       //]]>
+</script>
+
+<header class="boxHeadline">
+       <hgroup>
+               <h1>{lang}wcf.acp.language.add{/lang}</h1>
+       </hgroup>
+</header>
+
+{if $errorField}
+       <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+       <p class="success">{lang}wcf.global.form.add.success{/lang}</p> 
+{/if}
+
+{hascontent}
+       <div class="contentNavigation">
+               <nav>
+                       <ul>
+                               {content}
+                                       {if $__wcf->session->getPermission('admin.language.canDeleteLanguage') || $__wcf->session->getPermission('admin.language.canEditLanguage')}
+                                               <li><a href="{link controller='LanguageList'}{/link}" title="{lang}wcf.acp.menu.link.language.list{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.menu.link.language.list{/lang}</span></a></li>
+                                       {/if}
+                                       
+                                       {event name='contentNavigationButtons'}
+                               {/content}
+                       </ul>
+               </nav>
+       </div>
+{/hascontent}
+
+<form enctype="multipart/form-data" method="post" action="{link controller='LanguageAdd'}{/link}">
+       <div class="container containerPadding marginTop">
+               <fieldset>
+                       <legend>{lang}wcf.acp.language.add.mode{/lang}</legend>
+                       
+                       <dl>
+                               <dd class="floated">
+                                       <label><input type="radio" name="mode" value="import" id="import" {if $mode == 'import'}checked="checked" {/if}/> {lang}wcf.acp.language.add.mode.import{/lang}</label>
+                                       <label><input type="radio" name="mode" value="copy" id="copy" {if $mode == 'copy'}checked="checked" {/if}/> {lang}wcf.acp.language.add.mode.copy{/lang}</label>
+                               </dd>
+                       </dl>
+               </fieldset>
+               
+               <fieldset id="importDiv">
+                       <legend>{lang}wcf.acp.language.import.source{/lang}</legend>
+                       
+                       <dl{if $errorField == 'languageFile'} class="formError"{/if}>
+                               <dt><label for="languageFile">{lang}wcf.acp.language.import.source.file{/lang}</label></dt>
+                               <dd>
+                                       <input type="text" id="languageFile" name="languageFile" value="{$languageFile}" class="long" />
+                                       {if $errorField == 'languageFile'}
+                                               <small class="innerError">
+                                                       {if $errorType == 'empty'}
+                                                               {lang}wcf.global.error.empty{/lang}
+                                                       {else}
+                                                               {lang}wcf.acp.language.import.error{/lang} {$errorType}
+                                                       {/if}
+                                               </small>
+                                       {/if}
+                                       <small>{lang}wcf.acp.language.import.source.file.description{/lang}</small>
+                               </dd>
+                       </dl>
+                       
+                       <dl{if $errorField == 'languageUpload'} class="formError"{/if}>
+                               <dt><label for="languageUpload">{lang}wcf.acp.language.import.source.upload{/lang}</label></dt>
+                               <dd>
+                                       <input type="file" id="languageUpload" name="languageUpload" />
+                                       {if $errorField == 'languageUpload'}
+                                               <small class="innerError">
+                                                       {lang}wcf.acp.language.import.error{/lang} {$errorType}
+                                               </small>
+                                       {/if}
+                               </dd>
+                       </dl>
+               </fieldset>
+               
+               <fieldset id="copyDiv">
+                       <legend>{lang}wcf.acp.language.add.new{/lang}</legend>
+                       
+                       <dl{if $errorField == 'languageCode'} class="formError"{/if}>
+                               <dt><label for="languageCode">{lang}wcf.acp.language.code{/lang}</label></dt>
+                               <dd>
+                                       <input type="text" id="languageCode" name="languageCode" value="{$languageCode}" class="long" />
+                                       {if $errorField == 'languageCode'}
+                                               <small class="innerError">
+                                                       {if $errorType == 'empty'}
+                                                               {lang}wcf.global.error.empty{/lang}
+                                                       {else}
+                                                               {lang}wcf.acp.language.add.languageCode.error.{@$errorType}{/lang}
+                                                       {/if}
+                                               </small>
+                                       {/if}
+                                       <small>{lang}wcf.acp.language.code.description{/lang}</small>
+                               </dd>
+                       </dl>
+                       
+                       <dl{if $errorField == 'sourceLanguageID'} class="formError"{/if}>
+                               <dt><label for="sourceLanguageID">{lang}wcf.acp.language.add.source{/lang}</label></dt>
+                               <dd>
+                                       <select id="sourceLanguageID" name="sourceLanguageID">
+                                               {foreach from=$languages item=language}
+                                                       <option value="{@$language->languageID}"{if $language->languageID == $sourceLanguageID} selected="selected"{/if}>{$language->languageName} ({$language->languageCode})</option>
+                                               {/foreach}
+                                       </select>
+                                       {if $errorField == 'sourceLanguageID'}
+                                               <small class="innerError">
+                                                       {if $errorType == 'empty'}
+                                                               {lang}wcf.global.error.empty{/lang}
+                                                       {else}
+                                                               {lang}wcf.acp.language.add.source.error.{@$errorType}{/lang}
+                                                       {/if}
+                                               </small>
+                                       {/if}
+                               </dd>
+                       </dl>
+               </fieldset>
+               
+               {event name='fieldsets'}
+       </div>
+       
+       <div class="formSubmit">
+               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+       </div>
+</form>
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/acp/templates/languageExport.tpl b/wcfsetup/install/files/acp/templates/languageExport.tpl
new file mode 100644 (file)
index 0000000..e0e2af9
--- /dev/null
@@ -0,0 +1,72 @@
+{include file='header' pageTitle='wcf.acp.language.export'}
+
+<header class="boxHeadline">
+       <hgroup>
+               <h1>{lang}wcf.acp.language.export{/lang}</h1>
+       </hgroup>
+</header>
+
+{if $errorField}
+       <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+       <p class="success">{lang}wcf.acp.language.add.success{/lang}</p>
+{/if}
+
+{hascontent}
+       <div class="contentNavigation">
+               <nav>
+                       <ul>
+                               {content}
+                                       {if $__wcf->session->getPermission('admin.language.canDeleteLanguage') || $__wcf->session->getPermission('admin.language.canEditLanguage')}
+                                               <li><a href="{link controller='LanguageList'}{/link}" title="{lang}wcf.acp.menu.link.language.list{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.menu.link.language.list{/lang}</span></a></li>
+                                       {/if}
+                                       
+                                       {event name='contentNavigationButtons'}
+                               {/content}
+                       </ul>
+               </nav>
+       </div>
+{/hascontent}
+
+<form enctype="multipart/form-data" method="post" action="{link controller='LanguageExport' id=$languageID}{/link}">
+       <div class="container containerPadding marginTop">
+               <fieldset>
+                       <legend>{lang}wcf.acp.language.export{/lang}</legend>
+                       
+                       <dl>
+                               <dt><label for="languageID">{lang}wcf.user.language{/lang}</label></dt>
+                               <dd>
+                                       {htmlOptions options=$languages selected=$languageID name='languageID' id='languageID'}
+                               </dd>
+                       </dl>
+                       
+                       <dl>
+                               <dt><label for="selectedPackages">{lang}wcf.acp.language.export.selectPackages{/lang}</label></dt>
+                               <dd>
+                                       <select id="selectedPackages" name="selectedPackages[]" multiple="multiple" size="20" class="long">
+                                               <option value="*"{if $selectAllPackages} selected="selected"{/if}>{lang}wcf.acp.language.export.allPackages{/lang}</option>
+                                               <option value="-">--------------------</option>
+                                               {foreach from=$packages item=package}
+                                                       {assign var=loop value=$packageNameLength-$package->packageNameLength}
+                                                       <option value="{@$package->packageID}"{if $selectedPackages[$package->packageID]|isset} selected="selected"{/if}>{lang}{$package->packageName}{/lang} {section name=i loop=$loop}&nbsp;{/section}&nbsp;&nbsp;{$package->package}</option>
+                                               {/foreach}
+                                       </select>
+                               </dd>
+                       </dl>
+                       
+                       <dl>
+                               <dd>
+                                       <label for="exportCustomValues"><input type="checkbox" name="exportCustomValues" id="exportCustomValues" value="1" /> {lang}wcf.acp.language.export.customValues{/lang}</label>
+                               </dd>
+                       </dl>
+               </fieldset>
+       </div>
+       
+       <div class="formSubmit">
+               <input type="submit" accesskey="s" value="{lang}wcf.global.button.submit{/lang}" />
+       </div>
+</form>
+
+{include file='footer'}
\ No newline at end of file
diff --git a/wcfsetup/install/files/acp/templates/languageList.tpl b/wcfsetup/install/files/acp/templates/languageList.tpl
new file mode 100644 (file)
index 0000000..eab0115
--- /dev/null
@@ -0,0 +1,143 @@
+{include file='header' pageTitle='wcf.acp.language.list'}
+
+<script type="text/javascript">
+       //<![CDATA[
+       $(function() {
+               new WCF.Action.Delete('wcf\\data\\language\\LanguageAction', '.jsLanguageRow');
+               new WCF.Action.SimpleProxy({
+                       action: 'setAsDefault',
+                       className: 'wcf\\data\\language\\LanguageAction',
+                       elements: $('.jsLanguageRow .setAsDefaultButton')
+               }, {
+                       success: function(data, statusText, jqXHR) {
+                               $('.jsLanguageRow').each(function(index, row) {
+                                       var $button = $(row).find('.jsSetAsDefaultButton');
+                                       
+                                       if (WCF.inArray($($button).data('objectID'), data.objectIDs)) {
+                                               $($button).attr('src', '{@$__wcf->getPath()}icon/default.svg');
+                                               $(row).find('.jsDeleteButton').attr('src', '{@$__wcf->getPath()}icon/delete.svg');
+                                       }
+                                       else {
+                                               $($button).attr('src', '{@$__wcf->getPath()}icon/default1.svg');
+                                               $(row).find('.jsDeleteButton').attr('src', '{@$__wcf->getPath()}icon/delete.svg');
+                                       }
+                               });
+                       }
+               });
+       });
+       //]]>
+</script>
+
+<header class="boxHeadline">
+       <hgroup>
+               <h1>{lang}wcf.acp.language.list{/lang}</h1>
+       </hgroup>
+</header>
+
+<div class="contentNavigation">
+       {pages print=true assign=pagesLinks controller='LanguageList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+       
+       {hascontent}
+               <nav>
+                       <ul>
+                               {content}
+                                       {if $__wcf->getSession()->getPermission('admin.language.canAddLanguage')}
+                                               <li><a href="{link controller='LanguageAdd'}{/link}" title="{lang}wcf.acp.language.add{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/add.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.language.add{/lang}</span></a></li>
+                                       {/if}
+                                       
+                                       {event name='contentNavigationButtonsTop'}
+                               {/content}
+                       </ul>
+               </nav>
+       {/hascontent}
+</div>
+
+{if $objects|count}
+       <div id="userTableContainer" class="tabularBox tabularBoxTitle marginTop">
+               <hgroup>
+                       <h1>{lang}wcf.acp.language.list{/lang} <span class="badge badgeInverse" title="{lang}wcf.acp.language.list.count{/lang}">{#$items}</span></h1>
+               </hgroup>
+               
+               <table class="table">
+                       <thead>
+                               <tr>
+                                       <th class="columnID columnLanguageID{if $sortField == 'languageID'} active{/if}" colspan="2"><a href="{link controller='LanguageList'}pageNo={@$pageNo}&sortField=languageID&sortOrder={if $sortField == 'languageID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}{if $sortField == 'languageID'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                                       <th class="columnTitle columnLanguageName{if $sortField == 'languageName'} active{/if}"><a href="{link controller='LanguageList'}pageNo={@$pageNo}&sortField=languageName&sortOrder={if $sortField == 'languageName' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.language.name{/lang}{if $sortField == 'languageName'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                                       <th class="columnDigits columnUsers{if $sortField == 'users'} active{/if}"><a href="{link controller='LanguageList'}pageNo={@$pageNo}&sortField=users&sortOrder={if $sortField == 'users' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.language.users{/lang}{if $sortField == 'users'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                                       <th class="columnDigits columnVariables{if $sortField == 'variables'} active{/if}"><a href="{link controller='LanguageList'}pageNo={@$pageNo}&sortField=variables&sortOrder={if $sortField == 'variables' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.language.variables{/lang}{if $sortField == 'variables'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                                       <th class="columnDigits columnCustomVariables{if $sortField == 'customVariables'} active{/if}"><a href="{link controller='LanguageList'}pageNo={@$pageNo}&sortField=customVariables&sortOrder={if $sortField == 'customVariables' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.language.customVariables{/lang}{if $sortField == 'customVariables'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                               </tr>
+                       </thead>
+                       
+                       <tbody>
+                       {foreach from=$objects item=language}
+                               <tr class="jsLanguageRow">
+                                       <td class="columnIcon">
+                                               {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')}
+                                                       <a href="{link controller='LanguageExport' id=$language->languageID}{/link}"><img src="{@$__wcf->getPath()}icon/download.svg" alt="" title="{lang}wcf.acp.language.export{/lang}" class="icon16 jsTooltip" /></a>
+                                               {else}
+                                                       <img src="{@$__wcf->getPath()}icon/download.svg" alt="" title="{lang}wcf.acp.language.export{/lang}" class="icon16 disabloed" />
+                                               {/if}
+                                               
+                                               {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')}
+                                                       {if !$language->isDefault}
+                                                               <img src="{@$__wcf->getPath()}icon/default.svg" alt="" title="{lang}wcf.acp.language.setAsDefault{/lang}" class="icon16 jsSetAsDefaultButton jsTooltip" data-object-id="{@$language->languageID}" />
+                                                       {else}
+                                                               <img src="{@$__wcf->getPath()}icon/default.svg" alt="" title="{lang}wcf.acp.language.setAsDefault{/lang}" class="icon16 disabled" />
+                                                       {/if}
+                                               {else}
+                                                       <img src="{@$__wcf->getPath()}icon/default.svg" alt="" title="{lang}wcf.acp.language.setAsDefault{/lang}" class="icon16 disabled" />
+                                               {/if}
+                                               
+                                               {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')}
+                                                       <a href="{link controller='LanguageEdit' id=$language->languageID}{/link}"><img src="{@$__wcf->getPath()}icon/edit.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="icon16 jsTooltip" /></a>
+                                               {else}
+                                                       <img src="{@$__wcf->getPath()}icon/edit.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="icon16 disabled" />
+                                               {/if}
+                                               {if $__wcf->getSession()->getPermission('admin.language.canDeleteLanguage')}
+                                                       {if !$language->isDefault}
+                                                               <img src="{@$__wcf->getPath()}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="icon16 jsTooltip jsDeleteButton" data-object-id="{@$language->languageID}" data-confirm-message="{lang}wcf.acp.language.delete.sure{/lang}" />
+                                                       {else}
+                                                               <img src="{@$__wcf->getPath()}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="icon16 disabled" />
+                                                       {/if}
+                                               {else}
+                                                       <img src="{@$__wcf->getPath()}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="icon16 disabled" />
+                                               {/if}
+                                       </td>
+                                       <td class="columnID columnLanguageID">{@$language->languageID}</td>
+                                       <td class="columnTitle columnLanguageName">
+                                               {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')}
+                                                       <a href="{link controller='LanguageEdit' id=$language->languageID}{/link}">{$language->languageName} ({@$language->languageCode})</a>
+                                               {else}
+                                                       {$language->languageName} ({@$language->languageCode})
+                                               {/if}
+                                       </td>
+                                       <td class="columnDigits columnUsers">{#$language->users}</td>
+                                       <td class="columnDigits columnVariables">{#$language->variables}</td>
+                                       <td class="columnDigits columnCustomVariables">{if $language->customVariables > 0 && $__wcf->getSession()->getPermission('admin.language.canEditLanguage')}<a href="{link controller='LanguageEdit' id=$language->languageID}customVariables=1{/link}">{#$language->customVariables}</a>{else}{#$language->customVariables}{/if}</td>
+                               </tr>
+                       {/foreach}
+                       </tbody>
+               </table>
+       </div>
+       
+       <div class="contentNavigation">
+               {@$pagesLinks}
+               
+               {hascontent}
+                       <nav>
+                               <ul>
+                                       {content}
+                                               {if $__wcf->getSession()->getPermission('admin.language.canAddLanguage')}
+                                                       <li><a href="{link controller='LanguageAdd'}{/link}" title="{lang}wcf.acp.language.add{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/add.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.language.add{/lang}</span></a></li>
+                                               {/if}
+                                               
+                                               {event name='contentNavigationButtonsBottom'}
+                                       {/content}
+                               </ul>
+                       </nav>
+               {/hascontent}
+       </div>
+{/if}
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/acp/templates/languageMultilingualism.tpl b/wcfsetup/install/files/acp/templates/languageMultilingualism.tpl
new file mode 100644 (file)
index 0000000..1dc94b1
--- /dev/null
@@ -0,0 +1,55 @@
+{include file='header' pageTitle='wcf.acp.language.multilingualism'}
+
+<script type="text/javascript">
+       //<![CDATA[
+       $(function() {
+               var $languageIDs = $('#languageIDs');
+               $('#enable').click(function() { $languageIDs.toggle(); });
+               {if !$enable}$languageIDs.hide();{/if}
+       });
+       //]]>
+</script>
+
+<header class="boxHeadline">
+       <hgroup>
+               <h1>{lang}wcf.acp.language.multilingualism{/lang}</h1>
+       </hgroup>
+</header>
+
+{if $errorField}
+       <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+       <p class="success">{lang}wcf.acp.language.multilingualism.success{/lang}</p>
+{/if}
+
+<form enctype="multipart/form-data" method="post" action="{link controller='LanguageMultilingualism'}{/link}">
+       <div class="container containerPadding marginTop">
+               <fieldset>
+                       <legend><label><input type="checkbox" id="enable" name="enable" value="1" {if $enable}checked="checked" {/if}/> {lang}wcf.acp.language.multilingualism.enable{/lang}</label></legend>
+                       <small>{lang}wcf.acp.language.multilingualism.enable.description{/lang}</small>
+                       
+                       <dl id="languageIDs" class="marginTop{if $errorField == 'languageIDs'} formError{/if}">
+                               <dt><label for="languageIDs">{lang}wcf.acp.language.multilingualism.languages{/lang}</label></dt>
+                               <dd class="floated">
+                                       {htmlCheckboxes options=$languages name=languageIDs selected=$languageIDs disableEncoding=true}
+                                       
+                                       {if $errorField == 'languageIDs'}
+                                               <small class="innerError">
+                                                       {lang}wcf.acp.language.multilingualism.languages.error.{@$errorType}{/lang}
+                                               </small>
+                                       {/if}
+                               </dd>
+                       </dl>
+                       
+                       {event name='additionalFields'}
+               </fieldset>
+       </div>
+       
+       <div class="formSubmit">
+               <input type="submit" accesskey="s" value="{lang}wcf.global.button.submit{/lang}" />
+       </div>
+</form>
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/acp/templates/languageServerAdd.tpl b/wcfsetup/install/files/acp/templates/languageServerAdd.tpl
new file mode 100644 (file)
index 0000000..b90a029
--- /dev/null
@@ -0,0 +1,59 @@
+{include file='header' pageTitle='wcf.acp.languageServer.'|concat:$action}
+
+<header class="boxHeadline">
+       <hgroup>
+               <h1>{lang}wcf.acp.languageServer.{$action}{/lang}</h1>
+       </hgroup>
+</header>
+
+{if $errorField}
+       <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+       <p class="success">{lang}wcf.acp.languageServer.{$action}.success{/lang}</p>    
+{/if}
+
+{hascontent}
+       <div class="contentNavigation">
+               <nav>
+                       <ul>
+                               {content}
+                                       {if $__wcf->session->getPermission('admin.language.canDeleteServer') || $__wcf->session->getPermission('admin.language.canEditServer')}
+                                               <li><a href="{link controller='LanguageServerList'}{/link}" title="{lang}wcf.acp.menu.link.language.server.list{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.menu.link.language.server.list{/lang}</span></a></li>
+                                       {/if}
+                                       
+                                       {event name='contentNavigationButtons'}
+                               {/content}
+                       </ul>
+               </nav>
+       </div>
+{/hascontent}
+
+<form method="post" action="{if $action == 'add'}{link controller='LanguageServerAdd'}{/link}{else}{link controller='LanguageServerEdit' id=$languageServerID}{/link}{/if}">
+       <div class="container containerPadding marginTop">
+               <fieldset>
+                       <legend>{lang}wcf.acp.languageServer.data{/lang}</legend>
+                       
+                       <dl{if $errorField == 'server'} class="formError"{/if}>
+                               <dt><label for="server">{lang}wcf.acp.languageServer.server{/lang}</label></dt>
+                               <dd>
+                                       <input type="text" name="server" id="server" value="{$server}" autofocus="autofocus" class="long" />
+                                       {if $errorField == 'server'}
+                                               <small class="innerError">
+                                                       {if $errorType == 'empty'}{lang}wcf.global.error.empty{/lang}{/if}
+                                                       {if $errorType == 'notValid'}{lang}wcf.acp.languageServer.server.error.notValid{/lang}{/if}
+                                               </small>
+                                       {/if}
+                                       <small>{lang}wcf.acp.languageServer.server.description{/lang}</small>
+                               </dd>
+                       </dl>
+               </fieldset>
+       </div>
+       
+       <div class="formSubmit">
+               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+       </div>
+</form>
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/acp/templates/languageServerList.tpl b/wcfsetup/install/files/acp/templates/languageServerList.tpl
new file mode 100644 (file)
index 0000000..b4861e1
--- /dev/null
@@ -0,0 +1,106 @@
+{include file='header' pageTitle='wcf.acp.languageServer.list'}
+
+<script type="text/javascript">
+       //<![CDATA[
+       $(function() {
+               {if $__wcf->getSession()->getPermission('admin.language.canDeleteServer')}
+                       new WCF.Action.Delete('wcf\\data\\language\\server\\LanguageServerAction', '.jsLanguageServerRow');
+               {/if}
+               {if $__wcf->getSession()->getPermission('admin.language.canEditServer')}
+                       new WCF.Action.Toggle('wcf\\data\\language\\server\\LanguageServerAction', $('.jsLanguageServerRow'));
+               {/if}
+       });
+       //]]>
+</script>
+
+<header class="boxHeadline">
+       <hgroup>
+               <h1>{lang}wcf.acp.languageServer.list{/lang}</h1>
+       </hgroup>
+</header>
+
+<div class="contentNavigation">
+       {pages print=true assign=pagesLinks controller='LanguageServerList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+       
+       {hascontent}
+               <nav>
+                       <ul>
+                               {content}
+                                       {if $__wcf->getSession()->getPermission('admin.language.canAddServer')}
+                                               <li><a href="{link controller='LanguageServerAdd'}{/link}" title="{lang}wcf.acp.languageServer.add{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/add.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.languageServer.add{/lang}</span></a></li>
+                                       {/if}
+                                       
+                                       {event name='contentNavigationButtonsTop'}
+                               {/content}
+                       </ul>
+               </nav>
+       {/hascontent}
+</div>
+
+{if !$languageServers|count}
+       <p class="warning">{lang}wcf.acp.languageServer.view.noneAvailable{/lang}</p>
+{else}
+       <div class="tabularBox tabularBoxTitle marginTop">
+               <hgroup>
+                       <h1>{lang}wcf.acp.languageServer.list{/lang} <span class="badge badgeInverse" title="{lang}wcf.acp.languageServer.list.count{/lang}">{#$items}</span></h1>
+               </hgroup>
+               
+               <table class="table">
+                       <thead>
+                               <tr>
+                                       <th class="columnID columnLanguageServerID{if $sortField == 'languageServerID'} active{/if}" colspan="2"><a href="{link controller='LanguageServerList'}pageNo={@$pageNo}&sortField=languageServerID&sortOrder={if $sortField == 'languageServerID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}{if $sortField == 'languageServerID'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                                       <th class="columnTitle columnServerURL{if $sortField == 'serverURL'} active{/if}"><a href="{link controller='LanguageServerList'}pageNo={@$pageNo}&sortField=serverURL&sortOrder={if $sortField == 'serverURL' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.languageServer.serverURL{/lang}{if $sortField == 'serverURL'} <img src="{@$__wcf->getPath()}icon/sort{@$sortOrder}.svg" alt="" />{/if}</a></th>
+                               </tr>
+                       </thead>
+                       <tbody>
+                               {foreach from=$languageServers item=languageServer}
+                                       <tr class="jsLanguageServerRow">
+                                               <td class="columnIcon">
+                                                       {if $__wcf->getSession()->getPermission('admin.language.canEditServer')}
+                                                               <img src="{@$__wcf->getPath()}icon/{if !$languageServer->isDisabled}enabled{else}disabled{/if}.svg" alt="" title="{lang}wcf.global.button.{if !$languageServer->isDisabled}disable{else}enable{/if}{/lang}" class="icon16 jsToggleButton jsTooltip" data-object-id="{@$languageServer->languageServerID}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" />
+                                                               <a href="{link controller='LanguageServerEdit' id=$languageServer->languageServerID}{/link}"><img src="{@$__wcf->getPath()}icon/edit.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="icon16jsTooltip" /></a>
+                                                       {else}
+                                                               <img src="{@$__wcf->getPath()}icon/{if !$languageServer->isDisabled}enabled{else}disabled{/if}.svg" alt="" title="{lang}wcf.global.button.{if !$languageServer->isDisabled}disable{else}enable{/if}{/lang}" class="icon16 disabled" />
+                                                               <img src="{@$__wcf->getPath()}icon/edit.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="icon16 disabled" />
+                                                       {/if}
+                                                       
+                                                       {if $__wcf->getSession()->getPermission('admin.language.canDeleteServer')}
+                                                               <img src="{@$__wcf->getPath()}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="icon16 jsDeleteButton jsTooltip" data-object-id="{@$languageServer->languageServerID}" data-confirm-message="{lang}wcf.acp.languageServer.delete.sure{/lang}" />
+                                                       {else}
+                                                               <img src="{@$__wcf->getPath()}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="icon16 disabled" />
+                                                       {/if}
+                                               </td>
+                                               <td class="columnID columnLanguageServerID">{@$languageServer->languageServerID}</td>
+                                               <td class="columnTitle columnServerURL">
+                                                       {if $__wcf->getSession()->getPermission('admin.language.canEditServer')}
+                                                               <a href="{link controller='LanguageServerEdit' id=$languageServer->languageServerID}{/link}">{@$languageServer->serverURL}</a>
+                                                       {else}
+                                                               {@$languageServer->serverURL}
+                                                       {/if}
+                                               </td>
+                                       </tr>
+                               {/foreach}
+                       </tbody>
+               </table>
+       </div>
+       
+       <div class="contentNavigation">
+               {@$pagesLinks}
+               
+               {hascontent}
+                       <nav>
+                               <ul>
+                                       {content}
+                                               {if $__wcf->getSession()->getPermission('admin.language.canAddServer')}
+                                                       <li><a href="{link controller='LanguageServerAdd'}{/link}" title="{lang}wcf.acp.languageServer.add{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/add.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.languageServer.add{/lang}</span></a></li>
+                                               {/if}
+                                               
+                                               {event name='contentNavigationButtonsBottom'}
+                                       {/content}
+                               </ul>
+                       </nav>
+               {/hascontent}
+       </div>
+{/if}
+
+{include file='footer'}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php
new file mode 100644 (file)
index 0000000..af033ab
--- /dev/null
@@ -0,0 +1,217 @@
+<?php
+namespace wcf\acp\form;
+use wcf\data\language\LanguageEditor;
+use wcf\form\AbstractForm;
+use wcf\system\exception\SystemException;
+use wcf\system\exception\UserInputException;
+use wcf\system\language\LanguageFactory;
+use wcf\system\WCF;
+use wcf\system\WCFACP;
+use wcf\util\StringUtil;
+use wcf\util\XML;
+
+/**
+ * Shows the language add form.
+ * 
+ * @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 acp.form
+ * @category   Community Framework
+ */
+class LanguageAddForm extends AbstractForm {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language.add';
+       
+       /**
+        * file name
+        * @var string
+        */
+       public $filename = '';
+       
+       /**
+        * import field
+        * @var string
+        */
+       public $importField = 'languageFile';
+       
+       /**
+        * language object
+        * @var wcf\data\language\Language
+        */
+       public $language = null;
+       
+       /**
+        * language code
+        * @var string
+        */
+       public $languageCode = '';
+       
+       /**
+        * import language file
+        * @var string
+        */
+       public $languageFile = '';
+       
+       /**
+        * list of available languages
+        * @var array<wcf\data\language\Language>
+        */
+       public $languages = array();
+       
+       /**
+        * mode
+        * @var string
+        */
+       public $mode = 'import';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canAddLanguage');
+       
+       /**
+        * source language object
+        * @var wcf\data\language\Language
+        */
+       public $sourceLanguage = null;
+       
+       /**
+        * source language id
+        * @var integer
+        */
+       public $sourceLanguageID = 0;
+       
+       /**
+        * @see wcf\form\Form::readFormParameters()
+        */
+       public function readFormParameters() {
+               parent::readFormParameters();
+               
+               // mode
+               if (isset($_POST['mode'])) $this->mode = $_POST['mode'];
+               
+               // copy
+               if (isset($_POST['languageCode'])) $this->languageCode = $_POST['languageCode'];
+               if (isset($_POST['sourceLanguageID'])) $this->sourceLanguageID = intval($_POST['sourceLanguageID']);
+               
+               // import
+               if (isset($_POST['languageFile']) && !empty($_POST['languageFile'])) {
+                       $this->languageFile = $_POST['languageFile'];
+                       $this->filename = $_POST['languageFile'];
+               }
+               if (isset($_FILES['languageUpload']) && !empty($_FILES['languageUpload']['tmp_name'])) {
+                       $this->importField = 'languageUpload';
+                       $this->filename = $_FILES['languageUpload']['tmp_name'];
+               }
+       }
+       
+       /**
+        * @see wcf\form\Form::validate()
+        */
+       public function validate() {
+               parent::validate();
+               
+               if ($this->mode == 'copy') {
+                       // language code
+                       if (empty($this->languageCode)) {
+                               throw new UserInputException('languageCode');
+                       }
+                       
+                       // 
+                       if (LanguageFactory::getInstance()->getLanguageByCode($this->languageCode)) {
+                               throw new UserInputException('languageCode', 'notUnique');
+                       }
+                       
+                       // source language id
+                       if (empty($this->sourceLanguageID)) {
+                               throw new UserInputException('sourceLanguageID');
+                       }
+                       
+                       // get language
+                       $this->sourceLanguage = LanguageFactory::getInstance()->getLanguage($this->sourceLanguageID);
+                       if (!$this->sourceLanguage->languageID) {
+                               throw new UserInputException('sourceLanguageID');
+                       }
+               }
+               else {
+                       // check file
+                       if (!file_exists($this->filename)) {
+                               throw new UserInputException('languageFile');
+                       }
+                       
+                       // try to import
+                       try {
+                               // open xml document
+                               $xml = new XML();
+                               $xml->load($this->filename);
+                               
+                               // import xml document
+                               $this->language = LanguageEditor::importFromXML($xml, PACKAGE_ID);
+                       }
+                       catch (SystemException $e) {
+                               throw new UserInputException($this->importField, $e->getMessage());
+                       }
+               }
+       }
+       
+       /**
+        * @see wcf\form\Form::save()
+        */
+       public function save() {
+               parent::save();
+               
+               if ($this->mode == 'copy') {
+                       $this->language = LanguageEditor::create(array(
+                               'languageCode' => StringUtil::toLowerCase($this->languageCode)
+                       ));
+                       $languageEditor = new LanguageEditor($this->sourceLanguage);
+                       $languageEditor->copy($this->language);
+               }
+               
+               LanguageFactory::getInstance()->clearCache();
+               LanguageFactory::getInstance()->deleteLanguageCache();
+               
+               $this->saved();
+               
+               // show success message
+               WCF::getTPL()->assign('success', true);
+       }
+       
+       /**
+        * @see wcf\page\Page::readData()
+        */
+       public function readData() {
+               parent::readData();
+               
+               $this->languages = LanguageFactory::getInstance()->getLanguages();
+       }
+       
+       /**
+        * @see wcf\page\Page::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+               
+               WCF::getTPL()->assign(array(
+                       'mode' => $this->mode,
+                       'languageCode' => $this->languageCode,
+                       'sourceLanguageID' => $this->sourceLanguageID,
+                       'languages' => $this->languages,
+                       'languageFile' => $this->languageFile
+               ));
+       }
+       
+       /**
+        * @see wcf\page\Page::show()
+        */
+       public function show() {
+               // check master password
+               WCFACP::checkMasterPassword();
+               
+               parent::show();
+       }
+}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php
new file mode 100644 (file)
index 0000000..e05b861
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+namespace wcf\acp\form;
+use wcf\data\language\LanguageEditor;
+use wcf\data\package\Package;
+use wcf\form\AbstractForm;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\language\LanguageFactory;
+use wcf\system\WCF;
+use wcf\util\ArrayUtil;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the language export form.
+ * 
+ * @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 acp.form
+ * @category   Community Framework
+ */
+class LanguageExportForm extends AbstractForm {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canEditLanguage');
+       
+       /**
+        * language id
+        * @var integer
+        */
+       public $languageID = 0;
+       
+       /**
+        * language editor object
+        * @var wcf\data\language\LanguageEditor
+        */
+       public $language = null;
+       
+       /**
+        * selected packages
+        * @var array<string>
+        */
+       public $selectedPackages = array();
+       
+       /**
+        * available packages
+        * @var array<string>
+        */
+       public $packages = array();
+       
+       /**
+        * true to export custom variables
+        * @var boolean
+        */
+       public $exportCustomValues = false;
+       
+       /**
+        * max package name length
+        * @var integer
+        */
+       public $packageNameLength = 0; 
+       
+       /**
+        * @see wcf\page\IPage::readParameters()
+        */
+       public function readParameters() {
+               parent::readParameters();
+               
+               // get language editor object
+               if (isset($_REQUEST['id'])) $this->languageID = intval($_REQUEST['id']);
+               $language = LanguageFactory::getInstance()->getLanguage($this->languageID);
+               if ($language === null) {
+                       throw new IllegalLinkException();
+               }
+               $this->language = new LanguageEditor($language);
+       }
+       
+       /**
+        * @see wcf\form\IForm::readFormParameters()
+        */
+       public function readFormParameters() {
+               parent::readFormParameters();
+               
+               if (isset($_POST['selectedPackages']) && is_array($_POST['selectedPackages'])) {
+                       $selectedPackages = ArrayUtil::toIntegerArray($_POST['selectedPackages']);
+                       $this->selectedPackages = array_combine($selectedPackages, $selectedPackages);
+                       if (isset($this->selectedPackages[0])) unset($this->selectedPackages[0]);
+               }
+               
+               if (isset($_POST['exportCustomValues'])) {
+                       $this->exportCustomValues = intval($_POST['exportCustomValues']);
+               }
+       }
+       
+       /**
+        * @see wcf\page\IPage::readData()
+        */
+       public function readData() {
+               parent::readData();
+               
+               $this->readPackages();
+       }
+       
+       /**
+        * @see wcf\form\IForm::save()
+        */
+       public function save() {
+               parent::save();
+               
+               // send headers
+               header('Content-Type: text/xml; charset=UTF-8');
+               header('Content-Disposition: attachment; filename="'.$this->language->languageCode.'.xml"');
+               $this->language->export($this->selectedPackages, $this->exportCustomValues);
+               exit;
+       }
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+               
+               WCF::getTPL()->assign(array(
+                       'languageID' => $this->languageID,
+                       'languages' => LanguageFactory::getInstance()->getLanguages(),
+                       'selectedPackages' => $this->selectedPackages,
+                       'packages' => $this->packages,
+                       'selectAllPackages' => true,
+                       'packageNameLength' => $this->packageNameLength
+               ));
+       }
+       
+       /**
+        * Read available packages.
+        */
+       protected function readPackages() {
+               $sql = "SELECT          *
+                       FROM            wcf".WCF_N."_package
+                       ORDER BY        packageName";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute(array($this->languageID));
+               while ($row = $statement->fetchArray()) {
+                       $row['packageNameLength'] = StringUtil::length(WCF::getLanguage()->get($row['packageName']));
+                       $this->packages[] = new Package(null, $row);
+                       if ($row['packageNameLength'] > $this->packageNameLength) {
+                               $this->packageNameLength = $row['packageNameLength'];   
+                       } 
+               }
+       }
+}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php
new file mode 100644 (file)
index 0000000..7c1e326
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+namespace wcf\acp\form;
+use wcf\data\language\LanguageEditor;
+use wcf\form\AbstractForm;
+use wcf\system\language\LanguageFactory;
+use wcf\system\exception\UserInputException;
+use wcf\system\cache\CacheHandler;
+use wcf\system\WCF;
+use wcf\system\WCFACP;
+use wcf\util\ArrayUtil;
+
+/**
+ * Shows the language multilingualism form.
+ * 
+ * @author     Jean-Marc Licht
+ * @copyright  2001-2013 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 LanguageMultilingualismForm extends AbstractForm {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language.multilingualism';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canEditLanguage');
+       
+       // data
+       // todo: comment
+       public $enable = 0;
+       public $languageIDs = array();
+       public $languages = array();
+       public $languageList = array();
+       
+       /**
+        * @see wcf\page\IPage::readParameters()
+        */
+       public function readParameters() {
+               parent::readParameters();
+               
+               $this->languages = LanguageFactory::getInstance()->getLanguages();
+       }
+       
+       /**
+        * @see wcf\form\IForm::readFormParameters()
+        */
+       public function readFormParameters() {
+               parent::readFormParameters();
+               
+               if (isset($_POST['enable'])) $this->enable = intval($_POST['enable']);
+               if (isset($_POST['languageIDs']) && is_array($_POST['languageIDs'])) $this->languageIDs = ArrayUtil::toIntegerArray($_POST['languageIDs']);
+       }
+       
+       /**
+        * @see wcf\form\IForm::validate()
+        */
+       public function validate() {
+               parent::validate();
+               
+               if ($this->enable == 1) {
+                       // add default language
+                       if (!in_array(LanguageFactory::getInstance()->getDefaultLanguageID(), $this->languageIDs)) {
+                               $this->languageIDs[] = LanguageFactory::getInstance()->getDefaultLanguageID();
+                       }
+                       
+                       // validate language ids
+                       $contentLanguages = 0;
+                       foreach ($this->languageIDs as $languageID) {
+                               if (isset($this->languages[$languageID])) {
+                                       $contentLanguages++;
+                               }
+                       }
+                       
+                       if ($contentLanguages < 2) {
+                               throw new UserInputException('languageIDs');
+                       }
+               }
+       }
+       
+       /**
+        * @see wcf\form\IForm::save()
+        */
+       public function save() {
+               parent::save();
+               
+               // save
+               LanguageEditor::enableMultilingualism(($this->enable == 1 ? $this->languageIDs : array()));
+               
+               // clear cache
+               CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
+               $this->saved();
+               
+               // show success message
+               WCF::getTPL()->assign('success', true);
+       }
+       
+       /**
+        * @see wcf\page\IPage::readData()
+        */
+       public function readData() {
+               parent::readData();
+               
+               if (empty($_POST)) {
+                       // default values
+                       $contentLanguages = 0;
+                       foreach ($this->languages as $languageID => $language) {
+                               if ($language->hasContent) {
+                                       $contentLanguages++;
+                                       $this->languageIDs[] = $languageID;
+                               }
+                       }
+                       
+                       // add default language
+                       if (!in_array(LanguageFactory::getInstance()->getDefaultLanguageID(), $this->languageIDs)) {
+                               $this->languageIDs[] = LanguageFactory::getInstance()->getDefaultLanguageID();
+                       }
+                       
+                       if ($contentLanguages > 1) {
+                               $this->enable = 1;
+                       }
+               }
+               
+               $this->languageList = LanguageFactory::getInstance()->getLanguages();
+       }
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+               
+               WCF::getTPL()->assign(array(
+                       'enable' => $this->enable,
+                       'languageIDs' => $this->languageIDs,
+                       'languages' => $this->languageList
+               ));
+       }
+       
+       /**
+        * @see wcf\page\IPage::show()
+        */
+       public function show() {
+               // check master password
+               WCFACP::checkMasterPassword();
+               
+               parent::show();
+       }
+}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageServerAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageServerAddForm.class.php
new file mode 100644 (file)
index 0000000..bde1871
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+namespace wcf\acp\form;
+use wcf\data\language\server\LanguageServerAction;
+use wcf\data\package\update\server\PackageUpdateServer;
+use wcf\form\AbstractForm;
+use wcf\system\WCF;
+use wcf\system\WCFACP;
+use wcf\system\exception\UserInputException;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the language server add form.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2013 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 LanguageServerAddForm extends AbstractForm {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language.server.add';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canAddServer');
+       
+       /**
+        * server url
+        * @var string
+        */
+       public $server = '';
+       
+       /**
+        * @see wcf\form\IForm::readFormParameters()
+        */
+       public function readFormParameters() {
+               parent::readFormParameters();
+               
+               if (isset($_POST['server'])) $this->server = StringUtil::trim($_POST['server']);
+       }
+       
+       /**
+        * @see wcf\form\IForm::validate()
+        */
+       public function validate() {
+               parent::validate();
+               
+               if (empty($this->server)) {
+                       throw new UserInputException('server');
+               }
+               
+               if (!PackageUpdateServer::isValidServerURL($this->server)) {
+                       throw new UserInputException('server', 'notValid');
+               }
+       }
+       
+       /**
+        * @see wcf\form\IForm::save()
+        */
+       public function save() {
+               parent::save();
+               
+               // save server
+               $this->objectAction = new LanguageServerAction(array(), 'create', array('data' => array(
+                       'serverURL' => $this->server
+               )));
+               $this->objectAction->executeAction();
+               $this->saved();
+               
+               // reset values
+               $this->server = '';
+               
+               // show success message
+               WCF::getTPL()->assign('success', true);
+       }
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+               
+               WCF::getTPL()->assign(array(
+                       'server' => $this->server,
+                       'action' => 'add'
+               ));
+       }
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function show() {
+               // check master password
+               WCFACP::checkMasterPassword();
+               
+               parent::show();
+       }
+}
diff --git a/wcfsetup/install/files/lib/acp/form/LanguageServerEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageServerEditForm.class.php
new file mode 100644 (file)
index 0000000..30f2981
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+namespace wcf\acp\form;
+use wcf\data\language\server\LanguageServer;
+use wcf\data\language\server\LanguageServerAction;
+use wcf\form\AbstractForm;
+use wcf\system\WCF;
+use wcf\system\exception\IllegalLinkException;
+
+/**
+ * Shows the language server edit form.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2013 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 LanguageServerEditForm extends LanguageServerAddForm {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language.server';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canAddServer');
+       
+       /**
+        * language server id
+        * @var integer
+        */
+       public $languageServerID = 0;
+       
+       /**
+        * active language server
+        * @var wcf\data\language\server\LanguageServer
+        */
+       public $languageServer = null;
+       
+       /**
+        * @see wcf\page\IPage::readParameters()
+        */
+       public function readParameters() {
+               parent::readParameters();
+               
+               if (isset($_REQUEST['id'])) $this->languageServerID = intval($_REQUEST['id']);
+               $this->languageServer = new LanguageServer($this->languageServerID);
+               if (!$this->languageServer->languageServerID) {
+                       throw new IllegalLinkException();
+               }
+       }
+       
+       /**
+        * @see wcf\form\IForm::save()
+        */
+       public function save() {
+               AbstractForm::save();
+               
+               // save server
+               $this->objectAction = new LanguageServerAction(array($this->languageServerID), 'update', array('data' => array(
+                       'serverURL' => $this->server
+               )));
+               $this->objectAction->executeAction();
+               $this->saved();
+               
+               // show success message
+               WCF::getTPL()->assign('success', true);
+       }
+       
+       /**
+        * @see wcf\page\IPage::readData()
+        */
+       public function readData() {
+               parent::readData();
+               
+               if (empty($_POST)) {
+                       $this->server = $this->languageServer->serverURL;
+               }
+       }
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+                       
+               WCF::getTPL()->assign(array(
+                       'languageServerID' => $this->languageServerID,
+                       'languageServer' => $this->languageServer,
+                       'action' => 'edit'
+               ));
+       }
+}
diff --git a/wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php b/wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php
new file mode 100644 (file)
index 0000000..63d9739
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+namespace wcf\acp\page;
+use wcf\page\SortablePage;
+use wcf\system\WCF;
+
+/**
+ * Shows a list of all installed languages.
+ * 
+ * @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 acp.page
+ * @category   Community Framework
+ */
+class LanguageListPage extends SortablePage {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language.list';
+       
+       /**
+        * @see wcf\page\SortablePage::$defaultSortField
+        */
+       public $defaultSortField = 'languageName';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canEditLanguage', 'admin.language.canDeleteLanguage');
+       
+       /**
+        * @see wcf\page\MultipleLinkPage::$objectListClassName
+        */
+       public $objectListClassName = 'wcf\data\language\LanguageList';
+       
+       /**
+        * @see wcf\page\SortablePage::$validSortFields
+        */
+       public $validSortFields = array('languageID', 'languageCode', 'languageName', 'users', 'variables', 'customVariables');
+       
+       /**
+        * @see wcf\page\MultipleLinkPage::initObjectList()
+        */
+       public function initObjectList() {
+               parent::initObjectList();
+               
+               $this->objectList->sqlSelects = "(SELECT COUNT(*) FROM wcf".WCF_N."_user user WHERE languageID = language.languageID) AS users,";
+               $this->objectList->sqlSelects .= "(SELECT COUNT(*) FROM wcf".WCF_N."_language_item WHERE languageID = language.languageID) AS variables,";
+               $this->objectList->sqlSelects .= "(SELECT COUNT(*) FROM wcf".WCF_N."_language_item WHERE languageID = language.languageID AND languageCustomItemValue <> NULL) AS customVariables";
+               $this->sqlOrderBy = "cronjob.".$this->sortField." ".$this->sortOrder;
+       }
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+               
+               WCF::getTPL()->assign(array(
+                       'languages' => $this->objectList->getObjects()
+               ));
+       }
+}
diff --git a/wcfsetup/install/files/lib/acp/page/LanguageServerListPage.class.php b/wcfsetup/install/files/lib/acp/page/LanguageServerListPage.class.php
new file mode 100644 (file)
index 0000000..df44962
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+namespace wcf\acp\page;
+use wcf\page\SortablePage;
+use wcf\system\WCF;
+
+/**
+ * Shows information about available language servers.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2013 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 LanguageServerListPage extends SortablePage {
+       /**
+        * @see wcf\page\AbstractPage::$activeMenuItem
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.language.server.list';
+       
+       /**
+        * @see wcf\page\SortablePage::$defaultSortField
+        */
+       public $defaultSortField = 'serverURL';
+       
+       /**
+        * @see wcf\page\AbstractPage::$neededPermissions
+        */
+       public $neededPermissions = array('admin.language.canEditServer', 'admin.language.canDeleteServer');
+       
+       /**
+        * @see wcf\page\MultipleLinkPage::$objectListClassName
+        */
+       public $objectListClassName = 'wcf\data\language\server\LanguageServerList';
+       
+       /**
+        * @see wcf\page\SortablePage::$validSortFields
+        */
+       public $validSortFields = array('languageServerID', 'serverURL');
+       
+       /**
+        * @see wcf\page\IPage::assignVariables()
+        */
+       public function assignVariables() {
+               parent::assignVariables();
+               
+               WCF::getTPL()->assign(array(
+                       'languageServers' => $this->objectList->getObjects()
+               ));
+       }
+}
index c1f3c266463352013e58d1b1ed1f18483778b56c..3b3afffbd45551f08dc454b40f1ab746866be625 100644 (file)
                <item name="wcf.acp.group.showMembers"><![CDATA[Zeige die Mitglieder dieser Benutzergruppe]]></item>
        </category>
        
+       <category name="wcf.acp.language">
+               <item name="wcf.acp.language.add"><![CDATA[Sprache hinzufügen]]></item>
+               <item name="wcf.acp.language.add.languageCode.error.notUnique"><![CDATA[Dieser Sprachcode wird bereits von einer anderen im System installierten Sprache verwendet.]]></item>
+               <item name="wcf.acp.language.add.mode"><![CDATA[Sprache erstellen durch]]></item>
+               <item name="wcf.acp.language.add.mode.copy"><![CDATA[Übersetzen einer vorhandenen Sprache]]></item>
+               <item name="wcf.acp.language.add.mode.import"><![CDATA[Importieren einer Sprachdatei]]></item>
+               <item name="wcf.acp.language.add.new"><![CDATA[Neue Sprache]]></item>
+               <item name="wcf.acp.language.add.source"><![CDATA[Zu übersetzende Sprache]]></item>
+               <item name="wcf.acp.language.code"><![CDATA[Sprachcode]]></item>
+               <item name="wcf.acp.language.code.description"><![CDATA[Geben Sie hier den passenden Sprachcode nach <strong>ISO 639-1</strong> an. Weitere Informationen zu Sprachcodes finden Sie unter <a href="http://de.wikipedia.org/wiki/ISO_639-1" class="wcf-externalURL">http://de.wikipedia.org/wiki/ISO_639-1</a>.]]></item>
+               <item name="wcf.acp.language.customVariables"><![CDATA[Veränderte Variablen]]></item>
+               <item name="wcf.acp.language.delete.sure"><![CDATA[Wollen Sie die Sprache „{$language->languageName}“ wirklich löschen?]]></item>
+               <item name="wcf.acp.language.edit"><![CDATA[Sprache bearbeiten]]></item>
+               <item name="wcf.acp.language.export"><![CDATA[Sprache exportieren]]></item>
+               <item name="wcf.acp.language.export.allPackages"><![CDATA[Alle Pakete]]></item>
+               <item name="wcf.acp.language.export.customValues"><![CDATA[Veränderte Variablen exportieren]]></item>
+               <item name="wcf.acp.language.export.selectPackages"><![CDATA[Pakete auswählen]]></item>
+               <item name="wcf.acp.language.import.error"><![CDATA[Beim Importieren der Sprachdatei ist folgender Fehler aufgetreten:]]></item>
+               <item name="wcf.acp.language.import.source"><![CDATA[Quelle]]></item>
+               <item name="wcf.acp.language.import.source.file"><![CDATA[Pfad zur Sprachdatei]]></item>
+               <item name="wcf.acp.language.import.source.file.description"><![CDATA[Geben Sie hier den relativen Pfad zu einer gültigen XML-Sprachdatei an.]]></item>
+               <item name="wcf.acp.language.import.source.upload"><![CDATA[Sprachdatei vom lokalen Computer hochladen]]></item>
+               <item name="wcf.acp.language.list"><![CDATA[Sprachen]]></item>
+               <item name="wcf.acp.language.list.count"><![CDATA[{#$items} Sprache{if $items != 1}n{/if}]]></item>
+               <item name="wcf.acp.language.multilingualism"><![CDATA[Mehrsprachigkeit verwalten]]></item>
+               <item name="wcf.acp.language.multilingualism.enable"><![CDATA[Mehrsprachige Inhalte aktivieren]]></item>
+               <item name="wcf.acp.language.multilingualism.enable.description"><![CDATA[Haben Sie mehrere Sprachen installiert, können sich Ihre Mitglieder die Programmoberfläche in diesen Sprachen anzeigen lassen. Erstellte Inhalte werden durch die aktivierte Mehrsprachigkeit außerdem einer Sprache zugeordnet. Die Benutzer können in ihrem Profil auswählen, dass ausschließlich Inhalte von bestimmten Sprachen angezeigt werden. Bei der Erstellung von Inhalten ist standardmäßig die aktive Oberflächensprache vorausgewählt.]]></item>
+               <item name="wcf.acp.language.multilingualism.languages"><![CDATA[Inhalte in folgenden Sprachen zulassen]]></item>
+               <item name="wcf.acp.language.multilingualism.languages.error.empty"><![CDATA[Um die Mehrsprachigkeit zu nutzen, müssen Sie mindestens zwei Sprachen auswählen.]]></item>
+               <item name="wcf.acp.language.multilingualism.success"><![CDATA[Ihre Einstellungen wurden erfolgreich gespeichert.]]></item>
+               <item name="wcf.acp.language.name"><![CDATA[Name]]></item>
+               <item name="wcf.acp.language.setAsDefault"><![CDATA[Zur Standardsprache machen]]></item>
+               <item name="wcf.acp.language.variables"><![CDATA[Variablen]]></item>
+               <item name="wcf.acp.language.users"><![CDATA[Verwendet von]]></item>
+       </category>
+       
        <category name="wcf.acp.masterPassword">
                <item name="wcf.acp.masterPassword"><![CDATA[Hauptkennwort]]></item>
                <item name="wcf.acp.masterPassword.confirm"><![CDATA[Hauptkennwort wiederholen]]></item>
                <item name="wcf.acp.menu.link.cronjob"><![CDATA[Cronjobs]]></item>
                <item name="wcf.acp.menu.link.cronjob.add"><![CDATA[Aufgabe hinzufügen]]></item>
                <item name="wcf.acp.menu.link.cronjob.list"><![CDATA[Aufgaben auflisten]]></item>
+               <item name="wcf.acp.menu.link.language"><![CDATA[Sprachen]]></item>
+               <item name="wcf.acp.menu.link.language.add"><![CDATA[Sprache hinzufügen]]></item>
+               <item name="wcf.acp.menu.link.language.list"><![CDATA[Sprachen auflisten]]></item>
+               <item name="wcf.acp.menu.link.language.multilingualism"><![CDATA[Mehrsprachigkeit verwalten]]></item>
+               <item name="wcf.acp.menu.link.language.server.add"><![CDATA[Server hinzufügen]]></item>
+               <item name="wcf.acp.menu.link.language.server.list"><![CDATA[Server auflisten]]></item>
                <item name="wcf.acp.menu.link.log"><![CDATA[Protokoll]]></item>
                <item name="wcf.acp.menu.link.log.session"><![CDATA[Sitzungen]]></item>
                <item name="wcf.acp.menu.link.log.cronjob"><![CDATA[Cronjobs]]></item>