');
+ $caption = $doc->createElement('figcaption');
+ $img->after($caption);
+
+ $title = $img->getAttribute('title');
+ if ($title) {
+ $span = $doc->createElement('span', $title);
+ $span->addClass('title');
+ $caption->append($span);
+ }
+
+ $attribution = $img->getAttribute('data-attribution');
+ if ($attribution) {
+ $small = $doc->createElement('small', $attribution);
+ $small->addClass('attribution');
+ $caption->append($small);
+ }
+ }
+
/*
Function: versionSelector
generate html select element with available revisions for given page
diff --git a/system/wymeditor/lang/en.js b/system/wymeditor/lang/en.js
index 8d514c2b..890e136a 100644
--- a/system/wymeditor/lang/en.js
+++ b/system/wymeditor/lang/en.js
@@ -28,6 +28,8 @@ WYMeditor.STRINGS.en = {
Title: 'Title',
Relationship: 'Relationship',
Alternative_Text: 'Alternative text',
+ Attribution: 'Attribution',
+ Attribution_placeholder: 'license: author (date)',
Caption: 'Caption',
Summary: 'Summary',
Number_Of_Rows: 'Number of rows',
diff --git a/system/wymeditor/lang/nl.js b/system/wymeditor/lang/nl.js
index 834fea38..c4529de1 100644
--- a/system/wymeditor/lang/nl.js
+++ b/system/wymeditor/lang/nl.js
@@ -28,6 +28,8 @@ WYMeditor.STRINGS.nl = {
Title: 'Titel',
Relationship: 'Relatie',
Alternative_Text: 'Alternatieve tekst',
+ Attribution: 'Bijdrage',
+ Attribution_placeholder: 'licentie: auteur (datum)',
Caption: 'Bijschrift',
Summary: 'Summary',
Number_Of_Rows: 'Aantal rijen',
@@ -53,4 +55,4 @@ WYMeditor.STRINGS.nl = {
File: 'File',
Preset: 'Preset',
-};
\ No newline at end of file
+};
diff --git a/system/wymeditor/plugins/image_upload/jquery.wymeditor.image_upload.js b/system/wymeditor/plugins/image_upload/jquery.wymeditor.image_upload.js
index 9d974166..2e60b2c6 100644
--- a/system/wymeditor/plugins/image_upload/jquery.wymeditor.image_upload.js
+++ b/system/wymeditor/plugins/image_upload/jquery.wymeditor.image_upload.js
@@ -14,6 +14,10 @@
WYMeditor.editor.prototype.image_upload = function() {
var wym = this;
var uploadUrl = wym._options.dialogImageUploadUrl;
+
+ wym._options.attributionImgAttribute = 'data-attribution';
+ wym._options.attributionSelector = '.wym_attribution';
+
// Check the options
if (uploadUrl == undefined) {
WYMeditor.console.warn(
@@ -27,7 +31,12 @@ WYMeditor.editor.prototype.image_upload = function() {
var orig = d.initialize;
d.initialize = function(wDialog) {
orig.call(this, wDialog);
- var doc = wDialog.document;
+ var wym = this,
+ doc = wDialog.document,
+ options = wym._options,
+ selectedImage = wym.getSelectedImage();
+
+ jQuery(options.attributionSelector, doc).val(jQuery(selectedImage).attr(options.attributionImgAttribute));
var oldSubmitLabel = jQuery("form#image_upload_form .submit", doc).val();
// WYMEditor automatically locks onto any form here, so remove the binding.
@@ -43,14 +52,39 @@ WYMeditor.editor.prototype.image_upload = function() {
if (response.error){
alert(response.error);
} else {
- jQuery(".wym_src", doc).val(response.thumbUrl);
- jQuery(".wym_alt", doc).val(response.original_filename);
+ jQuery(options.srcSelector, doc).val(response.thumbUrl);
+ jQuery(options.altSelector, doc).val(response.original_filename);
+ jQuery(options.attributionSelector, doc).val(response.attribution);
}
jQuery("form#image_upload_form .submit", doc).val(oldSubmitLabel);
}
})
};
+ d.submitHandler = function (wDialog) {
+ var wym = this,
+ options = wym._options,
+ imgAttrs,
+ selectedImage = wym.getSelectedImage();
+
+ imgAttrs = {
+ src: jQuery(options.srcSelector, wDialog.document).val(),
+ title: jQuery(options.titleSelector, wDialog.document).val(),
+ alt: jQuery(options.altSelector, wDialog.document).val(),
+ };
+ imgAttrs[options.attributionImgAttribute] = jQuery(options.attributionSelector, wDialog.document).val();
+
+ wym.focusOnDocument();
+
+ if (selectedImage) {
+ wym._updateImageAttrs(selectedImage, imgAttrs);
+ wym.registerModification();
+ } else {
+ wym.insertImage(imgAttrs);
+ }
+ wDialog.close();
+ }
+
// Put together the whole dialog script
wym._options.dialogImageHtml = String() +
'' +
@@ -93,6 +127,10 @@ WYMeditor.editor.prototype.image_upload = function() {
'' +
'' +
'' +
+ '' +
+ '' +
+ '' +
+ '
' +
'' +
'' +
'' +