|
Lines 1-134
Link Here
|
| 1 |
[% INCLUDE 'doc-head-open.inc' %] |
1 |
[% INCLUDE 'doc-head-open.inc' %] |
| 2 |
<title>Koha › Tools › Automatic item modifications by age</title> |
2 |
<title>Koha › Tools › Automatic item modifications by age</title> |
| 3 |
[% INCLUDE 'doc-head-close.inc' %] |
3 |
[% INCLUDE 'doc-head-close.inc' %] |
| 4 |
<script type="text/javascript">//<![CDATA[ |
4 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> |
| 5 |
function clear_inputs(node, new_node) { |
5 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/automatic_item_modification_by_age.js"></script> |
| 6 |
var selects = $(node).find("select"); |
6 |
[% IF op == 'edit_form' %] |
| 7 |
$(selects).each(function(i) { |
7 |
<script type="text/javascript">//<![CDATA[ |
| 8 |
var select = this; |
8 |
$(document).ready(function() { |
| 9 |
$(new_node).find("select").eq(i).val($(select).val()); |
9 |
[% IF ( op == 'edit_form' ) %] |
| 10 |
}); |
10 |
$('#toolbar').fixFloat(); |
| 11 |
var inputs = $(node).find("input"); |
11 |
[% END %] |
| 12 |
$(inputs).each(function(i) { |
12 |
[% IF rules.size > 0 %] |
| 13 |
var input = this; |
13 |
$("#norules").hide(); |
| 14 |
$(new_node).find("input").eq(i).val($(input).val()); |
14 |
[% ELSE %] |
| 15 |
}); |
15 |
$("#rules").show(); |
| 16 |
} |
16 |
[% END %] |
| 17 |
|
17 |
}); |
| 18 |
function remove_block_action( link ) { |
18 |
//]]> |
| 19 |
var blocks = $(link).parent().parent(); |
19 |
</script> |
| 20 |
if( $(blocks).find(".block").length > 2 ) { |
20 |
[% END %] |
| 21 |
$(blocks).find("a.remove_block").show(); |
|
|
| 22 |
} else { |
| 23 |
$(blocks).find("a.remove_block").hide(); |
| 24 |
} |
| 25 |
$(link).parent().remove(); |
| 26 |
} |
| 27 |
|
| 28 |
function remove_rule_action( link ) { |
| 29 |
if( $("#rules").find("div.rule").length < 2 ) { |
| 30 |
$("#rules").hide(); |
| 31 |
$("#norules").show(); |
| 32 |
} |
| 33 |
$(link).parent().remove(); |
| 34 |
} |
| 35 |
|
| 36 |
function clone_block(block) { |
| 37 |
var new_block = $(block).clone(1); |
| 38 |
clear_inputs(block, new_block); |
| 39 |
$(new_block).find('a.remove_block').show(); |
| 40 |
var blocks = $(block).parent(); |
| 41 |
$(blocks).append(new_block); |
| 42 |
$(blocks).find('a.remove_block').click(function(){ |
| 43 |
remove_block_action($(this)); |
| 44 |
}).show(); |
| 45 |
} |
| 46 |
|
| 47 |
$(document).ready(function() { |
| 48 |
$("#new_rule a.remove_rule").hide(); |
| 49 |
$("#new_rule a.remove_block").hide(); |
| 50 |
$("#rules a.remove_block").click(function(){ |
| 51 |
remove_block_action($(this)); |
| 52 |
}); |
| 53 |
$("#rules a.remove_rule").click(function(){ |
| 54 |
remove_rule_action($(this)); |
| 55 |
}); |
| 56 |
|
| 57 |
var unique_id = $("div.rule").length + 1; |
| 58 |
$("a.add_rule").click(function(){ |
| 59 |
var rule = $("#new_rule"); |
| 60 |
var new_rule = $(rule).clone(1); |
| 61 |
$(new_rule).removeAttr('id'); |
| 62 |
$(new_rule).attr('class', 'rule'); |
| 63 |
clear_inputs(rule, new_rule); |
| 64 |
$(new_rule).find("select[name='condition_field']").attr('name', 'condition_field_' + unique_id); |
| 65 |
$(new_rule).find("select[name='substitution_field']").attr('name', 'substitution_field_' + unique_id); |
| 66 |
$(new_rule).find("input[name='condition_value']").attr('name', 'condition_value_' + unique_id); |
| 67 |
$(new_rule).find("input[name='substitution_value']").attr('name', 'substitution_value_' + unique_id); |
| 68 |
$(new_rule).find("input[name='age']").attr('name', 'age_' + unique_id); |
| 69 |
$(new_rule).find("input[name='unique_id']").val(unique_id); |
| 70 |
|
| 71 |
$("#rules").append(new_rule); |
| 72 |
|
| 73 |
if( $("#rules").find("div.rule").length > 0 ) { |
| 74 |
$("#rules").show(); |
| 75 |
$("#norules").hide(); |
| 76 |
} |
| 77 |
if( $("#rules").find(".conditions > .condition").length > 1 ) { |
| 78 |
|
| 79 |
} |
| 80 |
if( $("#rules").find(".conditions > .condition").length > 1 ) { |
| 81 |
|
| 82 |
} |
| 83 |
$(new_rule).find('a.remove_rule').click(function(){ |
| 84 |
remove_rule_action( $(this) ); |
| 85 |
}).show(); |
| 86 |
$(new_rule).find('a.add_rule').remove(); |
| 87 |
unique_id++; |
| 88 |
}); |
| 89 |
|
| 90 |
$("a.add_block").click(function(){ |
| 91 |
clone_block( $(this).parent() ); |
| 92 |
}); |
| 93 |
|
| 94 |
if( $("#rules").find("div.rule").length < 1 ) { |
| 95 |
$("#rules").hide(); |
| 96 |
$("#norules").show(); |
| 97 |
} |
| 98 |
|
| 99 |
$("#rules .rule .blocks").each(function(){ |
| 100 |
if ( $(this).find(".block").length == 1 ) { |
| 101 |
$(this).find("a.remove_block").hide(); |
| 102 |
} |
| 103 |
}); |
| 104 |
|
| 105 |
[% IF op == 'edit_form' %] |
| 106 |
[% IF rules.size > 0 %] |
| 107 |
$("#norules").hide(); |
| 108 |
[% ELSE %] |
| 109 |
$("#rules").show(); |
| 110 |
[% END %] |
| 111 |
[% END %] |
| 112 |
}); |
| 113 |
//]]> |
| 114 |
</script> |
| 115 |
</head> |
21 |
</head> |
| 116 |
<body id="tools_automatic_item_modification_by_age" class="tools"> |
22 |
<body id="tools_automatic_item_modification_by_age" class="tools"> |
| 117 |
[% INCLUDE 'header.inc' %] |
23 |
[% INCLUDE 'header.inc' %] |
| 118 |
[% INCLUDE 'cat-search.inc' %] |
24 |
[% INCLUDE 'cat-search.inc' %] |
| 119 |
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a></div> |
25 |
<div id="breadcrumbs"> |
|
|
26 |
<a href="/cgi-bin/koha/mainpage.pl">Home</a> › |
| 27 |
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › |
| 28 |
[% IF ( op == 'edit_form' ) %] |
| 29 |
<a href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Automatic item modifications by age</a> › |
| 30 |
Rules |
| 31 |
[% ELSE %] |
| 32 |
Automatic item modifications by age |
| 33 |
[% END %] |
| 34 |
</div> |
| 120 |
|
35 |
|
| 121 |
<div id="doc3" class="yui-t2"> |
36 |
<div id="doc3" class="yui-t2"> |
| 122 |
<div id="bd"> |
37 |
<div id="bd"> |
| 123 |
<div id="yui-main"> |
38 |
<div id="yui-main"> |
| 124 |
<div class="yui-b"> |
39 |
<div class="yui-b"> |
| 125 |
<h3>Automatic item modifications by age</h3> |
40 |
|
| 126 |
<div id="toolbar" class="btn-toolbar"> |
41 |
[% IF ( op == 'edit_form' ) %] |
| 127 |
<a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-pencil"></i> Edit</a> |
42 |
<form method="post" id="rules_form" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"> |
| 128 |
</div> |
43 |
<h3>Rules for automatic item modifications by age</h3> |
|
|
44 |
<div id="toolbar" class="btn-toolbar"> |
| 45 |
<div class="btn-group"> |
| 46 |
<button class="btn btn-small add_rule"><i class="fa fa-plus"></i> Add rule</button> |
| 47 |
</div> |
| 48 |
<div class="btn-group"> |
| 49 |
<button type="submit" id="save_rules" class="btn btn-small"><i class="fa fa-save"></i> Save</button> |
| 50 |
</div> |
| 51 |
<div class="btn-group"> |
| 52 |
<a class="btn btn-small" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"><i class="fa fa-remove"></i> Cancel</a> |
| 53 |
</div> |
| 54 |
</div> |
| 55 |
[% ELSE %] |
| 56 |
<h3>Automatic item modifications by age</h3> |
| 57 |
[% IF ( rules ) %] |
| 58 |
<div id="toolbar" class="btn-toolbar"> |
| 59 |
<a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-pencil"></i> Edit rules</a> |
| 60 |
</div> |
| 61 |
[% ELSE %] |
| 62 |
<div id="toolbar" class="btn-toolbar"> |
| 63 |
<a class="btn btn-small" id="newentry" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl?op=edit_form"><i class="fa fa-plus"></i> Add rules</a> |
| 64 |
</div> |
| 65 |
[% END %] |
| 66 |
[% END %] |
| 67 |
|
| 129 |
[% FOR message IN messages %] |
68 |
[% FOR message IN messages %] |
| 130 |
[% IF message.type == "error" %] |
69 |
[% IF message.type == "error" %] |
| 131 |
<div class="dialog error"> |
70 |
<div class="dialog alert"> |
| 132 |
[% END %] |
71 |
[% END %] |
| 133 |
[% IF message.code == "unable_to_load_configuration" %] |
72 |
[% IF message.code == "unable_to_load_configuration" %] |
| 134 |
An error occurs: Unable to load the configuration. |
73 |
An error occurs: Unable to load the configuration. |
|
Lines 137-153
Link Here
|
| 137 |
[% END %] |
76 |
[% END %] |
| 138 |
|
77 |
|
| 139 |
[% IF op == 'edit_form' %] |
78 |
[% IF op == 'edit_form' %] |
| 140 |
<form method="post" action="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl"> |
|
|
| 141 |
<div id="edit_rules"> |
79 |
<div id="edit_rules"> |
| 142 |
<h4>List of rules</h4> |
|
|
| 143 |
<div id="rules"> |
80 |
<div id="rules"> |
| 144 |
[% FOR rule IN rules %] |
81 |
[% FOR rule IN rules %] |
| 145 |
[% SET id = loop.count %] |
82 |
[% SET id = loop.count %] |
| 146 |
<div class="rule"> |
83 |
<fieldset class="rule"> |
|
|
84 |
<legend>Rule <span class="rulecount">[% loop.count %]</span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend> |
| 147 |
<input type="hidden" name="unique_id" value="[% loop.count %]" /> <!-- FIXME on update, the unique_id should be filled --> |
85 |
<input type="hidden" name="unique_id" value="[% loop.count %]" /> <!-- FIXME on update, the unique_id should be filled --> |
| 148 |
<div class="age"> |
86 |
<div class="age"> |
| 149 |
<h5>Age</h5> |
87 |
<h5>Age in days</h5> |
| 150 |
<input type="number" value="[% rule.age %]" name="age_[% id %]" /> days |
88 |
<input class="age" required="required" type="number" value="[% rule.age %]" name="age_[% id %]" /> |
|
|
89 |
<span class="required">Required</span> |
| 151 |
</div> |
90 |
</div> |
| 152 |
<div class="blocks"> |
91 |
<div class="blocks"> |
| 153 |
<h5>Conditions</h5> |
92 |
<h5>Conditions</h5> |
|
Lines 165-172
Link Here
|
| 165 |
</select> |
104 |
</select> |
| 166 |
= |
105 |
= |
| 167 |
<input type="text" value="[% condition.value %]" name="condition_value_[% id%]" /> |
106 |
<input type="text" value="[% condition.value %]" name="condition_value_[% id%]" /> |
| 168 |
<a class="add_block" style="cursor:pointer"><i class="fa fa-plus"></i></a> |
107 |
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a> |
| 169 |
<a class="remove_block" style="cursor:pointer"><i class="fa fa-trash"></i></a> |
108 |
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a> |
| 170 |
</div> |
109 |
</div> |
| 171 |
[% END %] |
110 |
[% END %] |
| 172 |
</div> |
111 |
</div> |
|
Lines 174-180
Link Here
|
| 174 |
<h5>Substitutions</h5> |
113 |
<h5>Substitutions</h5> |
| 175 |
[% FOR substitution IN rule.substitutions %] |
114 |
[% FOR substitution IN rule.substitutions %] |
| 176 |
<div class="block"> |
115 |
<div class="block"> |
| 177 |
<select name="substitution_field_[% id %]"> |
116 |
<select class="required" required="required" name="substitution_field_[% id %]"> |
| 178 |
<option value="">Choose a field name</option> |
117 |
<option value="">Choose a field name</option> |
| 179 |
[% FOR field IN substitution_fields %] |
118 |
[% FOR field IN substitution_fields %] |
| 180 |
[% IF substitution.field == field %] |
119 |
[% IF substitution.field == field %] |
|
Lines 185-216
Link Here
|
| 185 |
[% END %] |
124 |
[% END %] |
| 186 |
</select> |
125 |
</select> |
| 187 |
= |
126 |
= |
| 188 |
<input type="text" value="[% substitution.value %]" name="substitution_value_[% id %]" /> |
127 |
<input class="required" required="required" type="text" value="[% substitution.value %]" name="substitution_value_[% id %]" /> |
| 189 |
<a class="add_block" style="cursor:pointer"><i class="fa fa-plus"></i></a> |
128 |
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a> |
| 190 |
<a class="remove_block" style="cursor:pointer"><i class="fa fa-trash"></i></a> |
129 |
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a> |
|
|
130 |
<span class="required">Required</span> |
| 191 |
</div> |
131 |
</div> |
| 192 |
[% END %] |
132 |
[% END %] |
| 193 |
</div> |
133 |
</div> |
| 194 |
<a class="remove_rule" style="cursor:pointer">Remove this rule</a> |
134 |
</fieldset> |
| 195 |
</div> |
|
|
| 196 |
[% END %] |
135 |
[% END %] |
| 197 |
</div> |
136 |
</div> |
| 198 |
<div id="norules"> |
|
|
| 199 |
There is no rule defined. |
| 200 |
</div> |
| 201 |
<fieldset class="action"> |
| 202 |
<input type="hidden" name="op" value="update" /> |
137 |
<input type="hidden" name="op" value="update" /> |
| 203 |
<a class="cancel" href="/cgi-bin/koha/tools/automatic_item_modification_by_age.pl">Cancel</a> |
|
|
| 204 |
<input type="submit" value="Submit these rules" /> |
| 205 |
</fieldset> |
| 206 |
</div> |
138 |
</div> |
| 207 |
</form> |
139 |
</form> |
| 208 |
<h4>Add a new rule</h4> |
140 |
|
| 209 |
<div id="new_rule"> |
141 |
<div id="norules" class="dialog message"> |
|
|
142 |
There are no rules defined. |
| 143 |
</div> |
| 144 |
|
| 145 |
<fieldset id="new_rule"> |
| 146 |
<legend>Rule <span class="rulecount"></span> <a href="#" class="remove_rule"><i class="fa fa-trash"></i> Remove this rule</a></legend> |
| 210 |
<input type="hidden" name="unique_id" /> |
147 |
<input type="hidden" name="unique_id" /> |
| 211 |
<div class="age"> |
148 |
<div class="age"> |
| 212 |
<h5>Age</h5> |
149 |
<h5>Age in days</h5> |
| 213 |
<input type="number" value="" name="age" /> days |
150 |
<input class="age" type="number" value="" name="age" /> |
|
|
151 |
<span class="required">Required</span> |
| 214 |
</div> |
152 |
</div> |
| 215 |
<div class="blocks"> |
153 |
<div class="blocks"> |
| 216 |
<h5>Conditions</h5> |
154 |
<h5>Conditions</h5> |
|
Lines 223-288
Link Here
|
| 223 |
</select> |
161 |
</select> |
| 224 |
= |
162 |
= |
| 225 |
<input type="text" value="" name="condition_value" /> |
163 |
<input type="text" value="" name="condition_value" /> |
| 226 |
<a class="add_block" style="cursor:pointer"><i class="fa fa-plus"></i></a> |
164 |
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a condition</a> |
| 227 |
<a class="remove_block" style="cursor:pointer"><i class="fa fa-trash"></i></a> |
165 |
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove condition</a> |
| 228 |
</div> |
166 |
</div> |
| 229 |
</div> |
167 |
</div> |
| 230 |
<div class="blocks"> |
168 |
<div class="blocks"> |
| 231 |
<h5>Substitutions</h5> |
169 |
<h5>Substitutions</h5> |
| 232 |
<div class="block"> |
170 |
<div class="block"> |
| 233 |
<select name="substitution_field"> |
171 |
<select required="required" class="required" name="substitution_field"> |
| 234 |
<option value="">Choose a field name</option> |
172 |
<option value="">Choose a field name</option> |
| 235 |
[% FOR field IN substitution_fields %] |
173 |
[% FOR field IN substitution_fields %] |
| 236 |
<option value="[% field %]">[% field %]</option> |
174 |
<option value="[% field %]">[% field %]</option> |
| 237 |
[% END %] |
175 |
[% END %] |
| 238 |
</select> |
176 |
</select> |
| 239 |
= |
177 |
= |
| 240 |
<input type="text" value="" name="substitution_value" /> |
178 |
<input class="required" required="required" type="text" value="" name="substitution_value" /> |
| 241 |
<a class="add_block" style="cursor:pointer"><i class="fa fa-plus"></i></a> |
179 |
<a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a> |
| 242 |
<a class="remove_block" style="cursor:pointer"><i class="fa fa-trash"></i></a> |
180 |
<a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a> |
|
|
181 |
<span class="required">Required</span> |
| 243 |
</div> |
182 |
</div> |
| 244 |
</div> |
183 |
</div> |
| 245 |
<a class="add_rule" style="cursor:pointer">Add this rule</a> |
184 |
</fieldset> |
| 246 |
<a class="remove_rule" style="cursor:pointer">Remove this rule</a> |
185 |
[% ELSIF rules %] |
| 247 |
</div> |
186 |
<div> |
| 248 |
[% ELSIF rules and op == 'show' %] |
187 |
<h4>List of rules</h4> |
| 249 |
<div id="rules"> |
188 |
<table id="rulest"> |
| 250 |
<h4>List of rules</h4> |
189 |
<thead> |
| 251 |
[% FOR rule IN rules %] |
190 |
<tr> |
| 252 |
<div class="rule"> |
191 |
<th>Age</th> |
| 253 |
<div class="age"> |
192 |
<th>Conditions</th> |
| 254 |
<h5>Age</h5> |
193 |
<th>Substitutions</th> |
| 255 |
[% IF rule.age.defined and rule.age.length > 0 %] |
194 |
</tr> |
| 256 |
[% rule.age %] days |
195 |
</thead> |
| 257 |
[% ELSE %] |
196 |
<tbody> |
| 258 |
There is no age for this rule. |
197 |
[% FOR rule IN rules %] |
| 259 |
[% END %] |
198 |
<tr> |
| 260 |
</div> |
199 |
<td> |
| 261 |
<div class="blocks"> |
200 |
[% IF rule.age.defined and rule.age.length > 0 %] |
| 262 |
<h5>Conditions</h5> |
201 |
[% rule.age %] days |
| 263 |
[% FOR condition IN rule.conditions %] |
202 |
[% ELSE %] |
| 264 |
[% IF condition.field %] |
203 |
There is no age for this rule. |
| 265 |
<div class="block"> |
204 |
[% END %] |
| 266 |
[% condition.field %] = [% condition.value %] |
205 |
</td> |
| 267 |
</div> |
206 |
<td> |
| 268 |
[% ELSE %] |
207 |
[% FOR condition IN rule.conditions %] |
| 269 |
There is no condition for this rule. |
208 |
[% IF condition.field %] |
| 270 |
[% END %] |
209 |
<div class="block"> |
| 271 |
[% END %] |
210 |
[% condition.field %] = [% condition.value %] |
| 272 |
</div> |
211 |
</div> |
| 273 |
<div class="blocks"> |
212 |
[% ELSE %] |
| 274 |
<h5>Substitutions</h5> |
213 |
There is no condition for this rule. |
| 275 |
[% FOR substitution IN rule.substitutions %] |
214 |
[% END %] |
| 276 |
<div class="block"> |
215 |
[% END %] |
| 277 |
[% substitution.field %] = [% substitution.value %] |
216 |
</td> |
| 278 |
</div> |
217 |
<td> |
| 279 |
[% END %] |
218 |
[% FOR substitution IN rule.substitutions %] |
| 280 |
</div> |
219 |
<div class="block"> |
| 281 |
</div> |
220 |
[% substitution.field %] = [% substitution.value %] |
| 282 |
[% END %] |
221 |
</div> |
| 283 |
</div> |
222 |
[% END %] |
|
|
223 |
</td> |
| 224 |
</tr> |
| 225 |
[% END %] |
| 226 |
</tbody> |
| 227 |
</table> |
| 228 |
</div> |
| 284 |
[% ELSE %] |
229 |
[% ELSE %] |
| 285 |
There is no rule defined. Please click on the edit button. |
230 |
<div class="dialog message"> |
|
|
231 |
There are no rules defined. |
| 232 |
</div> |
| 286 |
[% END %] |
233 |
[% END %] |
| 287 |
|
234 |
|
| 288 |
</div> |
235 |
</div> |