aggiunta componenti x nuova master page bootstrap

This commit is contained in:
Samuele E. Locatelli
2021-01-07 10:42:09 +01:00
parent 6985135540
commit 037f3244f7
6 changed files with 430 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_footer.ascx.cs" Inherits="GPW_Admin.WebUserControls.cmp_footer" %>
<footer class="fixed-bottom bg-dark text-light small textCondens p-1">
<div class="container px-1">
<div class="row">
<div class="col-8 text-left pr-0">
<span class="d-none d-lg-inline">
<asp:Label ID="lblDateTime" runat="server" Text="..." />
&nbsp;|&nbsp;</span>
<asp:Label ID="lblCodOperatore" runat="server" Text="-" />
</div>
<div class="col-4 text-right pl-0 fontCond">
<asp:Label runat="server" ID="lblApp" Text="." />
</div>
</div>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>
</div>
</footer>
@@ -0,0 +1,60 @@
using SteamWare;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GPW_Admin.WebUserControls
{
public partial class cmp_footer : BaseUserControl
{
#region Public Events
public event EventHandler eh_doRefresh;
#endregion Public Events
#region Private Methods
private void setClock()
{
lblDateTime.Text = DateTime.Now.ToString("ddd dd.MM.yyyy, HH:mm:ss");
lblCodOperatore.Text = $"{user_std.UtSn.CognomeNome} ({Page.User.Identity.Name})";
}
/// <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 = SteamWare.memLayer.ML.confReadInt("intUpdatePagina_ms");
}
#endregion Private Methods
#region Protected Methods
protected void Page_Load(object sender, EventArgs e)
{
// sistemo le stringhe...
lblApp.Text = string.Format("<b>{0}</b> v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
setTimer();
setClock();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
setClock();
// se qualcuno ascolta sollevo evento nuovo valore...
if (eh_doRefresh != null)
{
eh_doRefresh(this, new EventArgs());
}
}
#endregion Protected Methods
}
}
+53
View File
@@ -0,0 +1,53 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace GPW_Admin.WebUserControls
{
public partial class cmp_footer
{
/// <summary>
/// Controllo lblDateTime.
/// </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 lblDateTime;
/// <summary>
/// Controllo lblCodOperatore.
/// </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 lblCodOperatore;
/// <summary>
/// Controllo lblApp.
/// </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 lblApp;
/// <summary>
/// Controllo Timer1.
/// </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.Timer Timer1;
}
}
@@ -0,0 +1,52 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_menuTop.ascx.cs" Inherits="GPW_Admin.WebUserControls.cmp_menuTop" %>
<asp:HiddenField runat="server" ID="hfAnonym" />
<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-light py-1 mb-1">
<%--<asp:LinkButton runat="server" ID="lbnUpdate" Text="---" OnClick="lbnUpdate_Click" CssClass="navbar-brand" ToolTip="HOME">Sauder NKC <i class="fa fa-object-group" aria-hidden="true"></i></asp:LinkButton>--%>
<a class="navbar-brand" href="../">GPW <i class="fa fa-users" aria-hidden="true"></i></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 mr-auto">
<asp:Repeater ID="menu" runat="server" DataSourceID="XmlMenu">
<ItemTemplate>
<li class="nav-item dropdown">
<a href='<%# XPath("@url").ToString().Replace("~/","") %>' class="nav-link dropdown-toggle text-light bg-dark" data-toggle="dropdown">
<i class='<%# XPath("@description")%>'></i>
<%# XPath("@title")%>
<b class="caret"></b>
</a>
<div class="dropdown-menu">
<asp:Repeater ID="voci" runat="server" DataSource='<%# XPathSelect("voce") %>'>
<ItemTemplate>
<a href='<%# XPath("@url").ToString().Replace("~/","")%>' class="dropdown-item py-0">
<i class='<%# XPath("@description")%>'></i>
<%# XPath("@title")%>
</a>
</ItemTemplate>
</asp:Repeater>
</div>
</li>
</ItemTemplate>
<SeparatorTemplate>
</SeparatorTemplate>
</asp:Repeater>
<asp:XmlDataSource ID="XmlMenu" runat="server" EnableCaching="True" CacheDuration="5"></asp:XmlDataSource>
<%--<li class="nav-item">
<a class="nav-link text-light" href="ForceReload"><i class="fa fa-retweet shortcut-icon"></i> <%: traduci("ForceReload") %></a>
</li>--%>
<li class="nav-item">
<a class="nav-link text-light" href="About"><i class="fa fa-dot-circle-o" aria-hidden="true"></i><%: traduci ("About") %></a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="Contact"><i class="fa fa-handshake-o" aria-hidden="true"></i><%: traduci ("Contacts") %></a>
</li>
</ul>
<div runat="server" id="divSearch" class="form-inline my-2 my-lg-0">
<asp:TextBox runat="server" ID="txtSearch" class="form-control mr-sm-2" type="search" placeholder="[S]earch" aria-label="Search" AutoPostBack="true" OnTextChanged="txtSearch_TextChanged" AccessKey="S" />
<asp:LinkButton runat="server" ID="lbtSearch" class="btn btn-secondary my-2 my-sm-0" type="submit" OnClick="lbtSearch_Click"># <%: traduci ("Search") %> <i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
</div>
</div>
</nav>
@@ -0,0 +1,176 @@
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GPW_Admin.WebUserControls
{
public partial class cmp_menuTop : BaseUserControl
{
#region Public Events
public event EventHandler eh_doRefresh;
#endregion Public Events
#region Protected Properties
/// <summary>
/// Valore ricerca attivo
/// </summary>
protected string searchVal
{
get
{
return txtSearch.Text.Trim();
}
set
{
txtSearch.Text = value.Trim();
}
}
#endregion Protected Properties
#region Public Properties
/// <summary>
/// Abilitazione esecuzione anonima
/// </summary>
public bool enableAnonym
{
get
{
bool answ = false;
bool.TryParse(hfAnonym.Value, out answ);
return answ;
}
set
{
hfAnonym.Value = value.ToString();
}
}
/// <summary>
/// imposta visibilità search globale
/// </summary>
public bool showSearch
{
get
{
return divSearch.Visible;
}
set
{
divSearch.Visible = value;
}
}
#endregion Public Properties
#region Private Methods
private void checkAuth()
{
// in primis SOLO SE non è permesso login anonymous...
if (!enableAnonym)
{
if (!Page.User.Identity.IsAuthenticated)
{
Response.Redirect("default");
}
}
}
private void doSearch()
{
// se searchVal !=""
if (!string.IsNullOrEmpty(searchVal))
{
memLayer.ML.setSessionVal("valoreSearch", searchVal);
}
else
{
memLayer.ML.emptySessionVal("valoreSearch");
}
// se qualcuno ascolta sollevo evento nuovo valore...
if (eh_doRefresh != null)
{
eh_doRefresh(this, new EventArgs());
}
}
/// <summary>
/// aggiornamento del menù
/// </summary>
private void updateTreeMenu()
{
// SOLO SE è permesso login anonymous --> nascondo menù!
if (enableAnonym)
{
menu.Visible = false;
}
else
{
try
{
if (string.IsNullOrEmpty(user_std.UtSn.mappaSito))
{
Response.Redirect("Default", true);
}
XmlMenu.Data = user_std.UtSn.mappaSito;
XmlMenu.XPath = "mainMenu/menu";
XmlMenu.DataBind();
}
catch
{
Response.Redirect("default", true);
}
}
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// click su pagina corrente, fa update!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbnUpdate_Click(object sender, EventArgs e)
{
// SOLO SE non è permesso login anonymous...
if (!enableAnonym)
{
Response.Redirect("default");
}
}
protected void lbtSearch_Click(object sender, EventArgs e)
{
doSearch();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
checkAuth();
searchVal = "";
doSearch();
updateTreeMenu();
}
}
protected void txtSearch_TextChanged(object sender, EventArgs e)
{
doSearch();
}
#endregion Protected Methods
}
}
+71
View File
@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace GPW_Admin.WebUserControls
{
public partial class cmp_menuTop
{
/// <summary>
/// Controllo hfAnonym.
/// </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.HiddenField hfAnonym;
/// <summary>
/// Controllo menu.
/// </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.Repeater menu;
/// <summary>
/// Controllo XmlMenu.
/// </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.XmlDataSource XmlMenu;
/// <summary>
/// Controllo divSearch.
/// </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 divSearch;
/// <summary>
/// Controllo txtSearch.
/// </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.TextBox txtSearch;
/// <summary>
/// Controllo lbtSearch.
/// </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 lbtSearch;
}
}