'wcf.style.colorPicker.new': '{lang}wcf.style.colorPicker.new{/lang}',
'wcf.style.colorPicker.current': '{lang}wcf.style.colorPicker.current{/lang}'
});
- new WCF.ACP.Style.ImageUpload(0, '{$tmpHash}');
+ new WCF.ACP.Style.ImageUpload({if $action == 'add'}0{else}{@$style->styleID}{/if}, '{$tmpHash}');
{if $action == 'edit'}
new WCF.ACP.Style.CopyStyle({@$style->styleID});
throw new PermissionDeniedException();
}
- if (!isset($this->parameters['tmpHash']) || empty($this->parameters['tmpHash'])) {
- throw new UserInputException('tmpHash');
+ $this->readString('tmpHash');
+ $this->readString('styleID', true);
+
+ if ($this->parameters['styleID']) {
+ $styles = StyleHandler::getInstance()->getStyles();
+ if (!isset($styles[$this->parameters['styleID']])) {
+ throw new UserInputException('styleID');
+ }
+
+ $this->style = $styles[$this->parameters['styleID']];
}
if (count($this->parameters['__files']->getFiles()) != 1) {
// store extension within session variables
WCF::getSession()->register('stylePreview-'.$this->parameters['tmpHash'], $file->getFileExtension());
+ if ($this->parameters['styleID']) {
+ $this->updateStylePreviewImage($this->style);
+
+ return array(
+ 'url' => WCF::getPath().'images/stylePreview-'.$this->parameters['styleID'].'.'.$file->getFileExtension()
+ );
+ }
+
// return result
return array(
- 'errorType' => '',
'url' => WCF::getPath().'images/stylePreview-'.$this->parameters['tmpHash'].'.'.$file->getFileExtension()
);
}