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

(-)a/admin/printers.pl (-15 / +1 lines)
Lines 60-69 sub StringSearch { Link Here
60
my $input = new CGI;
60
my $input = new CGI;
61
my $searchfield=$input->param('searchfield');
61
my $searchfield=$input->param('searchfield');
62
#my $branchcode=$input->param('branchcode');
62
#my $branchcode=$input->param('branchcode');
63
my $offset=$input->param('offset') || 0;
64
my $script_name="/cgi-bin/koha/admin/printers.pl";
63
my $script_name="/cgi-bin/koha/admin/printers.pl";
65
64
66
my $pagesize=20;
67
my $op = $input->param('op');
65
my $op = $input->param('op');
68
$searchfield=~ s/\,//g;
66
$searchfield=~ s/\,//g;
69
67
Lines 132-150 if ($op eq 'add_form') { Link Here
132
} else { # DEFAULT
130
} else { # DEFAULT
133
	$template->param(else => 1);
131
	$template->param(else => 1);
134
	my ($count,$results)=StringSearch($searchfield,'web');
132
	my ($count,$results)=StringSearch($searchfield,'web');
135
	my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count;
133
    $template->param(loop => $results);
136
	my @loop = (@$results)[$offset..$max];
137
	
138
	$template->param(loop => \@loop);
139
	
140
	if ($offset>0) {
141
		$template->param(offsetgtzero => 1,
142
				 prevpage => $offset-$pagesize);
143
	}
144
	if ($offset+$pagesize<$count) {
145
		$template->param(ltcount => 1,
146
				 nextpage => $offset+$pagesize);
147
	}
148
134
149
} #---- END $OP eq DEFAULT
135
} #---- END $OP eq DEFAULT
150
136
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/printers-admin-search.inc (-28 lines)
Lines 1-28 Link Here
1
<div class="gradient">
2
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Printers Resident Search Box -->
3
<div id="header_search">
4
	<div id="printer_search" class="residentsearch">
5
    <p class="tip">Printer search:</p>
6
<form action="[% script_name %]" method="post">
7
                <input class="head-searchbox" type="text" size="40" name="description" value="[% searchfield %]" />
8
                <input type="submit" name="submit" value="Search" />
9
        </form>
10
	</div>
11
    [% INCLUDE 'patron-search-box.inc' %]
12
	[% IF ( CAN_user_catalogue ) %]
13
    <div id="catalog_search" class="residentsearch">
14
	<p class="tip">Enter search keywords:</p>
15
		<form action="/cgi-bin/koha/catalogue/search.pl"  method="get" id="cat-search-block">
16
            <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="head-searchbox form-text" />
17
				<input type="submit" value="Submit"  class="submit" />
18
		</form>
19
	</div>
20
	[% END %]
21
			<ul>
22
            <li><a onclick="keep_text(0)" href="#printer_search">Search printers</a></li>
23
            [% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]<li><a onclick="keep_text(1)" href="#circ_search">Check out</a></li>[% END %]
24
            [% IF ( CAN_user_catalogue ) %]<li><a onclick="keep_text(2)" href="#catalog_search">Search the catalog</a></li>[% END %]
25
			</ul>	
26
</div>
27
</div><!-- /gradient -->
28
<!-- End Printers Resident Search Box -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt (-93 / +70 lines)
Lines 6-58 Link Here
6
[% IF ( delete_confirmed ) %] Printers &rsaquo; Printer deleted[% END %]
6
[% IF ( delete_confirmed ) %] Printers &rsaquo; Printer deleted[% END %]
7
[% IF ( else ) %]Printers[% END %]</title>
7
[% IF ( else ) %]Printers[% END %]</title>
8
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
9
[% IF ( add_form ) %]<script type="text/javascript">
9
[% IF ( loop ) %]
10
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
11
[% INCLUDE 'datatables.inc' %]
12
<script type="text/javascript">
10
//<![CDATA[
13
//<![CDATA[
11
        //
14
    $(document).ready(function() {
12
        function isNotNull(f,noalert) {
15
        $("#printerst").dataTable($.extend(true, {}, dataTablesDefaults, {
13
                if (f.value.length ==0) {
16
            "aoColumnDefs": [
14
   return false;
17
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
15
                }
18
            ],
16
                return true;
19
            "aaSorting": [[ 0, "asc" ]],
17
        }
20
            "sPaginationType": "four_button"
18
        //
21
        }));
19
        function isNum(v,maybenull) {
22
    });
20
        var n = new Number(v.value);
23
//]]>
21
        if (isNaN(n)) {
22
                return false;
23
                }
24
        if (maybenull==0 && v.value=="") {
25
                return false;
26
        }
27
        return true;
28
        }
29
        //
30
        function Check(f) {
31
                var ok=1;
32
                var _alertString="";
33
                var alertString2;
34
                if (f.printername.value.length==0) {
35
                        _alertString += "- printer name missing\n";
36
                }
37
                if (f.printqueue.value.length==0) {
38
                        _alertString += "- Queue missing\n";
39
                }
40
                if (_alertString.length==0) {
41
                        document.Aform.submit();
42
                } else {
43
                        alertString2 = "Form not submitted because of the following problem(s)\n";
44
                        alertString2 += "------------------------------------------------------------------------------------\n\n";
45
                        alertString2 += _alertString;
46
                        alert(alertString2);
47
                }
48
        }
49
        //]]>
50
</script>
24
</script>
51
	[% END %]
25
[% END %]
52
</head>
26
</head>
53
<body id="admin_printers" class="admin">
27
<body id="admin_printers" class="admin">
54
[% INCLUDE 'header.inc' %]
28
[% INCLUDE 'header.inc' %]
55
[% INCLUDE 'printers-admin-search.inc' %]
29
[% INCLUDE 'cat-search.inc' %]
56
30
57
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Modify printer '[% searchfield %]'[% ELSE %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; New printer[% END %][% END %]
31
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Modify printer '[% searchfield %]'[% ELSE %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; New printer[% END %][% END %]
58
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
32
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
Lines 73-79 Link Here
73
	[% ELSE %]
47
	[% ELSE %]
74
		<h1>New printer</h1>
48
		<h1>New printer</h1>
75
	[% END %]
49
	[% END %]
76
        <form action="[% script_name %]" name="Aform" method="post">
50
        <form action="[% script_name %]" name="Aform" method="post" class="validated">
77
        <input type="hidden" name="op" value="add_validate" />
51
        <input type="hidden" name="op" value="add_validate" />
78
	[% IF ( searchfield ) %]
52
	[% IF ( searchfield ) %]
79
		<input type="hidden" name="add" value="0" />
53
		<input type="hidden" name="add" value="0" />
Lines 88-107 Link Here
88
		</li>
62
		</li>
89
	[% ELSE %]
63
	[% ELSE %]
90
		<li>
64
		<li>
91
            <label for="printername">Printer name: </label>
65
            <label for="printername" class="required">Printer name: </label>
92
				<input type="text" name="printername" id="printername" size="50" maxlength="50" />
66
                <input type="text" name="printername" id="printername" size="40" maxlength="40" class="required" required="required" />
67
                <span class="required">Required</span>
93
		</li>
68
		</li>
94
	[% END %]
69
	[% END %]
95
        	<li>
70
        	<li>
96
			<label for="printqueue">Queue: </label>
71
            <label for="printqueue" class="required">Queue: </label>
97
			<input type="text" name="printqueue" id="printqueue" size="50" maxlength="50" value="[% printqueue %]" /> 
72
            <input type="text" name="printqueue" id="printqueue" size="20" maxlength="20" value="[% printqueue %]"  class="required" required="required" />
73
            <span class="required">Required</span>
98
		</li>
74
		</li>
99
        	<li>
75
        	<li>
100
			<label for="printtype">Type: </label>
76
			<label for="printtype">Type: </label>
101
			<input type="text" name="printtype" id="printtype" size="50" maxlength="50" value="[% printtype %]" /> 
77
            <input type="text" name="printtype" id="printtype" size="20" maxlength="20" value="[% printtype %]" />
102
		</li></ol>
78
		</li></ol>
103
        </fieldset>
79
        </fieldset>
104
		<fieldset class="action"><input type="submit" value="Submit" onclick="Check(this.form);" /> <a class="cancel" href="/cgi-bin/koha/admin/printers.pl">Cancel</a></fieldset>
80
        <fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/printers.pl">Cancel</a></fieldset>
105
        </form>
81
        </form>
106
82
107
[% END %]
83
[% END %]
Lines 114-148 Link Here
114
[% END %]
90
[% END %]
115
91
116
[% IF ( delete_confirm ) %]
92
[% IF ( delete_confirm ) %]
117
<h3>Confirm deletion of printer <em>[% searchfield %]</em></h3>
93
    <div class="dialog alert">
118
<ul>
94
        <h3>Confirm deletion of printer <em>[% searchfield %]</em></h3>
119
		<li>
95
120
			<strong>Printer: </strong>
96
        <table>
121
			[% searchfield %]
97
            <tr>
122
		</li>
98
                <th scope="row">Printer: </th><td>[% searchfield %]</td>
123
		<li>
99
            </tr>
124
			<strong>Queue: </strong>
100
            <tr>
125
			[% printqueue %]
101
                <th scope="row">Queue: </th><td>[% printqueue %]</td>
126
		</li>
102
            </tr>
127
        	<li>
103
            <tr>
128
			<strong>Type: </strong>
104
                <th scope="row">Type: </th><td>[% printtype %]</td>
129
			[% printtype %]
105
            </tr>
130
		</li>
106
        </table>
131
	</ul>
107
132
    	<form action="[% script_name %]" method="post">
108
        <form action="[% script_name %]" method="post">
133
			<input type="hidden" name="op" value="delete_confirmed" />
109
            <input type="hidden" name="op" value="delete_confirmed" />
134
			<input type="hidden" name="searchfield" value="[% searchfield %]" />
110
            <input type="hidden" name="searchfield" value="[% searchfield %]" />
135
			<input type="submit" value="Delete this printer" />
111
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
136
			</form> <form action="[% script_name %]" method="post">
112
        </form>
137
				<input type="submit" value="Do not Delete" />
113
        <form action="/cgi-bin/koha/admin/printers.pl" method="get">
138
			</form>
114
            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
115
        </form>
116
    </div>
139
[% END %]
117
[% END %]
140
118
141
[% IF ( delete_confirmed ) %]
119
[% IF ( delete_confirmed ) %]
142
<h3>Printer deleted</h3>
120
    <div class="dialog message">
143
<form action="[% script_name %]" method="post">
121
        <h3>Printer deleted</h3>
144
		<fieldset class="action"><input type="submit" value="OK" /></fieldset>
122
        <form action="[% script_name %]" method="post">
145
</form>
123
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
124
        </form>
125
    </div>
126
146
[% END %]
127
[% END %]
147
128
148
[% IF ( else ) %]
129
[% IF ( else ) %]
Lines 156-185 Link Here
156
		You searched for [% searchfield %]</span>
137
		You searched for [% searchfield %]</span>
157
	[% END %]
138
	[% END %]
158
139
159
[% IF ( loop ) %]<table>
140
[% IF ( loop ) %]
160
		<tr>
141
    <table id="printerst">
161
			<th>Name</th>
142
        <thead>
162
			<th>Queue</th>
143
            <tr>
163
			<th>Type</th>
144
                <th>Name</th>
164
			<th>&nbsp;</th>
145
                <th>Queue</th>
165
		</tr>
146
                <th>Type</th>
147
                <th>&nbsp;</th>
148
            </tr>
149
        </thead>
150
        <tbody>
166
		[% FOREACH loo IN loop %]
151
		[% FOREACH loo IN loop %]
167
        <tr>
152
        <tr>
168
			<td>[% loo.printername %]</td>
153
			<td>[% loo.printername %]</td>
169
			<td>[% loo.printqueue %]</td>
154
			<td>[% loo.printqueue %]</td>
170
			<td>[% loo.printtype %]</td>
155
			<td>[% loo.printtype %]</td>
171
			<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.printername %]">Edit</a> <a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.printername %]">Delete</a></td>
156
            <td class="actions"><a class="btn btn-mini" href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-pencil"></i> Edit</a> <a class="btn btn-mini" href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-trash"></i> Delete</a></td>
172
		</tr>
157
		</tr>
173
		[% END %]
158
		[% END %]
174
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
159
        </tbody>
175
160
    </table>[% ELSE %]<div class="dialog message">No printers defined.</div>[% END %]
176
	[% IF ( offsetgtzero ) %]
177
		<a href="[% script_name %]?offset=[% prevpage %]">&lt;&lt; Previous</a>
178
	[% END %]
179
180
	[% IF ( ltcount ) %]
181
		<a href="[% script_name %]?offset=[% nextpage %]">Next &gt;&gt;</a>	
182
	[% END %]
183
[% END %]
161
[% END %]
184
162
185
</div>
163
</div>
186
- 

Return to bug 16764