<%Links::Tools::validate_changes%>
<html>

<head>
<title>Gossamer Links - Tools - Validate Records</title>
<base target="_self">
<script language="JavaScript">
/* Takes a check-all element, and a check-all value of
 * 'email', 'delete', or 'modify'
 */
function checkAll (all, value) {
  var valform = document.valform;
  for (var i = valform.elements.length - 1; i >= 0; i--) {
    var element = valform.elements[i];
    if (/^validate-\d+$/.test(element.name) && element.value == value) {
      if (all.checked)
        element.checked = true;
      else
        document.getElementById(element.name + '-nothing').checked = true;
    }
  }
  checkValidate();
}

function checkValidate () {
  var checked = {
    'modify'       : false,
    'deletechange' : false,
    'emailchange'  : false,
    ''             : false,
    'types'        : 0
  };
  var valform = document.valform;
  if (!valform) return;
  for (var i = valform.elements.length - 1; i >= 0; i--) {
    var element = valform.elements[i];
    if (/^validate-\d+$/.test(element.name) && element.checked) {
      checked[element.value] = true;
      checked['types'] = 0;
      if (checked['']) checked['types']++;
      if (checked['modify']) checked['types']++;
      if (checked['emailchange']) checked['types']++;
      if (checked['deletechange']) checked['types']++;
      if (checked['types'] > 1) break;
    }
  }
  if (checked['types'] > 1) {
    checked['modify'] = checked['deletechange'] = checked['emailchange'] = false;
  }
  if (!document.getElementById('checkall_validate_top')) return;
  document.getElementById('checkall_validate_top').checked    = checked['modify'];
  document.getElementById('checkall_validate_bottom').checked = checked['modify'];
  document.getElementById('checkall_email_top').checked    = checked['emailchange'];
  document.getElementById('checkall_email_bottom').checked = checked['emailchange'];
  document.getElementById('checkall_delete_top').checked    = checked['deletechange'];
  document.getElementById('checkall_delete_bottom').checked = checked['deletechange'];
}

<%if total > 1%>window.onload = checkValidate;<%endif%>

function toggleOriginal(id) {
  var orig = document.getElementById(id);
  orig.style.display = orig.style.display == 'none' ? '' : 'none';
}
</script>
</head>

<body bgcolor="#FFFFFF">

<table border="1" cellpadding="0" cellspacing="0"><tr><td>
	<table bgColor="#ffffff" border="0" cellPadding="3" cellSpacing="3" width="500" valign="top">
	  <tr>
		<td align="left" bgColor="navy"><b><font color="#ffffff" size="2" face="Tahoma,Arial,Helvetica">Validate Changes</font></b></td>
	  </tr>
	  <tr>
		<td>
		  <p align="center"><b><font color="#000000" size="2" face="Tahoma,Arial,Helvetica">Validate Changes</font></b></p>
		  <p><font size="2" face="Tahoma,Arial,Helvetica">This allows you to validate changes that users have requested.</font></p>
                  <p><font size="2" face="Tahoma,Arial,Helvetica">For columns that have been modified, you can view the original contents of the field by clicking on the column name.</font></p>
<%if results%>
	<p><font size="2" face="Tahoma,Arial,Helvetica"><%results%></p>
<%endif%>
		  <p><font size="2" face="Tahoma,Arial,Helvetica">There are <b><%total%></b> links waiting to be validated.</font></p></font></td>
	  </tr>
	</table>
	</td></tr>
</table>

<%if total%>
<br>
<form action="admin.cgi" method="get" name="repage" style="margin: 0px">
  <input type="hidden" name="do" value="page">
  <input type="hidden" name="page" value="tools_validate_changes.html">
  <input type="hidden" name="mh" value="<%if mh%><%mh%><%else%>5<%endif%>" id="mh">
</form>
<form action="admin.cgi" method="post" name="valform">
<input type="hidden" name="do" value="page">
<input type="hidden" name="page" value="tools_validate_changes.html">

<%if total > 1%>
<table border="1" cellpadding="0" cellspacing="0" style="margin-bottom: 20px">
  <tr><td>
    <table bgColor="#ffffff" border="0" cellpadding="3" cellspacing="3" valign="top" width="500">
      <tr><td colspan="2">
        <p><font size="2" face="Tahoma,Arial,Helvetica">
          Pages: <%if toolbar%><%toolbar%><%else%>1<%endif%> -
          Links per page:
          <select onchange="document.getElementById('mh').value = this.value; document.repage.submit()">
            <option value="1"<%if mh == 1%> selected="selected"<%endif%>>1</option>
            <option value="5"<%if mh == 5 or not mh%> selected="selected"<%endif%>>5</option>
            <option value="10"<%if mh == 10%> selected="selected"<%endif%>>10</option>
            <option value="25"<%if mh == 25%> selected="selected"<%endif%>>25</option>
            <option value="100"<%if mh == 100%> selected="selected"<%endif%>>100</option>
          </select>
          <noscript><input type="submit" value="Go"></noscript>
        </font></p>
        <p><font size="2" face="Tahoma,Arial,Helvetica">
          <input type="checkbox" id="checkall_validate_top" onclick="checkAll(this, 'modify')"><label for="checkall_validate_top"> Modify all</label>
          <input type="checkbox" id="checkall_delete_top" onclick="checkAll(this, 'deletechange')"><label for="checkall_delete_top"> Delete all without reason</label>
          <input type="checkbox" id="checkall_email_top" onclick="checkAll(this, 'emailchange')"><label for="checkall_email_top"> Delete all and e-mail reason</label>
        </font></p>
      </td></tr>
    </table>
  </td></tr>
</table>
<%endif%>

<%output%>

<%if total > 1%>
<table border="1" cellpadding="0" cellspacing="0">
  <tr><td>
    <table bgColor="#ffffff" border="0" cellpadding="3" cellspacing="3" valign="top" width="500">
      <tr><td colspan="2">
        <p><font size="2" face="Tahoma,Arial,Helvetica">
          Pages: <%if toolbar%><%toolbar%><%else%>1<%endif%>
          Links per page:
          <select onchange="document.getElementById('mh').value = this.value; document.repage.submit()">
            <option value="1"<%if mh == 1%> selected="selected"<%endif%>>1</option>
            <option value="5"<%if mh == 5 or not mh%> selected="selected"<%endif%>>5</option>
            <option value="10"<%if mh == 10%> selected="selected"<%endif%>>10</option>
            <option value="25"<%if mh == 25%> selected="selected"<%endif%>>25</option>
            <option value="100"<%if mh == 100%> selected="selected"<%endif%>>100</option>
          </select>
          <noscript><input type="submit" value="Go"></noscript>
        </font></p>
        <p><font size="2" face="Tahoma,Arial,Helvetica">
          <input type="checkbox" id="checkall_validate_bottom" onclick="checkAll(this, 'modify')"><label for="checkall_validate_bottom"> Modify all</label>
          <input type="checkbox" id="checkall_delete_bottom" onclick="checkAll(this, 'deletechange')"><label for="checkall_delete_bottom"> Delete all without reason</label>
          <input type="checkbox" id="checkall_email_bottom" onclick="checkAll(this, 'emailchange')"><label for="checkall_email_bottom"> Delete all and e-mail reason</label>
        </font></p>
      </td></tr>
    </table>
  </td></tr>
</table>
<%endif%>

<br>
<table border=1 cellpadding=0 cellspacing=0><tr><td align=center>
	<table border=0 width=500><tr><td align=center><center><input type=submit value="Validate Selected"></font></center></td></tr></table>
</td></tr></table>

</form>
<%endif%>

</body>
</html>



