Use list template for "reloadIfOlderNumber".

pull/1/head
bhoerdzn 11 years ago
parent 52bad7b908
commit 8e74098cd4

@ -352,23 +352,11 @@
</span></span><input type="radio" name="recrawl" id="reloadoldoff" value="nodoubles" #(recrawl_nodoubles)#checked="checked"#(/recrawl_nodoubles)#/>Never load any page that is already known. Only the start-url may be loaded again.</dd>
<dt>Re-load</dt>
<dd><input type="radio" name="recrawl" id="reloadoldage" value="reload" #(recrawl_reload)#checked="checked"#(/recrawl_reload)#/>Treat documents that are loaded
<select name="reloadIfOlderNumber" id="reloadIfOlderNumber">
<option value="1" #(reloadIfOlderNumber_1)#::selected="selected"#(/reloadIfOlderNumber_1)#>1</option>
<option value="2" #(reloadIfOlderNumber_2)#::selected="selected"#(/reloadIfOlderNumber_2)#>2</option>
<option value="3" #(reloadIfOlderNumber_3)#::selected="selected"#(/reloadIfOlderNumber_3)#>3</option>
<option value="4" #(reloadIfOlderNumber_4)#::selected="selected"#(/reloadIfOlderNumber_4)#>4</option>
<option value="5" #(reloadIfOlderNumber_5)#::selected="selected"#(/reloadIfOlderNumber_5)#>5</option>
<option value="6" #(reloadIfOlderNumber_6)#::selected="selected"#(/reloadIfOlderNumber_6)#>6</option>
<option value="7" #(reloadIfOlderNumber_7)#::selected="selected"#(/reloadIfOlderNumber_7)#>7</option>
<option value="8" #(reloadIfOlderNumber_8)#::selected="selected"#(/reloadIfOlderNumber_8)#>8</option>
<option value="9" #(reloadIfOlderNumber_9)#::selected="selected"#(/reloadIfOlderNumber_9)#>9</option>
<option value="10" #(reloadIfOlderNumber_10)#::selected="selected"#(/reloadIfOlderNumber_10)#>10</option>
<option value="12" #(reloadIfOlderNumber_12)#::selected="selected"#(/reloadIfOlderNumber_12)#>12</option>
<option value="14" #(reloadIfOlderNumber_14)#::selected="selected"#(/reloadIfOlderNumber_14)#>14</option>
<option value="21" #(reloadIfOlderNumber_21)#::selected="selected"#(/reloadIfOlderNumber_21)#>21</option>
<option value="28" #(reloadIfOlderNumber_28)#::selected="selected"#(/reloadIfOlderNumber_28)#>28</option>
<option value="30" #(reloadIfOlderNumber_30)#::selected="selected"#(/reloadIfOlderNumber_30)#>30</option>
</select>
<select name="reloadIfOlderNumber" id="reloadIfOlderNumber">
#(reloadIfOlderSelect)#::
#{list}#<option value="#[name]#" #[default]#>#[name]#</option>#{/list}#
#(/reloadIfOlderSelect)#
</select>
<select name="reloadIfOlderUnit" id="reloadIfOlderUnit">
<option value="year" #(reloadIfOlderUnit_year)#::selected="selected"#(/reloadIfOlderUnit_year)#>years</option>
<option value="month" #(reloadIfOlderUnit_month)#::selected="selected"#(/reloadIfOlderUnit_month)#>months</option>

@ -345,21 +345,32 @@ public class CrawlStartExpert_p {
// ---------- Double-Check Rules
// reload settings: number value
prop.put("reloadIfOlderSelect", "1");
for (int i=0; i<13; i++) {
prop.put("reloadIfOlderSelect_list_"+i+"_name", Integer.toString(i));
}
prop.put("reloadIfOlderSelect_list_13_name", "14");
prop.put("reloadIfOlderSelect_list_14_name", "21");
prop.put("reloadIfOlderSelect_list_15_name", "28");
prop.put("reloadIfOlderSelect_list_16_name", "30");
prop.put("reloadIfOlderSelect_list", 16);
if (post != null && post.containsKey("reloadIfOlderNumber")) {
final Integer olderNumber = post.getInt("reloadIfOlderNumber", -1);
if (olderNumber >0 && olderNumber <=12) {
prop.put("reloadIfOlderNumber" + olderNumber, "1");
} else {
Integer olderNumber = post.getInt("reloadIfOlderNumber", -1);
if (olderNumber <=0 || olderNumber >12) {
switch (olderNumber) {
case 14: prop.put("reloadIfOlderNumber_14", "1"); break;
case 21: prop.put("reloadIfOlderNumber_21", "1"); break;
case 28: prop.put("reloadIfOlderNumber_28", "1"); break;
case 30: prop.put("reloadIfOlderNumber_30", "1"); break;
default: prop.put("reloadIfOlderNumber_14", "1"); break;
case 14:
case 21:
case 28:
case 30: break;
default: olderNumber = 14; break;
}
}
prop.put("reloadIfOlderSelect_list_"+olderNumber+"_default",
"selected=\"selected\"");
} else {
prop.put("reloadIfOlderNumber_14", "1");
prop.put("reloadIfOlderSelect_list_14_default",
"selected=\"selected\"");
}
// reload settings: number unit

Loading…
Cancel
Save