Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
Owen Leonard eb7456c685 Fix for Bug 4419 - cannot change module for notice templates
Adding a hidden form field to contain the original module
so that it can be used in the check for an existing entry.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-08-27 19:35:44 +12:00

310 lines
11 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Notices[% IF ( add_form ) %][% IF ( modify ) %] &rsaquo; Modify notice[% ELSE %] &rsaquo; Add notice[% END %][% END %][% IF ( add_validate ) %] &rsaquo; Notice added[% END %][% IF ( delete_confirm ) %] &rsaquo; Confirm Deletion[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
$("#lettert").tablesorter({
widgets : ['zebra'],
sortList: [[0,0]],
headers: { 3: {sorter:false},4: { sorter: false }}
});
});
[% IF ( add_form ) %]
function isNotNull(f,noalert) {
if (f.value.length ==0) {
return false;
}
return true;
}
function toUC(f) {
var x=f.value.toUpperCase();
f.value=x;
return true;
}
function isNum(v,maybenull) {
var n = new Number(v.value);
if (isNaN(n)) {
return false;
}
if (maybenull==0 && v.value=='') {
return false;
}
return true;
}
function isDate(f) {
var t = Date.parse(f.value);
if (isNaN(t)) {
return false;
}
}
function Check(f) {
var ok=1;
var _alertString="";
var alertString2;
/* if (!(isNotNull(window.document.Aform.code))) {
_alertString += "\n- " + _("Code missing");
}*/
/* if (!(isNotNull(window.document.Aform.name))) {
_alertString += "\n- " + _("Name missing");
}*/
if (_alertString.length==0) {
document.Aform.submit();
} else {
alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n";
alertString2 += _alertString;
alert(alertString2);
}
}
// GPL code coming from PhpMyAdmin
function insertValueQuery() {
var myQuery = document.Aform.content;
var myListBox = document.Aform.SQLfieldname;
if(myListBox.options.length > 0) {
var chaineAj = "";
var NbSelect = 0;
for(var i=0; i<myListBox.options.length; i++) {
if (myListBox.options[i].selected){
NbSelect++;
if (NbSelect > 1)
chaineAj += ", ";
chaineAj += myListBox.options[i].value;
}
}
//IE support
if (document.selection) {
myQuery.focus();
sel = document.selection.createRange();
sel.text = chaineAj;
document.Aform.insert.focus();
}
//MOZILLA/NETSCAPE support
else if (document.Aform.content.selectionStart || document.Aform.content.selectionStart == "0") {
var startPos = document.Aform.content.selectionStart;
var endPos = document.Aform.content.selectionEnd;
var chaineSql = document.Aform.content.value;
myQuery.value = chaineSql.substring(0, startPos) +'<<'+ chaineAj+'>>' + chaineSql.substring(endPos, chaineSql.length);
} else {
myQuery.value += chaineAj;
}
}
}
[% END %]
//]]>
</script>
</head>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'letters-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %][% IF ( modify ) %]<a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Add notice[% END %][% ELSE %][% IF ( add_validate ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Confirm Deletion[% ELSE %]Notices[% END %][% END %][% END %]</div>
[% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( no_op_set ) %]
<div id="toolbar">
<script type="text/javascript">
//<![CDATA[
// prepare DOM for YUI Toolbar
$(document).ready(function() {
yuiToolbar();
});
// YUI Toolbar Functions
function yuiToolbar() {
new YAHOO.widget.Button("newnotice");
}
//]]>
</script>
<ul class="toolbar">
<li><a id="newnotice" href="/cgi-bin/koha/tools/letter.pl?op=add_form">New Notice</a></li>
</ul></div>
[% IF ( search ) %]
<p>You Searched for <b>[% searchfield %]</b></p>
[% END %]
[% IF ( letter ) %]<table id="lettert">
<thead><tr>
<th>Module</th>
<th>Code</th>
<th>Name</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr></thead>
<tbody>[% FOREACH lette IN letter %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td>[% lette.module %]</td>
<td>[% lette.code %]</td>
<td>[% lette.name %]</td>
<td>
<a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Edit</a>
</td>
<td>
[% IF ( lette.protected ) %]
-
[% ELSE %]
<a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Delete</a>
[% END %]
</td>
</tr>
[% END %]</tbody>
</table>
[% END %]
[% END %]
[% IF ( add_form ) %]
<form action="/cgi-bin/koha/tools/letter.pl" name="Aform" method="post">
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="checked" value="0" />
[% IF ( modify ) %]
<input type="hidden" name="add" value="0" />
[% ELSE %]
<input type="hidden" name="add" value="1" />
[% END %]
<fieldset class="rows">
<legend>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</legend>
<ol>
<li>
<label for="module">Koha module:</label>
<input type="hidden" name="oldmodule" value="[% module %]" />
[% IF ( modify ) %]<select name="module" id="module">[% END %] [% IF ( adding ) %] <select name="module" id="module" onchange="javascript:window.location.href = unescape(window.location.pathname)+'?op=add_form&amp;module='+this.value+'&amp;content='+window.document.forms['Aform'].elements['content'].value;">[% END %]
[% IF ( catalogue ) %]
<option value="catalogue" selected="selected">Catalog</option>
[% ELSE %]
<option value="catalogue" >Catalog</option>
[% END %]
[% IF ( circulation ) %]
<option value="circulation" selected="selected">Circulation</option>
[% ELSE %]
<option value="circulation">Circulation</option>
[% END %]
[% IF ( claimacquisition ) %]
<option value="claimacquisition" selected="selected">Claim Acquisition</option>
[% ELSE %]
<option value="claimacquisition">Claim Acquisition</option>
[% END %]
[% IF ( claimissues ) %]
<option value="claimissues" selected="selected">Claim Serial Issue</option>
[% ELSE %]
<option value="claimissues">Claim Serial Issue</option>
[% END %]
[% IF ( reserves ) %]
<option value="reserves" selected="selected">Holds</option>
[% ELSE %]
<option value="reserves">Holds</option>
[% END %]
[% IF ( members ) %]
<option value="members" selected="selected">Members</option>
[% ELSE %]
<option value="members">Members</option>
[% END %]
[% IF ( serial ) %]
<option value="serial" selected="selected">Serials (Routing List)</option>
[% ELSE %]
<option value="serial">Serials (Routing List)</option>
[% END %]
[% IF ( suggestions ) %]
<option value="suggestions" selected="selected">Suggestions</option>
[% ELSE %]
<option value="suggestions">Suggestions</option>
[% END %]
</select>
</li>
<li>
<span class="label">Code:</span>[% IF ( adding ) %]<input type="text" id="code" name="code" size="20" maxlength="20" />[% ELSE %]<input type="hidden" id="code" name="code" value="[% code %]" />[% code %][% END %]
</li>
<li>
<label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
</li>
<li>
<label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
</li>
<li>
<label for="SQLfieldname">Message Body:</label>
</li>
<li>
<table>
<tr><td><select name="SQLfieldname" id="SQLfieldname" size="9">
[% FOREACH SQLfieldnam IN SQLfieldname %]
<option value="[% SQLfieldnam.value %]">[% SQLfieldnam.text %]</option>
[% END %]
</select></td><td><input type="button" name="insert" value="&gt;&gt;" onclick="insertValueQuery()" title="Insert" /></td><td><textarea name="content" cols="80" rows="15">[% content %]</textarea></td></tr></table>
</li>
</ol>
</fieldset>
<fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
</form>
[% END %]
[% IF ( add_validate ) %]
Data recorded
<form action="[% action %]" method="post">
<input type="submit" value="OK" />
</form>
[% END %]
[% IF ( delete_confirm ) %]
<div class="dialog alert"><h3>Delete Notice?</h3>
<table>
<thead>
<tr>
<th>Module</th>
<th>Code</th>
<th>Name</th>
</tr>
</thead>
<tr>
<td>[% module %]</td>
<td>[% code %]</td>
<td>[% name %]</td>
</tr>
</table>
<form action="[% action %]" method="post">
<input type="hidden" name="op" value="delete_confirmed">
<input type="hidden" name="code" value="[% code %]" />
<input type="hidden" name="module" value="[% module %]" />
<input type="submit" value="Yes, Delete" class="approve" />
</form>
<form action="[% action %]" method="get">
<input type="submit" value="No, Do Not Delete" class="deny" />
</form>
</div>
[% END %]
[% IF ( delete_confirmed ) %]
Data deleted
<form action="[% action %]" method="post">
<input type="submit" value="OK" />
</form>
[% END %]
</div>
</div>
[% UNLESS ( add_form ) %]
<div class="yui-b noprint">
[% INCLUDE 'tools-menu.inc' %]
</div>
[% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]