}
});
-/**
- * Handles the preview image upload.
- *
- * @param integer styleID
- * @param string tmpHash
- * @deprecated use WoltLabSuite/Core/Acp/Ui/Style/Image/Upload
- */
-WCF.ACP.Style.ImageUpload = WCF.Upload.extend({
- /**
- * upload button
- * @var jQuery
- */
- _button: null,
-
- /**
- * preview image
- * @var jQuery
- */
- _image: null,
-
- /**
- * style id
- * @var integer
- */
- _styleID: 0,
-
- /**
- * tmp hash
- * @var string
- */
- _tmpHash: '',
-
- /**
- * @see WCF.Upload.init()
- */
- init: function(styleID, tmpHash) {
- this._styleID = parseInt(styleID) || 0;
- this._tmpHash = tmpHash;
-
- this._button = $('#uploadImage');
- this._image = $('#styleImage');
-
- this._super(this._button, undefined, 'wcf\\data\\style\\StyleAction');
- },
-
- /**
- * @see WCF.Upload._initFile()
- */
- _initFile: function(file) {
- return this._image;
- },
-
- /**
- * @see WCF.Upload._getParameters()
- */
- _getParameters: function() {
- return {
- styleID: this._styleID,
- tmpHash: this._tmpHash
- };
- },
-
- /**
- * @see WCF.Upload._success()
- */
- _success: function(uploadID, data) {
- if (data.returnValues.url) {
- // show image
- this._image.attr('src', data.returnValues.url + '?timestamp=' + Date.now());
-
- // hide error
- this._button.next('.innerError').remove();
-
- // show success message
- var $notification = new WCF.System.Notification(WCF.Language.get('wcf.global.success'));
- $notification.show();
- }
- else if (data.returnValues.errorType) {
- // show error
- this._getInnerErrorElement().text(WCF.Language.get('wcf.acp.style.image.error.' + data.returnValues.errorType));
- }
- },
-
- /**
- * Returns error display element.
- *
- * @return jQuery
- */
- _getInnerErrorElement: function() {
- var $span = this._button.next('.innerError');
- if (!$span.length) {
- $span = $('<small class="innerError" />').insertAfter(this._button);
- }
-
- return $span;
- }
-});
-
/**
* Handles style list management buttons.
*/