Skip to content

Commit

Permalink
MDL-43869 Atto: id escaping so Atto works with when there is : in the…
Browse files Browse the repository at this point in the history
… id.

(Quiz)
Also includes fixes for Atto when the repositories should not be displayed.
  • Loading branch information
Damyon Wiese committed Jan 29, 2014
1 parent 4246605 commit 6922964
Show file tree
Hide file tree
Showing 16 changed files with 300 additions and 206 deletions.
Expand Up @@ -200,49 +200,55 @@ M.atto_image = M.atto_image || {
}
},
get_form_content : function(elementid) {
var content = Y.Node.create('<form class="atto_form">' +
'<label for="atto_image_urlentry">' + M.util.get_string('enterurl', 'atto_image') +
'</label>' +
'<input class="fullwidth" type="url" value="" id="atto_image_urlentry" size="32"/>' +
'<br/>' +
'<button id="openimagebrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
M.util.get_string('browserepositories', 'atto_image') +
'</button>' +
'<br/>' +
'<div style="display:none" role="alert" id="atto_image_altwarning" class="warning">' +
M.util.get_string('presentationoraltrequired', 'atto_image') +
'</div>' +
'<label for="atto_image_altentry">' + M.util.get_string('enteralt', 'atto_image') +
'</label>' +
'<input class="fullwidth" type="text" value="" id="atto_image_altentry" size="32"/>' +
'<br/>' +
'<input type="checkbox" id="atto_image_presentation"/>' +
'<label class="sameline" for="atto_image_presentation">' + M.util.get_string('presentation', 'atto_image') +
'</label>' +
'<br/>' +
'<label class="sameline" for="atto_image_widthentry">' + M.util.get_string('width', 'atto_image') +
'</label>' +
'<input type="text" value="" id="atto_image_widthentry" size="10"/>' +
'<br/>' +
'<label class="sameline" for="atto_image_heightentry">' + M.util.get_string('height', 'atto_image') +
'</label>' +
'<input type="text" value="" id="atto_image_heightentry" size="10"/>' +
'<br/>' +
'<label for="atto_image_preview">' + M.util.get_string('preview', 'atto_image') +
'</label>' +
'<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>' +
'<div class="mdl-align">' +
'<br/>' +
'<button id="atto_image_urlentrysubmit">' +
M.util.get_string('createimage', 'atto_image') +
'</button>' +
'</div>' +
'</form>' +
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_image'));
var html = '<form class="atto_form">' +
'<label for="atto_image_urlentry">' + M.util.get_string('enterurl', 'atto_image') +
'</label>' +
'<input class="fullwidth" type="url" value="" id="atto_image_urlentry" size="32"/>' +
'<br/>';
if (M.editor_atto.can_show_filepicker(elementid, 'image')) {
html += '<button id="openimagebrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
M.util.get_string('browserepositories', 'atto_image') +
'</button>' +
'<br/>';
}
html += '<div style="display:none" role="alert" id="atto_image_altwarning" class="warning">' +
M.util.get_string('presentationoraltrequired', 'atto_image') +
'</div>' +
'<label for="atto_image_altentry">' + M.util.get_string('enteralt', 'atto_image') +
'</label>' +
'<input class="fullwidth" type="text" value="" id="atto_image_altentry" size="32"/>' +
'<br/>' +
'<input type="checkbox" id="atto_image_presentation"/>' +
'<label class="sameline" for="atto_image_presentation">' + M.util.get_string('presentation', 'atto_image') +
'</label>' +
'<br/>' +
'<label class="sameline" for="atto_image_widthentry">' + M.util.get_string('width', 'atto_image') +
'</label>' +
'<input type="text" value="" id="atto_image_widthentry" size="10"/>' +
'<br/>' +
'<label class="sameline" for="atto_image_heightentry">' + M.util.get_string('height', 'atto_image') +
'</label>' +
'<input type="text" value="" id="atto_image_heightentry" size="10"/>' +
'<br/>' +
'<label for="atto_image_preview">' + M.util.get_string('preview', 'atto_image') +
'</label>' +
'<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>' +
'<div class="mdl-align">' +
'<br/>' +
'<button id="atto_image_urlentrysubmit">' +
M.util.get_string('createimage', 'atto_image') +
'</button>' +
'</div>' +
'</form>' +
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_image');

var content = Y.Node.create(html);

content.one('#atto_image_urlentry').on('blur', M.atto_image.url_changed, this);
content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image, this, elementid);
content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
if (M.editor_atto.can_show_filepicker(elementid, 'image')) {
content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
}
return content;
}
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6922964

Please sign in to comment.