[Koha-patches] [PATCH] Bug 1542, followup patch to tidy up some messy dropdown behaviour

Chris Cormack chrisc at catalyst.net.nz
Sun Feb 14 21:23:46 CET 2010


---
 C4/Reports/Guided.pm                               |    2 ++
 .../prog/en/modules/reports/dictionary.tmpl        |    8 ++++++--
 reports/dictionary.pl                              |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm
index d8277b7..3cdd5b4 100644
--- a/C4/Reports/Guided.pm
+++ b/C4/Reports/Guided.pm
@@ -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 );
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tmpl
index 3c0d863..f6d2317 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tmpl
@@ -28,8 +28,12 @@
 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>
diff --git a/reports/dictionary.pl b/reports/dictionary.pl
index 5bbc473..3fd4e52 100755
--- a/reports/dictionary.pl
+++ b/reports/dictionary.pl
@@ -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,
-- 
1.6.3.3




More information about the Koha-patches mailing list