function setvar(num,val) {
num=parseInt(num);
val=parseInt(val);
walden_vars[num] = val;
}
function setMode(val) {
walden_mode = val;
}
function removeBefore() {
setvar(35,0);
beforeStr = "";
var ConstraintsDiv = document.getElementById("constraints");
if (ConstraintsDiv != null) { ConstraintsDiv.innerHTML = ""; }
var uns = walden_vars[33];
show_only_unseen(0);
if (uns) { show_only_unseen(1); }
}
function removeAfter() {
setvar(34,0);
afterStr = "";
var ConstraintsDiv = document.getElementById("constraints");
if (ConstraintsDiv != null) { ConstraintsDiv.innerHTML = ""; }
var uns = walden_vars[33];
show_only_unseen(0);
if (uns) { show_only_unseen(0); }
}
function printConstraints() {
var ConstraintsDiv = document.getElementById("constraints");
if (ConstraintsDiv != null) {
var theString = "
";
if ((afterStr.length > 0) && (beforeStr.length > 0)) {
theString += "Only selecting pages added after: "+afterStr;
theString += " (REMOVE)
\n";
theString += "And Before: "+beforeStr+" (REMOVE)
";
} else if (afterStr.length > 0) {
theString += "Only selecting pages added after: "+afterStr;
theString += " (REMOVE)
\n";
} else if (beforeStr.length > 0) {
theString += "Only selecting pages added before: "+beforeStr;
theString += " (REMOVE)
\n";
}
if (walden_vars[33]) {
theString += "Only displaying pages you haven't already seen
\n";
}
ConstraintsDiv.innerHTML = theString;
}
}
function setAfterDate(dateStr) {
var NowDate = new Date();
var ProposedDate = new Date(Date.parse(dateStr));
// if now is < parsed date that's the future
if (NowDate.getTime() < ProposedDate.getTime()) {
alert("Cannot accept constraint - that date's in the future.");
return;
}
// Can't have an after that's after the before
if (beforeStr.length > 0) {
var BeforeDate = new Date(Date.parse(beforeStr));
if (BeforeDate.getTime() < ProposedDate.getTime()) {
alert("You've already specified a constraint that conflicts. Cannot get dates after "+dateStr+
" and before "+beforeStr+" change the other constraint first");
return;
}
}
afterStr = dateStr;
var dateAsSecs = (ProposedDate.getTime())/1000;
setvar(34, dateAsSecs);
printConstraints();
}
function setBeforeDate(dateStr) {
var ProposedDate = new Date(Date.parse(dateStr));
if (afterStr.length > 0) {
var AfterDate = new Date(Date.parse(afterStr));
if (ProposedDate.getTime() < AfterDate.getTime()) {
alert("You've already specified a constraint that conflicts. Cannot get dates after "+afterStr+
" and before "+dateStr+" change the other constraint first");
return;
}
}
beforeStr = dateStr;
var dateAsSecs = (ProposedDate.getTime())/1000;
setvar(35, dateAsSecs);
printConstraints();
}
function goToShowPath() {
var newlocation = "showPath.php?";
for (i = 0; i < walden_vars.length; i++) {
if (walden_vars[i]) {
newlocation += "walden_"+i+"="+walden_vars[i]+"&";
}
}
newlocation = newlocation.substring(0, newlocation.length - 1);
if (walden_mode.length) newlocation += "walden_mode="+walden_mode;
if (walden_mode.length) newlocation += "walden_mode="+walden_mode;
if (newlocation == "showPath.php") return;
// alert(newlocation);
window.location = newlocation;
}
function get_terms() {
var load = window.open('dynamic_path.php?walden_1='+walden_vars[1]+'&walden_5='+walden_vars[5]+'&walden_33='+walden_vars[33]+'&walden_34='+
walden_vars[34]+'&walden_35='+walden_vars[35],'','scrollbars=no,menubar=no,height=120,width=300,'+
'resizable=yes,toolbar=no,location=no,status=no');
}
function goToAlternatePathList() {
var newlocation = "index.php?";
if (!walden_vars[33]) {
walden_vars[33]="0";
}
for (i = 0; i < walden_vars.length; i++) {
if (walden_vars[i]) {
newlocation += "walden_"+i+"="+walden_vars[i]+"&";
}
}
newlocation = newlocation.substring(0, newlocation.length - 1);
if (walden_mode.length) newlocation += "walden_mode="+walden_mode;
if (walden_mode.length) newlocation += "walden_mode="+walden_mode;
// if (newlocation == "index.php") return;
// alert(newlocation);
window.location = newlocation;
}
function printErrors() {
var ConstraintsDiv = document.getElementById("constraints");
if (ConstraintsDiv && ConstraintsDiv.innerHTML) {
if (error_msg.length > 3) {
var orig = ConstraintsDiv.innerHTML;
ConstraintsDiv.innerHTML += "ERROR: "+error_msg+"
";
}
}
}