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 (-5 / +95 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 ('mainmainentry' == searchType) {
10
                $("#header_search").tabs( "option", "selected", 0 );
11
            } else if ('mainentry' == 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="authority_search" class="residentsearch">
21
    <div id="authority_search" class="residentsearch">
6
    <p class="tip">Enter authority heading ($a):</p>
22
    <p class="tip">Enter authority heading ($a):</p>
Lines 18-33 Link Here
18
        [% END %]
34
        [% END %]
19
        </select>
35
        </select>
20
        <input type="hidden" name="marclist" value="mainmainentry" />
36
        <input type="hidden" name="marclist" value="mainmainentry" />
37
        <input type="hidden" name="and_or" value="and" />
38
        <input type="hidden" name="excluding" value="" />
21
        <select name="operator">
39
        <select name="operator">
40
            [% IF ( operator == 'contains' ) %]
41
            <option value="contains" selected="selected">contains</option>
42
            [% ELSE %]
22
            <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 %]
23
            <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 %]
24
            <option value="is">is exactly</option>
53
            <option value="is">is exactly</option>
54
            [% END %]
25
        </select>
55
        </select>
26
        <input id="value_anywhere" type="text" name="value" value="[% value %]" />
56
        <input id="value_anywhere" type="text" name="value" value="[% value %]" />
27
        <select name="orderby">
57
        <select name="orderby">
28
            <option value="">None</option>
58
            [% IF ( orderby == 'HeadingAsc' ) %]
29
            <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 %]
30
            <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 %]
31
         </select>
73
         </select>
32
         <input type="submit" class="submit" value="Submit" />
74
         <input type="submit" class="submit" value="Submit" />
33
    </form>
75
    </form>
Lines 51-66 Link Here
51
        <input type="hidden" name="and_or" value="and" />
93
        <input type="hidden" name="and_or" value="and" />
52
        <input type="hidden" name="excluding" value="" />
94
        <input type="hidden" name="excluding" value="" />
53
        <select name="operator">
95
        <select name="operator">
96
            [% IF ( operator == 'contains' ) %]
97
            <option value="contains" selected="selected">contains</option>
98
            [% ELSE %]
54
            <option value="contains">contains</option>
99
            <option value="contains">contains</option>
100
            [% END %]
101
            [% IF ( operator == 'start' ) %]
102
            <option value="start" selected="selected">starts with</option>
103
            [% ELSE %]
55
            <option value="start">starts with</option>
104
            <option value="start">starts with</option>
105
            [% END %]
106
            [% IF ( operator == 'is' ) %]
107
            <option value="is" selected="selected">is exactly</option>
108
            [% ELSE %]
56
            <option value="is">is exactly</option>
109
            <option value="is">is exactly</option>
110
            [% END %]
57
        </select>
111
        </select>
58
        <input id="value_mainentry" type="text" name="value" value="[% value %]" />
112
        <input id="value_mainentry" type="text" name="value" value="[% value %]" />
59
        <select name="orderby">
113
        <select name="orderby">
60
            <option value="">None</option>
114
            [% IF ( orderby == 'HeadingAsc' ) %]
61
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
115
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
116
            [% ELSE %]
117
            <option value="HeadingAsc">Heading A-Z</option>
118
            [% END %]
119
            [% IF ( orderby == 'HeadingDsc' ) %]
120
            <option value="HeadingDsc" selected="selected">Heading Z-A</option>
121
            [% ELSE %]
62
            <option value="HeadingDsc">Heading Z-A</option>
122
            <option value="HeadingDsc">Heading Z-A</option>
63
        </select>
123
            [% END %]
124
            [% IF ( orderby == '' && op ) %]
125
            <option value="" selected="selected">None</option>
126
            [% ELSE %]
127
            <option value="">None</option>
128
            [% END %]
129
         </select>
64
        <input type="submit" class="submit" value="Submit" />
130
        <input type="submit" class="submit" value="Submit" />
65
    </form>
131
    </form>
66
    </div>
132
    </div>
Lines 83-98 Link Here
83
        <input type="hidden" name="and_or" value="and" />
149
        <input type="hidden" name="and_or" value="and" />
84
        <input type="hidden" name="excluding" value="" />
150
        <input type="hidden" name="excluding" value="" />
85
        <select name="operator">
151
        <select name="operator">
152
            [% IF ( operator == 'contains' ) %]
153
            <option value="contains" selected="selected">contains</option>
154
            [% ELSE %]
86
            <option value="contains">contains</option>
155
            <option value="contains">contains</option>
156
            [% END %]
157
            [% IF ( operator == 'start' ) %]
158
            <option value="start" selected="selected">starts with</option>
159
            [% ELSE %]
87
            <option value="start">starts with</option>
160
            <option value="start">starts with</option>
161
            [% END %]
162
            [% IF ( operator == 'is' ) %]
163
            <option value="is" selected="selected">is exactly</option>
164
            [% ELSE %]
88
            <option value="is">is exactly</option>
165
            <option value="is">is exactly</option>
166
            [% END %]
89
        </select>
167
        </select>
90
        <input id="value_mainmainentry" type="text" name="value" value="[% value %]" />
168
        <input id="value_mainmainentry" type="text" name="value" value="[% value %]" />
91
        <select name="orderby">
169
        <select name="orderby">
92
            <option value="">None</option>
170
            [% IF ( orderby == 'HeadingAsc' ) %]
93
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
171
            <option value="HeadingAsc" selected="selected">Heading A-Z</option>
172
            [% ELSE %]
173
            <option value="HeadingAsc">Heading A-Z</option>
174
            [% END %]
175
            [% IF ( orderby == 'HeadingDsc' ) %]
176
            <option value="HeadingDsc" selected="selected">Heading Z-A</option>
177
            [% ELSE %]
94
            <option value="HeadingDsc">Heading Z-A</option>
178
            <option value="HeadingDsc">Heading Z-A</option>
95
        </select>
179
            [% END %]
180
            [% IF ( orderby == '' && op ) %]
181
            <option value="" selected="selected">None</option>
182
            [% ELSE %]
183
            <option value="">None</option>
184
            [% END %]
185
         </select>
96
        <input type="submit" class="submit" value="Submit" />
186
        <input type="submit" class="submit" value="Submit" />
97
    </form>
187
    </form>
98
    </div>
188
    </div>
(-)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