View | Details | Raw Unified | Return to bug 8692
Collapse All | Expand All

(-)a/authorities/authorities-home.pl (-57 / +48 lines)
Lines 21-26 use strict; Link Here
21
use warnings;
21
use warnings;
22
22
23
use CGI;
23
use CGI;
24
use URI::Escape;
24
use C4::Auth;
25
use C4::Auth;
25
26
26
use C4::Context;
27
use C4::Context;
Lines 32-44 use C4::Koha; # XXX subfield_is_koha_internal_p Link Here
32
use C4::Biblio;
33
use C4::Biblio;
33
34
34
my $query = new CGI;
35
my $query = new CGI;
35
my $op    = $query->param('op');
36
my $dbh   = C4::Context->dbh;
36
$op ||= q{};
37
my $op           = $query->param('op')           || '';
37
my $authtypecode = $query->param('authtypecode');
38
my $authtypecode = $query->param('authtypecode') || '';
38
$authtypecode ||= q{};
39
my $authid       = $query->param('authid')       || '';
39
my $dbh = C4::Context->dbh;
40
40
41
my $authid = $query->param('authid');
42
my ( $template, $loggedinuser, $cookie );
41
my ( $template, $loggedinuser, $cookie );
43
42
44
my $authtypes = getauthtypes;
43
my $authtypes = getauthtypes;
Lines 71-93 if ( $op eq "delete" ) { Link Here
71
    );
70
    );
72
    &DelAuthority( $authid, 1 );
71
    &DelAuthority( $authid, 1 );
73
72
74
    $op = "do_search";
73
    if ( $query->param('operator') ) {
74
        # query contains search params so perform search
75
        $op = "do_search";
76
    }
77
    else {
78
        $op = '';
79
    }
75
}
80
}
76
if ( $op eq "do_search" ) {
81
if ( $op eq "do_search" ) {
77
    my @marclist  = $query->param('marclist');
82
    my $marclist  = $query->param('marclist')  || '';
78
    my @and_or    = $query->param('and_or');
83
    my $and_or    = $query->param('and_or')    || '';
79
    my @excluding = $query->param('excluding');
84
    my $excluding = $query->param('excluding') || '';
80
    my @operator  = $query->param('operator');
85
    my $operator  = $query->param('operator')  || '';
81
    my $orderby   = $query->param('orderby');
86
    my $orderby   = $query->param('orderby')   || '';
82
    my @value     = $query->param('value');
87
    my $value     = $query->param('value')     || '';
83
88
84
    my $startfrom      = $query->param('startfrom')      || 1;
89
    my $startfrom      = $query->param('startfrom')      || 1;
85
    my $resultsperpage = $query->param('resultsperpage') || 20;
90
    my $resultsperpage = $query->param('resultsperpage') || 20;
86
91
87
    my ( $results, $total ) =
92
    my ( $results, $total ) = SearchAuthorities(
88
      SearchAuthorities( \@marclist, \@and_or, \@excluding, \@operator, \@value,
93
        [$marclist],  [$and_or],
89
        ( $startfrom - 1 ) * $resultsperpage,
94
        [$excluding], [$operator],
90
        $resultsperpage, $authtypecode, $orderby );
95
        [$value], ( $startfrom - 1 ) * $resultsperpage,
96
        $resultsperpage, $authtypecode,
97
        $orderby
98
    );
91
99
92
    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
100
    ( $template, $loggedinuser, $cookie ) = get_template_and_user(
93
        {
101
        {
Lines 101-154 if ( $op eq "do_search" ) { Link Here
101
    );
109
    );
102
110
103
    $template->param(
111
    $template->param(
104
        marclist       => $query->param('marclist'),
112
        marclist       => $marclist,
105
        and_or         => $query->param('and_or'),
113
        and_or         => $and_or,
106
        excluding      => $query->param('excluding'),
114
        excluding      => $excluding,
107
        operator       => $query->param('operator'),
115
        operator       => $operator,
108
        orderby        => $query->param('orderby'),
116
        orderby        => $orderby,
109
        value          => $query->param('value'),
117
        value          => $value,
110
        authtypecode   => $query->param('authtypecode'),
118
        authtypecode   => $authtypecode,
111
        startfrom      => $startfrom,
119
        startfrom      => $startfrom,
112
        resultsperpage => $resultsperpage,
120
        resultsperpage => $resultsperpage,
113
    );
121
    );
114
122
115
    my @field_data = ();
116
117
    # we must get parameters once again. Because if there is a mainentry, it
123
    # we must get parameters once again. Because if there is a mainentry, it
118
    # has been replaced by something else during the search, thus the links
124
    # has been replaced by something else during the search, thus the links
119
    # next/previous would not work anymore
125
    # next/previous would not work anymore
120
    my @marclist_ini = $query->param('marclist');
121
    for ( my $i = 0 ; $i <= $#marclist ; $i++ ) {
122
        if ( $value[$i] ) {
123
            push @field_data, { term => "marclist", val => $marclist_ini[$i] };
124
            if ( !defined $and_or[$i] ) {
125
                $and_or[$i] = q{};
126
            }
127
            push @field_data, { term => "and_or", val => $and_or[$i] };
128
            if ( !defined $excluding[$i] ) {
129
                $excluding[$i] = q{};
130
            }
131
            push @field_data, { term => "excluding", val => $excluding[$i] };
132
            push @field_data, { term => "operator",  val => $operator[$i] };
133
            push @field_data, { term => "value",     val => $value[$i] };
134
        }
135
    }
136
126
137
    # construction of the url of each page
127
    # construction of the url of each page
138
    my $base_url =
128
    my $value_url = uri_escape($value);
139
        'authorities-home.pl?'
129
    my $base_url = "authorities-home.pl?"
140
      . join( '&amp;', map { $_->{term} . '=' . $_->{val} } @field_data )
130
      ."marclist=$marclist"
141
      . '&amp;'
131
      ."&amp;and_or=$and_or"
142
      . join(
132
      ."&amp;excluding=$excluding"
143
        '&amp;',
133
      ."&amp;operator=$operator"
144
        map { $_->{term} . '=' . $_->{val} } (
134
      ."&amp;value=$value_url"
145
            { term => 'resultsperpage', val => $resultsperpage },
135
      ."&amp;resultsperpage=$resultsperpage"
146
            { term => 'type',           val => 'intranet' },
136
      ."&amp;type=intranet"
147
            { term => 'op',             val => 'do_search' },
137
      ."&amp;op=do_search"
148
            { term => 'authtypecode',   val => $authtypecode },
138
      ."&amp;authtypecode=$authtypecode"
149
            { term => 'orderby',        val => $orderby },
139
      ."&amp;orderby=$orderby";
150
        )
151
      );
152
140
153
    my $from = ( $startfrom - 1 ) * $resultsperpage + 1;
141
    my $from = ( $startfrom - 1 ) * $resultsperpage + 1;
154
    my $to;
142
    my $to;
Lines 191-197 if ( $op eq '' ) { Link Here
191
179
192
}
180
}
193
181
194
$template->param( authtypesloop => \@authtypesloop, );
182
$template->param(
183
    authtypesloop => \@authtypesloop,
184
    op            => $op,
185
);
195
186
196
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
187
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
197
188
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc (-3 / +91 lines)
Lines 1-6 Link Here
1
<div class="gradient">
1
<div class="gradient">
2
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1>
2
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1>
3
<!-- Begin Authorities Resident Search Box -->
3
<!-- Begin Authorities Resident Search Box -->
4
<script type="text/javascript">
5
//<![CDATA[
6
    $(document).ready(function() {
7
        var searchType = '[% marclist %]';
8
        if (searchType) {
9
            if ('mainentry' == searchType) {
10
                $("#header_search").tabs( "option", "selected", 0 );
11
            } else if ('match' == searchType) {
12
                $("#header_search").tabs( "option", "selected", 1 );
13
            } else if ('all' == searchType) {
14
                $("#header_search").tabs( "option", "selected", 2 );
15
            }
16
        }
17
    });
18
//]]>
19
</script>
4
<div id="header_search" class="residentsearch">
20
<div id="header_search" class="residentsearch">
5
    <div id="main_heading" class="residentsearch">
21
    <div id="main_heading" class="residentsearch">
6
    <p class="tip">Enter authorized heading:</p>
22
    <p class="tip">Enter authorized heading:</p>
Lines 21-35 Link Here
21
        <input type="hidden" name="and_or" value="and" />
37
        <input type="hidden" name="and_or" value="and" />
22
        <input type="hidden" name="excluding" value="" />
38
        <input type="hidden" name="excluding" value="" />
23
        <select name="operator">
39
        <select name="operator">
40
            [% IF ( operator == 'contains' ) %]
41
            <option value="contains" selected="selected">contains</option>
42
            [% ELSE %]
24
            <option value="contains">contains</option>
43
            <option value="contains">contains</option>
44
            [% END %]
45
            [% IF ( operator == 'start' ) %]
46
            <option value="start" selected="selected">starts with</option>
47
            [% ELSE %]
25
            <option value="start">starts with</option>
48
            <option value="start">starts with</option>
49
            [% END %]
50
            [% IF ( operator == 'is' ) %]
51
            <option value="is" selected="selected">is exactly</option>
52
            [% ELSE %]
26
            <option value="is">is exactly</option>
53
            <option value="is">is exactly</option>
54
            [% END %]
27
        </select>
55
        </select>
28
        <input id="value_mainentry" type="text" name="value" value="[% value %]" />
56
        <input id="value_mainentry" type="text" name="value" value="[% value %]" />
29
        <select name="orderby">
57
        <select name="orderby">
30
            <option value="">None</option>
58
            [% IF ( orderby == 'HeadingAsc' ) %]
31
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
59
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
60
            [% ELSE %]
61
            <option value="HeadingAsc">Heading A-Z</option>
62
            [% END %]
63
            [% IF ( orderby == 'HeadingDsc' ) %]
64
            <option value="HeadingDsc" selected="selected">Heading Z-A</option>
65
            [% ELSE %]
32
            <option value="HeadingDsc">Heading Z-A</option>
66
            <option value="HeadingDsc">Heading Z-A</option>
67
            [% END %]
68
            [% IF ( orderby == '' && op ) %]
69
            <option value="" selected="selected">None</option>
70
            [% ELSE %]
71
            <option value="">None</option>
72
            [% END %]
33
        </select>
73
        </select>
34
        <input type="submit" class="submit" value="Submit" />
74
        <input type="submit" class="submit" value="Submit" />
35
    </form>
75
    </form>
Lines 51-65 Link Here
51
        </select>
91
        </select>
52
        <input type="hidden" name="marclist" value="match" />
92
        <input type="hidden" name="marclist" value="match" />
53
        <select name="operator">
93
        <select name="operator">
94
            [% IF ( operator == 'contains' ) %]
95
            <option value="contains" selected="selected">contains</option>
96
            [% ELSE %]
54
            <option value="contains">contains</option>
97
            <option value="contains">contains</option>
98
            [% END %]
99
            [% IF ( operator == 'start' ) %]
100
            <option value="start" selected="selected">starts with</option>
101
            [% ELSE %]
55
            <option value="start">starts with</option>
102
            <option value="start">starts with</option>
103
            [% END %]
104
            [% IF ( operator == 'is' ) %]
105
            <option value="is" selected="selected">is exactly</option>
106
            [% ELSE %]
56
            <option value="is">is exactly</option>
107
            <option value="is">is exactly</option>
108
            [% END %]
57
        </select>
109
        </select>
58
        <input id="value_matchheading" type="text" name="value" value="[% value %]" />
110
        <input id="value_matchheading" type="text" name="value" value="[% value %]" />
59
        <select name="orderby">
111
        <select name="orderby">
60
            <option value="">None</option>
112
            [% IF ( orderby == 'HeadingAsc' ) %]
61
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
113
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
114
            [% ELSE %]
115
            <option value="HeadingAsc">Heading A-Z</option>
116
            [% END %]
117
            [% IF ( orderby == 'HeadingDsc' ) %]
118
            <option value="HeadingDsc" selected="selected">Heading Z-A</option>
119
            [% ELSE %]
62
            <option value="HeadingDsc">Heading Z-A</option>
120
            <option value="HeadingDsc">Heading Z-A</option>
121
            [% END %]
122
            [% IF ( orderby == '' && op ) %]
123
            <option value="" selected="selected">None</option>
124
            [% ELSE %]
125
            <option value="">None</option>
126
            [% END %]
63
         </select>
127
         </select>
64
         <input type="submit" class="submit" value="Submit" />
128
         <input type="submit" class="submit" value="Submit" />
65
    </form>
129
    </form>
Lines 83-97 Link Here
83
        <input type="hidden" name="and_or" value="and" />
147
        <input type="hidden" name="and_or" value="and" />
84
        <input type="hidden" name="excluding" value="" />
148
        <input type="hidden" name="excluding" value="" />
85
        <select name="operator">
149
        <select name="operator">
150
            [% IF ( operator == 'contains' ) %]
151
            <option value="contains" selected="selected">contains</option>
152
            [% ELSE %]
86
            <option value="contains">contains</option>
153
            <option value="contains">contains</option>
154
            [% END %]
155
            [% IF ( operator == 'start' ) %]
156
            <option value="start" selected="selected">starts with</option>
157
            [% ELSE %]
87
            <option value="start">starts with</option>
158
            <option value="start">starts with</option>
159
            [% END %]
160
            [% IF ( operator == 'is' ) %]
161
            <option value="is" selected="selected">is exactly</option>
162
            [% ELSE %]
88
            <option value="is">is exactly</option>
163
            <option value="is">is exactly</option>
164
            [% END %]
89
        </select>
165
        </select>
90
        <input id="value_anywhere" type="text" name="value" value="[% value %]" />
166
        <input id="value_anywhere" type="text" name="value" value="[% value %]" />
91
        <select name="orderby">
167
        <select name="orderby">
92
            <option value="">None</option>
168
            [% IF ( orderby == 'HeadingAsc' ) %]
93
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
169
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
170
            [% ELSE %]
171
            <option value="HeadingAsc">Heading A-Z</option>
172
            [% END %]
173
            [% IF ( orderby == 'HeadingDsc' ) %]
174
            <option value="HeadingDsc" selected="selected">Heading Z-A</option>
175
            [% ELSE %]
94
            <option value="HeadingDsc">Heading Z-A</option>
176
            <option value="HeadingDsc">Heading Z-A</option>
177
            [% END %]
178
            [% IF ( orderby == '' && op ) %]
179
            <option value="" selected="selected">None</option>
180
            [% ELSE %]
181
            <option value="">None</option>
182
            [% END %]
95
        </select>
183
        </select>
96
        <input type="submit" class="submit" value="Submit" />
184
        <input type="submit" class="submit" value="Submit" />
97
    </form>
185
    </form>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt (-1 / +1 lines)
Lines 18-24 Link Here
18
function confirm_deletion() {
18
function confirm_deletion() {
19
	var is_confirmed = confirm('Are you sure you want to delete this authority?');
19
	var is_confirmed = confirm('Are you sure you want to delete this authority?');
20
	if (is_confirmed) {
20
	if (is_confirmed) {
21
		window.location="authorities-home.pl?op=delete&amp;authid=[% authid %]";
21
		window.location="authorities-home.pl?op=delete&authid=[% authid %]";
22
	}
22
	}
23
}
23
}
24
function Dopop(link) {
24
function Dopop(link) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt (-4 / +12 lines)
Lines 8-16 function confirm_deletion(id) { Link Here
8
    
8
    
9
    var is_confirmed = confirm('Are you sure you want to delete this authority?');
9
    var is_confirmed = confirm('Are you sure you want to delete this authority?');
10
    if (is_confirmed) {
10
    if (is_confirmed) {
11
      window.location="authorities-home.pl?op=delete&amp;authid="
11
      window.location="authorities-home.pl?op=delete"
12
          + id
12
          + "&authid=" + id
13
          + "&amp;marclist=[% marclist %]&amp;and_or=[% and_or %]&amp;excluding=[% excluding %]&amp;operator=[%operator%]&amp;orderby=[% orderby %]&amp;value=[% value %]&amp;startfrom=[% startfrom %]&amp;resultsperpage=[% resultsperpage %]";
13
          + "&type=intranet"
14
          + "&authtypecode=[% authtypecode %]"
15
          + "&marclist=[% marclist %]"
16
          + "&and_or=[% and_or %]"
17
          + "&excluding=[% excluding %]"
18
          + "&operator=[% operator %]"
19
          + "&orderby=[% orderby %]"
20
          + "&value=[% value |url %]"
21
          + "&startfrom=[% startfrom %]"
22
          + "&resultsperpage=[% resultsperpage %]";
14
    }
23
    }
15
}
24
}
16
function Help() {
25
function Help() {
17
- 

Return to bug 8692