<dt><label for="smileyTitle">{lang}wcf.acp.smiley.title{/lang}</label></dt>
<dd>
<input type="text" id="smileyTitle" name="smileyTitle" value="{$smileyTitle}" autofocus="autofocus" class="long" />
+
{if $errorField == 'smileyTitle'}
<small class="innerError">
{if $errorType == 'empty'}
<dt><label for="smileyCode">{lang}wcf.acp.smiley.smileyCode{/lang}</label></dt>
<dd>
<input type="text" id="smileyCode" name="smileyCode" value="{$smileyCode}" required="required" class="medium" />
+
{if $errorField == 'smileyCode'}
<small class="innerError">
{if $errorType == 'empty'}
</dd>
</dl>
+ <dl{if $errorField == 'smileyPath'} class="formError"{/if}>
+ <dt><label for="smileyPath">{lang}wcf.acp.smiley.smileyPath{/lang}</label></dt>
+ <dd>
+ <input type="text" id="smileyPath" name="smileyPath" value="{$smileyPath}" required="required" class="long" />
+
+ {if $errorField == 'smileyPath'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.smiley.smileyPath.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ <small>{lang}wcf.acp.smiley.smileyPath.description{/lang}</small>
+ </dd>
+ </dl>
+
<dl{if $errorField == 'showOrder'} class="formError"{/if}>
<dt><label for="showOrder">{lang}wcf.acp.smiley.showOrder{/lang}</label></dt>
<dd>
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
use wcf\system\WCF;
+use wcf\util\FileUtil;
use wcf\util\StringUtil;
/**
*/
public $aliases = '';
+ /**
+ * smileyPath
+ * @var string
+ */
+ public $smileyPath = '';
+
/**
* node tree with available smiley categories
* @var wcf\data\category\CategoryNodeTree
'categoryID' => $this->categoryID,
'smileyCode' => $this->smileyCode,
'aliases' => $this->aliases,
+ 'smileyPath' => $this->smileyPath,
'categoryNodeList' => $this->categoryNodeTree->getIterator()
));
}
if (I18nHandler::getInstance()->isPlainValue('smileyTitle')) $this->smileyTitle = I18nHandler::getInstance()->getValue('smileyTitle');
- if (isset($_POST['showOrder'])) {
- $this->showOrder = intval($_POST['showOrder']);
- }
- if (isset($_POST['smileyCode'])) {
- $this->smileyCode = StringUtil::trim($_POST['smileyCode']);
- }
- if (isset($_POST['categoryID'])) {
- $this->categoryID = intval($_POST['categoryID']);
- }
- if (isset($_POST['aliases'])) {
- $this->aliases = StringUtil::unifyNewlines(StringUtil::trim($_POST['aliases']));
- }
+ if (isset($_POST['showOrder'])) $this->showOrder = intval($_POST['showOrder']);
+ if (isset($_POST['categoryID'])) $this->categoryID = intval($_POST['categoryID']);
+ if (isset($_POST['smileyCode'])) $this->smileyCode = StringUtil::trim($_POST['smileyCode']);
+ if (isset($_POST['aliases'])) $this->aliases = StringUtil::unifyNewlines(StringUtil::trim($_POST['aliases']));
+ if (isset($_POST['smileyPath'])) $this->smileyPath = FileUtil::removeLeadingSlash(StringUtil::trim($_POST['smileyPath']));
}
/**
'data' => array(
'smileyTitle' => $this->smileyTitle,
'smileyCode' => $this->smileyCode,
+ 'aliases' => $this->aliases,
+ 'smileyPath' => $this->smileyPath,
'showOrder' => $this->showOrder,
'categoryID' => $this->categoryID ?: null,
- 'packageID' => 1,
- 'aliases' => $this->aliases
+ 'packageID' => 1
)
));
$this->objectAction->executeAction();
throw new UserInputException('smileyCode');
}
+ if (empty($this->smileyPath)) {
+ throw new UserInputException('smileyPath');
+ }
+
+ if (!file_exists(WCF_DIR.$this->smileyPath)) {
+ throw new UserInputException('smileyPath', 'notFound');
+ }
+
// validate smiley code and aliases against existing smilies
$conditionBuilder = new PreparedStatementConditionBuilder();
if (isset($this->smiley)) {
$this->objectAction = new SmileyAction(array($this->smileyID), 'update', array('data' => array(
'smileyTitle' => $this->smileyTitle,
'smileyCode' => $this->smileyCode,
+ 'aliases' => $this->aliases,
+ 'smileyPath' => $this->smileyPath,
'showOrder' => $this->showOrder,
- 'categoryID' => $this->categoryID ?: null,
- 'aliases' => $this->aliases
+ 'categoryID' => $this->categoryID ?: null
)));
$this->objectAction->executeAction();
$this->smileyCode = $this->smiley->smileyCode;
$this->aliases = $this->smiley->aliases;
+ $this->smileyPath = $this->smiley->smileyPath;
$this->showOrder = $this->smiley->showOrder;
$this->categoryID = $this->smiley->categoryID;
}
<item name="wcf.acp.smiley.category.list"><![CDATA[Smiley-Kategorien]]></item>
<item name="wcf.acp.smiley.categoryID"><![CDATA[Kategorie]]></item>
<item name="wcf.acp.smiley.categoryID.default"><![CDATA[Standard-Kategorie]]></item>
- <item name="wcf.acp.smiley.categoryID.error.notValid"><![CDATA[Die gewählte Kategorie ist nicht gültig.]]></item>
+ <item name="wcf.acp.smiley.categoryID.error.notValid"><![CDATA[Die gewählte Kategorie ist nicht gültig]]></item>
<item name="wcf.acp.smiley.smileyCode"><![CDATA[Primärer Smiley-Code]]></item>
<item name="wcf.acp.smiley.smileyCode.error.notUnique"><![CDATA[Dieser Smiley-Code wird bereits von einem anderen Smiley verwendet]]></item>
<item name="wcf.acp.smiley.aliases"><![CDATA[Alternative Smiley-Codes]]></item>
<item name="wcf.acp.smiley.aliases.error.notUnique"><![CDATA[Mindestens ein alternativer Smiley-Code wird bereits von einem anderen Smiley verwendet]]></item>
+ <item name="wcf.acp.smiley.smileyPath"><![CDATA[Smiley-Pfad]]></item>
+ <item name="wcf.acp.smiley.smileyPath.description"><![CDATA[Der Smiley-Pfad wird relativ zu „{$__wcf->getPath()}“ interpretiert.]]></item>
+ <item name="wcf.acp.smiley.smileyPath.error.notFound"><![CDATA[Es wurde keine Datei unter dem angegebenen Pfad gefunden]]></item>
<item name="wcf.acp.smiley.showOrder"><![CDATA[Position]]></item>
</category>
<item name="wcf.acp.smiley.category.list"><![CDATA[Smiley Categories]]></item>
<item name="wcf.acp.smiley.categoryID"><![CDATA[Category]]></item>
<item name="wcf.acp.smiley.categoryID.default"><![CDATA[Default Category]]></item>
- <item name="wcf.acp.smiley.categoryID.error.notValid"><![CDATA[Chosen category is invalid.]]></item>
+ <item name="wcf.acp.smiley.categoryID.error.notValid"><![CDATA[Chosen category is invalid]]></item>
<item name="wcf.acp.smiley.smileyCode"><![CDATA[Primary Smiley Code]]></item>
<item name="wcf.acp.smiley.smileyCode.error.notUnique"><![CDATA[This smiley code is already in use by an other smiley]]></item>
<item name="wcf.acp.smiley.aliases"><![CDATA[Alternative Smiley Codes]]></item>
<item name="wcf.acp.smiley.aliases.error.notUnique"><![CDATA[At least one alternative smiley code is already in use by an other smiley]]></item>
+ <item name="wcf.acp.smiley.smileyPath"><![CDATA[Smiley Path]]></item>
+ <item name="wcf.acp.smiley.smileyPath.description"><![CDATA[TODO: Der Smiley-Pfad wird relativ zu „{$__wcf->getPath()}“ interpretiert.]]></item>
+ <item name="wcf.acp.smiley.smileyPath.error.notFound"><![CDATA[TODO: Es wurde keine Datei unter dem angegebenen Pfad gefunden]]></item>
<item name="wcf.acp.smiley.showOrder"><![CDATA[Show Order]]></item>
</category>