Aggiunta altra pagina di testing

Corretta gestione file upload (in cartella temp utente)
Ignorate folder utente x salvataggio SVN


git-svn-id: https://keyhammer.ath.cx/svn/ETS/trunk@22 72332f79-082b-4ce8-9953-5b7f197a49bb
This commit is contained in:
samuele
2012-08-30 12:52:17 +00:00
parent a228e575fe
commit 835fe65693
23 changed files with 378 additions and 56 deletions
BIN
View File
Binary file not shown.
+22 -15
View File
@@ -142,7 +142,6 @@
<Content Include="plupload\js\plupload.silverlight.js" />
<Content Include="plupload\js\plupload.silverlight.xap" />
<Content Include="MenuExtenderExample.aspx" />
<Content Include="protocollo.aspx" />
<Content Include="ricerca.aspx" />
<Content Include="css\Style.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -152,6 +151,8 @@
<Content Include="Scripts\jquery-1.7.1.min.js" />
<Content Include="Styles\menu-h.css" />
<Content Include="Styles\menu-v.css" />
<Content Include="test.aspx" />
<Content Include="testMast.aspx" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
@@ -161,7 +162,7 @@
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="WebUserControls\mod_fileInOut.ascx" />
<Content Include="WebUserControls\mod_fileUpload.ascx" />
<Content Include="WebUserControls\mod_gestioneDati.ascx" />
<Content Include="WebUserControls\mod_gestioneDocumenti.ascx" />
<Content Include="WebUserControls\mod_inputDati.ascx" />
@@ -193,13 +194,6 @@
<DependentUpon>GestioneDocumenti.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="protocollo.aspx.cs">
<DependentUpon>protocollo.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="protocollo.aspx.designer.cs">
<DependentUpon>protocollo.aspx</DependentUpon>
</Compile>
<Compile Include="ricerca.aspx.cs">
<DependentUpon>ricerca.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -207,6 +201,20 @@
<Compile Include="ricerca.aspx.designer.cs">
<DependentUpon>ricerca.aspx</DependentUpon>
</Compile>
<Compile Include="test.aspx.cs">
<DependentUpon>test.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="test.aspx.designer.cs">
<DependentUpon>test.aspx</DependentUpon>
</Compile>
<Compile Include="testMast.aspx.cs">
<DependentUpon>testMast.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="testMast.aspx.designer.cs">
<DependentUpon>testMast.aspx</DependentUpon>
</Compile>
<Compile Include="WebMasterPages\AjaxSimpleFull.Master.cs">
<DependentUpon>AjaxSimpleFull.Master</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -214,12 +222,12 @@
<Compile Include="WebMasterPages\AjaxSimpleFull.Master.designer.cs">
<DependentUpon>AjaxSimpleFull.Master</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_fileInOut.ascx.cs">
<DependentUpon>mod_fileInOut.ascx</DependentUpon>
<Compile Include="WebUserControls\mod_fileUpload.ascx.cs">
<DependentUpon>mod_fileUpload.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\mod_fileInOut.ascx.designer.cs">
<DependentUpon>mod_fileInOut.ascx</DependentUpon>
<Compile Include="WebUserControls\mod_fileUpload.ascx.designer.cs">
<DependentUpon>mod_fileUpload.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_gestioneDati.ascx.cs">
<DependentUpon>mod_gestioneDati.ascx</DependentUpon>
@@ -277,8 +285,7 @@
<Folder Include="Content\themes\Fresh-Squeezed\" />
<Folder Include="Content\themes\Supercharged\" />
<Folder Include="logs\" />
<Folder Include="TempUploads\IN\" />
<Folder Include="TempUploads\OUT\" />
<Folder Include="TempUploads\" />
</ItemGroup>
<ItemGroup>
<Content Include="NLog.config">
+6 -4
View File
@@ -1,18 +1,20 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/AjaxSimpleFull.Master"
AutoEventWireup="true" CodeBehind="GestioneDocumenti.aspx.cs" Inherits="ETS_WS.GestioneDocumenti" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="WebUserControls/mod_gestioneDocumenti.ascx" TagName="mod_gestioneDocumenti"
TagPrefix="uc1" %>
<%@ Register Src="WebUserControls/mod_gestioneDati.ascx" TagName="mod_gestioneDati"
TagPrefix="uc2" %>
<%@ Register Src="WebUserControls/mod_fileUpload.ascx" TagName="mod_fileUpload" TagPrefix="uc3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="clearDiv divSx" style="width: 320px; width:25%;">
<uc2:mod_gestioneDati ID="mod_gestioneDati1" runat="server" />
<div class="clearDiv divSx" style="width: 320px; width: 25%;">
<uc3:mod_fileUpload ID="mod_fileUpload1" runat="server" />
</div>
<div class="divSx" style=" min-width:640px; width:75%;">
<div class="divSx" style="min-width: 640px; width: 75%;">
<div style="width: 100%">
<uc1:mod_gestioneDocumenti ID="mod_gestioneDocumenti1" runat="server" />
<uc2:mod_gestioneDati ID="mod_gestioneDati1" runat="server" />
</div>
</div>
</asp:Content>
+3 -1
View File
@@ -11,7 +11,9 @@ namespace ETS_WS
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
}
}
}
+11 -2
View File
@@ -13,13 +13,13 @@ namespace ETS_WS {
public partial class GestioneDocumenti {
/// <summary>
/// mod_gestioneDati1 control.
/// mod_fileUpload1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_gestioneDati mod_gestioneDati1;
protected global::ETS_WS.WebUserControls.mod_fileUpload mod_fileUpload1;
/// <summary>
/// mod_gestioneDocumenti1 control.
@@ -29,5 +29,14 @@ namespace ETS_WS {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_gestioneDocumenti mod_gestioneDocumenti1;
/// <summary>
/// mod_gestioneDati1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_gestioneDati mod_gestioneDati1;
}
}
+2 -1
View File
@@ -28,8 +28,9 @@
<add key="appName" value="ETS-WS"/>
<add key="SiteName" value="ETS"/>
<add key="mainRev" value="0.2"/>
<add key="minRev" value="16"/>
<add key="minRev" value="18"/>
<add key="copyRight" value="SteamWare, ETS © 2012"/>
<add key="tempUplDir" value="~/TempUploads"/>
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000"/>
<!--config x WebServices autocompletamento-->
@@ -0,0 +1,18 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_fileUpload.ascx.cs"
Inherits="ETS_WS.WebUserControls.mod_fileUpload" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<% if (false)
{ %>
<link href="../css/BuildBlocks.css" rel="stylesheet" type="text/css" />
<link href="../css/ETS.css" rel="stylesheet" type="text/css" />
<link href="../css/ExtraComp.css" rel="stylesheet" type="text/css" />
<link href="../css/MasterPage.css" rel="stylesheet" type="text/css" />
<link href="../css/Style.css" rel="stylesheet" type="text/css" />
<% } %>
<div class="divCenter fontPiccolo">
<div class="fontMedio">
<b>Upload File</b>
</div>
<asp:AjaxFileUpload ID="fileUpload" runat="server" OnUploadComplete="fileUpload_UploadComplete" />
<i>Caricamento files in area personale per catalogazione</i>
</div>
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using NLog;
using ETS_Data;
namespace ETS_WS.WebUserControls
{
public partial class mod_fileUpload : System.Web.UI.UserControl
{
public event EventHandler eh_fileCaricato;
protected Logger lg;
protected void Page_Load(object sender, EventArgs e)
{
lg = LogManager.GetCurrentClassLogger();
}
/// <summary>
/// completato upload file
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void fileUpload_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
// salvo!
string path = "";
// prima il path
try
{
path = string.Format("{0}/{1}", utils.obj.confReadString("tempUplDir"), utils.obj.currUser_FS);
utils.obj.checkDir(path);
}
catch(Exception exc)
{
lg.Info("errore check directory: {0}", exc);
}
// opra il file...
try
{
if(path!="")
{
path = string.Format("{0}/{1}",path, e.FileName);
fileUpload.SaveAs(MapPath(path));
lg.Info("salvato file: {0}, {1} Kb", path, e.FileSize / 1024);
if (eh_fileCaricato != null)
{
eh_fileCaricato(this, new EventArgs());
}
}
}
catch (Exception exc)
{
lg.Info("errore salvataggio: {0}", exc);
}
}
}
}
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ETS_WS.WebUserControls {
public partial class mod_fileUpload {
/// <summary>
/// fileUpload control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.AjaxFileUpload fileUpload;
}
}
@@ -1,23 +1,16 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_gestioneDocumenti.ascx.cs"
Inherits="ETS_WS.WebUserControls.mod_gestioneDocumenti" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="mod_fileInOut.ascx" TagName="mod_fileInOut" TagPrefix="uc1" %>
<asp:TabContainer ID="tcDocumenti" runat="server" ActiveTabIndex="0" OnDemand="true"
AutoPostBack="false" TabStripPlacement="Top" ScrollBars="None" Width="100%">
<asp:TabPanel runat="server" ID="tblDocumenti">
<HeaderTemplate>
Gestione Documenti
</HeaderTemplate>
<asp:TabContainer ID="tcDocumenti" runat="server" OnDemand="true" TabStripPlacement="Top"
Width="100%">
<asp:TabPanel runat="server" ID="tblDocumenti" HeaderText="Gestione Documenti" TabIndex="0">
<ContentTemplate>
tutti i documenti</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="tblMyDocs">
<HeaderTemplate>
My uploads
</HeaderTemplate>
<ContentTemplate>
i miei docs temporanei
<uc1:mod_fileInOut ID="mod_fileInOut1" runat="server" />
tutti i documenti
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
<asp:TabPanel runat="server" ID="tblMyDocs" HeaderText="My uploads" TabIndex="0">
<ContentTemplate>
i miei docs temporanei CARICATI da sistemare
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
@@ -38,14 +38,5 @@ namespace ETS_WS.WebUserControls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.TabPanel tblMyDocs;
/// <summary>
/// mod_fileInOut1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_fileInOut mod_fileInOut1;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="ETS_WS.test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register src="WebUserControls/mod_fileUpload.ascx" tagname="mod_fileUpload" tagprefix="uc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<uc1:mod_fileUpload ID="mod_fileUpload1" runat="server" />
</div>
</form>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using NLog;
namespace ETS_WS
{
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+42
View File
@@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ETS_WS {
public partial class test {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// ScriptManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.ScriptManager ScriptManager1;
/// <summary>
/// mod_fileUpload1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_fileUpload mod_fileUpload1;
}
}
+5
View File
@@ -0,0 +1,5 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/AjaxSimpleFull.Master" AutoEventWireup="true" CodeBehind="testMast.aspx.cs" Inherits="ETS_WS.testMast" %>
<%@ Register src="WebUserControls/mod_fileUpload.ascx" tagname="mod_fileUpload" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<uc1:mod_fileUpload ID="mod_fileUpload1" runat="server" />
</asp:Content>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ETS_WS
{
public partial class testMast : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+24
View File
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ETS_WS {
public partial class testMast {
/// <summary>
/// mod_fileUpload1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ETS_WS.WebUserControls.mod_fileUpload mod_fileUpload1;
}
}
Binary file not shown.
+93 -7
View File
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Configuration;
using System.Collections.Generic;
using System.IO;
namespace ETS_Data
{
@@ -61,6 +56,10 @@ namespace ETS_Data
/// </summary>
public static utils obj = new utils();
#endregion
#region area user
/// <summary>
/// utente correntemente connesso (Formato dominio\username)
/// </summary>
@@ -81,7 +80,16 @@ namespace ETS_Data
return answ;
}
}
/// <summary>
/// utente correntemente connesso per utilizzo FileSystem (Formato dominio.username)
/// </summary>
public string currUser_FS
{
get
{
return currUserAD.Replace(@"\", ".");
}
}
/// <summary>
/// utente correntemente connesso (Formato Cognome, nome)
/// </summary>
@@ -102,6 +110,10 @@ namespace ETS_Data
}
}
#endregion
#region area Session
/// <summary>
/// carica dalla sessione un dato di tipo object generico
/// </summary>
@@ -206,5 +218,79 @@ namespace ETS_Data
}
#endregion
#region gestione file config
/// <summary>
/// legge dalla config un valore bool
/// </summary>
/// <param name="nomeParam"></param>
/// <returns></returns>
public bool confReadBool(string nomeParam)
{
bool answ = false;
try
{
answ = (bool)configAppSetReader.GetValue(nomeParam, typeof(bool));
}
catch
{ }
return answ;
}
/// <summary>
/// legge dalla config un valore string
/// </summary>
/// <param name="nomeParam"></param>
/// <returns></returns>
public string confReadString(string nomeParam)
{
string answ = "";
try
{
answ = (string)configAppSetReader.GetValue(nomeParam, typeof(string));
}
catch
{ }
return answ;
}
/// <summary>
/// legge dalla config un valore int
/// </summary>
/// <param name="nomeParam"></param>
/// <returns></returns>
public int confReadInt(string nomeParam)
{
int answ = -1;
try
{
answ = (int)configAppSetReader.GetValue(nomeParam, typeof(int));
}
catch
{ }
return answ;
}
#endregion
#region area file/dir
/// <summary>
/// verifica esistenza directory, eventualmente crea e restituisce controllo DirectoryInfo
/// </summary>
/// <param name="dirPath"></param>
/// <returns></returns>
public DirectoryInfo checkDir(string dirPath)
{
DirectoryInfo _di = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath(dirPath));
if (!_di.Exists)
{
_di.Create();
}
return _di;
}
#endregion
}
}