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

(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (-1 / +1 lines)
Lines 155-161 aside { Link Here
155
155
156
    fieldset {
156
    fieldset {
157
        &.brief {
157
        &.brief {
158
            margin: 0;
158
            margin: 0 0 1em 0;
159
            padding: .4em .7em;
159
            padding: .4em .7em;
160
160
161
            fieldset {
161
            fieldset {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-32 / +89 lines)
Lines 100-123 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
100
                <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
100
                <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
101
        </form>
101
        </form>
102
    [% ELSE %]
102
    [% ELSE %]
103
        <div style="margin-bottom:5px;">
104
        <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
105
            <label for="lang">Display location:</label>
106
            <select name="lang" id="lang">
107
                [% PROCESS lang_locations language => lang %]
108
            </select>
109
            <label for="branch">Library: </label>
110
            <select id="branch" name="branch">
111
                [% IF ( branchcode == "" ) %]
112
                <option value="" selected="selected">All libraries</option>
113
                [% ELSE %]
114
                <option value=""         >All libraries</option>
115
                [% END %]
116
                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
117
            </select>
118
            <input type="submit" class="button" value="Filter" />
119
        </form>
120
        </div>
121
        [% IF ( opac_news_count ) %]
103
        [% IF ( opac_news_count ) %]
122
        <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
104
        <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
123
                <table id="newst">
105
                <table id="newst">
Lines 186-191 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
186
168
187
                <div class="col-sm-2 col-sm-pull-10">
169
                <div class="col-sm-2 col-sm-pull-10">
188
                    <aside>
170
                    <aside>
171
172
                        <div id="news-filter">
173
                            <form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
174
                                <h4>Filter</h4>
175
                                <fieldset class="brief">
176
                                    <ol>
177
                                        <li>
178
                                            <label for="news_keyword">Keyword:</label>
179
                                            <input type="text" name="news_keyword" id="news_keyword" />
180
                                        </li>
181
                                        <li>
182
                                            <label for="news_display_location">Display location:</label>
183
                                            <select name="news_display_location" id="news_display_location">
184
                                                [% PROCESS lang_locations %]
185
                                            </select>
186
                                        </li>
187
                                        <li>
188
                                            <label for="news_library">Library: </label>
189
                                            <select id="news_library" name="news_library">
190
                                                <option value=""></option>
191
                                                <option value="">All libraries</option>
192
                                                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
193
                                            </select>
194
                                        </li>
195
                                    </ol>
196
                                </fieldset>
197
                            </form>
198
                        </div>
199
189
                        [% INCLUDE 'tools-menu.inc' %]
200
                        [% INCLUDE 'tools-menu.inc' %]
190
                    </aside>
201
                    </aside>
191
                </div> <!-- /.col-sm-2.col-sm-pull-10 -->
202
                </div> <!-- /.col-sm-2.col-sm-pull-10 -->
Lines 198-205 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
198
    [% IF ( opac_news_count ) %]
209
    [% IF ( opac_news_count ) %]
199
        [% INCLUDE 'datatables.inc' %]
210
        [% INCLUDE 'datatables.inc' %]
200
        <script>
211
        <script>
212
            function Checkbox(){
213
                var form = document.getElementById('del_form');
214
                var inputs = form.getElementsByTagName('input');
215
                var checked = false;
216
                for (var i=0; i<inputs.length; i++) {
217
                    if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
218
                        checked = inputs[i].checked;
219
                        if (checked) return true;
220
                    }
221
                }
222
            }
223
224
            function filterDataTable( table, column, term ){
225
                if( column ){
226
                    table.column( column ).search( term ).draw();
227
                } else {
228
                    table.search( term ).draw();
229
                }
230
                clearFilter( term );
231
            }
232
233
            function clearFilter( term ){
234
                if( term == "" ){
235
                    $(".dt_button_clear_filter").addClass("disabled");
236
                } else {
237
                    $(".dt_button_clear_filter").removeClass("disabled");
238
                }
239
            }
240
201
            $(document).ready(function() {
241
            $(document).ready(function() {
202
                $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
242
                var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
203
                    "aoColumnDefs": [
243
                    "aoColumnDefs": [
204
                        { "aTargets": [ 0,-1,-2 ], "bSortable": false },
244
                        { "aTargets": [ 0,-1,-2 ], "bSortable": false },
205
                        { "aTargets": [ 0, -1 ], "bSearchable": false },
245
                        { "aTargets": [ 0, -1 ], "bSearchable": false },
Lines 207-228 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
207
                    ],
247
                    ],
208
                    "sPaginationType": "full_numbers"
248
                    "sPaginationType": "full_numbers"
209
                }));
249
                }));
250
210
                $(".delete_news").on("click", function(){
251
                $(".delete_news").on("click", function(){
211
                    return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
252
                    return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
212
                });
253
                });
213
254
214
                function Checkbox(){
215
                    var form = document.getElementById('del_form');
216
                    var inputs = form.getElementsByTagName('input');
217
                    var checked = false;
218
                    for (var i=0; i<inputs.length; i++) {
219
                        if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
220
                            checked = inputs[i].checked;
221
                            if (checked) return true;
222
                        }
223
                    }
224
                }
225
226
                $("#del_form").on("submit",function(){
255
                $("#del_form").on("submit",function(){
227
                    if ( Checkbox() ) {
256
                    if ( Checkbox() ) {
228
                        return confirmDelete( _("Are you sure you want to delete the selected news?") );
257
                        return confirmDelete( _("Are you sure you want to delete the selected news?") );
Lines 231-236 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
231
                        return false;
260
                        return false;
232
                    }
261
                    }
233
                });
262
                });
263
264
                newst.on( 'search.dt', function () {
265
                    var term = newst.search();
266
                    $("#news_keyword").val( term );
267
                });
268
269
                $("#news_keyword").on("keyup", function(){
270
                    var term = $(this).val();
271
                    filterDataTable( newst, null, term );
272
                });
273
274
                $("#news_display_location").on("change", function(){
275
                    var term = $(this).val();
276
                    filterDataTable( newst, 1, term );
277
                });
278
279
                $("#news_library").on("change", function(){
280
                    // Table must be filtered by the <option>'s text, not its value
281
                    var opt = $(this).find("option:selected").text();
282
                    filterDataTable( newst, 2, opt );
283
                });
284
285
                $(".dt_button_clear_filter").on("click", function(){
286
                    newst.search('').columns().search('').draw();
287
                    $("#news-filter select").each(function(){
288
                        $(this).val("");
289
                    });
290
                });
234
            });
291
            });
235
        </script>
292
        </script>
236
    [% END %]
293
    [% END %]
Lines 262-268 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
262
319
263
[% BLOCK lang_locations %]
320
[% BLOCK lang_locations %]
264
    [% IF ( language == "" ) %]
321
    [% IF ( language == "" ) %]
265
        <option value="" selected="selected">All</option>
322
        <option value="" selected="selected"></option>
266
    [% ELSE %]
323
    [% ELSE %]
267
        <option value="">All</option>
324
        <option value="">All</option>
268
    [% END %]
325
    [% END %]
(-)a/tools/koha-news.pl (-2 / +1 lines)
Lines 144-150 elsif ( $op eq 'del' ) { Link Here
144
144
145
else {
145
else {
146
146
147
    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode );
147
    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, undef, undef );
148
    
148
    
149
    foreach my $new ( @$opac_news ) {
149
    foreach my $new ( @$opac_news ) {
150
        next unless $new->{'expirationdate'};
150
        next unless $new->{'expirationdate'};
151
- 

Return to bug 22888