Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
Wainui Witika-Park b6f036a7ac Bug 26703: tools folder
Swapped the order of the page titles to have the unique information
first, i.e. the name of the specific page displays first, and the name of the website (e.g. Koha) displays at the end.

To test:
1) Apply patch
2) Ensure each of the files in the tools folder are swapped around
to display the most unique information first, and the website name is at the end
3) Ensure the pages displayed on the Staff Client that correspond to
these files also display the changes

Sponsored-by: Catalyst IT
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 11:16:35 +02:00

477 lines
22 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>News &rsaquo; Tools &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% IF ( opac_news_count ) %]
[% END %]
[% UNLESS ( wysiwyg ) %]
[% Asset.css("lib/codemirror/codemirror.css") | $raw %]
[% Asset.css("lib/codemirror/lint.min.css") | $raw %]
<style>
.CodeMirror {
resize: vertical;
z-index: 0;
}
</style>
[% END %]
</head>
<body id="tools_koha-news" class="tools">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
</li>
[% IF ( add_form ) %]
<li>
<a href="/cgi-bin/koha/tools/koha-news.pl">News</a>
</li>
<li>
<a href="#" aria-current="page">
[% IF ( id ) %]
Edit news item
[% ELSE %]
Add news item
[% END %]
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
News
</a>
</li>
[% END %]
</ol>
</nav>
[% IF ( add_form ) %]
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
[% ELSE %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
[% END %]
<main>
[% UNLESS ( add_form ) %]
[% IF error_message == 'title_missing' %]
<div class="dialog alert">Error: Required news title missing!</div>
[% END %]
<h2>News</h2>
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;lang=[% lang | html %]"><i class="fa fa-plus"></i> New entry</a>
</div>
[% END %]
[% IF ( add_form ) %]
[% IF ( op == 'add' ) %]
[% default_lang = lang %]
[% ELSE %]
[% default_lang = new_detail.lang %]
[% END %]
<form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
<input type="hidden" name="op" value="[% op | html %]" />
<input type="hidden" name="id" value="[% id | html %]" />
<fieldset class="rows">
<legend>OPAC and Koha news</legend>
<ol> <li>
<label for="lang">Display location:</label>
<select id="lang" name="lang">
[% PROCESS lang_locations language => default_lang %]
</select>
</li>
<li>
<label for="branch">Library: </label>
<select id="branch" name="branch">
[% IF ( new_detail.branchcode == '' ) %]
<option value="" selected="selected">All libraries</option>
[% ELSE %]
<option value="" >All libraries</option>
[% END %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
</select>
</li>
<li>
<label for="title" class="required">Title: </label>
<input id="title" size="30" type="text" name="title" value="[% new_detail.title | html %]" required="required" class="required" /> <span class="required">Required</span>
</li>
<li>
<label for="from">Publication date: </label>
<input id="from" type="text" name="published_on" size="15" value="[% new_detail.published_on | html %]" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="to">Expiration date: </label>
<input id="to" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate | html %]" class="datepickerto" />
<div class="hint">
[% INCLUDE 'date-format.inc' %]
<br>News will still be accessible by direct URL if expired.
</div>
</li>
<li>
<label for="number">Appear in position: </label>
[% IF ( new_detail.number ) %]
<input id="number" size="3" name="number" type="text" value="[% new_detail.number | html %]" />
[% ELSE %]
<input id="number" size="3" name="number" type="text" />
[% END %]
</li>
<li><label for="content">News: </label>
<textarea name="content" id="content" cols="75" rows="10">[% new_detail.content | html %]</textarea>
</li>
</ol>
</fieldset>
<fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
</form>
[% ELSE %]
[% IF ( opac_news_count ) %]
<form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl">
<table id="newst">
<thead> <tr>
<th class="NoSort">&nbsp;</th>
<th>Location</th>
<th>Library</th>
<th>Number</th>
<th>Publication date</th>
<th>Expiration date</th>
<th class="anti-the">Title</th>
<th>Author</th>
<th class="anti-the">News</th>
<th class="NoSort noExport">Actions</th>
</tr></thead>
<tbody>[% FOREACH opac_new IN opac_news %]
[% IF ( opac_new.expired ) %]
<tr class="expired">
[% ELSE %]
<tr>
[% END %]
<td>
<input type="checkbox" name="ids" value="[% opac_new.idnew | html %]" />
</td>
<td>[% SWITCH opac_new.lang %]
[% CASE "koha" %]
Librarian interface
[% CASE "slip" %]
Slip
[% CASE "" %]
All
[% CASE %]
OPAC ([% opac_new.lang | html %])
[% END %]
</td>
<td>[% IF ( opac_new.branchcode == "" ) -%]
All libraries
[% ELSE %][% opac_new.branchname | html %]
[% END %]</td>
<td>[% opac_new.number | html %]</td>
<td data-order="[% opac_new.newdate | html %]">[% opac_new.newdate | $KohaDates %]</td>
<td data-order="[% opac_new.expirationdate | html %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</td>
<td>[% opac_new.title | html %]</td>
<td>[% opac_new.author_title | html %] [% opac_new.author_firstname | html %] [% opac_new.author_surname | html %]</td>
<td>
<div class="btn-group">
<a class="preview_news btn btn-default btn-xs" data-number="[% loop.count | html %]"><i class="fa fa-eye" aria-hidden="true"></i> Preview content</a>
</div>
<div id="contentModal[% loop.count | html %]" class="modal" tabindex="-1" role="dialog" data-number="[% loop.count | html %]">
<div class="modal-dialog" role="document">
<div class="modal-content modal-lg">
<div class="modal-header">
<h5 class="modal-title">Preview of: "[% opac_new.title | html %]"</h5>
</div>
<div class="modal-body">
[% opac_new.content | $raw %]
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</td>
<td class="actions">
[% IF ( wysiwyg ) %]
[% SET editmode = "wysiwyg" %]
[% ELSE %]
[% SET editmode = "text" %]
[% END %]
<div class="btn-group dropup">
<a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew | uri %]&editmode=[% editmode | uri %]" class="btn btn-default btn-xs"> <i class="fa fa-pencil"></i> Edit</a><button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li>
[% IF ( wysiwyg ) %]
<a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew | uri %]&editmode=text"><i class="fa fa-pencil"></i> Edit with text editor</a>
[% ELSE %]
<a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew | uri %]&editmode=wysiwyg"><i class="fa fa-pencil"></i> Edit with WYSIWYG editor</a>
[% END %]
</li>
</ul>
</div>
<div class="btn-group">
<a href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% opac_new.idnew | uri %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
</div>
</td>
</tr>
[% END %]</tbody>
</table>
<input type="hidden" name="op" value="del" />
<fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset>
</form>
[% ELSE %]
<div class="dialog message">There are no news items.</div>
[% END %]
[% END %]
</main>
[% UNLESS ( add_form ) %]
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
<div id="news-filter">
<form action="/cgi-bin/koha/tools/koha-news.pl" method="get">
<h4>Filter</h4>
<fieldset class="brief">
<ol>
<li>
<label for="news_keyword">Keyword:</label>
<input type="text" name="news_keyword" id="news_keyword" />
</li>
<li>
<label for="news_display_location">Display location:</label>
<select name="news_display_location" id="news_display_location">
[% PROCESS lang_locations %]
</select>
</li>
<li>
<label for="news_library">Library: </label>
<select id="news_library" name="news_library">
<option value=""></option>
<option value="">All libraries</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
</select>
</li>
<li>
<label>
<input type="checkbox" name="show_expired" id="show_expired" /> Show expired
</label>
</li>
</ol>
</fieldset>
</form>
</div>
[% INCLUDE 'tools-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
[% END %]
</div> <!-- /.row -->
</div> <!-- /.main.container-fluid -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% IF ( opac_news_count ) %]
[% INCLUDE 'datatables.inc' %]
<script>
$('.preview_news').click( function() {
modalNumber = $(this).attr('data-number');
$('.modal[data-number="'+modalNumber+'"]').modal('show');
})
function Checkbox(){
var form = document.getElementById('del_form');
var inputs = form.getElementsByTagName('input');
var checked = false;
for (var i=0; i<inputs.length; i++) {
if (inputs[i].type == 'checkbox' && inputs[i].name == 'ids') {
checked = inputs[i].checked;
if (checked) return true;
}
}
}
function filterDataTable( table, column, term ){
if( column ){
table.column( column ).search( term ).draw();
} else {
table.search( term ).draw();
}
clearFilter( term );
}
function clearFilter( term ){
if( term == "" ){
$(".dt_button_clear_filter").addClass("disabled");
} else {
$(".dt_button_clear_filter").removeClass("disabled");
}
}
/* Custom table search configuration: If a table row
has an "expired" class, hide it UNLESS the
show_expired checkbox is checked */
$.fn.dataTable.ext.search.push(
function( settings, searchData, index, rowData, counter ) {
var row = $(settings.aoData[index].nTr);
if( row.hasClass("expired") && !$("#show_expired").prop("checked") ){
return false;
} else {
return true;
}
}
);
$(document).ready(function() {
var newst = $("#newst").DataTable($.extend(true, {}, dataTablesDefaults, {
"order": [[ 4, "desc" ]],
"aoColumnDefs": [
{ "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
{ "type": "anti-the", "targets": [ "anti-the" ] }
],
"sPaginationType": "full_numbers"
}));
$(".delete_news").on("click", function(){
return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") );
});
$("#del_form").on("submit",function(){
if ( Checkbox() ) {
return confirmDelete( _("Are you sure you want to delete the selected news?") );
} else {
alert(_("Please select a news item to delete."));
return false;
}
});
$("#show_expired").on("change", function(){
/* redraw the DataTable according to the custom search function */
newst.draw();
});
newst.on( 'search.dt', function () {
var term = newst.search();
$("#news_keyword").val( term );
});
$("#news_keyword").on("keyup", function(){
var term = $(this).val();
filterDataTable( newst, null, term );
});
$("#news_display_location").on("change", function(){
var term = $(this).val();
filterDataTable( newst, 1, term );
});
$("#news_library").on("change", function(){
// Table must be filtered by the <option>'s text, not its value
var opt = $(this).find("option:selected").text();
filterDataTable( newst, 2, opt );
});
$(".dt_button_clear_filter").on("click", function(){
newst.search('').columns().search('').draw();
$("#news-filter select").each(function(){
$(this).val("");
});
});
});
</script>
[% END %]
[% UNLESS ( wysiwyg ) %]
[% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
[% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
[% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
[% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
[% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
<script>
var editor = CodeMirror.fromTextArea(document.getElementById('content'), {
lineNumbers: true,
lineWrapping: true,
lint: true,
mode: "text/html",
gutters: ["CodeMirror-lint-markers"],
viewportMargin: Infinity,
});
</script>
[% ELSE %]
[% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %]
[% INCLUDE 'str/tinymce_i18n.inc' %]
<script>
tinyMCE.init({
verify_html: false,
force_br_newlines : false,
force_p_newlines : false,
forced_root_block : '',
branding : false,
relative_urls : false,
content_css : "[% interface | html %]/[% theme | html %]/css/tinymce.css",
menubar : "file edit view insert format tools table",
mode : "specific_textareas",
plugins : "autoresize table hr link image charmap lists code emoticons",
extended_valid_elements:"style,link[href|rel]",
custom_elements:"style,link,~link",
toolbar : [
"formatselect | bold italic | cut copy paste | alignleft aligncenter alignright | outdent indent | image link unlink anchor cleanup hr",
"table | bullist numlist | undo redo | removeformat | emoticons charmap | forecolor backcolor | code visualaid help"
],
});
</script>
[% END # /IF NewsToolEditor %]
[% END %]
[% BLOCK lang_locations %]
[% IF ( language == "" ) %]
<option value="" selected="selected"></option>
[% ELSE %]
<option value="">All</option>
[% END %]
[% IF ( language == "koha" ) %]
<option value="koha" selected="selected">Librarian interface</option>
[% ELSE %]
<option value="koha">Librarian interface</option>
[% END %]
[% IF ( language == "slip" ) %]
<option value="slip" selected="selected">Slip</option>
[% ELSE %]
<option value="slip">Slip</option>
[% END %]
[% FOREACH lang_lis IN lang_list %]
<optgroup label="[% lang_lis.language | html %]">
[% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacSuggestionInstructions'] %]
[% IF ( location == '' ) %]
[% SET location_lang = lang_lis.language %]
[% location = BLOCK %]OPAC news[% END %]
[% ELSE %]
[% SET location_lang = location _ "_" _ lang_lis.language %]
[% END %]
[% IF ( location_lang == language ) %]
<option value="[% location_lang | html %]" selected="selected">[% location | html %] ([% lang_lis.language | html %])</option>
[% ELSE %]
<option value="[% location_lang | html %]">[% location | html %] ([% lang_lis.language | html %])</option>
[% END %]
[% END %]
</optgroup>
[% END %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]