fix gestione caricamento e refresh con timer

OCCHIO al parametro countdown!!!
This commit is contained in:
samuele
2012-10-23 10:50:49 +02:00
parent e0906ff5f4
commit bdd0033992
9 changed files with 106 additions and 53 deletions
+8 -4
View File
@@ -6,8 +6,6 @@
<%@ Register Src="WebUserControls/mod_inputDati.ascx" TagName="mod_inputDati" TagPrefix="uc3" %>
<%@ Register Src="WebUserControls/mod_pathAndDocs.ascx" TagName="mod_pathAndDocs" TagPrefix="uc4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Timer ID="timerUpload" runat="server" Interval="1000" >
</asp:Timer>
<div class="clearDiv divSx" style="min-width: 320px; width: 25%; background-color: #DDFFFF; min-height: 640px; height: 100%;">
<div class="divCenter" style="padding-top: 0px; padding-bottom: 4px;">
<div class="divSx half">
@@ -36,8 +34,14 @@
</div>
<div class="divSx" style="min-width: 640px; width: 75%;">
<div style="width: 100%" class="fontPiccolo">
<uc4:mod_pathAndDocs ID="mod_pathAndDocs1" runat="server" />
<uc2:mod_myTempFile ID="mod_myTempFile1" runat="server" />
<asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:Timer ID="timerUpload" runat="server" Interval="1000">
</asp:Timer>
<uc4:mod_pathAndDocs ID="mod_pathAndDocs1" runat="server" />
<uc2:mod_myTempFile ID="mod_myTempFile1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
+30 -15
View File
@@ -11,20 +11,19 @@ namespace ETS_WS
public partial class MyDocs : System.Web.UI.Page
{
/// <summary>
/// salvo stato upload in corso...
/// salvo countDown upload in corso...
/// </summary>
protected bool uploadInCorso
protected int countDown
{
get
{
return utils.obj.BoolSessionObj("uploadInCorso");
return utils.obj.IntSessionObj("countDown");
}
set
{
utils.obj.setSessionVal("uploadInCorso", value);
utils.obj.setSessionVal("countDown", value);
}
}
/// <summary>
/// caricamento pagina
/// </summary>
@@ -32,10 +31,9 @@ namespace ETS_WS
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && !uploadInCorso)
//Page.IsCallback;
if (!Page.IsPostBack)
{
timerUpload.Enabled = false;
showUpload = true;
setPnlVisibility();
}
@@ -44,6 +42,14 @@ namespace ETS_WS
mod_pathAndDocs1.eh_reqSalva += new EventHandler(mod_pathAndDocs1_eh_reqSalva);
timerUpload.Tick += new EventHandler<EventArgs>(timerUpload_Tick);
}
//protected override void OnUnload(EventArgs e)
//{
// base.OnUnload(e);
// timerUpload.Tick += new EventHandler<EventArgs>(timerUpload_Tick);
//}
/// <summary>
/// quando scade il timer rimanda a visualizzazione risultati
/// </summary>
@@ -51,9 +57,21 @@ namespace ETS_WS
/// <param name="e"></param>
void timerUpload_Tick(object sender, EventArgs e)
{
showUpload = false;
setPnlVisibility();
timerUpload.Enabled = false;
// solo se in "fase upload"
if (showUpload)
{
// controllo countDown...
if (countDown > 0)
{
countDown--;
}
else if (countDown == 0)
{
showUpload = false;
setPnlVisibility();
countDown = -1;
}
}
}
/// <summary>
/// update inserimento metadati
@@ -80,8 +98,7 @@ namespace ETS_WS
/// <param name="e"></param>
void mod_fileUpload1_eh_fileCaricato(object sender, EventArgs e)
{
uploadInCorso = true;
timerUpload.Enabled = true;
countDown = utils.obj.confReadInt("countDownUploadFile");
}
/// <summary>
/// fix panel visibility
@@ -120,7 +137,6 @@ namespace ETS_WS
/// <param name="e"></param>
protected void lnkUpload_Click(object sender, EventArgs e)
{
uploadInCorso = false;
showUpload = true;
setPnlVisibility();
}
@@ -131,7 +147,6 @@ namespace ETS_WS
/// <param name="e"></param>
protected void lnkGestione_Click(object sender, EventArgs e)
{
uploadInCorso = false;
showUpload = false;
setPnlVisibility();
}
+18 -9
View File
@@ -12,15 +12,6 @@ namespace ETS_WS {
public partial class MyDocs {
/// <summary>
/// timerUpload control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.Timer timerUpload;
/// <summary>
/// lnkUpload control.
/// </summary>
@@ -75,6 +66,24 @@ namespace ETS_WS {
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_inputDati mod_inputDati1;
/// <summary>
/// upMain control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel upMain;
/// <summary>
/// timerUpload control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.Timer timerUpload;
/// <summary>
/// mod_pathAndDocs1 control.
/// </summary>
+2 -1
View File
@@ -28,7 +28,7 @@
<add key="appName" value="ETS-WS" />
<add key="SiteName" value="ETS" />
<add key="mainRev" value="1.0" />
<add key="minRev" value="99" />
<add key="minRev" value="100" />
<add key="copyRight" value="SteamWare, ETS © 2012" />
<add key="tempUplDir" value="~/TempUploads" />
<add key="archiveDir" value="~/ArchivioDocs" />
@@ -39,6 +39,7 @@
<add key="srcPageSize" value="15" />
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000" />
<add key="countDownUploadFile" value="2"/>
<!--config x WebServices autocompletamento-->
<add key="MinCharAutocomplete" value="2" />
<add key="MaxRowToDisplay" value="15" />
@@ -1,13 +1,11 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="AjaxSimpleFull.master.cs"
Inherits="GMW.WebMasterPages.AjaxSimpleFull" %>
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="AjaxSimpleFull.master.cs" Inherits="GMW.WebMasterPages.AjaxSimpleFull" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="../WebUserControls/mod_testata.ascx" TagName="mod_testata" TagPrefix="uc1" %>
<%@ Register Src="../WebUserControls/mod_menuBottomFullpage.ascx" TagName="mod_menuBottomFullpage"
TagPrefix="uc2" %>
<%@ Register Src="../WebUserControls/mod_menuBottomFullpage.ascx" TagName="mod_menuBottomFullpage" TagPrefix="uc2" %>
<% if (false)
{ %>
<script src="../Scripts/jquery-1.6.4-vsdoc.js" type="text/javascript"></script>
<script src="../Scripts/jquery-1.6.4-vsdoc.js" type="text/javascript"></script>
<% } %>
<!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">
@@ -17,9 +15,9 @@
<link rel="icon" href="../images/favicon.png" type="image/png" />
<link rel="shortcut icon" href="../images/favicon.png" type="image/png" />
<%--Area jQueryUI via CDN--%>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.24/jquery-ui.min.js"></script>
<link rel="Stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.24/themes/base/jquery-ui.css">
<link rel="Stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.24/themes/base/jquery-ui.css">
<%--Area jQuery via delivery locale--%>
<%--
<script src="../Scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
@@ -43,26 +41,34 @@
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true"
EnableScriptGlobalization="true" EnableScriptLocalization="true">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true" EnableScriptGlobalization="true" EnableScriptLocalization="true">
</asp:ToolkitScriptManager>
<div class="fullscreen">
<asp:UpdatePanel ID="updPanelPagina" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<%--testata pagina--%>
<div class="clearDiv">
<%--testata pagina--%>
<div class="clearDiv">
<asp:UpdatePanel ID="updPanelTop" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<uc1:mod_testata ID="mod_testata1" runat="server" />
</div>
<div class="clearDiv">
</ContentTemplate>
</asp:UpdatePanel>
</div>
<%--corpo pagina--%>
<div class="clearDiv">
<asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<%--footer pagina--%>
<div class="clearDiv bottomWrite">
</ContentTemplate>
</asp:UpdatePanel>
</div>
<%--footer pagina--%>
<div class="clearDiv bottomWrite">
<asp:UpdatePanel ID="upLineClock" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<uc2:mod_menuBottomFullpage ID="mod_menuBottomFullpage1" runat="server" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</form>
</body>
@@ -40,13 +40,13 @@ namespace GMW.WebMasterPages {
protected global::AjaxControlToolkit.ToolkitScriptManager ToolkitScriptManager1;
/// <summary>
/// updPanelPagina control.
/// updPanelTop control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updPanelPagina;
protected global::System.Web.UI.UpdatePanel updPanelTop;
/// <summary>
/// mod_testata1 control.
@@ -57,6 +57,15 @@ namespace GMW.WebMasterPages {
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_testata mod_testata1;
/// <summary>
/// upMain control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel upMain;
/// <summary>
/// ContentPlaceHolder1 control.
/// </summary>
@@ -66,6 +75,15 @@ namespace GMW.WebMasterPages {
/// </remarks>
protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder1;
/// <summary>
/// upLineClock control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel upLineClock;
/// <summary>
/// mod_menuBottomFullpage1 control.
/// </summary>
@@ -35,7 +35,7 @@ namespace ETS_WS.WebUserControls
// carico path e file
path = string.Format("{0}/{1}", path, System.IO.Path.GetFileName(e.FileName));
fileUpload.SaveAs(MapPath(path));
lg.Info("salvato file: {0}, {1} Kb", path, e.FileSize / 1024);
lg.Info("salvato file: {0}, {1:#.0} Kb", path, (double)e.FileSize / 1024);
if (eh_fileCaricato != null)
{
eh_fileCaricato(this, new EventArgs());
Binary file not shown.
Binary file not shown.