Automatically select the appropriate radio button. Also, disable the
input box for the one which is not selected, to work around some validation
issues.
Patch by allen.
diffs (59 lines):
diff -r 8359f11e6d86 -r 520d2b04e91d htdocs/editpics.bml
--- a/htdocs/editpics.bml Tue Dec 01 15:21:37 2009 +0000
+++ b/htdocs/editpics.bml Tue Dec 01 17:26:48 2009 +0000
@@ -346,13 +346,13 @@ use strict;
'class' => 'radio', 'value' => 'file',
'selected' => '1',
'accesskey' => $ML{'.fromfile.key'} }) .
"\n";
$body .= "<label for='radio_file'>$ML{'.fromfile'}</label><br
/>\n";
- $body .= "<input type='file' class='file' name='userpic_0'
size='18' style='margin: 0em 0em 0.5em 2em;' />\n";
+ $body .= "<input type='file' class='file' name='userpic_0'
id='userpic_0' size='18' style='margin: 0em 0em 0.5em 2em;' />\n";
$body .= "</p>\n";
$body .= "<p class='pkg'>\n";
$body .= LJ::html_check({ 'type' => 'radio', 'name' => 'src',
'value' => 'url',
'id' => 'radio_url', 'class' => 'radio',
'accesskey' => $ML{'.fromurl.key'} }) . "\n";
$body .= "<label for='radio_url'>$ML{'.fromurl'}</label><br />\n";
- $body .= LJ::html_text({ 'name' => 'urlpic_0', class => 'text',
style => 'margin: 0em 0em 0.5em 2em;' }) . "\n";
+ $body .= LJ::html_text({ 'name' => 'urlpic_0', 'id' => 'urlpic_0',
class => 'text', style => 'margin: 0em 0em 0.5em 2em;' }) . "\n";
$body .= "</p>\n";
$body .= "<p class='detail'>$ML{'.label.formats.desc'}</p>\n";
$body .= "</div>\n";
diff -r 8359f11e6d86 -r 520d2b04e91d htdocs/js/editpics.js
--- a/htdocs/js/editpics.js Tue Dec 01 15:21:37 2009 +0000
+++ b/htdocs/js/editpics.js Tue Dec 01 17:26:48 2009 +0000
@@ -60,6 +60,11 @@ function setup () {
pbar.init($("progressBar"));
$("progressBar").className="lj_progresscontainer";
+
+ DOM.addEventListener($("radio_url"), "click", selectUrlUpload);
+ DOM.addEventListener($("radio_file"), "click", selectFileUpload);
+ DOM.addEventListener($("urlpic_0"), "keypress", keyPressUrlUpload);
+ DOM.addEventListener($("userpic_0"), "change", keyPressFileUpload);
}
function editpicsInit() {
@@ -181,4 +186,24 @@ function removeNoDefaultButton() {
removeFromTag.removeChild(removeElement);
}
+function selectUrlUpload() {
+ $("userpic_0").disabled = true;
+ $("urlpic_0").disabled = false;
+}
+
+function selectFileUpload() {
+ $("urlpic_0").disabled = true;
+ $("userpic_0").disabled = false;
+}
+
+function keyPressUrlUpload() {
+ $("radio_url").checked =true;
+ selectUrlUpload();
+}
+
+function keyPressFileUpload() {
+ $("radio_file").checked =true;
+ selectFileUpload();
+}
+
DOM.addEventListener(window, "load", setup);
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog