<%@language = "javascript" %>
<% /*
    LET OP: Dit bestand moeilijk te beantwoorden vragen kan opwerpen
            en is dan ook een 'undocumented' feature.

    $Revision$
    $Id$

    File:           appl/fac/fac_verify_sha.asp
    Description:    Verify Facilitor asp files
    Parameters:
    Context:        Manual call to check asp file consistency
    Note:           FACTAB authorization is required
*/ %>
<!--#include file="../Shared/common.inc"-->
<!-- #include file="./fac_verify_sha.inc" -->
<%
    var autfunction = "WEB_FACTAB";
    var authparams = user.checkAutorisation(autfunction);
    if (Server.ScriptTimeout<600) Server.ScriptTimeout=600;

%>
<html>
<head>
    <% FCLTHeader.Generate(); %>
    <title>Facilitor file checksum verifier</title>
    <style>
        table { width: 900px!important };
    </style>
</head>
<body id="listbody">
<%
var SHAinfo = findSHAinfo();
if (!SHAinfo)
{
    shared.internal_error("No .sha file found in " + Server.MapPath("../"));
    Response.End()
}

Response.Write("<h1>Checking files from {0} ({1})</h1>".format(
        SHAinfo.shafile,
        toDateTimeString(SHAinfo.shadate)));

%><h2>Correct files (<%=SHAinfo.ok.length%>)</h2><%

if (SHAinfo.changed.length)
{
    %><h2>Changed files (<%=SHAinfo.changed.length%>)</h2>
    <table class='rstable'>
    <thead><tr><th>File</th><th>Message</th><th>Date</th><th>Readonly</th></tr></thead>
    <%
    var cntbad = 0;
    for (var i in SHAinfo.changed)
    {
        var file = SHAinfo.changed[i];
        Response.Write("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>".format(safe.html(file.fname), safe.html(file.message),
                                                                                          toDateTimeString(file.date, true), file.readonly?"ok":"false"));
    }
    %></table><%
}
else
    Response.Write("<p>No modified files detected</p>");

if (SHAinfo.missing.length)
{
    %><h2>Missing files (<%=SHAinfo.missing.length%>)</h2>
    <table class='rstable'>
    <thead><tr><th>File</th></tr></thead>
    <%
    var cntbad = 0;
    for (var i in SHAinfo.missing)
    {
        var file = SHAinfo.missing[i];
        Response.Write("<tr><td>{0}</td></tr>".format(safe.html(file.fname)));
    }
    %></table><%
}

if (SHAinfo.unknown.length)
{
    %><h2>Unknown files (<%=SHAinfo.unknown.length%>)</h2>
    <table class='rstable'>
    <thead><tr><th>File</th><th>Date</th><th>Readonly</th></tr></thead>
    <%
    var cntbad = 0;
    for (var i in SHAinfo.unknown)
    {
        var file = SHAinfo.unknown[i];
        Response.Write("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>".format(safe.html(file.fname), toDateTimeString(file.date, true), file.readonly?"ok":"false"));
    }
    %></table><%
}
Response.Write("<p>Done in " + (SHAinfo.duration) + "ms");

%>
</body>
</html><% ASPPAGE_END(); %>
