|
From: <sv...@de...> - 2005-06-15 23:36:07
|
Author: marcelo Date: 2005-06-15 19:36:06 -0400 (Wed, 15 Jun 2005) New Revision: 1333 Added: humano2/trunk/web/builder/site/importWz-step1.aspx humano2/trunk/web/builder/site/importWz-step1.aspx.cs humano2/trunk/web/builder/site/importWz-step2.aspx humano2/trunk/web/builder/site/importWz-step2.aspx.cs humano2/trunk/web/builder/site/importWz-step3.aspx humano2/trunk/web/builder/site/importWz-step3.aspx.cs Modified: humano2/trunk/README.txt humano2/trunk/web/builder/Builder.csproj humano2/trunk/web/builder/site/leftbar.aspx humano2/trunk/web/portal/portal.csproj Log: CHANGE: README.txt - Updated URLs ADDED: Import related files. Changed Projects to reflect new files Modified: humano2/trunk/README.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/README.txt 2005-06-15 23:05:11 UTC (rev 1332) +++ humano2/trunk/README.txt 2005-06-15 23:36:06 UTC (rev 1333) @@ -8,20 +8,21 @@ About this Release =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -This release is part of the 4.9.x Humano2 experimental releases. This +This release is part of the 5.0.x Humano2 experimental releases. This is a developer release. They contain many untested and new functions. This release only has comunity support.=20 =20 -For further information -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +For further information and support +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 For more information you can consult:=20 -Humano2 user community (http://www.humano2.org) +Humano2 user community (http://www.humano2.com/network) The developer community (http://devel.humano2.org) =20 Subscribe to the mailling lists at list.humano2.org The IRC channel #humano2 on the irc.freenode.net servers. =20 + Commercial support =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 Modified: humano2/trunk/web/builder/Builder.csproj =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/Builder.csproj 2005-06-15 23:05:11 UTC (rev= 1332) +++ humano2/trunk/web/builder/Builder.csproj 2005-06-15 23:36:06 UTC (rev= 1333) @@ -442,6 +442,36 @@ BuildAction =3D "Compile" /> <File + RelPath =3D "site\importWz-step1.aspx" + BuildAction =3D "Content" + /> + <File + RelPath =3D "site\importWz-step1.aspx.cs" + DependentUpon =3D "importWz-step1.aspx" + SubType =3D "ASPXCodeBehind" + BuildAction =3D "Compile" + /> + <File + RelPath =3D "site\importWz-step2.aspx" + BuildAction =3D "Content" + /> + <File + RelPath =3D "site\importWz-step2.aspx.cs" + DependentUpon =3D "importWz-step2.aspx" + SubType =3D "ASPXCodeBehind" + BuildAction =3D "Compile" + /> + <File + RelPath =3D "site\importWz-step3.aspx" + BuildAction =3D "Content" + /> + <File + RelPath =3D "site\importWz-step3.aspx.cs" + DependentUpon =3D "importWz-step3.aspx" + SubType =3D "ASPXCodeBehind" + BuildAction =3D "Compile" + /> + <File RelPath =3D "site\index.aspx" SubType =3D "Form" BuildAction =3D "Content" @@ -475,6 +505,11 @@ BuildAction =3D "Compile" /> <File + RelPath =3D "site\leftbar.aspx.resx" + DependentUpon =3D "leftbar.aspx.cs" + BuildAction =3D "EmbeddedResource" + /> + <File RelPath =3D "site\portalXslt.aspx" BuildAction =3D "Content" /> @@ -589,6 +624,11 @@ BuildAction =3D "Compile" /> <File + RelPath =3D "site\xBarFrame.aspx.resx" + DependentUpon =3D "xBarFrame.aspx.cs" + BuildAction =3D "EmbeddedResource" + /> + <File RelPath =3D "site\GFX\1x1.gif" BuildAction =3D "Content" /> Added: humano2/trunk/web/builder/site/importWz-step1.aspx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/importWz-step1.aspx 2005-06-15 23:05:1= 1 UTC (rev 1332) +++ humano2/trunk/web/builder/site/importWz-step1.aspx 2005-06-15 23:36:0= 6 UTC (rev 1333) @@ -0,0 +1,43 @@ +<%@ Page language=3D"c#" Codebehind=3D"importWz-step1.aspx.cs" AutoEvent= Wireup=3D"false" Inherits=3D"Portal.site.import" %> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > +<HTML> + <HEAD> + <title>import</title> + <meta content=3D"C#" name=3D"CODE_LANGUAGE"> + </HEAD> + <body > + <form id=3D"Form1" action=3D"importWz-step2.aspx" method=3D"post" encT= ype=3D"multipart/form-data"> + <input type=3D"hidden" name=3D"domainID" value=3D"<%GetDomain();%>"> + <table> + <tr> + <td>1. Select which class you wish to populate</td> + <td><SELECT id=3D"classId" name=3D"classId"> + <OPTION value=3D"0" selected>Select a class to import</OPTION> + <% GetClasses(); %> + </SELECT> + </td> + </tr> + <tr> + <td>2. Choose an ASCII file to upload:</td> + <td><INPUT id=3D"File1" type=3D"file" name=3D"File1"></td> + </tr> + <tr> + <td>3. Field delimitator:</td> + <td><input type=3D"radio" id=3D"delimitator" name=3D"delimitator" v= alue=3D"tab">Tab + <input type=3D"radio" id=3D"delimitator" name=3D"delimitator" valu= e=3D";">Semi-colon + <input type=3D"radio" id=3D"delimitator" name=3D"delimitator" valu= e=3D",">Coma + </td> + </tr> + <tr> + <td>4. Text qualifier:</td> + <td><input type=3D"radio" id=3D"qualifier" name=3D"qualifier" value= =3D"single">single quote(') + <input type=3D"radio" id=3D"qualifier" name=3D"qualifier" value=3D= "double">double quote (") + </td> + </tr> + <tr> + <td colspan=3D"2" align=3D"center"><INPUT id=3D"cmdUpload" type=3D"= submit" value=3D"Upload" name=3D"cmdUpload"></td> + </tr> + </table> + </form> + </body> +</HTML> Added: humano2/trunk/web/builder/site/importWz-step1.aspx.cs =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/importWz-step1.aspx.cs 2005-06-15 23:0= 5:11 UTC (rev 1332) +++ humano2/trunk/web/builder/site/importWz-step1.aspx.cs 2005-06-15 23:3= 6:06 UTC (rev 1333) @@ -0,0 +1,90 @@ +// +// The Humano2 Business solution. +// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. =20 +// +// $Id: importWz-step1.aspx.cs 921 2005-05-09 22:39:26Z marcelo $ +// + +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; + +using Humano2.Components.WebTools; + +namespace Portal.site +{ + /// <summary> + /// Summary description for import. + /// </summary> + public class import : basePage + { + private int domainId; + private void Page_Load(object sender, System.EventArgs e) + { + + // FIXME : cuando este funccionando el codigo de arriba (se guarde el= id del dominio en la sesion) eliminar esta linea + =09 + domainId =3D userCred.DomainIds[userCred.CurrentDomainIndex]; + } + ///<summary>Generates list of classes which can be imported into a spe= cific domain.</summary> + ///<param name=3D"domainID">Id of the domain which we are importing in= to.</param> + public void GetClasses() + { + int[] classIds; + string[] classNames; + adapter dbAdapter =3D userCred.CoreAdapter; + + dbAdapter.ClassByDomainId(domainId, out classNames,out classIds); + =09 + Response.Write("<option value=3D\"8\" >textline</option>\r\n"); + for (int i=3D0;i<classIds.Length;i++) + { + Response.Write("<option value=3D\"" + classIds[i] + "\" >" + classN= ames[i] + "</option>\r\n"); +// getViews(Convert.ToString(cd[i*2])); +// Response.Write(@"<UL><a href=3D""createInstance.aspx?id_entity=3D"= +cd[i*2]+@""" target=3D""mainFrame"">Crear: "+cd[i*2+1]+"</a></UL>"); + + } + =09 + } +=09 + public void GetDomain() + { + Response.Write(domainId); + } + + #region Web Form Designer generated code + override protected void OnInit(EventArgs e) + { + // + // CODEGEN: This call is required by the ASP.NET Web Form Designer. + // + InitializeComponent(); + base.OnInit(e); + } + =09 + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { =20 + this.Load +=3D new System.EventHandler(this.Page_Load); + + } + #endregion + + } +} Added: humano2/trunk/web/builder/site/importWz-step2.aspx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/importWz-step2.aspx 2005-06-15 23:05:1= 1 UTC (rev 1332) +++ humano2/trunk/web/builder/site/importWz-step2.aspx 2005-06-15 23:36:0= 6 UTC (rev 1333) @@ -0,0 +1,30 @@ +<%@ Page language=3D"c#" Codebehind=3D"importWz-step2.aspx.cs" AutoEvent= Wireup=3D"false" Inherits=3D"Portal.site.import2" %> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > +<HTML> + <HEAD> + <title>import2</title> + <meta content=3D"C#" name=3D"CODE_LANGUAGE"> + </HEAD> + <body> + <form id=3D"Form1" method=3D"post" action=3D"importWz-step3.aspx"> + <table> + <tr> + <td colspan=3D"3">The system tried to automatically match up the fi= elds from the=20 + textfile with the fields in the database, please double check the = match-ups and=20 + match-up any missing columns.<br> + If you are updating the information in the database, please select= wich column=20 + should be used as the key.</td> + </tr> + <tr> + <td>Databse Column</td> + <td>Text file Field</td> + <td>Update field</td> + </tr> + <% GetAttributesList(); %> + <tr> + <td colspan=3D"2"><input type=3D"submit" value=3D"Continuar"></td> + </tr> + </table> + </form> + </body> +</HTML> Added: humano2/trunk/web/builder/site/importWz-step2.aspx.cs =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/importWz-step2.aspx.cs 2005-06-15 23:0= 5:11 UTC (rev 1332) +++ humano2/trunk/web/builder/site/importWz-step2.aspx.cs 2005-06-15 23:3= 6:06 UTC (rev 1333) @@ -0,0 +1,348 @@ +//=20 +// The Humano2 Business solution.=20 +// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com)=20 +//=20 +// This program is free software; you can redistribute it and/or modify=20 +// it under the terms of the GNU General Public License as published by=20 +// the Free Software Foundation; either version 2 of the License, or=20 +// (at your option) any later version. =20 +//=20 +// $Id: config.cs 295 2005-02-17$ + +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Text; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; + +using Humano2.Components.WebTools; +using Humano2.Core; + + +namespace Portal.site +{ + /// <summary> + /// Summary description for import2. + /// </summary> + public class import2 : basePage + { + private Hashtable formObjList =3D new Hashtable(); + private int userId, domainId, maxsize; + private string basePath, baseDir; + private int uploaded =3D 0; + private string pathFilename; + private int classId; + private double now =3D DateTime.Now.ToOADate(); + private char qualifier, delimitator ; + + private void Page_Load(object sender, System.EventArgs e) + { + =09 + userId =3D userCred.UserId; + domainId =3D userCred.DomainIds[userCred.CurrentDomainIndex]; + basePath =3D Humano2.Core.Config.Instance().GetAbsoluteLocation("clie= ntPath") + "\\import\\uploadTmp\\"; + + LoadXMLvals(); + + ProcessRequest(); + + if (!formObjList.Contains("classId") || !formObjList.Contains("delimi= tator")) + return; + + classId =3D Convert.ToInt32(formObjList["classId"].ToString()); + if (formObjList["delimitator"].ToString() =3D=3D "tab") + { + delimitator =3D Convert.ToChar("\t"); + }else{ + delimitator =3D Convert.ToChar(formObjList["delimitator"].ToString()= ); + } + if (formObjList.Contains("qualifier")) + qualifier =3D Convert.ToChar(formObjList["qualifier"].ToString()); + + if (uploaded =3D=3D 0 && pathFilename !=3D "") + { + Response.Write("El archivo NO se subio, este no debe ser mayor a " += maxsize + " Bytes"); + return; + } + else + { + + File.Move(pathFilename, pathFilename.Replace(now.ToString(),"idDomai= n-idUser"+now)); + pathFilename =3D pathFilename.Replace(now.ToString(),"idDomain-idUse= r"+now.ToString()); +=09 + } + + } + + ///<summary>Sets the variable values.</summary> + ///<remarks>Eventually these values should be read from an XML config = file</remarks> + private void LoadXMLvals() + { + maxsize =3D 0; + } + + + ///<summary>Fills the dictionay with the form name/value pair and trie= s to upload the file.</summary> + ///<remarks>Perhaps the 2 things should be seperated into seperate fun= ctions.</remarks> + private void ProcessRequest() + { + =09 + // Put user code to initialize the page here + string sPostData =3D ""; + + // get form-data + byte [] biData =3D Request.BinaryRead (Request.TotalBytes); + =20 + // convert byte-array to its string representation + sPostData =3D System.Text.Encoding.Default.GetString (biData, 0, biDa= ta.Length); + =20 + // we get the content type and try to pull out the boundary informati= on + string sContentType =3D Request.ContentType; + string [] arrContentType =3D sContentType.Split (new char [] {';'}); + + if (arrContentType [0] =3D=3D "multipart/form-data") + { + // parse the boundary information + string [] arrBoundary =3D arrContentType [1].Trim ().Split (new char= [] {'=3D'}); + string sBoundary =3D "--" + arrBoundary [1].Trim (); + + // on a Windows98/IE5.0x machine the boundary ends with the enctype, + // so we just cut that off + if (sBoundary.IndexOf (",multipart/form-data") >=3D 0) + { + sBoundary =3D sBoundary.Replace (",multipart/form-data", ""); + } + + // loop for every item in the forms collection (enclosed by the boun= dary) + string sTemp =3D sPostData; + int iStartBoundary =3D sTemp.IndexOf (sBoundary, 0); + int i =3D 0; + bool bEndForm =3D false; + if (iStartBoundary >=3D 0) + { + // start: loop for form items + do + { + string sFormField =3D ""; + string sFormValue =3D ""; + + // parse the item's name and general information + int iStartField =3D iStartBoundary + sBoundary.Length + 2; + string sCRLF =3D sTemp.Substring (iStartBoundary + sBoundary.Lengt= h, 2); + int iStartCRLF =3D sTemp.IndexOf (sCRLF, iStartField); + int iStartNextBoundary =3D sTemp.IndexOf (sBoundary, iStartField); + sFormField =3D sTemp.Substring (iStartField, iStartCRLF - iStartFi= eld); + + // is the current item the <input type=3D"file">? + if (sFormField.IndexOf ("filename=3D") >=3D 0) + { + // then the next line contains the content-type of the uploaded f= ile + int iStartFieldContentType =3D iStartCRLF + 2; + iStartCRLF =3D sTemp.IndexOf (sCRLF, iStartFieldContentType); + string sFieldContentType =3D sTemp.Substring (iStartFieldContentT= ype, iStartCRLF - iStartFieldContentType); + + sFormField +=3D "; " + sFieldContentType; + } + + // parse the item's name + int iStartFieldName =3D sFormField.IndexOf (" name=3D"); + string sFieldName =3D sFormField.Substring (iStartFieldName + 7, s= FormField.Length - iStartFieldName - 7); + int iEndFieldName =3D sFieldName.IndexOf (";"); + if (iEndFieldName =3D=3D -1) iEndFieldName =3D sFieldName.Length; + sFieldName =3D sFieldName.Substring (0, iEndFieldName - 1); + + // parse the item's value + int iStartValue =3D iStartCRLF + 4; + iStartCRLF =3D sTemp.IndexOf (sCRLF, iStartValue); + int iEndValue =3D iStartNextBoundary - iStartValue - 2; + sFormValue =3D sTemp.Substring (iStartValue, iEndValue); + + // is the current item the <input type=3D"file">? + if (sFormField.IndexOf ("filename=3D") >=3D 0) + { + // parse the name of the uploaded file (without the path) + int iStartFileName =3D sFormField.IndexOf ("filename=3D"); + string sFileName =3D sFormField.Substring (iStartFileName + 10, s= FormField.Length - iStartFileName - 10); + int iEndFileName =3D sFileName.IndexOf (";"); + sFileName =3D sFileName.Substring (0, iEndFileName - 1); + int iPos =3D sFileName.LastIndexOf ("\\"); + iPos++; + sFileName =3D sFileName.Substring (iPos, sFileName.Length - iPos)= ; + + // parse the content-type of the uploaded file + + // get the binary data of the uploaded file + byte [] bFileContent =3D Encoding.Default.GetBytes (sFormValue); + =09 + if (maxsize =3D=3D 0 || (maxsize > 0 && bFileContent.Length <=3D= maxsize )) + { + // we could save the uploaded file here + pathFilename =3D basePath + now + sFileName ; + FileStream fs =3D new FileStream (pathFilename, FileMode.Create,= FileAccess.Write); + //fs.Write (bAux, 0, bFileContent.Length); + fs.Write (bFileContent, 0, bFileContent.Length); + fs.Close (); + uploaded =3D 1; + } + + // write file to db here + =20 + ViewState ["UrlReferrer4ChapterImage"] +=3D "true"; + + formObjList.Add(sFieldName,baseDir + sFileName); + + }else + formObjList.Add(sFieldName,sFormValue); + + // cut off the current item from the rest of the post data + sTemp =3D sTemp.Substring (iStartValue + iEndValue + 2, sTemp.Leng= th - iStartValue - iEndValue - 2); + =20 + // look for the next item + iStartBoundary =3D sTemp.IndexOf (sBoundary, 0); + + // the last item ends with two additional hyphens + if (sTemp.Substring (0, sBoundary.Length + 2) =3D=3D sBoundary + "= --") + { + bEndForm =3D true; + } + + // increment the counter + i++; + } while (iStartBoundary >=3D 0 && !bEndForm); + // end of: loop for form items + } + } + } + + + ///<summary>Builds the interface to match-up the columns to be importe= d.</summary> + ///<param name=3D"classId">Id of the class which we are importing into= .</param> + ///<remarks>Currently generates HTML, should change to XML.</remarks> + public void GetAttributesList() + { + =09 + DataSet dsAtts =3D new DataSet(); + string rawFileFields; + string allDbAtts =3D ""; + bool dateCols =3D false; + //Read the first line of the file uploaded + using (StreamReader sr =3D new StreamReader(pathFilename))=20 + { + if ((rawFileFields =3D sr.ReadLine()) =3D=3D null)=20 + { + Response.Write ("File is Empty"); + } + } + =09 + string[] colsArr =3D rawFileFields.Split(delimitator); + =09 + //absCrud crud =3D Factory.Crud(); + //This section will need to be modified in the future to restrict=20 + // the attributes which the user can manipulate + //DataSet dsAtts=3D crud.ReadStructure(classId); + + //For debuging reasons I use these 2 calls to get the XML version of = the dataset. + adapter dbAdapter =3D new adapter(); + string xmlStr =3D dbAdapter.ReadStructureAsXml(classId); + + StringReader strReader =3D new StringReader(xmlStr);=20 + dsAtts.ReadXml(strReader); + + //load allowed or forbiden attributes (to be definded) + // attribs =3D somefunc(classId); + + StringBuilder HtmlData =3D new StringBuilder(); + StringWriter swHtml =3D new StringWriter(HtmlData); + + + if(dsAtts.Tables.Contains("attribute")) + { + if(dsAtts.Tables["attribute"].Rows.Count>0) + { + foreach(DataRow attRow in dsAtts.Tables["attribute"].Rows) + { + if (attRow["classId"].ToString() !=3D "3") + { + if (attRow["refClassSysName"].ToString() =3D=3D "dateTime") + dateCols =3D true; + + allDbAtts =3D allDbAtts + attRow["id_entity"].ToString() +","; + // if attribute is allowed to be manipulated... + swHtml.WriteLine("<tr><td>" + attRow["attName"].ToString() + "</t= d>" ); + swHtml.WriteLine("<td><select name=3D\"strFieldPosName\">"); + swHtml.WriteLine("<option value=3D\"0\">Select an Attribute</opti= on>"); + int i; + for (i=3D0;i<colsArr.Length;i++) + { + if (colsArr[i].ToUpper() !=3D "ID") + { + swHtml.Write("<option value=3D'" + Convert.ToString(i + 1) + "|= " + colsArr[i] + "' "); + if (attRow["attName"].ToString().ToUpper() =3D=3D colsArr[i].Tr= im().ToUpper()) swHtml.Write(" SELECTED "); + swHtml.Write(">" + colsArr[i] + "</option>\r\n") ; + } + } + swHtml.WriteLine("</select>"); + swHtml.WriteLine("</td><td><input type=3D\"checkbox\" name=3D\"up= dateAtts\" value=3D\""+ attRow["id_entity"].ToString() + "\">"); + swHtml.WriteLine("</tr>"); + } + } + }else + Response.Write ("This class has no attributes defined"); + }else + Response.Write ("This class has no attributes defined"); + if (dateCols) + { + // text to be obtained from language file + swHtml.WriteLine("<tr><td>Por favor indica en que formato estan las = fechas</td>" ); + swHtml.WriteLine("<td><select name=3D\"dateFormat\">"); + swHtml.WriteLine("<option value=3D'mm/dd/yyyy'>mm/dd/yyyy</option>")= ; + swHtml.WriteLine("<option value=3D'mm-dd-yyyy'>mm-dd-yyyy</option>")= ; + swHtml.WriteLine("<option value=3D'dd/mm/yyyy'>dd/mm/yyyy</option>")= ; + swHtml.WriteLine("<option value=3D'dd-mm-yyyy'>dd-mm-yyyy</option>")= ; + swHtml.WriteLine("<option value=3D'yyyy-mm-dd'>yyyy-mm-dd</option>")= ; + swHtml.WriteLine("<option value=3D'yyyy/mm/dd'>yyyy/mm/dd</option>")= ; + swHtml.WriteLine("</select>"); + }else + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"dateFormat\" val= ue=3D\"\">"); + + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"classId\" value=3D= \"" + classId + "\">"); + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"delimitator\" val= ue=3D\"" + delimitator + "\">"); + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"qualifier\" value= =3D\"" + qualifier + "\">"); + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"srcFile\" value=3D= \"" + pathFilename + "\">"); + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"rawFileFields\" v= alue=3D\"" + rawFileFields + "\">"); + swHtml.WriteLine("<input type=3D\"hidden\" name=3D\"allDbAtts\" value= =3D\"" + allDbAtts.Substring(0,allDbAtts.Length-1) + "\">"); + =09 + swHtml.Flush(); + swHtml.Close(); + + Response.Write (swHtml.ToString()); + } + + + #region Web Form Designer generated code + override protected void OnInit(EventArgs e) + { + // + // CODEGEN: This call is required by the ASP.NET Web Form Designer. + // + InitializeComponent(); + base.OnInit(e); + } + =09 + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { =20 + this.Load +=3D new System.EventHandler(this.Page_Load); + } + #endregion + } +} Added: humano2/trunk/web/builder/site/importWz-step3.aspx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/importWz-step3.aspx 2005-06-15 23:05:1= 1 UTC (rev 1332) +++ humano2/trunk/web/builder/site/importWz-step3.aspx 2005-06-15 23:36:0= 6 UTC (rev 1333) @@ -0,0 +1,13 @@ +<%@ Page language=3D"c#" Codebehind=3D"importWz-step3.aspx.cs" AutoEvent= Wireup=3D"false" Inherits=3D"Portal.site.import3" %> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > +<HTML> + <HEAD> + <title>import3</title> + <meta name=3D"CODE_LANGUAGE" Content=3D"C#"> + </HEAD> + <body > + <% createFiles(); %> + Your file is ready to be uploaded. + + </body> +</HTML> Added: humano2/trunk/web/builder/site/importWz-step3.aspx.cs =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/importWz-step3.aspx.cs 2005-06-15 23:0= 5:11 UTC (rev 1332) +++ humano2/trunk/web/builder/site/importWz-step3.aspx.cs 2005-06-15 23:3= 6:06 UTC (rev 1333) @@ -0,0 +1,119 @@ +//=20 +// The Humano2 Business solution.=20 +// Copyright (C) 2004,5 Humano2 Chile S.A. (http://www.humano2.com)=20 +//=20 +// This program is free software; you can redistribute it and/or modify=20 +// it under the terms of the GNU General Public License as published by=20 +// the Free Software Foundation; either version 2 of the License, or=20 +// (at your option) any later version. =20 +//=20 +// $Id: config.cs 295 2005-02-17$ + +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; +using System.IO; +using Humano2.Components.WebTools; + +namespace Portal.site +{ + /// <summary> + /// Summary description for import3. + /// </summary> + public class import3 : basePage + { + private int userId, domainId, classId; + private string delimitator, qualifier, dbAtts, fileAtts, rawFileField= s, srcFile; + private string baseDir, updateAtts; + private string[] arrFieldPosName, allDbAtts; + + private void Page_Load(object sender, System.EventArgs e) + { + // FIXME : cuando este funccionando el codigo de arriba (se guarde el= id del dominio en la sesion) eliminar esta linea + //userId =3D userCred.Id; + //domainId =3D userCred.Domain; + userId =3D userCred.UserId; + domainId =3D userCred.DomainIds[userCred.CurrentDomainIndex]; + + baseDir =3D Humano2.Core.Config.Instance().GetAbsoluteLocation("clien= tPath"); + classId =3D Convert.ToInt32(Request.Form["classId"]); + delimitator =3D Request.Form["delimitator"]; + qualifier =3D Request.Form["qualifier"]; + updateAtts =3D Request.Form["updateAtts"]; + allDbAtts =3D Request.Form["allDbAtts"].Split(','); + rawFileFields =3D Request.Form["rawFileFields"]; + srcFile =3D Request.Form["srcFile"]; + arrFieldPosName =3D Request.Form["strFieldPosName"].Split(','); + } + + public void createFiles() + { + string basename; + int i; + //remove the path from the file name + int iPos =3D srcFile.LastIndexOf ("\\"); + iPos++; + basename =3D srcFile.Substring (iPos, srcFile.Length - iPos); + for (i=3D0;i<arrFieldPosName.Length;i++) + { + if (arrFieldPosName[i] !=3D "0")=20 + { + dbAtts =3D dbAtts + allDbAtts[i] + ","; + fileAtts =3D fileAtts + arrFieldPosName[i].Substring(0,arrFieldPosN= ame[i].IndexOf("|")) + ","; + + } + } + dbAtts =3D dbAtts.Substring(0,dbAtts.Length -1); + fileAtts =3D fileAtts.Substring(0,fileAtts.Length -1); + + //remove the path from the file extension and add the .xml extension + iPos =3D basename.LastIndexOf ("."); + basename =3D basename.Substring (0, iPos) + ".xml"; + =09 + using (StreamWriter sw =3D new StreamWriter(baseDir + "\\import\\toBe= Procesed\\"+basename))=20 + { + sw.WriteLine("<?xml version=3D\"1.0\" encoding=3D\"UTF-8\"?>"); + sw.WriteLine("<config>"); + sw.WriteLine(" <userId>" + userId + "</userId>"); + sw.WriteLine(" <domainId>" + domainId + "</domainId>"); + sw.WriteLine(" <classId>" + classId + "</classId>"); + sw.WriteLine(" <delimitator>" + delimitator + "</delimitator>"); + sw.WriteLine(" <qualifier>" + qualifier + "</qualifier>"); + sw.WriteLine(" <updateAtts>" + updateAtts + "</updateAtts>"); + sw.WriteLine(" <dbAtts>" + dbAtts + "</dbAtts>"); + sw.WriteLine(" <fileAtts>" + fileAtts + "</fileAtts>"); + sw.WriteLine(" <rawFileFields>" + rawFileFields + "</rawFileFields>"= ); + sw.WriteLine("</config>"); + + } + File.Move(srcFile,baseDir + "\\import\\toBeProcesed\\" + basename.Rep= lace(".xml","-TMP.TXT")); =09 + } + + #region Web Form Designer generated code + override protected void OnInit(EventArgs e) + { + // + // CODEGEN: This call is required by the ASP.NET Web Form Designer. + // + InitializeComponent(); + base.OnInit(e); + } + =09 + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { =20 + this.Load +=3D new System.EventHandler(this.Page_Load); + } + #endregion + } +} Modified: humano2/trunk/web/builder/site/leftbar.aspx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/builder/site/leftbar.aspx 2005-06-15 23:05:11 UTC (= rev 1332) +++ humano2/trunk/web/builder/site/leftbar.aspx 2005-06-15 23:36:06 UTC (= rev 1333) @@ -193,6 +193,14 @@ </a> </td> <tr> =09 + <tr id=3D'1' fname=3D'Application' style=3D"cursor: hand;"> + <td id=3D'folder1' align=3D"center" width=3D"100%" nowrap> + <a target=3D"mainFrame" href=3D"importWz-step1.aspx"> + <img src=3D"img/icon_import_XL.gif" border=3D0><br> + Import Data + </a> + </td> + <tr> =09 </table>=20 </div> =09 <!-- </td> Modified: humano2/trunk/web/portal/portal.csproj =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- humano2/trunk/web/portal/portal.csproj 2005-06-15 23:05:11 UTC (rev 1= 332) +++ humano2/trunk/web/portal/portal.csproj 2005-06-15 23:36:06 UTC (rev 1= 333) @@ -167,7 +167,7 @@ <File RelPath =3D "site\domain.aspx.cs" DependentUpon =3D "domain.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -199,7 +199,7 @@ <File RelPath =3D "site\index.aspx.cs" DependentUpon =3D "index.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -209,7 +209,7 @@ <File RelPath =3D "site\indexPortal.aspx.cs" DependentUpon =3D "indexPortal.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -234,7 +234,7 @@ <File RelPath =3D "site\instancedelete.aspx.cs" DependentUpon =3D "instancedelete.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -286,7 +286,7 @@ <File RelPath =3D "site\Report.aspx.cs" DependentUpon =3D "Report.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -306,7 +306,7 @@ <File RelPath =3D "site\showView.aspx.cs" DependentUpon =3D "showView.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -322,7 +322,7 @@ <File RelPath =3D "site\topbar.aspx.cs" DependentUpon =3D "topbar.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File @@ -363,7 +363,7 @@ <File RelPath =3D "site\viewrelations.aspx.cs" DependentUpon =3D "viewrelations.aspx" - SubType =3D "Code" + SubType =3D "ASPXCodeBehind" BuildAction =3D "Compile" /> <File |