<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" EnableEventValidation="false"
    CodeFile="ReportDiagnosi.aspx.cs" Inherits="ReportDiagnosi" %>

<%@ Register Assembly="TreeViewCompositeControl" Namespace="CustomCompositeControl"
    TagPrefix="Custom2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Report-->Diagnosi</title>
    <link href="CSS/tv.css" type="text/css" rel="stylesheet" />
    <link href="CSS/Pagina.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="css/CheckScriptDiagnosi.js"></script>
    <script src="Comuni/Script/Utilita.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function updateTop() {
            //parent.TOP.lblNavPath.innerText = "<%=pathNav%>";
            parent.frames['TOP'].document.getElementById('lblNavPath').innerHTML = "<%=pathNav%>";
        }

        function TracciaEventoAudit(boid) {

            //            var url = CalcolaPercorsoFileComuni() + "Infrastruttura/Audit.aspx?boid=" + boid;
            //            Naviga(self.frames('Audit'), url);
        }

        //        function Naviga(Finestra, Url) {

        //            if (Finestra != null)
        //                Finestra.navigate(Url);
        //        }

    </script>
    <!-- MODIFICA PER GESTIONE STAMPA e POOL SU CLIENT-->
    <script language="javascript" type="text/javascript">
        var timerID;
        var queryStringGlobal;
        function generaPDF(url, querystring) {
            //alert(typeof(mettiClessidra));
            //mettiClessidra();
            bloccaPagina(true);
            queryStringGlobal = querystring;
            //alert(queryStringGlobal);
            window.open(url + "?" + querystring);
            timerID = setInterval('poolInterval()', 1000);
            //window.open("Generator.aspx?" + document.getElementById('CampoNascoto').value + "&tipoReport=DIAGNOSI&action=createDiagnosi");
            //document.getElementById('lbl_message').value
            return;
        }
        function bloccaPagina(boleana) {
            if (boleana) {
                document.getElementById('wait').style.display = '';
                document.getElementById('selectorPanel').style.display = 'none';
            } else {
                document.getElementById('wait').style.display = 'none';
                document.getElementById('selectorPanel').style.display = '';
            }
        }
        function poolInterval() {
            var ca = document.cookie.split(';');
            for (var i = 0; i < ca.length; i++) {
                var c = ca[i];
                var vcookie = c.split('=');
                if (vcookie[0].replace(/^\s+|\s+$/g, "") == 'endOfJob') {
                    if (vcookie[1] == 1) {
                        bloccaPagina(false);
                        clearInterval(timerID);
                        var url = "reportStampa.aspx?" + queryStringGlobal;
                        window.navigate(url);
                    } else if (vcookie[1] == 2) {
                        bloccaPagina(false);
                        clearInterval(timerID);
                    }
                    break;
                }
            }
        }

        function checkPresence() {
            var i;
            var found = false;
            var textToFind = trim(document.forms[0].txb_nomeModello.value);

            var lbl_message = document.getElementById('lbl_message');


            if (trim(textToFind) == '') {

                lbl_message.innerText = 'Attenzione. Immettere il nome del modello da salvare.';

                return false;
            }
            else if (textToFind.toUpperCase() == "BASE" || textToFind.toUpperCase() == "COMPLETO") {
                lbl_message.innerText = 'Attenzione. Non � possibile salvare un modello con questo nome, cambiare nome e riprovare con il salvataggio.';
                return false;
            }
            else {

                for (i = 0; i < document.forms[0].ddl_Modello.length; i++) {
                    if (textToFind.toUpperCase() == trim(document.forms[0].ddl_Modello[i].text.toUpperCase())) {
                        found = true;
                    }
                }

                if (found == true) {
                    if (confirm('Un report con questo NOME esiste in archivio. Sovrascriverlo?')) {
                        check_all_in_document(document.forms[0]);
                        return true;
                    }
                    else
                        return false;

                }
                else
                    check_all_in_document(document.forms[0]);
            }
        }

        function trim(stringToTrim) {
            return stringToTrim.replace(/^\s+|\s+$/g, "");
        }

        function CallCheck_all_in_document() {
            check_all_in_document(document.forms[0]);
        }
    </script>
    <!-- FINE MODIFICA PER GESTIONE STAMPA e POOL SU CLIENT-->
</head>
<body onload="updateTop()">
    <form id="mainForm" runat="server">
    <!-- MODIFICA PER GESTIONE STAMPA e POOL SU CLIENT-->
    <div id="wait" style="display: none">
        <asp:Label ID="Label3" runat="server" Text="ATTENDERE IL COMPLETAMENTO DELLA GENERAZIONE DEL REPORT PREGO...."
            Width="697px" BackColor="#E0E0E0" Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black"
            Style="position: absolute; left: 10px; top: 196px;" Font-Bold="True"></asp:Label>
    </div>
    <!-- FINE MODIFICA PER GESTIONE STAMPA e POOL SU CLIENT-->
    <div id="selectorPanel">
        <asp:Label ID="lblTitle" runat="server" CssClass="stateTitle" Style="left: 10px;
            position: absolute" Width="700px">Report di Diagnosi</asp:Label>
        <asp:Button ID="btn_Salva" runat="server" Font-Names="Tahoma" Font-Size="10pt" Height="24px"
            OnClick="btn_Salva_Click" Style="z-index: 106; left: 473px; position: absolute;
            top: 41px; right: 198px;" TabIndex="3" Text="Salva" Width="108px" OnClientClick="return checkPresence();" />
        <asp:Button ID="btn_GestioneModelli" runat="server" Font-Names="Tahoma" Font-Size="10pt"
            Height="24px" OnClientClick="javascript:TracciaEventoAudit('2302');return;" OnClick="btn_GestioneModelli_Click"
            Style="z-index: 106; left: 354px; position: absolute; top: 42px; right: 556px;"
            TabIndex="3" Text="Gestione Modelli" Width="108px" />
        &nbsp;
        <asp:Button ID="btn_Stampa" runat="server" Font-Names="Tahoma" Font-Size="10pt" Height="24px"
            Style="z-index: 106; left: 591px; position: absolute; top: 41px" TabIndex="3"
            Text="Stampa" Width="108px" OnClick="btn_Stampa_Click" OnClientClick="javascript:check_all_in_document_stampa(document.forms[0]);TracciaEventoAudit('2101');return;" />
        <asp:Panel ID="pnl_Controlli" runat="server" BackColor="White" BorderColor="Black"
            BorderStyle="Solid" BorderWidth="1px" Height="40px" Style="z-index: 1; left: 10px;
            position: absolute; top: 30px" Width="700px">
            &nbsp;
            <asp:DropDownList ID="ddl_Modello" runat="server" Style="position: absolute; left: 189px;
                top: 12px; right: 363px;" Width="148px" Enabled="False" AutoPostBack="True" OnSelectedIndexChanged="ddl_Modello_SelectedIndexChanged"
                CssClass="lblSchede">
            </asp:DropDownList>
            <asp:RadioButtonList ID="rbl_scelte" runat="server" Style="position: absolute; left: 8px;
                top: 9px;" AutoPostBack="True" Height="27px" OnSelectedIndexChanged="rbl_scelte_SelectedIndexChanged"
                RepeatDirection="Horizontal" Width="188px" CausesValidation="True">
                <asp:ListItem Selected="True" Value="2">Base</asp:ListItem>
                <asp:ListItem Value="1">Completo</asp:ListItem>
                <asp:ListItem></asp:ListItem>
            </asp:RadioButtonList>
            <asp:RadioButtonList ID="rbl_Privacy" runat="server" Style="position: absolute; left: 6px;
                top: 100px;" Height="27px" OnSelectedIndexChanged="rbl_Privacy_SelectedIndexChanged"
                Width="209px" AutoPostBack="True">
                <asp:ListItem Value="Nominativa">Reportistica nominativa</asp:ListItem>
                <asp:ListItem Value="Anonima">Reportistica in forma anonima</asp:ListItem>
            </asp:RadioButtonList>
            <asp:Label ID="lbl_Privacy" runat="server" Height="21px" Style="z-index: 110; left: 184px;
                position: absolute; top: 110px" Text="Non � possibile stampare la reportistica nominativa in assenza del check di privacy presente nella sezione Dati personali � Anagrafica"
                Width="507px" Font-Bold="False" Font-Names="Tahoma" Font-Size="7pt" Visible="False"></asp:Label>
            <asp:HiddenField ID="cxb7b" runat="server" Value="OFF" />
        </asp:Panel>
        <asp:Panel ID="pnl_InserimentoDati" runat="server" BackColor="White" BorderColor="Black"
            BorderStyle="Solid" BorderWidth="1px" Height="28px" Style="z-index: 1; left: 10px;
            position: absolute; top: 73px" Width="700px">
            <asp:Label ID="Label1" runat="server" CssClass="lblSchede" Height="21px" Style="z-index: 110;
                left: 19px; position: absolute; top: 6px" Text="Nome modello:" Width="93px"></asp:Label>
            <asp:Label ID="Label2" runat="server" CssClass="lblSchede" Height="21px" Style="z-index: 110;
                left: 345px; position: absolute; top: 5px" Text="Descrizione:" Width="78px"></asp:Label>
            <asp:TextBox ID="txb_nomeModello" runat="server" Style="position: absolute; left: 119px;
                top: 3px;" Width="211px" MaxLength="20"></asp:TextBox>
            <asp:TextBox ID="txb_descrizione" runat="server" Style="left: 432px; position: absolute;
                top: 3px" Width="256px" MaxLength="50"></asp:TextBox>
        </asp:Panel>
        <asp:Panel ID="pnl_tv" runat="server" BackColor="White" BorderColor="Black" BorderStyle="None"
            BorderWidth="1px" Height="221px" Style="z-index: 1; left: 11px; position: absolute;
            top: 186px" Width="700px">
            <Custom2:TreeViewCompositeControl ID="TreeViewCompositeControl1" runat="server" />
        </asp:Panel>
        <asp:Panel ID="pnl_message" runat="server" BackColor="White" BorderColor="White"
            BorderStyle="None" BorderWidth="1px" Height="20px" Style="z-index: 1; left: 10px;
            position: absolute; top: 105px" Width="700px">
            <asp:Label ID="lbl_message" runat="server" CssClass="lblMessage" Height="16px" Style="left: 1px;
                position: absolute; top: 2px" Width="700px"></asp:Label>
        </asp:Panel>
    </div>
    <asp:HiddenField ID="HiddenFieldSezioni" runat="server" />
    <asp:HiddenField ID="HiddenFieldStampa" runat="server" />
    </form>
    <%--<iframe id="Audit" src="Comuni/Infrastruttura/PaginaVuota.aspx" frameborder="0" scrolling="no"
        style="display: none; z-index: 1; width: 155px; height: 83px;"></iframe>--%>
</body>
</html>