Skip to content

Commit a2493a2

Browse files
wymeditor: Adds attribution to image dialog
Fixes #119
1 parent 3e65fa2 commit a2493a2

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

system/wymeditor/lang/en.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ WYMeditor.STRINGS.en = {
2828
Title: 'Title',
2929
Relationship: 'Relationship',
3030
Alternative_Text: 'Alternative text',
31+
Attribution: 'Attribution',
32+
Attribution_placeholder: 'cc: author (date)',
3133
Caption: 'Caption',
3234
Summary: 'Summary',
3335
Number_Of_Rows: 'Number of rows',

system/wymeditor/lang/nl.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ WYMeditor.STRINGS.nl = {
2828
Title: 'Titel',
2929
Relationship: 'Relatie',
3030
Alternative_Text: 'Alternatieve tekst',
31+
Attribution: 'Bijdrage',
32+
Attribution_placeholder: 'cc: auteur (datum)',
3133
Caption: 'Bijschrift',
3234
Summary: 'Summary',
3335
Number_Of_Rows: 'Aantal rijen',
@@ -53,4 +55,4 @@ WYMeditor.STRINGS.nl = {
5355
File: 'File',
5456

5557
Preset: 'Preset',
56-
};
58+
};

system/wymeditor/plugins/image_upload/jquery.wymeditor.image_upload.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,37 @@ WYMeditor.editor.prototype.image_upload = function() {
4545
} else {
4646
jQuery(".wym_src", doc).val(response.thumbUrl);
4747
jQuery(".wym_alt", doc).val(response.original_filename);
48+
jQuery(".wym_attribution", doc).val(response.attribution);
4849
}
4950
jQuery("form#image_upload_form .submit", doc).val(oldSubmitLabel);
5051
}
5152
})
5253
};
5354

55+
d.submitHandler = function (wDialog) {
56+
var wym = this,
57+
options = wym._options,
58+
imgAttrs,
59+
selectedImage = wym.getSelectedImage();
60+
61+
imgAttrs = {
62+
src: jQuery(options.srcSelector, wDialog.document).val(),
63+
title: jQuery(options.titleSelector, wDialog.document).val(),
64+
alt: jQuery(options.altSelector, wDialog.document).val(),
65+
longdesc: jQuery('.wym_attribution', wDialog.document).val()
66+
};
67+
68+
wym.focusOnDocument();
69+
70+
if (selectedImage) {
71+
wym._updateImageAttrs(selectedImage, imgAttrs);
72+
wym.registerModification();
73+
} else {
74+
wym.insertImage(imgAttrs);
75+
}
76+
wDialog.close();
77+
}
78+
5479
// Put together the whole dialog script
5580
wym._options.dialogImageHtml = String() +
5681
'<body class="wym_dialog wym_dialog_image">' +
@@ -93,6 +118,10 @@ WYMeditor.editor.prototype.image_upload = function() {
93118
'<label>{Title}</label>' +
94119
'<input type="text" class="wym_title" value="" size="40" />' +
95120
'</div>' +
121+
'<div class="row">' +
122+
'<label>{Attribution}</label>' +
123+
'<input type="text" class="wym_attribution" value="" size="40" placeholder="{Attribution_placeholder}" />' +
124+
'</div>' +
96125
'<div class="row row-indent">' +
97126
'<input class="wym_submit" type="submit" ' + 'value="{Submit}" />' +
98127
'<input class="wym_cancel" type="button" ' + 'value="{Cancel}" />' +

0 commit comments

Comments
 (0)