|
From: <sv...@de...> - 2005-06-14 23:32:29
|
Author: marcelo
Date: 2005-06-14 19:32:28 -0400 (Tue, 14 Jun 2005)
New Revision: 1328
Modified:
humano2/trunk/components/webTools/Html.cs
humano2/trunk/components/webTools/session.cs
humano2/trunk/config/config.xml.tmpl
humano2/trunk/core/config.cs
humano2/trunk/core/db/loader.cs
humano2/trunk/web/portal/portal.csproj
humano2/trunk/web/portal/site/domain.aspx.cs
humano2/trunk/web/portal/site/login.aspx.cs
Log:
* config.xml.tmpl changed the concepts of how the directories are specif=
ied, most files changed to reflect this.
* Login changed to show image of database being used
* Portal changed to eliminate files from poyect
Modified: humano2/trunk/components/webTools/Html.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/components/webTools/Html.cs 2005-06-14 23:14:25 UTC (re=
v 1327)
+++ humano2/trunk/components/webTools/Html.cs 2005-06-14 23:32:28 UTC (re=
v 1328)
@@ -90,21 +90,21 @@
///This path is taken from the config.xml <clientPath> tag which=
is concatenated to the current domainId
///<returns>The path of client</return>
///</summary>
- public static string GetClientPath(SessionCredencial userCred)=20
+ public static string GetClientPath(SessionCredencial userCred)
{
int domainId =3D userCred.DomainIds[userCred.CurrentDomainIn=
dex];
- string res =3D Config.Instance().GetOption("locations", "cli=
entPath") + Path.DirectorySeparatorChar + domainId;
+ string res =3D Config.Instance().GetAbsoluteLocation("client=
Path") + Path.DirectorySeparatorChar + domainId;
return res;
}
///<summary>
/// Allows to upload a collection of file in the directory
- /// specified in config.xml=20
+ /// specified in config.xml
///</summary>
public static void UploadFile(HttpPostedFile file,int idEntity, =
string attId, System.Web.HttpResponse Response,SessionCredencial userCred=
)
{
- string strFileName; =20
+ string strFileName;
=20
- if (file.FileName !=3D "")=20
+ if (file.FileName !=3D "")
{
//Due to a difference between Mono an .NET we must do a =
check here
string fileNameWithoutExtension =3D Path.GetFileName(fil=
e.FileName);
@@ -133,9 +133,9 @@
string fullFileName =3D uploadPath + Path.Directory=
SeparatorChar + strFileName;
file.SaveAs(fullFileName);
}
- catch (Exception err)=20
+ catch (Exception err)
{
- Response.Write("Failed uploading " + strFileName + "=
: " + err.ToString()+"<br>"); =20
+ Response.Write("Failed uploading " + strFileName + "=
: " + err.ToString()+"<br>");
}
}
}
Modified: humano2/trunk/components/webTools/session.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/components/webTools/session.cs 2005-06-14 23:14:25 UTC =
(rev 1327)
+++ humano2/trunk/components/webTools/session.cs 2005-06-14 23:32:28 UTC =
(rev 1328)
@@ -37,12 +37,12 @@
=09
/// <summary>Test if a user has the right to do a certain task.</summa=
ry>
/// <returns>Returns true if the user has the right, false otherwise.<=
/returns>
- public bool HasPrivilege(Privileges priv)=20
+ public bool HasPrivilege(Privileges priv)
{
switch(priv) {
case Privileges.UserModify: // See if the user has the privilege to =
modify users.
foreach(int dId in DomainIds) {
- if(dId =3D=3D (int) MetaModelConsts.DomainsSystem) {=20
+ if(dId =3D=3D (int) MetaModelConsts.DomainsSystem) {
return true;
}
}
@@ -66,7 +66,7 @@
static SessionManager currentSessionManager =3D null;
=20
///<summary>El path del directorio con las sessiones.</summary>
- private string sessionPath =3D Core.Config.Instance().GetOption("locat=
ions","session");
+ private string sessionPath =3D Core.Config.Instance().GetAbsoluteLocat=
ion("session");
=20
/// <summary>
/// Tiempo de vida de las sesiones.
@@ -101,13 +101,13 @@
Thread timerControler =3D new Thread(new ThreadStart(timeDeletion));
timerControler.Start();
}
-
- public void setNewLastAccess()
- {
- SessionManager cs =3D SessionManager.currentSessionManager;
- cs.newAccess =3D DateTime.Now;
- }
=20
+ public void setNewLastAccess()
+ {
+ SessionManager cs =3D SessionManager.currentSessionManager;
+ cs.newAccess =3D DateTime.Now;
+ }
+
/// <summary>
/// Libera todos los recursos de la session manager
/// </summary>
Modified: humano2/trunk/config/config.xml.tmpl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/config/config.xml.tmpl 2005-06-14 23:14:25 UTC (rev 132=
7)
+++ humano2/trunk/config/config.xml.tmpl 2005-06-14 23:32:28 UTC (rev 132=
8)
@@ -9,10 +9,11 @@
<pass>h2_dbase!</pass> <!-- The password of the database -->
</database>
<locations>
- <dbdrivers>C:\h2_install\bin</dbdrivers> <!-- Where is the datab=
ase driver direcotory -->
- <session>C:\h2_sessions</session> <!-- Directory where ar=
e the session xml files stored -->
+ <basedir>C:\h2_install</basedir> <!-- The base directory where the Hum=
ano2 files are located. -->
+ <dbdrivers>bin</dbdrivers> <!-- Where is the database driver dir=
ecotory -->
+ <session>h2_sessions</session> <!-- Directory where are t=
he session xml files stored -->
<webbase>http://localhost:8080</webbase> <!-- what's the base lo=
cation where the humano2 installation lives? -->=20
- <clientPath>C:\upload</clientPath> <!-- Where the user will stor=
e his files, and where other files related to him will remain -->
+ <clientPath>upload</clientPath> <!-- Where the user will store h=
is files, and where other files related to him will remain -->
</locations>
<log>
<level>0</level> <!-- detail of error logging. higher numer is high=
er logging level. 0 =3D off. -->
Modified: humano2/trunk/core/config.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/core/config.cs 2005-06-14 23:14:25 UTC (rev 1327)
+++ humano2/trunk/core/config.cs 2005-06-14 23:32:28 UTC (rev 1328)
@@ -137,12 +137,35 @@
/// <returns>The platform version.</returns>
public string GetVersion()
{
- return String.Format("{0}.{1}.{2}", major, minor, patch);
- //Version ver =3D new Version( major, minor, patch );
- //return ver.ToString( );
- =20
+ return String.Format("{0}.{1}.{2}", major, minor, patch);
}
+
=09
+ /// <summary>
+ /// Returns the absolute location of a variable.
+ /// </summary>
+ /// <returns>The absolute location</returns>
+ /// <param name=3D"variableName">The name of the option in the locatio=
ns section.</param>
+ public string GetAbsoluteLocation(string variableName)
+ {
+ string fileName =3D GetOption("locations", variableName);
+ =09
+ if( (fileName[0] =3D=3D Path.DirectorySeparatorChar) || // "/home" et=
c..
+ (fileName[1] =3D=3D ':') ) // "C:" or "F:".
+ { // The path reference is already absolute, don't add any base path.
+ return fileName;
+ }
+ =09
+ string baseDir =3D GetOption("locations", "basedir");
+ =09
+ if(baseDir[baseDir.Length-1] !=3D Path.DirectorySeparatorChar)
+ { // If the baseDir didn't add with a "/" or "\", add it.
+ baseDir =3D baseDir + Path.DirectorySeparatorChar;
+ }
+ =09
+ return baseDir + fileName;
+ }
+ =09
RunTimeEnum _runtime =3D RunTimeEnum.Unknown;
DataBaseEnum _database =3D DataBaseEnum.Unknown;
=09
Modified: humano2/trunk/core/db/loader.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/core/db/loader.cs 2005-06-14 23:14:25 UTC (rev 1327)
+++ humano2/trunk/core/db/loader.cs 2005-06-14 23:32:28 UTC (rev 1328)
@@ -75,7 +75,7 @@
private void genObjectConstructors(Config conf)
{
string driverFile =3D conf.GetOption("database", "driver");
- string driverDir =3D conf.GetOption("locations", "dbdrivers");
+ string driverDir =3D conf.GetAbsoluteLocation("dbdrivers");
string driverPath =3D driverDir + Path.DirectorySeparatorChar + drive=
rFile;
=20
Assembly dbAssem =3D Assembly.LoadFrom(driverPath);
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-14 23:14:25 UTC (rev 1=
327)
+++ humano2/trunk/web/portal/portal.csproj 2005-06-14 23:32:28 UTC (rev 1=
328)
@@ -290,17 +290,6 @@
BuildAction =3D "Compile"
/>
<File
- RelPath =3D "site\search.aspx"
- SubType =3D "Form"
- BuildAction =3D "Content"
- />
- <File
- RelPath =3D "site\search.aspx.cs"
- DependentUpon =3D "search.aspx"
- SubType =3D "Code"
- BuildAction =3D "Compile"
- />
- <File
RelPath =3D "site\showimage.aspx"
BuildAction =3D "Content"
/>
Modified: humano2/trunk/web/portal/site/domain.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/portal/site/domain.aspx.cs 2005-06-14 23:14:25 UTC =
(rev 1327)
+++ humano2/trunk/web/portal/site/domain.aspx.cs 2005-06-14 23:32:28 UTC =
(rev 1328)
@@ -81,7 +81,7 @@
}
protected void databaseImage()
{
- if(Config.Instance().GetOption("database", "driver") =3D=3D "Humano2.=
Core.Db.Pgsql.dll") {
+ if(Config.Instance().DataBase =3D=3D DataBaseEnum.PostgreSQL) {
Response.Write(@"<a href=3D""http://www.postgresql.org""><img src=3D=
""img/postgresql-powered.png"" border=3D""0""></a>");
}
}
Modified: humano2/trunk/web/portal/site/login.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/portal/site/login.aspx.cs 2005-06-14 23:14:25 UTC (=
rev 1327)
+++ humano2/trunk/web/portal/site/login.aspx.cs 2005-06-14 23:32:28 UTC (=
rev 1328)
@@ -110,7 +110,7 @@
}
protected void databaseImage()
{
- if(Config.Instance().GetOption("database", "driver") =3D=3D "Humano2.=
Core.Db.Pgsql.dll") {
+ if(Config.Instance().DataBase =3D=3D DataBaseEnum.PostgreSQL) {
Response.Write(@"<a href=3D""http://www.postgresql.org""><img src=3D=
""img/postgresql-powered.png"" border=3D""0""></a>");
}
}
|