$c->stash->{'return_target_action'} = $c->web_path("/books");
+ $c->stash->{'booklist_filter'} = $c->session->{'booklist_filter'} if $c->session->{'booklist_filter'};
+
$c->stash->{'cssfiles'} = [] unless $c->stash->{'cssfiles'};
push @{$c->stash->{'cssfiles'}}, 'books/styles.css';
#-------------------------------------------------------
+=head2 filter( )
+
+Stellt ein Formular zu Verfügung, mit dem Filterkriterien
+für die Buchliste definiert werden.
+
+=cut
+
+sub filter : Local {
+
+ my ($self, $c) = @_;
+ my $K = ( caller(0) )[3] . "(): ";
+ $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+
+ $self->add_booklist_menu($c);
+
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->web_path("/books/filter"),
+ 'name' => "Filter"
+ };
+
+ $self->prepare_data_structures($c);
+
+ $c->stash->{'template'} = 'books/filter.tt2';
+
+ return 1;
+
+}
+
+#-------------------------------------------------------
+
=head2 sorting
Stellt ein Formular zum Ändern der Sortierkriterien der Bücherliste zur Verfügung.
# Sortierkriterien der Buchliste
$prefs->{'book_order_criteria'} = $c->session->{'book_order_criteria'} if $c->session->{'book_order_criteria'};
+ # Filter für Buchliste speichern
+ $prefs->{'booklist_filter'} = $c->session->{'booklist_filter'} if $c->session->{'booklist_filter'};
+
# Anzahl der angezeigten zugeordneten Bücher in einer anderen Liste
$prefs->{'books_in_other_list'} = $c->stash->{'books_in_other_list'};
# Sortierkriterien der Buchliste
$c->session->{'book_order_criteria'} = $prefs->{'book_order_criteria'} if $prefs->{'book_order_criteria'};
+ # Filter für Buchliste speichern
+ $c->session->{'booklist_filter'} = undef;
+ $c->session->{'booklist_filter'} = $prefs->{'booklist_filter'} if $prefs->{'booklist_filter'};
+
return 1;
}
--- /dev/null
+<!-- [%#
+ ** Template fuer Formular zum Setzen eines Filters in der Büchereliste
+ **
+ ** vim: noai : ts=4 fenc=utf-8 filetype=html expandtab :
+ **
+ ** $Id$
+ ** $URL$
+ ** -%]
+
+ Formular zum Setzen eines Filters in der Büchereliste
+
+-->
+
+<script type="text/javascript">
+
+function set_filter_disabled() {
+ // alert( "Filter wurden deaktiviert." );
+ document.booklist_filter_form.title_name_where.disabled = true;
+ document.booklist_filter_form.title_name.disabled = true;
+ document.booklist_filter_form.autoren_ids.disabled = true;
+}
+
+function set_filter_enabled() {
+ // alert( "Filter wurden aktiviert." );
+ document.booklist_filter_form.title_name_where.disabled = false;
+ document.booklist_filter_form.title_name.disabled = false;
+ document.booklist_filter_form.autoren_ids.disabled = false;
+}
+
+</script>
+
+<form method="post" name="booklist_filter_form" action="[% self_url %]">
+<table class="ftable" cellspacing="0">
+ <tr>
+ <th class="title">Filter für die Buchliste</th>
+ </tr><tr>
+ <td class="empty"></td>
+ </tr><tr>
+ <td><input type="radio" id="filter_disabled" name="filter_enabled" onclick="set_filter_disabled();"
+ value="off"[% IF NOT booklist_filter %] checked[% END %]> <label
+ for="filter_disabled">Filter deaktiviert - es werden alle Bücher angezeigt</label></td>
+ </tr><tr>
+ <td><input type="radio" id="filter_enabled" name="filter_enabled"onclick="set_filter_enabled();"
+ value="on"[% IF booklist_filter %] checked[% END %]> <label
+ for="filter_enabled">Filter aktiviert - es werden die Bücher entsprechend ihrer Auswahl angezeigt</label></td>
+ </tr><tr>
+ <td><fieldset id="filter_fields">
+ <legend><b>Filterkriterien</b></legend>
+ <table class="ftable" cellspacing="0">
+ <tr>
+ <th><label for="title_name">Buchtitel/Untertitel/Originaltitel:</label> </th>
+ <td><select size="1" name="title_name_where">
+ <option value="is"[% IF booklist_filter.title_name_where != "starts_with" AND booklist_filter.title_name_where != "contains" %] selected[% END %]>ist</option>
+ <option value="starts_with"[% IF booklist_filter.title_name_where == "starts_with" %] selected[% END %]>beginnt mit</option>
+ <option value="contains"[% IF booklist_filter.title_name_where == "contains" %] selected[% END %]>enthält</option>
+ </select>
+ <input name="title_name" id="title_name" type="text" size="50" value="[% booklist_filter.title_name %]"></td>
+ </tr><tr>
+ <th><label for="autoren_ids">Autor:</label> </th>
+ <td><select name="autoren_ids" id="autoren_ids" size="12" multiple>
+ <option value="">-- Autor oder Autoren wählen --</option>[% FOR autor_id IN autor_array_sorted %]
+ <option value="[% autor_id %]"[% IF booklist_filter.autoren AND booklist_filter.autoren.$autor_id %] selected[% END %] >[% autor_list.$autor_id %]</option>
+ [% END %]</select></td>
+ </tr>
+ </table>
+ </fieldset>
+ </tr><tr>
+ <td class="empty"></td>
+ </tr><tr>
+ <th class="button"><input type="submit" name="do_save" value=" OK " /></th>
+ </tr>
+</table>
+</form>
+
+<script type="text/javascript">
+
+[% IF booklist_filter %]set_filter_enabled();[% ELSE %]set_filter_disabled();[% END %]
+
+</script>
+
+[%- IF error_message %]
+<div class="error">
+<span class="bold">Fehler:</span> [% error_message %]
+</div>
+[% END -%]
+
+<br />
+<div class="back">
+<h2><a href="[% path('/books/list') %]">[% 'Zurück' %]</a></h2>
+</div>
+<br />