Bug 1542, followup patch to tidy up some messy dropdown behaviour
authorChris Cormack <chrisc@catalyst.net.nz>
Sun, 14 Feb 2010 20:23:46 +0000 (09:23 +1300)
committerGalen Charlton <gmcharlt@gmail.com>
Sun, 14 Feb 2010 23:14:19 +0000 (18:14 -0500)
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
C4/Reports/Guided.pm
koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tmpl
reports/dictionary.pl

index d8277b7..3cdd5b4 100644 (file)
@@ -152,6 +152,7 @@ This will return a list of all the available report areas
 =cut
 
 sub get_report_areas {
+    my $area = shift;
     my $dbh = C4::Context->dbh();
 
     # FIXME these should be in the database
@@ -161,6 +162,7 @@ sub get_report_areas {
         my %hashrep;
         $hashrep{id}   = $i + 1;
         $hashrep{name} = $reports[$i];
+        $hashrep{selected} = 1 if $hashrep{id} == $area;
         push @reports2, \%hashrep;
     }
     return ( \@reports2 );
index 3c0d863..f6d2317 100644 (file)
 Filter by area <select name="areas">
 <option value="">All</option>
 <!-- TMPL_LOOP NAME="areas" -->     
-<option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>                  
-<!-- /TMPL_LOOP -->                
+    <!-- TMPL_IF NAME="selected">
+        <option value="<!-- TMPL_VAR NAME="id" -->" selected="selected" ><!-- TMPL_VAR NAME="name"--></option>
+    <!-- TMPL_ELSE -->
+        <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name"--></option>
+    <!-- /TMPL_IF -->
+<!-- /TMPL_LOOP -->
 </select> 
 <input name="submit" value="Go" type="submit" />
 </form>
index 5bbc473..3fd4e52 100755 (executable)
@@ -55,7 +55,7 @@ my    ( $template, $borrowernumber, $cookie ) = get_template_and_user(
 
 if ($phase eq 'View Dictionary'){
        # view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town
-       my $areas = get_report_areas();
+       my $areas = get_report_areas($area);
        my $definitions = get_from_dictionary($area);
        $template->param( 'areas' => $areas ,
                'start_dictionary' => 1,