fix testata e botto page

This commit is contained in:
Samuele Locatelli
2021-10-15 15:36:23 +02:00
parent 2823c62d74
commit c33ded5e5e
6 changed files with 215 additions and 224 deletions
@@ -1,17 +1,20 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_menuBottomFullpage.ascx.cs"
Inherits="PROJ_ETS.WebUserControls.mod_menuBottomFullpage" %>
<% if (false)
{ %>
<%--<webopt:BundleReference ID="BundleReference1" runat="server" Path="~/Content/css" />--%>
<% } %>
<div style="display: inline-block; width: 100%;">
<div class="divSx" style="padding-left: 1em;">
<nav class="navbar navbar-inverse fixed-bottom navbar-dark bg-dark text-light small">
<div style="display: inline-block; width: 100%;">
<div class="divSx" style="padding-left: 1em;">
<asp:Label runat="server" ID="lblUser" />
|
<asp:Label runat="server" ID="lblPostazione" />
|
<asp:Label ID="lblDateTime" runat="server" Text="..." CssClass="smallText" />
</div>
<div class="divDx smallText" style="padding-right: 1em;">
<asp:Label runat="server" ID="lblApp" Text="." CssClass="smallText" /><asp:Label ID="lblrev" runat="server" CssClass="smallText"> &nbsp;- &nbsp;</asp:Label>
<span class="smallText">&copy; 2013-<%: DateTime.Now.Year %> - SteamWare</span>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>
</div>
</div>
<div class="divDx smallText" style="padding-right: 1em;">
<asp:Label runat="server" ID="lblApp" Text="." CssClass="smallText" /><asp:Label ID="lblrev" runat="server" CssClass="smallText"> &nbsp;- &nbsp;</asp:Label>
<span class="smallText">&copy; 2013-<%: DateTime.Now.Year %> - SteamWare</span>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>
</div>
</div>
</nav>
@@ -15,6 +15,67 @@ namespace PROJ_ETS.WebUserControls
{
public partial class mod_menuBottomFullpage : System.Web.UI.UserControl
{
#region Protected Fields
protected Logger lg = LogManager.GetCurrentClassLogger();
#endregion Protected Fields
#region Public Fields
/// <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;
#endregion Public Fields
#region Private Methods
private void setClock()
{
lblDateTime.Text = DateTime.Now.ToString("dddd dd/MM/yyyy, HH:mm:ss");
}
/// <summary>
/// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada
/// </summary>
private void setTimer()
{
Timer1.Interval = Convert.ToInt32(ConfigurationManager.AppSettings.Get("intUpdatePagina_ms"));
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// salva in variabile pagina il nome della pagina corrente
/// </summary>
protected void PagCorrente()
{
Uri MyUrl = Request.Url;
string delimStr = "/";
char[] delimiter = delimStr.ToCharArray();
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
int n = finalUrl.Length;
_paginaCorrente = finalUrl[n - 1].ToString();
if (_paginaPrecedente == "")
{
_paginaPrecedente = _paginaCorrente;
utils.obj.setSessionVal("_paginaPrecedente", _paginaPrecedente);
}
if (_paginaCorrente != _paginaPrecedente)
{
_paginaPrecedente = _paginaCorrente;
utils.obj.setSessionVal("_paginaPrecedente", _paginaPrecedente);
}
}
/// <summary>
/// caricamento pagina
@@ -25,27 +86,46 @@ namespace PROJ_ETS.WebUserControls
{
// sistemo le stringhe...
//lblApp.Text = string.Format("<b>{0}</b> v.{1}.{2}", ConfigurationManager.AppSettings.Get("appName"), ConfigurationManager.AppSettings.Get("mainRev"), ConfigurationManager.AppSettings.Get("minRev"));
if (!Page.IsPostBack)
{
SetUpByUserRight();
}
lblApp.Text = string.Format("<b>{0}</b> v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
lblUser.Text = string.Format("{0} ({1})", utils.obj.currUserCognomeNome, utils.obj.currUserId);
lblPostazione.Text = Request.UserHostName;
setTimer();
setClock();
}
/// <summary>
/// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada
/// verifica che l'utente abbia almeno un permesso per la pagina corrente altrimenti redirect ad unauthorized
/// </summary>
private void setTimer()
protected virtual void SetUpByUserRight()
{
Timer1.Interval = Convert.ToInt32(ConfigurationManager.AppSettings.Get("intUpdatePagina_ms"));
PagCorrente();
// verifica la pagina NON sia di quelle "libere"
if (utils.obj.confReadString("_safePages").IndexOf(_paginaCorrente) == -1)
{
// verifica l'utente sia autorizzato (in session...)
if (!user_std.UtSn.isAuth)
{
Session["nextPage"] = _paginaCorrente;
Response.Redirect("login.aspx");
}
// verifica i permessi dell'utente per almeno vedere la pagina corrente SSE non è una common page...
if (!user_std.UtSn.isPageEnabled(_paginaCorrente.Replace(".aspx", "")) && utils.obj.confReadString("_commonPages").IndexOf(_paginaCorrente) == -1)
{
lg.Info(string.Format("Errore in SetUpByUserRight: utente {0} non autorizzato per la pagina {1}", user_std.UtSn.utente, _paginaCorrente));
Response.Redirect("unauthorized.aspx");
}
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
setClock();
}
private void setClock()
{
lblDateTime.Text = DateTime.Now.ToString("dddd dd/MM/yyyy, HH:mm:ss");
}
#endregion Protected Methods
}
}
@@ -7,11 +7,31 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace PROJ_ETS.WebUserControls {
public partial class mod_menuBottomFullpage {
namespace PROJ_ETS.WebUserControls
{
public partial class mod_menuBottomFullpage
{
/// <summary>
/// lblUser control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblUser;
/// <summary>
/// lblPostazione control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPostazione;
/// <summary>
/// lblDateTime control.
/// </summary>
@@ -20,7 +40,7 @@ namespace PROJ_ETS.WebUserControls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDateTime;
/// <summary>
/// lblApp control.
/// </summary>
@@ -29,7 +49,7 @@ namespace PROJ_ETS.WebUserControls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblApp;
/// <summary>
/// lblrev control.
/// </summary>
@@ -38,7 +58,7 @@ namespace PROJ_ETS.WebUserControls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblrev;
/// <summary>
/// Timer1 control.
/// </summary>
@@ -1,49 +1,48 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_testata.ascx.cs" Inherits="PROJ_ETS.WebUserControls.mod_testata" %>
<div class="areaTitolo row">
<div class="col-xs-12">
<div class="float-left fontPiccolo" style="padding: 6px 0px 6px 4px;">
<asp:Label runat="server" ID="lblUser" />
<br />
<asp:Label runat="server" ID="lblPostazione" />
</div>
<div class="float-left fontPiccolo" style="padding: 6px 0px 6px 4px;">
<asp:UpdatePanel ID="updPnlGears" runat="server">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="5" DynamicLayout="false">
<ProgressTemplate>
<div id="progress_back">
</div>
<div id="progress_top">
<i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="float-right" style="padding: 2px 10px 2px 0px;">
<nav>
<ul id="menu">
<li><a href="Menu" title="Home">
<asp:Image runat="server" ID="Image1" ImageUrl="~/images/home.png" Width="28px" Height="28px" AlternateText="Home" /></a></li>
<li><a href="Commesse" title="Commesse">
<asp:Image runat="server" ID="Image2" ImageUrl="~/images/progetto_white.png" Width="28px" Height="28px" AlternateText="Commesse" /></a></li>
<li><a href="Bazaar" title="Bazaar">
<asp:Image runat="server" ID="Image3" ImageUrl="~/images/bazaar_white.png" Width="28px" Height="28px" AlternateText="Bazaar" /></a></li>
<%--<li><a href="Admin"title="Admin"><asp:Image runat="server" ID="Image4" ImageUrl="~/images/tools_white.png" Width="28px" Height="28px" AlternateText="Progetti" /></a>
</li>--%>
<li><a href="help/index.html" title="Help" target="_blank">
<asp:Image runat="server" ID="Image5" ImageUrl="~/images/help_white.png" Width="28px" Height="28px" AlternateText="Progetti" /></a></li>
<nav class="navbar navbar-expand-md bg-dark navbar-dark fixed-top py-0">
<!-- Brand -->
<a href="Menu" title="Home" class="navbar-brand">
<i class="fa fa-home fa-2x" aria-hidden="true"></i>&nbsp;PROJ-ETS
</a>
<!-- Toggler/collapsibe Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<span class="navbar-text">
<asp:UpdatePanel ID="updPnlGears" runat="server">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="5" DynamicLayout="false">
<ProgressTemplate>
<i class="fa fa-circle-o-notch fa-spin fa-2x text-primary px-3"></i>
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</span>
<ul id="menu" class="navbar-nav ml-auto">
<li class="nav-item px-3">
<a href="Commesse" title="Commesse">
<i class="fa fa-puzzle-piece fa-2x" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item px-3">
<a href="Bazaar" title="Bazaar">
<i class="fa fa-bolt fa-2x" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item px-3">
<asp:LinkButton ID="lbtRefresh" runat="server" OnClick="btnUpdate_Click" ToolTip="Update">
<i class="fa fa-refresh fa-2x" aria-hidden="true"></i>
</asp:LinkButton>
</li>
<li class="nav-item px-3">
<a href="help/index.html" title="Help" target="_blank">
<i class="fa fa-question-circle fa-2x" aria-hidden="true"></i>
</a>
</li>
</ul>
</nav>
</div>
<div class="divCenter">
<p class="site-title">
<b>
<asp:LinkButton ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="PROJ-ETS" ToolTip="Update" />
</b>
</p>
</div>
</div>
</div>
</nav>
@@ -11,39 +11,8 @@ namespace PROJ_ETS.WebUserControls
{
public partial class mod_testata : System.Web.UI.UserControl
{
protected Logger lg = LogManager.GetCurrentClassLogger();
/// <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;
#region Private Methods
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SetUpByUserRight();
}
lblUser.Text = string.Format("{0} ({1})", utils.obj.currUserCognomeNome, utils.obj.currUserId);
lblPostazione.Text = Request.UserHostName;
}
/// <summary>
/// richiesta update
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUpdate_Click(object sender, EventArgs e)
{
doFullDataUpdate();
}
/// <summary>
/// svuota session!
/// </summary>
@@ -54,57 +23,29 @@ namespace PROJ_ETS.WebUserControls
Response.Redirect(Request.Url.ToString());
}
#endregion Private Methods
#region area gestione auth
#region Protected Methods
/// <summary>
/// verifica che l'utente abbia almeno un permesso per la pagina corrente altrimenti redirect ad unauthorized
/// richiesta update
/// </summary>
protected virtual void SetUpByUserRight()
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUpdate_Click(object sender, EventArgs e)
{
PagCorrente();
// verifica la pagina NON sia di quelle "libere"
if (utils.obj.confReadString("_safePages").IndexOf(_paginaCorrente) == -1)
{
// verifica l'utente sia autorizzato (in session...)
if (!user_std.UtSn.isAuth)
{
Session["nextPage"] = _paginaCorrente;
Response.Redirect("login.aspx");
}
// verifica i permessi dell'utente per almeno vedere la pagina corrente SSE non è una common page...
if (!user_std.UtSn.isPageEnabled(_paginaCorrente.Replace(".aspx","")) && utils.obj.confReadString("_commonPages").IndexOf(_paginaCorrente) == -1)
{
lg.Info(string.Format("Errore in SetUpByUserRight: utente {0} non autorizzato per la pagina {1}", user_std.UtSn.utente, _paginaCorrente));
Response.Redirect("unauthorized.aspx");
}
}
doFullDataUpdate();
}
/// <summary>
/// salva in variabile pagina il nome della pagina corrente
/// caricamento pagina
/// </summary>
protected void PagCorrente()
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
Uri MyUrl = Request.Url;
string delimStr = "/";
char[] delimiter = delimStr.ToCharArray();
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
int n = finalUrl.Length;
_paginaCorrente = finalUrl[n - 1].ToString();
if (_paginaPrecedente == "")
{
_paginaPrecedente = _paginaCorrente;
utils.obj.setSessionVal("_paginaPrecedente", _paginaPrecedente);
}
if (_paginaCorrente != _paginaPrecedente)
{
_paginaPrecedente = _paginaCorrente;
utils.obj.setSessionVal("_paginaPrecedente", _paginaPrecedente);
}
}
#endregion
#endregion Protected Methods
}
}
+24 -76
View File
@@ -1,96 +1,44 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
// <auto-generated>
// This code was generated by a tool.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PROJ_ETS.WebUserControls {
public partial class mod_testata {
namespace PROJ_ETS.WebUserControls
{
public partial class mod_testata
{
/// <summary>
/// Controllo lblUser.
/// updPnlGears control.
/// </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.WebControls.Label lblUser;
/// <summary>
/// Controllo lblPostazione.
/// </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.WebControls.Label lblPostazione;
/// <summary>
/// Controllo updPnlGears.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updPnlGears;
/// <summary>
/// Controllo UpdateProgress1.
/// UpdateProgress1 control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdateProgress UpdateProgress1;
/// <summary>
/// Controllo Image1.
/// lbtRefresh control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Image Image1;
/// <summary>
/// Controllo Image2.
/// </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.WebControls.Image Image2;
/// <summary>
/// Controllo Image3.
/// </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.WebControls.Image Image3;
/// <summary>
/// Controllo Image5.
/// </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.WebControls.Image Image5;
/// <summary>
/// Controllo btnUpdate.
/// </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.WebControls.LinkButton btnUpdate;
protected global::System.Web.UI.WebControls.LinkButton lbtRefresh;
}
}