|
From: <sv...@de...> - 2005-07-08 15:27:16
|
Author: marcelo
Date: 2005-07-08 11:27:14 -0400 (Fri, 08 Jul 2005)
New Revision: 1453
Modified:
humano2/trunk/core/config.cs
humano2/trunk/web/portal/site/topbar.aspx.cs
Log:
* User can now, not so easily though, opt not to send statistics to cent=
ral server.
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-07-08 14:39:29 UTC (rev 1452)
+++ humano2/trunk/core/config.cs 2005-07-08 15:27:14 UTC (rev 1453)
@@ -81,14 +81,13 @@
}
=09
private DataSet configSet =3D new DataSet();
- =09
/// <summary>
/// Returns the value of the option.
/// </summary>
/// <param name=3D"part">The section</param>
/// <param name=3D"key">The Item</param>
/// <returns>The value defined.</returns>
- public string GetOption(string part, string key)
+ public string GetOption(string part, string key, bool obligatory)
{
if( OptionExists( part, key ) )
{
@@ -97,9 +96,21 @@
}
else
{
- throw( new ConfigException( "Missing <" + part + "><" + key + "> in =
config." ) );
+ if (obligatory)
+ {
+ throw( new ConfigException( "Missing <" + part + "><" + key + "> in=
config." ) );
+ }
+ else
+ {
+ return "";
+ }
}
}
+
+ public string GetOption(string part, string key)
+ {
+ return GetOption(part, key, true);
+ }
=09
/// <summary>
/// Tests if the selected option is defined in the configuration and c=
ontains any values.
@@ -109,9 +120,11 @@
/// <returns>True if defined, false otherwise.</returns>
public bool OptionExists(string part, string key)
{
+ string res;
try
{
- string res =3D configSet.Tables[part].Rows[0][key].ToString( );
+ res =3D configSet.Tables[part].Rows[0][key].ToString( );
+
if( res.Length > 0 )
{
return true;
@@ -120,15 +133,21 @@
{
return false;
}
- }
+ }
catch(System.IndexOutOfRangeException)
{
- return false;
- }
+ return false;
+ }
catch(System.NullReferenceException)
{
- return false;
- }
+ return false;
+ }
+ catch(System.ArgumentException)
+ {
+ return false;
+ }
+
+ =09
}
=09
/// <summary>
Modified: humano2/trunk/web/portal/site/topbar.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/topbar.aspx.cs 2005-07-08 14:39:29 UTC =
(rev 1452)
+++ humano2/trunk/web/portal/site/topbar.aspx.cs 2005-07-08 15:27:14 UTC =
(rev 1453)
@@ -61,13 +61,16 @@
=20
=09
xmlString +=3D "<Page>";
- xmlString +=3D "<Current-Info>";
- xmlString +=3D "<UserName><![CDATA[" + userCred.UserName + "]]></User=
Name>";
- xmlString +=3D "<DomainName><![CDATA[" + userCred.DomainNames[userCre=
d.CurrentDomainIndex] + "]]></DomainName>";
- xmlString +=3D "<Session><![CDATA[" + Cookies.Get(WebConst.SessionCoo=
kie) + "]]></Session>";
- xmlString +=3D "<Version><![CDATA[" + Humano2.Core.Config.Instance().=
GetVersion() + "]]></Version>";
- xmlString +=3D "</Current-Info>";
=20
+ if(Humano2.Core.Config.Instance().GetOption("log", "statistics", fals=
e) !=3D "no")=20
+ {
+ xmlString +=3D "<Current-Info>";
+ xmlString +=3D "<UserName><![CDATA[" + userCred.UserName + "]]></Use=
rName>";
+ xmlString +=3D "<DomainName><![CDATA[" + userCred.DomainNames[userCr=
ed.CurrentDomainIndex] + "]]></DomainName>";
+ xmlString +=3D "<Session><![CDATA[" + Cookies.Get(WebConst.SessionCo=
okie) + "]]></Session>";
+ xmlString +=3D "<Version><![CDATA[" + Humano2.Core.Config.Instance()=
.GetVersion() + "]]></Version>";
+ xmlString +=3D "</Current-Info>";
+ }
xmlString+=3D"<classes>";
=20
for(int c =3D 0; c < classNames.Length; c++)
|