From: John M. <mo...@mu...> - 2001-08-14 11:33:24
|
Looks great. This is what I wanted to do from the beginning, but my javascript skills weren't up to the task. Thanks, John On Friday, August 10, 2001, at 02:57 AM, Brian Wellington wrote: > Hi. I noticed that the menus use 'onchange', which means that they > don't > work when javascript is disabled. The attached patch modifies the size > menu so that a 'Go' button is present if javascript is disabled. > > This switches the onchange event from assigning location.href to calling > submit(), and removes strings from the 'value' that are already present > in > hidden fields. Basically, this means the form is now sumbitted in the > same way both with and without javascript. > > I'm honestly not sure why the calls to encodeSpecialChars() needed to be > removed. The special characters in the url are properly encoded even > with > this removed. Assuming this doesn't break anything, it would make more > sense to get rid of $ealbumtodisplay and $eimagetodisplay, and use > $albumtodisplay and $imagetodisplay instead, but that would have made > the > patch longer. It doesn't appear that the hidden fields were used at > all, > so this probably never came up. > > If this patch is acceptable, similar changes should be applied to the > other menus (with the additional change listed above). I'd be willing > to > do this if it'll be integrated. > > Brian > > ----------------- > > --- index.cgi.old Thu Aug 9 23:29:07 2001 > +++ index.cgi Thu Aug 9 23:44:53 2001 > @@ -833,26 +833,29 @@ > $imagetitle =~ s/\#\d+_//g; > $imagetitle =~ s/_/ /g; > > - my ($ealbumtodisplay) = &encodeSpecialChars($albumtodisplay); > - my ($eimagetodisplay) = &encodeSpecialChars($imagetodisplay); > + my $ealbumtodisplay = $albumtodisplay; > + my $eimagetodisplay = $imagetodisplay; > > $imageResizer = " > <form action=\"$idscgi\" method=\"get\"> > <input type=\"hidden\" value=\"image\" name=\"mode\" /> > <input type=\"hidden\" value=\"$ealbumtodisplay\" name=\"album\" /> > <input type=\"hidden\" value=\"$eimagetodisplay\" name=\"image\" /> > - <select name=\"maxDimension\" size=\"1\" > onchange=\"location.href=this.form.maxDimension.options[this.form.maxDimension. > selectedIndex].value\"> > - ".(512 < $origMaxSize ? "<option > value=\"".$idscgi."?mode=image&album=".$ealbumtodisplay."&image=".$eimagetodisplay. > "&maxDimension=512\"".($maxDimension eq '512' ? ' > selected="selected"' : '').">".$localization{'image-imageSizeTiny'}." > (512)</option>" : '')." > - ".(640 < $origMaxSize ? "<option > value=\"".$idscgi."?mode=image&album=".$ealbumtodisplay."&image=".$eimagetodisplay. > "&maxDimension=640\"".($maxDimension eq '640' ? ' > selected="selected"' : '').">".$localization{'image-imageSizeSmall'}." > (640)</option>" : '')." > - ".(800 < $origMaxSize ? "<option > value=\"".$idscgi."?mode=image&album=".$ealbumtodisplay."&image=".$eimagetodisplay. > "&maxDimension=800\"".($maxDimension eq '800' ? ' > selected="selected"' : '').">".$localization{'image-imageSizeMedium'}." > (800)</option>" : '')." > - ".(1024 < $origMaxSize ? "<option > value=\"".$idscgi."?mode=image&album=".$ealbumtodisplay."&image=".$eimagetodisplay. > "&maxDimension=1024\"".($maxDimension eq '1024' ? ' > selected="selected"' : '').">".$localization{'image-imageSizeLarge'}." > (1024)</option>" : '')." > - ".(1600 < $origMaxSize ? "<option > value=\"".$idscgi."?mode=image&album=".$ealbumtodisplay."&image=".$eimagetodisplay. > "&maxDimension=1600\"".($maxDimension eq '1600' ? ' > selected="selected"' : '').">".$localization{'image-imageSizeXLarge'}." > (1600)</option>" : '')." > - <option > value=\"".$idscgi."?mode=image&album=".$ealbumtodisplay."&image=".$eimagetodisplay. > "&maxDimension=9999\""; > + <select name=\"maxDimension\" size=\"1\" > onchange=\"this.form.submit()\"> > + ".(512 < $origMaxSize ? "<option > value=\"512\"".($maxDimension eq '512' ? ' selected="selected"' : > '').">".$localization{'image-imageSizeTiny'}." (512)</option>" : '')." > + ".(640 < $origMaxSize ? "<option > value=\"640\"".($maxDimension eq '640' ? ' selected="selected"' : > '').">".$localization{'image-imageSizeSmall'}." (640)</option>" : '')." > + ".(800 < $origMaxSize ? "<option > value=\"800\"".($maxDimension eq '800' ? ' selected="selected"' : > '').">".$localization{'image-imageSizeMedium'}." (800)</option>" : '')." > + ".(1024 < $origMaxSize ? "<option > value=\"1024\"".($maxDimension eq '1024' ? ' selected="selected"' : > '').">".$localization{'image-imageSizeLarge'}." (1024)</option>" : '')." > + ".(1600 < $origMaxSize ? "<option > value=\"1600\"".($maxDimension eq '1600' ? ' selected="selected"' : > '').">".$localization{'image-imageSizeXLarge'}." > (1600)</option>" : '')." > + <option value=\"9999\""; > if ($maxDimension >= $origMaxSize) { > $imageResizer = $imageResizer . ' selected="selected"'; > } > $imageResizer = $imageResizer . > ">".$localization{'image-imageSizeOriginal'}."</option> > </select> > + <noscript> > + <input type=\"submit\" value=\"Go\"> > + </noscript> > </form>"; > > my ($bigImageURL) = $query->url; > > > > _______________________________________________ > IDS-devel mailing list > IDS...@li... > http://lists.sourceforge.net/lists/listinfo/ids-devel |