diff --git a/protected/humhub/modules/file/resources/js/humhub.file.js b/protected/humhub/modules/file/resources/js/humhub.file.js
index 360133a1bd..683428c8c7 100644
--- a/protected/humhub/modules/file/resources/js/humhub.file.js
+++ b/protected/humhub/modules/file/resources/js/humhub.file.js
@@ -109,8 +109,14 @@ humhub.module('file', function(module, require, $) {
};
Upload.prototype.initPreview = function() {
- this.preview = Preview.instance(this.$.data('upload-preview'));
- this.preview.source = this;
+ if(this.$.data('upload-preview')) {
+ this.preview = Preview.instance(this.$.data('upload-preview'));
+ if(this.preview.setSource) {
+ this.preview.setSource(this);
+ } else {
+ this.preview.source;
+ }
+ }
};
Upload.prototype.initProgress = function() {
@@ -128,6 +134,7 @@ humhub.module('file', function(module, require, $) {
start: this.options.start,
progressall: this.options.progressall,
done: this.options.done,
+ error: this.options.error,
stop: this.options.stop
};
@@ -135,11 +142,16 @@ humhub.module('file', function(module, require, $) {
start: $.proxy(this.start, this),
progressall: $.proxy(this.updateProgress, this),
done: $.proxy(this.done, this),
+ error: $.proxy(this.error, this),
stop: $.proxy(this.finish, this)
});
this.$.fileupload(this.options);
};
+
+ Upload.prototype.error = function(e) {
+ module.log.error(e, true);
+ };
Upload.prototype.start = function(e, data) {
if(this.progress) {
@@ -161,15 +173,17 @@ humhub.module('file', function(module, require, $) {
}
};
- Upload.prototype.done = function(e, data) {
+ Upload.prototype.done = function(e, response) {
var that = this;
- $.each(data.result.files, function(index, file) {
+ $.each(response.result.files, function(index, file) {
that.handleFileResponse(file);
});
-
+
if(this.callbacks.done) {
- this.callbacks.done(e, data);
+ this.callbacks.done(e, response);
}
+
+ this.fire('humhub:file:upload', [response]);
};
Upload.prototype.handleFileResponse = function(file) {
diff --git a/protected/humhub/modules/file/widgets/UploadButton.php b/protected/humhub/modules/file/widgets/UploadButton.php
index faa21939f4..2a4055fd7d 100644
--- a/protected/humhub/modules/file/widgets/UploadButton.php
+++ b/protected/humhub/modules/file/widgets/UploadButton.php
@@ -12,18 +12,34 @@ use Yii;
*/
class UploadButton extends UploadInput
{
+ /**
+ * Additional button html options.
+ * @var array
+ */
public $buttonOptions = [];
+ /**
+ * Show button tooltip on mousover.
+ * @var boolean
+ */
+ public $tooltip = true;
+
+ /**
+ * Tooltip position.
+ * @var string
+ */
+ public $tooltipPosition = 'bottom';
+
/**
* Draws the Upload Button output.
*/
public function run()
{
$defaultButtonOptions = [
- 'class' => 'btn btn-default fileinput-button tt',
+ 'class' => ($this->tooltip) ? 'btn btn-default fileinput-button tt' : 'btn btn-default fileinput-button',
'title' => Yii::t('FileModule.widgets_views_fileUploadButton', 'Upload files'),
'data' => [
- 'placement' => "bottom",
+ 'placement' => $this->tooltipPosition,
'action-click' => "file.upload",
'action-target' => '#'.$this->id
]
@@ -36,7 +52,4 @@ class UploadButton extends UploadInput
'options' => $options
]);
}
-
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/protected/humhub/modules/space/controllers/SpaceController.php b/protected/humhub/modules/space/controllers/SpaceController.php
index 2d7ac8397b..ba4b014b31 100644
--- a/protected/humhub/modules/space/controllers/SpaceController.php
+++ b/protected/humhub/modules/space/controllers/SpaceController.php
@@ -157,7 +157,7 @@ class SpaceController extends \humhub\modules\content\components\ContentContaine
$title = Yii::t('SpaceModule.base', 'Space followers');
return $this->renderAjaxContent(UserListBox::widget(['query' => $query, 'title' => $title]));
}
-
+
}
?>
diff --git a/protected/humhub/widgets/CoreJsConfig.php b/protected/humhub/widgets/CoreJsConfig.php
index 0c7a35aa64..b09023486c 100644
--- a/protected/humhub/widgets/CoreJsConfig.php
+++ b/protected/humhub/widgets/CoreJsConfig.php
@@ -56,7 +56,7 @@ class CoreJsConfig extends Widget
],
'text' => [
'error.upload' => Yii::t('base', 'Some files could not be uploaded:'),
- 'success.delete' => Yii::t('base', 'The file has been deleted.'),
+ 'success.delete' => Yii::t('base', 'The file has been deleted.')
]
],
'action' => [
@@ -73,6 +73,8 @@ class CoreJsConfig extends Widget
'ui.widget' => [
'text' => [
'error.unknown' => Yii::t('base', 'No error information given.'),
+ 'info.title' => Yii::t('base', 'Info:'),
+ 'error.title' => Yii::t('base', 'Error:')
]
],
'ui.richtext' => [
diff --git a/static/js/humhub/humhub.ui.widget.js b/static/js/humhub/humhub.ui.widget.js
index 1aacd7e041..7408450e2b 100644
--- a/static/js/humhub/humhub.ui.widget.js
+++ b/static/js/humhub/humhub.ui.widget.js
@@ -136,7 +136,7 @@ humhub.module('ui.widget', function(module, require, $) {
};
Widget.prototype.statusError = function(title) {
- var msg = title || 'Error:';
+ var msg = title || module.text('error.title');;
msg += '