COmpletata gestione multilingua x NOME scheda
This commit is contained in:
@@ -1,76 +1,80 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_anagSchedeColl.ascx.cs" Inherits="CMS_SC.WebUserControls.mod_anagSchedeColl" %>
|
||||
<%@ Register Src="~/WebUserControls/mod_textTrans.ascx" TagPrefix="uc1" TagName="mod_textTrans" %>
|
||||
|
||||
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="CodScheda,Vers" DataSourceID="ods" CssClass="table table-condensed table-sm table-striped m-0" AllowPaging="True" AllowSorting="True" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowDataBound="grView_RowDataBound">
|
||||
<PagerStyle CssClass="active GridPager" />
|
||||
<PagerSettings Mode="NumericFirstLast" />
|
||||
<SelectedRowStyle CssClass="info" />
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-Wrap="false">
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="lbUpdate" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check fa-2x" />
|
||||
<asp:LinkButton ID="lbCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo fa-2x" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbSelect" runat="server" CausesValidation="False" CommandName="Select" ToolTip="Select" CssClass="fa fa-search text-info fa-2x" />
|
||||
|
||||
<PagerStyle CssClass="active GridPager" />
|
||||
<PagerSettings Mode="NumericFirstLast" />
|
||||
<SelectedRowStyle CssClass="info" />
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-Wrap="false">
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="lbUpdate" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check fa-2x" />
|
||||
<asp:LinkButton ID="lbCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo fa-2x" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbSelect" runat="server" CausesValidation="False" CommandName="Select" ToolTip="Select" CssClass="fa fa-search text-info fa-2x" />
|
||||
|
||||
<asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False" CommandName="Edit" ToolTip="Edit" CssClass="fa fa-edit text-info fa-2x" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="CodScheda" HeaderText="CodScheda" ReadOnly="false" SortExpression="CodScheda" />
|
||||
<asp:BoundField DataField="Vers" HeaderText="Vers" SortExpression="Vers" ReadOnly="false" />
|
||||
<asp:TemplateField HeaderText="Descrizione" SortExpression="Descrizione">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Descrizione") %>' Width="100%" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Descrizione") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="FasiEnab" HeaderText="FasiEnab" SortExpression="FasiEnab" ReadOnly="false" ControlStyle-Width="8em" />
|
||||
<asp:BoundField DataField="CodVisib" HeaderText="Visib." SortExpression="CodVisib" ControlStyle-Width="4em" />
|
||||
<asp:TemplateField HeaderText="Doc" SortExpression="Path">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Path") %>' Width="100%" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink runat="server" ID="hlDoc" Target="_blank" ToolTip='<%# Eval("Path") %>' Visible='<%# CMS_SC_Data.DtProxy.notNullDocPath(Eval("Path")) %>' NavigateUrl='<%# CMS_SC_Data.DtProxy.getDocPath(Eval("Path")) %>'><i class="fa fa-file-pdf-o fa-2x"></i></asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-Wrap="false">
|
||||
<HeaderTemplate>
|
||||
<asp:LinkButton ID="lbAddNew" runat="server" CausesValidation="false" ToolTip="InsNew" CssClass="fa fa-plus text-success fa-2x" OnClick="lbAddNew_Click" />
|
||||
</HeaderTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="lbUpdate2" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check fa-2x" />
|
||||
<asp:LinkButton ID="lbCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo fa-2x" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" CommandName="Delete" ToolTip="Delete" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' CssClass="fa fa-trash text-danger fa-2x" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="CodScheda" HeaderText="CodScheda" ReadOnly="false" SortExpression="CodScheda" />
|
||||
<asp:BoundField DataField="Vers" HeaderText="Vers" SortExpression="Vers" ReadOnly="false" />
|
||||
<asp:TemplateField HeaderText="Descrizione" SortExpression="Descrizione">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Descrizione") %>' CssClass="form-control form-control-sm small" TextMode="MultiLine" Height="8em" Font-Size="0.9em" />
|
||||
<p><b>[IT]</b>Versione testo in Italiano<b>[/IT]</b><br />
|
||||
<b>[EN]</b>English version text<b>[/EN]</b></p>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<uc1:mod_textTrans runat="server" ID="mod_textTrans" fullText='<%# Eval("Descrizione") %>' tagOpen="[IT]" tagClose="[/IT]" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="FasiEnab" HeaderText="FasiEnab" SortExpression="FasiEnab" ReadOnly="false" ControlStyle-Width="8em" />
|
||||
<asp:BoundField DataField="CodVisib" HeaderText="Visib." SortExpression="CodVisib" ControlStyle-Width="4em" />
|
||||
<asp:TemplateField HeaderText="Doc" SortExpression="Path">
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Path") %>' Width="100%" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink runat="server" ID="hlDoc" Target="_blank" ToolTip='<%# Eval("Path") %>' Visible='<%# CMS_SC_Data.DtProxy.notNullDocPath(Eval("Path")) %>' NavigateUrl='<%# CMS_SC_Data.DtProxy.getDocPath(Eval("Path")) %>'><i class="fa fa-file-pdf-o fa-2x"></i></asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-Wrap="false">
|
||||
<HeaderTemplate>
|
||||
<asp:LinkButton ID="lbAddNew" runat="server" CausesValidation="false" ToolTip="InsNew" CssClass="fa fa-plus text-success fa-2x" OnClick="lbAddNew_Click" />
|
||||
</HeaderTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="lbUpdate2" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update" CssClass="fa fa-check fa-2x" />
|
||||
<asp:LinkButton ID="lbCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel" CssClass="fa fa-undo fa-2x" />
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" CommandName="Delete" ToolTip="Delete" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' CssClass="fa fa-trash text-danger fa-2x" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="CMS_SC_Data.DS_ApplicazioneTableAdapters.AnagSchedeTableAdapter" FilterExpression=" CodScheda LIKE '%{0}%' OR Descrizione LIKE '%{0}%'" DeleteMethod="deleteQuery" InsertMethod="insertQuery" UpdateMethod="updateQuery" OnUpdating="ods_Updating">
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Original_Vers" Type="Int32" />
|
||||
</DeleteParameters>
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="searchVal" />
|
||||
</FilterParameters>
|
||||
<InsertParameters>
|
||||
<asp:Parameter Name="CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Vers" Type="Int32" />
|
||||
<asp:Parameter Name="Descrizione" Type="String" />
|
||||
<asp:Parameter Name="Path" Type="String" />
|
||||
</InsertParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Vers" Type="Int32" />
|
||||
<asp:Parameter Name="Descrizione" Type="String" />
|
||||
<asp:Parameter Name="Path" Type="String" />
|
||||
<asp:Parameter Name="FasiEnab" Type="String" />
|
||||
<asp:Parameter Name="CodVisib" Type="String" />
|
||||
<asp:Parameter Name="Original_CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Original_Vers" Type="Int32" />
|
||||
</UpdateParameters>
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Original_Vers" Type="Int32" />
|
||||
</DeleteParameters>
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="searchVal" />
|
||||
</FilterParameters>
|
||||
<InsertParameters>
|
||||
<asp:Parameter Name="CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Vers" Type="Int32" />
|
||||
<asp:Parameter Name="Descrizione" Type="String" />
|
||||
<asp:Parameter Name="Path" Type="String" />
|
||||
</InsertParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Vers" Type="Int32" />
|
||||
<asp:Parameter Name="Descrizione" Type="String" />
|
||||
<asp:Parameter Name="Path" Type="String" />
|
||||
<asp:Parameter Name="FasiEnab" Type="String" />
|
||||
<asp:Parameter Name="CodVisib" Type="String" />
|
||||
<asp:Parameter Name="Original_CodScheda" Type="String" />
|
||||
<asp:Parameter Name="Original_Vers" Type="Int32" />
|
||||
</UpdateParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
@@ -5,50 +5,55 @@ using System.Web.UI.WebControls;
|
||||
|
||||
namespace CMS_SC.WebUserControls
|
||||
{
|
||||
public partial class mod_anagSchedeColl : SteamWare.UserControl
|
||||
public partial class mod_anagSchedeColl : SteamWare.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// dimensione pagina grid view
|
||||
/// </summary>
|
||||
public int pageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return grView.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
grView.PageSize = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// richiesta di aggiunta record, tutto a zero!
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lbAddNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
// inserisco nuovo record
|
||||
DtProxy.man.taASC.insertQuery(memLayer.ML.CRS("defASC01"), 0, memLayer.ML.CRS("defASC02"), "", memLayer.ML.CRS("defFasiEnab"));
|
||||
// update!
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// mando a dettaglio scheda...
|
||||
string codScheda = string.Format("{0}.{1}", grView.SelectedDataKey["CodScheda"], grView.SelectedDataKey["Vers"]);
|
||||
Response.Redirect(string.Format("~/DettScheda?CodSchedaVers={0}", codScheda));
|
||||
}
|
||||
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
if (e.InputParameters["Path"] == null) e.InputParameters["Path"] = "";
|
||||
if (e.InputParameters["FasiEnab"] == null) e.InputParameters["FasiEnab"] = "";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// dimensione pagina grid view
|
||||
/// </summary>
|
||||
public int pageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return grView.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
grView.PageSize = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// richiesta di aggiunta record, tutto a zero!
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lbAddNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
// inserisco nuovo record
|
||||
DtProxy.man.taASC.insertQuery(memLayer.ML.CRS("defASC01"), 0, memLayer.ML.CRS("defASC02"), "", memLayer.ML.CRS("defFasiEnab"));
|
||||
// update!
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// mando a dettaglio scheda...
|
||||
string codScheda = string.Format("{0}.{1}", grView.SelectedDataKey["CodScheda"], grView.SelectedDataKey["Vers"]);
|
||||
Response.Redirect(string.Format("~/DettScheda?CodSchedaVers={0}", codScheda));
|
||||
}
|
||||
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
if (e.InputParameters["Path"] == null) e.InputParameters["Path"] = "";
|
||||
if (e.InputParameters["FasiEnab"] == null) e.InputParameters["FasiEnab"] = "";
|
||||
// metto a capo tra i vari tag SE non ci fosse...
|
||||
if (e.InputParameters["Descrizione"].ToString().IndexOf("][") >= 0)
|
||||
{
|
||||
e.InputParameters["Descrizione"] = e.InputParameters["Descrizione"].ToString().Replace("][", "]\n[");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_textTrans.ascx.cs" Inherits="CMS_SC.WebUserControls.mod_textTrans" %>
|
||||
|
||||
<asp:HiddenField runat="server" ID="hfFullText" />
|
||||
<asp:Label runat="server" ID="lblItem" Text='<%# tradTesto(hfFullText.Value) %>'></asp:Label>
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using SteamWare;
|
||||
|
||||
namespace CMS_SC.WebUserControls
|
||||
{
|
||||
public partial class mod_textTrans : SteamWare.UserControl
|
||||
{
|
||||
|
||||
protected Dictionary<string, string> flagList;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
flagList = getDictFromFile("FlagList.map");
|
||||
}
|
||||
/// <summary>
|
||||
/// Lettura file di conf e ritorna dictionary
|
||||
/// </summary>
|
||||
/// <param name="filePath">File con le conf key-val tipo file.map</param>
|
||||
/// <returns></returns>
|
||||
protected Dictionary<string, string> getDictFromFile(string filePath)
|
||||
{
|
||||
// leggo file...
|
||||
string[] contenuto = File.ReadAllLines(resDir + filePath);
|
||||
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
foreach (var line in contenuto)
|
||||
{
|
||||
// se la linea non è commento e non è vuota...
|
||||
if (line.Length > 0 && line[0] != '#')
|
||||
{
|
||||
string[] tokens = line.Split(':');
|
||||
answ.Add(tokens[0], tokens[1]);
|
||||
}
|
||||
}
|
||||
// ritorno valori...
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// folder Risorse x configurazione (Resources)
|
||||
/// </summary>
|
||||
public static string resDir
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\App_Data\", HttpContext.Current.Server.MapPath("~"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Versione compelta del testo
|
||||
/// </summary>
|
||||
public string fullText
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfFullText.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfFullText.Value = value;
|
||||
}
|
||||
}
|
||||
public string tagOpen { get; set; }
|
||||
public string tagClose { get; set; }
|
||||
/// <summary>
|
||||
/// Effettua una traduzione del testo da originale a test con FLAG + a capo ove necessario
|
||||
/// </summary>
|
||||
/// <param name="fullData"></param>
|
||||
/// <returns></returns>
|
||||
public string tradTesto(string fullData)
|
||||
{
|
||||
fullData = fullData.Replace("\n", "");
|
||||
int idx = 1;
|
||||
int endPos = 0;
|
||||
int strLenght = fullData.Length;
|
||||
string Lang = "";
|
||||
string Translation = "";
|
||||
string currOpen, currClose;
|
||||
string outStr = "";
|
||||
// proseguo estraendo a blocchi...
|
||||
while (strLenght > 0)
|
||||
{
|
||||
// verifico formato inizia per iniziale del TAG
|
||||
if (fullData[0] == tagOpen[0])
|
||||
{
|
||||
Lang = fullData.Substring(1, 2);
|
||||
}
|
||||
// compongo i 2 tag di apertura/chiusura...
|
||||
currOpen = tagOpen.Replace("IT", Lang);
|
||||
currClose = tagClose.Replace("IT", Lang);
|
||||
// calcolo fine tag...
|
||||
endPos = fullData.IndexOf(currClose);
|
||||
try
|
||||
{
|
||||
// recupero la stringa effettiva
|
||||
Translation = fullData.Substring(0, endPos).Replace(currOpen, "").Replace(currClose, "");
|
||||
// tolgo tag+stringa da full e calcolo lunghezza, poi procedo
|
||||
fullData = fullData.Substring(endPos).Replace(currClose, "");
|
||||
strLenght = fullData.Length;
|
||||
// accodo stringa...
|
||||
outStr += string.Format(@"<img src='Images/blank.gif' class='flag {0}'/> {1}</br>", flagList[Lang], Translation);
|
||||
idx++;
|
||||
}
|
||||
catch
|
||||
{
|
||||
strLenght = 0;
|
||||
}
|
||||
}
|
||||
return outStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 CMS_SC.WebUserControls {
|
||||
|
||||
|
||||
public partial class mod_textTrans {
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfFullText.
|
||||
/// </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 hfFullText;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lblItem.
|
||||
/// </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 lblItem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user