From 2d66ddac53463f8293835e000f79a2af10b7cd25 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 3 Feb 2012 15:15:48 +0100 Subject: [PATCH 1/1] Initial version --- .gitignore | 38 ++++ acpmenu.xml | 36 ++++ acptemplates/languageAdd.tpl | 122 +++++++++++ acptemplates/languageEdit.tpl | 191 +++++++++++++++++ acptemplates/languageExport.tpl | 64 ++++++ acptemplates/languageList.tpl | 136 +++++++++++++ acptemplates/languageServerAdd.tpl | 55 +++++ acptemplates/languageServerList.tpl | 99 +++++++++ files/lib/acp/form/LanguageAddForm.class.php | 192 ++++++++++++++++++ .../lib/acp/form/LanguageExportForm.class.php | 169 +++++++++++++++ .../acp/form/LanguageServerAddForm.class.php | 102 ++++++++++ .../acp/form/LanguageServerEditForm.class.php | 100 +++++++++ files/lib/acp/page/LanguageListPage.class.php | 70 +++++++ .../acp/page/LanguageServerListPage.class.php | 58 ++++++ language/de.xml | 40 ++++ package.xml | 26 +++ usergroupoption.xml | 27 +++ 17 files changed, 1525 insertions(+) create mode 100644 .gitignore create mode 100644 acpmenu.xml create mode 100644 acptemplates/languageAdd.tpl create mode 100644 acptemplates/languageEdit.tpl create mode 100644 acptemplates/languageExport.tpl create mode 100644 acptemplates/languageList.tpl create mode 100644 acptemplates/languageServerAdd.tpl create mode 100644 acptemplates/languageServerList.tpl create mode 100644 files/lib/acp/form/LanguageAddForm.class.php create mode 100644 files/lib/acp/form/LanguageExportForm.class.php create mode 100644 files/lib/acp/form/LanguageServerAddForm.class.php create mode 100644 files/lib/acp/form/LanguageServerEditForm.class.php create mode 100644 files/lib/acp/page/LanguageListPage.class.php create mode 100644 files/lib/acp/page/LanguageServerListPage.class.php create mode 100644 language/de.xml create mode 100644 package.xml create mode 100644 usergroupoption.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..dc27165e1b --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# Linux +# backup files +*~ + +# Windows +# thumbnails +Thumbs.db + +# Mac OS X +# metadata +.DS_Store +# thumbnails +._* + +# Visual Studio PHP +*.sln +*.phpproj +*.puo +*.suo +*.cache + +# Eclipse +.settings/ +.project +.buildpath + +# Netbeans +nbproject/ +nbactions.xml + +# SVN +# svn folders +.svn/ + +# Community Framework +# Ignore packages build directly in the workspace. They can however be added manually via git add, if wanted. +*.tar +*.tar.gz diff --git a/acpmenu.xml b/acpmenu.xml new file mode 100644 index 0000000000..d4e3af27b5 --- /dev/null +++ b/acpmenu.xml @@ -0,0 +1,36 @@ + + + + + wcf.acp.menu.link.display + + + + wcf.acp.menu.link.language + index.php/LanguageList/ + admin.language.canEditLanguage,admin.language.canDeleteLanguage + + + + wcf.acp.menu.link.language + index.php/LanguageAdd/ + admin.language.canAddLanguage + + + + wcf.acp.menu.link.language + + + + index.php/LanguageServerList/ + wcf.acp.menu.link.language.server + admin.language.canEditServer,admin.language.canDeleteServer + + + + index.php/LanguageServerAdd/ + wcf.acp.menu.link.language.server + admin.language.canAddServer + + + diff --git a/acptemplates/languageAdd.tpl b/acptemplates/languageAdd.tpl new file mode 100644 index 0000000000..829e7cd224 --- /dev/null +++ b/acptemplates/languageAdd.tpl @@ -0,0 +1,122 @@ +{include file='header'} + + + +
+ +
+

{lang}wcf.acp.language.add{/lang}

+
+
+ +{if $errorField} +

{lang}wcf.global.form.error{/lang}

+{/if} + +{if $success|isset} +

{lang}wcf.global.form.add.success{/lang}

+{/if} + +
+ +
+ +
+
+
+
+
+ + +
+
+ +
+ {lang}wcf.acp.language.import.source{/lang} + + +
+
+ + {if $errorField == 'languageFile'} + + {if $errorType == 'empty'} + {lang}wcf.global.error.empty{/lang} + {else} + {lang}wcf.acp.language.import.error{/lang} {$errorType} + {/if} + + {/if} + {lang}wcf.acp.language.import.source.file.description{/lang} +
+ + + +
+
+ + {if $errorField == 'languageUpload'} + + {lang}wcf.acp.language.import.error{/lang} {$errorType} + + {/if} +
+ +
+ +
+ {lang}wcf.acp.language.add.new{/lang} + + +
+
+ + {if $errorField == 'languageCode'} + + {if $errorType == 'empty'}{lang}wcf.global.error.empty{/lang}{/if} + {if $errorType == 'notUnique'}{lang}wcf.acp.language.add.languageCode.error.notUnique{/lang}{/if} + + {/if} + {lang}wcf.acp.language.code.description{/lang} +
+ + + +
+
+ + {if $errorField == 'sourceLanguageID'} + + {if $errorType == 'empty'}{lang}wcf.global.error.empty{/lang}{/if} + + {/if} +
+ +
+ + {if $additionalFields|isset}{@$additionalFields}{/if} +
+ +
+ + + {@SID_INPUT_TAG} +
+
+ +{include file='footer'} diff --git a/acptemplates/languageEdit.tpl b/acptemplates/languageEdit.tpl new file mode 100644 index 0000000000..750fb54c94 --- /dev/null +++ b/acptemplates/languageEdit.tpl @@ -0,0 +1,191 @@ +{include file='header'} +{if $languageItems|count} + +{/if} + +
+ +
+

{lang}wcf.acp.language.edit{/lang}

+
+
+ +{if $errorField} +

{lang}wcf.global.form.error{/lang}

+{/if} + +{if $success|isset} +

{lang}wcf.acp.language.edit.success{/lang}

+{/if} + +
+ +
+
+
+
+
+

+ {lang}wcf.global.language.{@$language->languageCode}{/lang} ({@$language->languageCode}) + +

+
+ +
+
+ +
+
+ + {if $errorField == 'languageCategoryID'} +

+ {if $errorType == 'empty'}{lang}wcf.global.error.empty{/lang}{/if} +

+ {/if} +
+
+ +
+
+ +
+
+
+ + + + {@SID_INPUT_TAG} +
+
+ +{if $languageItems|count} +
+
+
+
+ {lang}wcf.acp.language.variable.quicksearch{/lang} +
+
+ +
+
+
+ + {foreach from=$languageItems item=category} +
+
+

{$category.category}

+ {foreach from=$category.items key=$languageItem item=languageItemValue} + + +
+ + {if $__wcf->getSession()->getPermission('admin.language.canDeleteLanguage')}{/if} + + + +
+
+ +
+
+ +
+
+
+
+ +
+
+ + +
+
+
+ + {if $languageItemID == $languageItemIDs.$languageItem} + + {/if} + {/foreach} +
+
+ {/foreach} + + {if $additionalFields|isset}{@$additionalFields}{/if} + +
+ + + {@SID_INPUT_TAG} + + + +
+
+{/if} + +{include file='footer'} diff --git a/acptemplates/languageExport.tpl b/acptemplates/languageExport.tpl new file mode 100644 index 0000000000..b06bce323a --- /dev/null +++ b/acptemplates/languageExport.tpl @@ -0,0 +1,64 @@ +{include file='header'} + +
+ +
+

{lang}wcf.acp.language.export{/lang}

+
+
+ +{if $errorField} +

{lang}wcf.global.form.error{/lang}

+{/if} + +{if $success|isset} +

{lang}wcf.acp.language.add.success{/lang}

+{/if} + +
+ +
+ +
+
+
+
+
+ {htmloptions options=$languages selected=$languageID name='languageID' id='languageID'} +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+ + + {@SID_INPUT_TAG} +
+
+ +{include file='footer'} \ No newline at end of file diff --git a/acptemplates/languageList.tpl b/acptemplates/languageList.tpl new file mode 100644 index 0000000000..4ab6030189 --- /dev/null +++ b/acptemplates/languageList.tpl @@ -0,0 +1,136 @@ +{include file='header'} + + + +
+ +
+

{lang}wcf.acp.language.list{/lang}

+
+
+ +
+ {pages print=true assign=pagesLinks controller='LanguageList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"} + + {if $__wcf->getSession()->getPermission('admin.language.canAddLanguage')} + + {/if} +
+ +{if $objects|count} +
+
+

{lang}wcf.acp.language.list{/lang} {#$items}

+
+ + + + + + + + + + + + + + {foreach from=$objects item=language} + + + + + + + + + {/foreach} + +
{lang}wcf.global.objectID{/lang}{if $sortField == 'languageID'} {/if}{lang}wcf.acp.language.name{/lang}{if $sortField == 'languageName'} {/if}{lang}wcf.acp.language.users{/lang}{if $sortField == 'users'} {/if}{lang}wcf.acp.language.variables{/lang}{if $sortField == 'variables'} {/if}{lang}wcf.acp.language.customVariables{/lang}{if $sortField == 'customVariables'} {/if}
+ {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')} + + {else} + + {/if} + + {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')} + {if !$language->isDefault} + + {else} + + {/if} + {else} + + {/if} + + {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')} + + {else} + + {/if} + {if $__wcf->getSession()->getPermission('admin.language.canDeleteLanguage')} + {if !$language->isDefault} + + {else} + + {/if} + {else} + + {/if} + {@$language->languageID} + {if $__wcf->getSession()->getPermission('admin.language.canEditLanguage')} + {$language->languageName} ({@$language->languageCode}) + {else} + {$language->languageName} ({@$language->languageCode}) + {/if} + {#$language->users}{#$language->variables}{if $language->customVariables > 0 && $__wcf->getSession()->getPermission('admin.language.canEditLanguage')}{#$language->customVariables}{else}{#$language->customVariables}{/if}
+
+ +
+ {@$pagesLinks} + + {if $__wcf->getSession()->getPermission('admin.language.canAddLanguage')} + + {/if} +
+{/if} + +{include file='footer'} diff --git a/acptemplates/languageServerAdd.tpl b/acptemplates/languageServerAdd.tpl new file mode 100644 index 0000000000..92f74a334f --- /dev/null +++ b/acptemplates/languageServerAdd.tpl @@ -0,0 +1,55 @@ +{include file='header'} + +
+ +
+

{lang}wcf.acp.languageServer.{$action}{/lang}

+
+
+ +{if $errorField} +

{lang}wcf.global.form.error{/lang}

+{/if} + +{if $success|isset} +

{lang}wcf.acp.languageServer.{$action}.success{/lang}

+{/if} + +
+ +
+ +
+
+
+ {lang}wcf.acp.languageServer.data{/lang} + + +
+
+ + {if $errorField == 'server'} + + {if $errorType == 'empty'}{lang}wcf.global.error.empty{/lang}{/if} + {if $errorType == 'notValid'}{lang}wcf.acp.languageServer.server.error.notValid{/lang}{/if} + + {/if} + {lang}wcf.acp.languageServer.server.description{/lang} +
+ + +
+
+ +
+ + + {@SID_INPUT_TAG} +
+
+ +{include file='footer'} diff --git a/acptemplates/languageServerList.tpl b/acptemplates/languageServerList.tpl new file mode 100644 index 0000000000..8079922892 --- /dev/null +++ b/acptemplates/languageServerList.tpl @@ -0,0 +1,99 @@ +{include file='header'} + + + +
+ +
+

{lang}wcf.acp.languageServer.list{/lang}

+
+
+ +
+ {pages print=true assign=pagesLinks controller='LanguageServerList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"} + + {if $__wcf->getSession()->getPermission('admin.language.canAddServer')} + + {/if} +
+ +{if !$languageServers|count} +
+
+

{lang}wcf.acp.languageServer.view.noneAvailable{/lang}

+
+
+{else} +
+
+

{lang}wcf.acp.languageServer.list{/lang} {#$items}

+
+ + + + + + + + + + {foreach from=$languageServers item=languageServer} + + + + + + {/foreach} + +
{lang}wcf.global.objectID{/lang}{if $sortField == 'languageServerID'} {/if}{lang}wcf.acp.languageServer.serverURL{/lang}{if $sortField == 'serverURL'} {/if}
+ {if $__wcf->getSession()->getPermission('admin.language.canEditServer')} + + + {else} + + + {/if} + + {if $__wcf->getSession()->getPermission('admin.language.canDeleteServer')} + + {else} + + {/if} + {@$languageServer->languageServerID} + {if $__wcf->getSession()->getPermission('admin.language.canEditServer')} + {@$languageServer->serverURL} + {else} + {@$languageServer->serverURL} + {/if} +
+
+ +
+ {@$pagesLinks} + + {if $__wcf->getSession()->getPermission('admin.language.canAddServer')} + + {/if} +
+{/if} + +{include file='footer'} diff --git a/files/lib/acp/form/LanguageAddForm.class.php b/files/lib/acp/form/LanguageAddForm.class.php new file mode 100644 index 0000000000..e911b8671d --- /dev/null +++ b/files/lib/acp/form/LanguageAddForm.class.php @@ -0,0 +1,192 @@ + + * @package com.woltlab.wcf.acp.language + * @subpackage acp.form + * @category Community Framework + */ +class LanguageAddForm extends ACPForm { + /** + * @see wcf\acp\form\ACPForm::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.language.add'; + + /** + * @see wcf\page\AbstractPage::$neededPermissions + */ + public $neededPermissions = array('admin.language.canAddLanguage'); + + public $mode = 'import'; + public $languageFile = ''; + public $languageCode = ''; + public $sourceLanguageID = 0; + public $filename = ''; + public $sourceLanguage, $language; + public $importField = 'languageFile'; + public $languages = array(); + + /** + * @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); + } + + // add language to this package + $sql = "SELECT COUNT(*) AS count + FROM wcf".WCF_N."_language_to_package + WHERE languageID = ? + AND packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + $this->language->languageID, + PACKAGE_ID + )); + + $row = $statement->fetchArray(); + if (!$row['count']) { + $sql = "INSERT INTO wcf".WCF_N."_language_to_package + (languageID, packageID) + VALUES (?, ?)"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + $this->language->languageID, + PACKAGE_ID + )); + } + + LanguageFactory::getInstance()->clearCache(); + + $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/files/lib/acp/form/LanguageExportForm.class.php b/files/lib/acp/form/LanguageExportForm.class.php new file mode 100644 index 0000000000..dc2845645b --- /dev/null +++ b/files/lib/acp/form/LanguageExportForm.class.php @@ -0,0 +1,169 @@ + + * @package com.woltlab.wcf.acp.language + * @subpackage acp.form + * @category Community Framework + */ +class LanguageExportForm extends ACPForm { + /** + * @see wcf\page\AbstractPage::$templateName + */ + public $templateName = 'languageExport'; + + /** + * @see wcf\acp\form\ACPForm::$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 + */ + public $selectedPackages = array(); + + /** + * available packages + * @var array + */ + public $packages = array(); + + /** + * true to export custom variables + * @var boolean + */ + public $exportCustomValues = false; + + /** + * maximum package name length + * TODO: still necessary? + * @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 package.*, + CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName + FROM wcf".WCF_N."_package_dependency package_dependency + LEFT JOIN wcf".WCF_N."_language_to_package language_to_package + ON (language_to_package.languageID = ? AND language_to_package.packageID = package_dependency.dependency) + LEFT JOIN wcf".WCF_N."_package package + ON (package.packageID = package_dependency.dependency) + WHERE package_dependency.packageID = ".PACKAGE_ID." + AND language_to_package.languageID IS NOT NULL + ORDER BY packageName"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($this->languageID)); + while ($row = $statement->fetchArray()) { + $row['packageNameLength'] = StringUtil::length($row['packageName']); + $this->packages[] = new Package(null, $row); + if ($row['packageNameLength'] > $this->packageNameLength) { + $this->packageNameLength = $row['packageNameLength']; + } + } + } +} diff --git a/files/lib/acp/form/LanguageServerAddForm.class.php b/files/lib/acp/form/LanguageServerAddForm.class.php new file mode 100644 index 0000000000..6ed524522a --- /dev/null +++ b/files/lib/acp/form/LanguageServerAddForm.class.php @@ -0,0 +1,102 @@ + + * @package com.woltlab.wcf + * @subpackage acp.form + * @category Community Framework + */ +class LanguageServerAddForm extends ACPForm { + /** + * @see wcf\acp\form\ACPForm::$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 + $languageServerAction = new LanguageServerAction(array(), 'create', array('data' => array( + 'serverURL' => $this->server + ))); + $languageServerAction->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/files/lib/acp/form/LanguageServerEditForm.class.php b/files/lib/acp/form/LanguageServerEditForm.class.php new file mode 100644 index 0000000000..c00819e9a2 --- /dev/null +++ b/files/lib/acp/form/LanguageServerEditForm.class.php @@ -0,0 +1,100 @@ + + * @package com.woltlab.wcf + * @subpackage acp.form + * @category Community Framework + */ +class LanguageServerEditForm extends LanguageServerAddForm { + /** + * @see wcf\page\AbstractPage::$templateName + */ + public $templateName = 'languageServerAdd'; + + /** + * @see wcf\acp\form\ACPForm::$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 + $languageServerAction = new LanguageServerAction(array($this->languageServerID), 'update', array('data' => array( + 'serverURL' => $this->server + ))); + $languageServerAction->executeAction(); + $this->saved(); + + // show success message + WCF::getTPL()->assign('success', true); + } + + /** + * @see wcf\page\IPage::readData() + */ + public function readData() { + parent::readData(); + + if (!count($_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/files/lib/acp/page/LanguageListPage.class.php b/files/lib/acp/page/LanguageListPage.class.php new file mode 100644 index 0000000000..45b9a77929 --- /dev/null +++ b/files/lib/acp/page/LanguageListPage.class.php @@ -0,0 +1,70 @@ + + * @package com.woltlab.wcf.acp.language + * @subpackage acp.page + * @category Community Framework + */ +class LanguageListPage extends SortablePage { + /** + * @see wcf\page\AbstractPage::$neededPermissions + */ + public $neededPermissions = array('admin.language.canEditLanguage', 'admin.language.canDeleteLanguage'); + + /** + * @see wcf\page\SortablePage::$defaultSortField + */ + public $defaultSortField = 'languageName'; + + /** + * @see wcf\page\SortablePage::$validSortFields + */ + public $validSortFields = array('languageID', 'languageCode', 'languageName', 'users', 'variables', 'customVariables'); + + /** + * @see wcf\page\MultipleLinkPage::$objectListClassName + */ + public $objectListClassName = 'wcf\data\language\LanguageList'; + + /** + * @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() + )); + } + + /** + * @see wcf\page\IPage::show() + */ + public function show() { + // set active menu item + ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.language.list'); + + parent::show(); + } +} diff --git a/files/lib/acp/page/LanguageServerListPage.class.php b/files/lib/acp/page/LanguageServerListPage.class.php new file mode 100644 index 0000000000..64b4728004 --- /dev/null +++ b/files/lib/acp/page/LanguageServerListPage.class.php @@ -0,0 +1,58 @@ + + * @package com.woltlab.wcf + * @subpackage acp.page + * @category Community Framework + */ +class LanguageServerListPage extends SortablePage { + /** + * @see wcf\page\AbstractPage::$neededPermissions + */ + public $neededPermissions = array('admin.language.canEditServer', 'admin.language.canDeleteServer'); + + /** + * @see wcf\page\SortablePage::$defaultSortField + */ + public $defaultSortField = 'serverURL'; + + /** + * @see wcf\page\SortablePage::$validSortFields + */ + public $validSortFields = array('languageServerID', 'serverURL'); + + /** + * @see wcf\page\MultipleLinkPage::$objectListClassName + */ + public $objectListClassName = 'wcf\data\language\server\LanguageServerList'; + + /** + * @see wcf\page\IPage::assignVariables() + */ + public function assignVariables() { + parent::assignVariables(); + + WCF::getTPL()->assign(array( + 'languageServers' => $this->objectList->getObjects() + )); + } + + /** + * @see wcf\page\IPage::show() + */ + public function show() { + // enable menu item + ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.language.server.list'); + + parent::show(); + } +} diff --git a/language/de.xml b/language/de.xml new file mode 100644 index 0000000000..08eaf3bc6c --- /dev/null +++ b/language/de.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ISO 639-1 an. Weitere Informationen zu Sprachcodes finden Sie unter http://de.wikipedia.org/wiki/ISO_639-1.]]> + languageName}« wirklich löschen?]]> + + + + + + + + + + \ No newline at end of file diff --git a/package.xml b/package.xml new file mode 100644 index 0000000000..59d48c8c05 --- /dev/null +++ b/package.xml @@ -0,0 +1,26 @@ + + + + Language Administration + Comprehensive language manager + 1.0.0 Alpha 1 + 2011-06-30 + + + + WoltLab GmbH + http://www.woltlab.com + + + + com.woltlab.wcf + + + + acpmenu.xml + acptemplates.tar + files.tar + usergroupoption.xml + language/*.xml + + diff --git a/usergroupoption.xml b/usergroupoption.xml new file mode 100644 index 0000000000..16f85e2261 --- /dev/null +++ b/usergroupoption.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + -- 2.20.1