inizio fix menù top x bootstrap...
This commit is contained in:
@@ -1,98 +1,98 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_testata.ascx.cs" Inherits="CMS_SC.WebUserControls.mod_testata" %>
|
||||
|
||||
<!-- Fixed navbar -->
|
||||
<div class="navbar navbar-fixed-top" role="navigation" style="background-color: white;">
|
||||
<div class="container-fluid" style="padding: 0px;">
|
||||
<div class="collapse subnav-collapse">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" id="A4" runat="server" href="~/Default">
|
||||
<img src="~/Images/LogoCms.png" alt="CMS" class="img-responsive" runat="server" id="imgLogo" height="70" width="160" />
|
||||
</a>
|
||||
<div class="subnavbar">
|
||||
<div class="subnavbar-inner">
|
||||
<div class="container">
|
||||
<div class="navbar navbar-expand-sm navbar-light bg-light fixed-top p-4 m-0">
|
||||
<%--<a class="navbar-brand" href="#">
|
||||
<asp:HyperLink runat="server" ID="hlHome" NavigateUrl="~/" CssClass="navbar-brand" ToolTip='<%# SteamWare.memLayer.ML.confReadString("titleApp") %>'> <i class="fa fa-home fa-lg"></i></asp:HyperLink>
|
||||
<asp:LinkButton CssClass="navbar-brand" runat="server" ID="lbnUpdate" Text="---" OnClick="lbnUpdate_Click" ToolTip="Update"><%: nomePag %> <i class="fa-lg <%: cssIconPag %>"></i></asp:LinkButton></a>--%>
|
||||
<a class="navbar-brand" id="A1" runat="server" href="~/Default">
|
||||
<img src="~/Images/LogoCms.png" alt="CMS" class="img-responsive" runat="server" id="imgLogo" height="70" width="160" />
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav">
|
||||
<li class='<%: "nav-item " + liClass("Home") %>'>
|
||||
<a href="Home">
|
||||
<i class="fa fa-home"></i>
|
||||
<span>Home</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class='<%: "nav-item dropdown " + checkShow("Anagrafiche") + liClass("AnagFamMacchine AnagMatricole AnagFasi AnagMisure AnagSchedeColl DettScheda SchemaCollFamMacc")%>'>
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-th"></i>
|
||||
<span>Anagrafiche</span></a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink1">
|
||||
<a class="dropdown-item" href="AnagFasi"><%: traduci("AnagFasi") %></a>
|
||||
<a class="dropdown-item" href="AnagTags"><%: traduci("AnagTags") %></a>
|
||||
<a class="dropdown-item" href="AnagSchedeColl"><%: traduci("AnagSchedeColl") %></a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="AnagFamMacchine"><%: traduci("AnagFamMacchine") %></a>
|
||||
<a class="dropdown-item" href="AnagMatricole"><%: traduci("AnagMatricole") %></a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="DettScheda"><%: traduci("DettScheda") %></a>
|
||||
<a class="dropdown-item" href="SchemaCollFamMacc"><%: traduci("SchemaCollFamMacc") %></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class='<%: "nav-item dropdown " + checkShow("Collaudi") + liClass("SchemaCollMacc ElencoSchede Collaudi")%>'>
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-copy"></i>
|
||||
<span>Collaudi</span></a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink1">
|
||||
<a class='<%: "dropdown-item " + checkShow("CollaudiAdv")%>' href="SchemaCollMacc"><%: traduci("SchemaCollMacc") %></a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class='<%: "dropdown-item " + checkShow("CollaudiAdv")%>' href="ElencoSchede"><%: traduci("ElencoSchede") %></a>
|
||||
<a class='<%: "dropdown-item " + checkShow("CollaudiAdv")%>' href="StatoDossiers"><%: traduci("StatoDossiers") %></a>
|
||||
<a class="dropdown-item" href="Collaudi"><%: traduci("Collaudi") %></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class='<%: "dropdown " + checkShow("Reports") + liClass("ReportCompatto ReportCompleto ReportCliente")%>'>
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-print"></i>
|
||||
<span>Reports</span> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="ReportCompatto"><%: traduci("ReportCompatto") %></a></li>
|
||||
<li><a href="ReportCompleto"><%: traduci("ReportCompleto") %></a></li>
|
||||
<li><a href="ReportCliente"><%: traduci("ReportCliente") %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class='<%: "dropdown " + checkShow("Settings") + liClass("Settings Vocabolario ListValues UserAdmin UpdateVoc")%>'>
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-cog"></i>
|
||||
<span>Settings</span> <b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li id="liGestVoc"><a href="Vocabolario"><%: traduci("GestVoc") %></a></li>
|
||||
<li id="liListValues"><a href="ListValues"><%: traduci("ListValuesMgmt") %></a></li>
|
||||
<li id="liUserAdmin"><a href="UserAdmin"><%: traduci("UserAdmin") %></a></li>
|
||||
<li class="divider" id="liDivider"></li>
|
||||
<li id="liUpdateVoc"><a href="UpdateVoc"><%: traduci("UpdateVoc") %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="bg-info">
|
||||
<asp:HyperLink runat="server" ID="hlUser" ToolTip='<%# usrAuthToolTip %>'>
|
||||
<i class="fa fa-user fa-lg <%: usrAuthCss %>"></i>
|
||||
<span>
|
||||
<asp:Label runat="server" ID="lblMatr" Text='<%# usrAuthText %>' /></span>
|
||||
</asp:HyperLink></li>
|
||||
</ul>
|
||||
<form class="form-inline my-2 my-lg-0">
|
||||
<asp:TextBox ID="txtSearch" runat="server" CssClass="form-control input-sm search-query" placeholder="[S]earch" AutoPostBack="true" OnTextChanged="txtSearch_TextChanged" TextMode="Search" AccessKey="s" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<a href="javascript:;" class="subnav-toggle" data-toggle="collapse" data-target=".subnav-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<i class="fa fa-reorder"></i>
|
||||
</a>
|
||||
<div class="collapse subnav-collapse">
|
||||
<ul class="mainnav">
|
||||
<li class='<%: liClass("Default") %>'>
|
||||
<a href="Home">
|
||||
<i class="fa fa-home"></i>
|
||||
<span>Home</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class='<%: "dropdown " + checkShow("Anagrafiche") + liClass("AnagFamMacchine AnagMatricole AnagFasi AnagMisure AnagSchedeColl DettScheda SchemaCollFamMacc")%>'>
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-th"></i>
|
||||
<span>Anagrafiche</span> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="AnagFasi"><%: traduci("AnagFasi") %></a></li>
|
||||
<li><a href="AnagTags"><%: traduci("AnagTags") %></a></li>
|
||||
<li><a href="AnagSchedeColl"><%: traduci("AnagSchedeColl") %></a></li>
|
||||
<li runat="server" id="li1" class="divider"></li>
|
||||
<li><a href="AnagFamMacchine"><%: traduci("AnagFamMacchine") %></a></li>
|
||||
<li><a href="AnagMatricole"><%: traduci("AnagMatricole") %></a></li>
|
||||
<li runat="server" id="li2" class="divider"></li>
|
||||
<li><a href="DettScheda"><%: traduci("DettScheda") %></a></li>
|
||||
<li><a href="SchemaCollFamMacc"><%: traduci("SchemaCollFamMacc") %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class='<%: "dropdown " + checkShow("Collaudi") + liClass("SchemaCollMacc ElencoSchede Collaudi")%>'>
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-copy"></i>
|
||||
<span>Collaudi</span> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class='<%: checkShow("CollaudiAdv")%>'><a href="SchemaCollMacc"><%: traduci("SchemaCollMacc") %></a></li>
|
||||
<li runat="server" id="li3" class="divider"></li>
|
||||
<li class='<%: checkShow("CollaudiAdv")%>'><a href="ElencoSchede"><%: traduci("ElencoSchede") %></a></li>
|
||||
<li class='<%: checkShow("CollaudiAdv")%>'><a href="StatoDossiers"><%: traduci("StatoDossiers") %></a></li>
|
||||
<li><a href="Collaudi"><%: traduci("Collaudi") %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class='<%: "dropdown " + checkShow("Reports") + liClass("ReportCompatto ReportCompleto ReportCliente")%>'>
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-print"></i>
|
||||
<span>Reports</span> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="ReportCompatto"><%: traduci("ReportCompatto") %></a></li>
|
||||
<li><a href="ReportCompleto"><%: traduci("ReportCompleto") %></a></li>
|
||||
<li><a href="ReportCliente"><%: traduci("ReportCliente") %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class='<%: "dropdown " + checkShow("Settings") + liClass("Settings Vocabolario ListValues UserAdmin UpdateVoc")%>'>
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-cog"></i>
|
||||
<span>Settings</span> <b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li id="liGestVoc"><a href="Vocabolario"><%: traduci("GestVoc") %></a></li>
|
||||
<li id="liListValues"><a href="ListValues"><%: traduci("ListValuesMgmt") %></a></li>
|
||||
<li id="liUserAdmin"><a href="UserAdmin"><%: traduci("UserAdmin") %></a></li>
|
||||
<li class="divider" id="liDivider"></li>
|
||||
<li id="liUpdateVoc"><a href="UpdateVoc"><%: traduci("UpdateVoc") %></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="bg-info">
|
||||
<asp:HyperLink runat="server" ID="hlUser" ToolTip='<%# usrAuthToolTip %>'>
|
||||
<i class="fa fa-user fa-lg <%: usrAuthCss %>"></i>
|
||||
<span>
|
||||
<asp:Label runat="server" ID="lblMatr" Text='<%# usrAuthText %>' /></span>
|
||||
</asp:HyperLink></li>
|
||||
</ul>
|
||||
<div class="navbar-form navbar-right" role="search">
|
||||
<div class="form-group-md navbar-brand">
|
||||
<asp:TextBox ID="txtSearch" runat="server" CssClass="form-control input-sm search-query" placeholder="[S]earch" AutoPostBack="true" OnTextChanged="txtSearch_TextChanged" TextMode="Search" AccessKey="s" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse subnav-collapse">
|
||||
|
||||
<div class="subnavbar">
|
||||
<div class="subnavbar-inner">
|
||||
<div class="container">
|
||||
|
||||
<a href="javascript:;" class="subnav-toggle" data-toggle="collapse" data-target=".subnav-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<i class="fa fa-reorder"></i>
|
||||
</a>
|
||||
<div class="collapse subnav-collapse">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,104 +7,104 @@ using System.Web.UI;
|
||||
|
||||
namespace CMS_SC.WebUserControls
|
||||
{
|
||||
public partial class mod_testata : System.Web.UI.UserControl
|
||||
public partial class mod_testata : System.Web.UI.UserControl
|
||||
{
|
||||
///// <summary>
|
||||
///// nome della pagina correntemente caricata
|
||||
///// </summary>
|
||||
//public string _paginaCorrente;
|
||||
///// <summary>
|
||||
///// memorizza la pagina precedente (ovvero la corrente ma non da page-object ma in session...
|
||||
///// </summary>
|
||||
//public string _paginaPrecedente;
|
||||
|
||||
/// <summary>
|
||||
/// calcola currentPage
|
||||
/// </summary>
|
||||
protected string currPage
|
||||
{
|
||||
///// <summary>
|
||||
///// nome della pagina correntemente caricata
|
||||
///// </summary>
|
||||
//public string _paginaCorrente;
|
||||
///// <summary>
|
||||
///// memorizza la pagina precedente (ovvero la corrente ma non da page-object ma in session...
|
||||
///// </summary>
|
||||
//public string _paginaPrecedente;
|
||||
get
|
||||
{
|
||||
return Request.Url.LocalPath.Split('/').Last();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// definisce visibilità logo: sempre SE la pagina non è quella default (su cui il logo è visibile in grande...)
|
||||
/// </summary>
|
||||
public bool logoVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return currPage != "Default";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// titolo pagina
|
||||
/// </summary>
|
||||
public string titolo
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.getPage(Request.Url);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// caricamento pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// altri controlli
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
txtSearch.Visible = pageHasSearch;
|
||||
Page.Title = Request.Url.ToString();
|
||||
// se ho cambiato pagina registro...)
|
||||
if (devicesAuthProxy.pagPrecedente != titolo)
|
||||
{
|
||||
devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente;
|
||||
}
|
||||
// salvo pagina corrente
|
||||
devicesAuthProxy.pagCorrente = titolo;
|
||||
// fix logo
|
||||
imgLogo.Visible = logoVisible;
|
||||
//PagCorrente(); // tolto 2015.02.24
|
||||
memLayer.ML.emptySessionVal("searchVal");
|
||||
// fix componenti
|
||||
hlUser.DataBind();
|
||||
}
|
||||
// SOLO se la pagina NON E' "safe"...
|
||||
if (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) < 0)
|
||||
{
|
||||
bool userOk = checkUser();
|
||||
bool pageOk = checkPageIsAuth();
|
||||
// controllo se c'è utente in sessione..
|
||||
if ((userOk))
|
||||
{
|
||||
// ora controllo pagina...
|
||||
if (!pageOk)
|
||||
{
|
||||
if (devicesAuthProxy.stObj.isPageEnabled(devicesAuthProxy.pagPrecedente))
|
||||
{
|
||||
Response.Redirect(devicesAuthProxy.pagPrecedente);
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("Home");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("UserAdmin");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// calcola currentPage
|
||||
/// </summary>
|
||||
protected string currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return Request.Url.LocalPath.Split('/').Last();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// definisce visibilità logo: sempre SE la pagina non è quella default (su cui il logo è visibile in grande...)
|
||||
/// </summary>
|
||||
public bool logoVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return currPage != "Default";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// titolo pagina
|
||||
/// </summary>
|
||||
public string titolo
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.getPage(Request.Url);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// caricamento pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// altri controlli
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
txtSearch.Visible = pageHasSearch;
|
||||
Page.Title = Request.Url.ToString();
|
||||
// se ho cambiato pagina registro...)
|
||||
if (devicesAuthProxy.pagPrecedente != titolo)
|
||||
{
|
||||
devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente;
|
||||
}
|
||||
// salvo pagina corrente
|
||||
devicesAuthProxy.pagCorrente = titolo;
|
||||
// fix logo
|
||||
imgLogo.Visible = logoVisible;
|
||||
//PagCorrente(); // tolto 2015.02.24
|
||||
memLayer.ML.emptySessionVal("searchVal");
|
||||
// fix componenti
|
||||
hlUser.DataBind();
|
||||
}
|
||||
// SOLO se la pagina NON E' "safe"...
|
||||
if (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) < 0)
|
||||
{
|
||||
bool userOk = checkUser();
|
||||
bool pageOk = checkPageIsAuth();
|
||||
// controllo se c'è utente in sessione..
|
||||
if ((userOk))
|
||||
{
|
||||
// ora controllo pagina...
|
||||
if (!pageOk)
|
||||
{
|
||||
if (devicesAuthProxy.stObj.isPageEnabled(devicesAuthProxy.pagPrecedente))
|
||||
{
|
||||
Response.Redirect(devicesAuthProxy.pagPrecedente);
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect("Home");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("UserAdmin");
|
||||
}
|
||||
}
|
||||
|
||||
//liReports.Visible = userIsSuperUser || userIsSuperAdmin;
|
||||
//liSettings.Visible = userIsSuperUser || userIsSuperAdmin;
|
||||
//ulSettings.Visible = userIsSuperAdmin;
|
||||
//liReports.Visible = userIsSuperUser || userIsSuperAdmin;
|
||||
//liSettings.Visible = userIsSuperUser || userIsSuperAdmin;
|
||||
//ulSettings.Visible = userIsSuperAdmin;
|
||||
#if false
|
||||
liListValues.Visible = userIsSuperAdmin;
|
||||
liImport.Visible = userIsSuperUser;
|
||||
@@ -112,350 +112,341 @@ namespace CMS_SC.WebUserControls
|
||||
liDivider.Visible = userIsSuperAdmin;
|
||||
liUpdateVoc.Visible = userIsSuperAdmin;
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica che la pagina sia tra quelle autorizzate x l'utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool checkPageIsAuth()
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica che la pagina sia tra quelle autorizzate x l'utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool checkPageIsAuth()
|
||||
{
|
||||
bool allOk = false;
|
||||
bool pageSafe = (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) >= 0);
|
||||
bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(titolo);
|
||||
allOk = (pageSafe || pageAuth);
|
||||
return allOk;
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica presenza utente autorizzato in sessione
|
||||
/// </summary>
|
||||
private bool checkUser()
|
||||
{
|
||||
bool allOk = devicesAuthProxy.stObj.isAuth;
|
||||
if (!devicesAuthProxy.stObj.isAuth)
|
||||
{
|
||||
// controllo cookie device...
|
||||
allOk = checkAuthCookieCMS_SC();
|
||||
if (!allOk)
|
||||
{
|
||||
bool allOk = false;
|
||||
bool pageSafe = (memLayer.ML.confReadString("PageNoIndex").IndexOf(titolo) >= 0);
|
||||
bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(titolo);
|
||||
allOk = (pageSafe || pageAuth);
|
||||
return allOk;
|
||||
ResetUser();
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica presenza utente autorizzato in sessione
|
||||
/// </summary>
|
||||
private bool checkUser()
|
||||
}
|
||||
return allOk;
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica la presenza di un cookie VALIDO per autorizzare il device ed avvia utente...
|
||||
/// </summary>
|
||||
private bool checkAuthCookieCMS_SC()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies[devicesAuthProxy.AuthCookieName];
|
||||
if (!(cookie == null || cookie.Value == ""))
|
||||
{
|
||||
bool allOk = devicesAuthProxy.stObj.isAuth;
|
||||
if (!devicesAuthProxy.stObj.isAuth)
|
||||
{
|
||||
// controllo cookie device...
|
||||
allOk = checkAuthCookieCMS_SC();
|
||||
if (!allOk)
|
||||
{
|
||||
ResetUser();
|
||||
}
|
||||
}
|
||||
return allOk;
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica la presenza di un cookie VALIDO per autorizzare il device ed avvia utente...
|
||||
/// </summary>
|
||||
private bool checkAuthCookieCMS_SC()
|
||||
{
|
||||
bool answ = false;
|
||||
// ricavo utente da cookie...
|
||||
string userAgent = "";
|
||||
string postazione_IP = "";
|
||||
string devSecret = cookie.Value;
|
||||
DS_Auth.AnagDevicesRow device = null;
|
||||
// cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
|
||||
string email = "";
|
||||
try
|
||||
{
|
||||
device = devicesAuthProxy.stObj.taAnagDev.getByDeviceSecret(devSecret)[0];
|
||||
email = device.USER_NAME;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("{0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
// cerco se si tratti PER CASO di un cookie di auth "base" per utenti base...
|
||||
if (email == "")
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies[devicesAuthProxy.AuthCookieName];
|
||||
if (!(cookie == null || cookie.Value == ""))
|
||||
email = devicesAuthProxy.decodeKey(cookie.Value);
|
||||
// cerco SE email sia valida...
|
||||
if (devicesAuthProxy.stObj.checkUserEmail(email))
|
||||
{
|
||||
// se l'utente è "base" procedo...
|
||||
if (devicesAuthProxy.stObj.numAuth(email) != 0)
|
||||
{
|
||||
// ricavo utente da cookie...
|
||||
string userAgent = "";
|
||||
string postazione_IP = "";
|
||||
string devSecret = cookie.Value;
|
||||
DS_Auth.AnagDevicesRow device = null;
|
||||
// cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
|
||||
string email = "";
|
||||
try
|
||||
{
|
||||
device = devicesAuthProxy.stObj.taAnagDev.getByDeviceSecret(devSecret)[0];
|
||||
email = device.USER_NAME;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("{0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
// cerco se si tratti PER CASO di un cookie di auth "base" per utenti base...
|
||||
if (email == "")
|
||||
{
|
||||
try
|
||||
{
|
||||
email = devicesAuthProxy.decodeKey(cookie.Value);
|
||||
// cerco SE email sia valida...
|
||||
if (devicesAuthProxy.stObj.checkUserEmail(email))
|
||||
{
|
||||
// se l'utente è "base" procedo...
|
||||
if (devicesAuthProxy.stObj.numAuth(email) != 0)
|
||||
{
|
||||
email = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
email = "";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
email = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
email = "";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
if (email != "")
|
||||
{
|
||||
// aggiorno descrizione (user agent) ed IP...
|
||||
userAgent = Request.UserAgent;
|
||||
postazione_IP = Request.UserHostAddress;
|
||||
// controllo IP e DeviceDescription x eventuale update
|
||||
if (device != null)
|
||||
{
|
||||
if (((device.lastIPv4 != postazione_IP) || (device.Description != userAgent)))
|
||||
{
|
||||
try
|
||||
{
|
||||
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
|
||||
devicesAuthProxy.stObj.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// salvo in sessione utente l'email...
|
||||
memLayer.ML.setSessionVal("email", email);
|
||||
// avvio utente...
|
||||
devicesAuthProxy.stObj.startUpUtente(email);
|
||||
// salvo dati di AUTH OP (x visualizzazione in testata...)
|
||||
OpAuth.startOpAuth(email, devicesAuthProxy.stObj.CognomeNome);
|
||||
hlUser.DataBind();
|
||||
// salvo gruppo...
|
||||
if (devicesAuthProxy.stObj.isAuth)
|
||||
{
|
||||
// se tutto ok
|
||||
memLayer.ML.setSessionVal("Gruppo", devicesAuthProxy.stObj.rigaUtente.CodGruppo);
|
||||
answ = true;
|
||||
}
|
||||
if (email != "")
|
||||
{
|
||||
// aggiorno descrizione (user agent) ed IP...
|
||||
userAgent = Request.UserAgent;
|
||||
postazione_IP = Request.UserHostAddress;
|
||||
// controllo IP e DeviceDescription x eventuale update
|
||||
if (device != null)
|
||||
{
|
||||
if (((device.lastIPv4 != postazione_IP) || (device.Description != userAgent)))
|
||||
{
|
||||
try
|
||||
{
|
||||
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
|
||||
devicesAuthProxy.stObj.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// salvo in sessione utente l'email...
|
||||
memLayer.ML.setSessionVal("email", email);
|
||||
// avvio utente...
|
||||
devicesAuthProxy.stObj.startUpUtente(email);
|
||||
// salvo dati di AUTH OP (x visualizzazione in testata...)
|
||||
OpAuth.startOpAuth(email, devicesAuthProxy.stObj.CognomeNome);
|
||||
hlUser.DataBind();
|
||||
// salvo gruppo...
|
||||
if (devicesAuthProxy.stObj.isAuth)
|
||||
{
|
||||
// se tutto ok
|
||||
memLayer.ML.setSessionVal("Gruppo", devicesAuthProxy.stObj.rigaUtente.CodGruppo);
|
||||
answ = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta utente
|
||||
/// </summary>
|
||||
private void ResetUser()
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta utente
|
||||
/// </summary>
|
||||
private void ResetUser()
|
||||
{
|
||||
devicesAuthProxy.stObj.clearAllUserData();
|
||||
// svuoto cookie...
|
||||
memLayer.ML.setCookieVal(devicesAuthProxy.AuthCookieName, "");
|
||||
memLayer.ML.emptyCookieVal(devicesAuthProxy.AuthCookieName);
|
||||
}
|
||||
/// <summary>
|
||||
/// classe grafica da pagina corrente
|
||||
/// </summary>
|
||||
/// <param name="nomeElem"></param>
|
||||
/// <returns></returns>
|
||||
public string liClass(string nomeElem)
|
||||
{
|
||||
string answ = "";
|
||||
if (user_std.pagCorrente != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
devicesAuthProxy.stObj.clearAllUserData();
|
||||
// svuoto cookie...
|
||||
memLayer.ML.setCookieVal(devicesAuthProxy.AuthCookieName, "");
|
||||
memLayer.ML.emptyCookieVal(devicesAuthProxy.AuthCookieName);
|
||||
if (nomeElem.IndexOf(user_std.pagCorrente) >= 0) answ = "active";
|
||||
}
|
||||
/// <summary>
|
||||
/// classe grafica da pagina corrente
|
||||
/// </summary>
|
||||
/// <param name="nomeElem"></param>
|
||||
/// <returns></returns>
|
||||
public string liClass(string nomeElem)
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// tooltip che indica se user autorizzato
|
||||
/// </summary>
|
||||
public string usrAuthToolTip
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
string answ = "";
|
||||
if (user_std.pagCorrente != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
if (nomeElem.IndexOf(user_std.pagCorrente) >= 0) answ = "active";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if (nomeElem == "default") answ = "active";
|
||||
// }
|
||||
// catch
|
||||
// { }
|
||||
//}
|
||||
return answ;
|
||||
if (userAuthOk)
|
||||
{
|
||||
answ = string.Format("{0} - {1}", traduci("UserAuthOk"), OpAuth.currAuth.CognomeNome);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = traduci("UserAuthKo");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// tooltip che indica se user autorizzato
|
||||
/// </summary>
|
||||
public string usrAuthToolTip
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// text x user autorizzato
|
||||
/// </summary>
|
||||
public string usrAuthText
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "...";
|
||||
try
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
if (userAuthOk)
|
||||
{
|
||||
answ = string.Format("{0} - {1}", traduci("UserAuthOk"), OpAuth.currAuth.CognomeNome);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = traduci("UserAuthKo");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
if (userAuthOk)
|
||||
{
|
||||
answ = OpAuth.currAuth.CognomeNome;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "...";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// text x user autorizzato
|
||||
/// </summary>
|
||||
public string usrAuthText
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// css x colore icona user auth
|
||||
/// </summary>
|
||||
public string usrAuthCss
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "...";
|
||||
try
|
||||
{
|
||||
if (userAuthOk)
|
||||
{
|
||||
answ = OpAuth.currAuth.CognomeNome;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "...";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
if (userAuthOk)
|
||||
{
|
||||
answ = "checkOk";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "checkKo";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// css x colore icona user auth
|
||||
/// </summary>
|
||||
public string usrAuthCss
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
protected bool userAuthOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return OpAuth.isAuth || devicesAuthProxy.stObj.isAuth;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica visibilità in base al menù...
|
||||
/// </summary>
|
||||
/// <param name="nomeMenu"></param>
|
||||
/// <returns></returns>
|
||||
public string checkShow(string nomeMenu)
|
||||
{
|
||||
string answ = "hidden ";
|
||||
// verifico: se è userIsSuperAdmin vede tutto
|
||||
if (userIsSuperAdmin)
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
else if (userIsCapoOfficina)
|
||||
{
|
||||
// controllo in base a cosa richiesto...
|
||||
if (nomeMenu == "Settings")
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
if (userAuthOk)
|
||||
{
|
||||
answ = "checkOk";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "checkKo";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
answ = "hidden ";
|
||||
}
|
||||
protected bool userAuthOk
|
||||
else
|
||||
{
|
||||
get
|
||||
{
|
||||
return OpAuth.isAuth || devicesAuthProxy.stObj.isAuth;
|
||||
}
|
||||
answ = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica visibilità in base al menù...
|
||||
/// </summary>
|
||||
/// <param name="nomeMenu"></param>
|
||||
/// <returns></returns>
|
||||
public string checkShow(string nomeMenu)
|
||||
}
|
||||
else if (userIsAnagAdmin)
|
||||
{
|
||||
// controllo in base a cosa richiesto...
|
||||
if ((nomeMenu == "Anagrafiche") || (nomeMenu == "Settings"))
|
||||
{
|
||||
string answ = "hidden ";
|
||||
// verifico: se è userIsSuperAdmin vede tutto
|
||||
if (userIsSuperAdmin)
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
else if (userIsCapoOfficina)
|
||||
{
|
||||
// controllo in base a cosa richiesto...
|
||||
if (nomeMenu == "Settings")
|
||||
{
|
||||
answ = "hidden ";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
}
|
||||
else if (userIsAnagAdmin)
|
||||
{
|
||||
// controllo in base a cosa richiesto...
|
||||
if ((nomeMenu == "Anagrafiche") || (nomeMenu == "Settings"))
|
||||
{
|
||||
answ = "hidden ";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// controllo in base a cosa richiesto...
|
||||
if (nomeMenu == "Collaudi")
|
||||
{
|
||||
answ = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "hidden ";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
answ = "hidden ";
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(object lemma)
|
||||
else
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma.ToString());
|
||||
answ = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se utente sia SuperAdmin
|
||||
/// </summary>
|
||||
public bool userIsSuperAdmin
|
||||
}
|
||||
else
|
||||
{
|
||||
// controllo in base a cosa richiesto...
|
||||
if (nomeMenu == "Collaudi")
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("SuperAdminRole"));
|
||||
}
|
||||
answ = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se utente sia SuperUser
|
||||
/// </summary>
|
||||
public bool userIsCapoOfficina
|
||||
else
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoOfficinaRole"));
|
||||
}
|
||||
} /// <summary>
|
||||
/// verifica se utente sia SuperUser
|
||||
/// </summary>
|
||||
public bool userIsCapoGruppo
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoGruppo"));
|
||||
}
|
||||
answ = "hidden ";
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se utente sia SuperUser
|
||||
/// </summary>
|
||||
public bool userIsAnagAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("AnagAdminRole"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se la pagina abbia abilitato il search
|
||||
/// </summary>
|
||||
public bool pageHasSearch { get; set; }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(object lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se utente sia SuperAdmin
|
||||
/// </summary>
|
||||
public bool userIsSuperAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("SuperAdminRole"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se utente sia SuperUser
|
||||
/// </summary>
|
||||
public bool userIsCapoOfficina
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoOfficinaRole"));
|
||||
}
|
||||
} /// <summary>
|
||||
/// verifica se utente sia SuperUser
|
||||
/// </summary>
|
||||
public bool userIsCapoGruppo
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("CapoGruppo"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se utente sia SuperUser
|
||||
/// </summary>
|
||||
public bool userIsAnagAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
return devicesAuthProxy.stObj.userHasRight(memLayer.ML.CRS("AnagAdminRole"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica se la pagina abbia abilitato il search
|
||||
/// </summary>
|
||||
public bool pageHasSearch { get; set; }
|
||||
#if false
|
||||
public bool pageHasSearch
|
||||
{
|
||||
@@ -466,30 +457,30 @@ namespace CMS_SC.WebUserControls
|
||||
}
|
||||
|
||||
#endif
|
||||
/// <summary>
|
||||
/// modifica campo ricerca...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
// salvo in sessione
|
||||
memLayer.ML.setSessionVal("searchVal", txtSearch.Text.Trim());
|
||||
}
|
||||
/// <summary>
|
||||
/// valore ricerca
|
||||
/// </summary>
|
||||
public string searchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtSearch.Text.Trim();
|
||||
}
|
||||
set
|
||||
{
|
||||
txtSearch.Text = value;
|
||||
memLayer.ML.setSessionVal("searchVal", value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// modifica campo ricerca...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
// salvo in sessione
|
||||
memLayer.ML.setSessionVal("searchVal", txtSearch.Text.Trim());
|
||||
}
|
||||
/// <summary>
|
||||
/// valore ricerca
|
||||
/// </summary>
|
||||
public string searchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtSearch.Text.Trim();
|
||||
}
|
||||
set
|
||||
{
|
||||
txtSearch.Text = value;
|
||||
memLayer.ML.setSessionVal("searchVal", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-29
@@ -13,13 +13,13 @@ namespace CMS_SC.WebUserControls {
|
||||
public partial class mod_testata {
|
||||
|
||||
/// <summary>
|
||||
/// Controllo A4.
|
||||
/// Controllo A1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlAnchor A4;
|
||||
protected global::System.Web.UI.HtmlControls.HtmlAnchor A1;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo imgLogo.
|
||||
@@ -30,33 +30,6 @@ namespace CMS_SC.WebUserControls {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlImage imgLogo;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo li1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl li1;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo li2.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl li2;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo li3.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl li3;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hlUser.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user