|
From: <sv...@de...> - 2005-06-09 20:10:43
|
Author: pcamacho
Date: 2005-06-09 16:10:43 -0400 (Thu, 09 Jun 2005)
New Revision: 1274
Modified:
humano2/trunk/web/portal/site/report.aspx.cs
humano2/trunk/web/portal/site/search.aspx
humano2/trunk/web/portal/site/search.aspx.cs
humano2/trunk/web/portal/site/topbar.aspx
Log:
FIX: bug #178. Can't be fixed completely as there's a problem in viewtool=
s (see #193). A new ticket for report has=20
been opened (#194).
Modified: humano2/trunk/web/portal/site/report.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/report.aspx.cs 2005-06-08 22:55:51 UTC =
(rev 1273)
+++ humano2/trunk/web/portal/site/report.aspx.cs 2005-06-09 20:10:43 UTC =
(rev 1274)
@@ -12,6 +12,7 @@
=20
using System;
using System.Collections;
+using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
@@ -64,9 +65,8 @@
/// Construct a xml string that represents a view
/// <param name=3D"idView">used to get the params of the view</=
param>
///</summary>
- private string getXmlFromDatableView(DataTable viewRes, int idVi=
ew) =20
+ private string getXmlFromDatableView(DataTable viewRes, int idRe=
port) =20
{
- //adapter dbAdapter =3D userCred.CoreAdapter;
absCrud crud =3D Factory.Crud();
absComplex complex =3D crud.GetCore().Complex;
string xmlString =3D "";
@@ -79,31 +79,31 @@
=20
foreach(DataColumn col in viewRes.Columns)=20
{
- string colName =3D col.ColumnName;
- =20
- if(colName =3D=3D "instanceUrl") //Skip this col
- {=20
- continue;=20
- }
- =20
- if(colName =3D=3D "id_entity") //Skip this col and u=
pdate the list of group attributes
- {=20
- xmlString +=3D"<attribute><value>id_entity</valu=
e><show>0</show></attribute>"; =20
- continue;=20
- }
- if(colName.StartsWith("id_entity")) //Skip this col
- {=20
- continue;=20
- } =20
- xmlString +=3D"<attribute>"; =20
- =20
- //Get the real user column name that corresponds to =
system column name
- string userColName =3D complex.ConvertSysAttNameToUs=
erAttName(colName);
- =20
- xmlString +=3D "<value>"
- + userColName
- + "</value><show>1</show>"; =
=20
- xmlString +=3D "</attribute>";
+ string colName =3D col.ColumnName;
+ =20
+ if(colName =3D=3D "instanceUrl") //Skip this col
+ {=20
+ continue;=20
+ }
+ =20
+ if(colName =3D=3D "id_entity") //Skip this col and updat=
e the list of group attributes
+ {=20
+ xmlString +=3D"<attribute><value>id_entity</value><s=
how>0</show></attribute>"; =20
+ continue;=20
+ }
+ if(colName.StartsWith("id_entity")) //Skip this col
+ {=20
+ continue;=20
+ } =20
+ xmlString +=3D"<attribute>"; =20
+ =20
+ //Get the real user column name that corresponds to syst=
em column name
+ string userColName =3D complex.ConvertSysAttNameToUserAt=
tName(colName);
+ =20
+ xmlString +=3D "<value>"
+ + userColName
+ + "</value><show>1</show>"; =
=20
+ xmlString +=3D "</attribute>";
}
xmlString +=3D "</attributes>";
=20
@@ -167,11 +167,11 @@
}
=20
//If the value corresponds to an attribute o=
f group then add it to the list of values of group
- string valueToCompare;
- =20
- =20
- if(isInArray( Convert.ToString(complex.Con=
vertSysAttNameToIdAttName(auxcolname)),
- getGroupAttributes(idView)))
+ string valueToCompare =3D Convert.ToString(c=
omplex.ConvertSysAttNameToIdAttName(auxcolname));
+ string fullValue;
+ if(isInArray( valueToCompare,
+ getGroupAttributes(idReport)=
,
+ out fullValue)) //Careful: d=
on't use fullValue as many target can have the same fullValue=3D> use the=
NameValueCollection
{
groupValues +=3D row[col] + separator;
}
@@ -182,10 +182,10 @@
//Now add the details for every agrupacion
//DataTable viewParamsTable =3D getViewTableRes(idEntity=
Report, out iniClass);
xmlString +=3D"<details>";
- xmlString +=3D "<attsIdToCompare>" + getXmlGroupAttri=
butes(idView,separator) + "</attsIdToCompare>";
+ xmlString +=3D "<attsIdToCompare>" + getXmlGroupAttri=
butes(idReport,separator) + "</attsIdToCompare>";
xmlString +=3D "<valuesToCompare>" + groupValues + "<=
/valuesToCompare>";
xmlString +=3D "<iniClass>" + Convert.ToString(iniCla=
ss) + "</iniClass>";
- xmlString +=3D "<operators>" + getOperatorsList(idVie=
w,separator) + "</operators>";
+ xmlString +=3D "<operators>" + getOperatorsList(idRep=
ort,separator) + "</operators>";
xmlString +=3D "</details>";
=20
xmlString +=3D "</instance>";
@@ -207,10 +207,10 @@
return columnsTab;
}
=20
- private string getOperatorsList(int viewId, string separator)
+ private string getOperatorsList(int reportId, string separator)
{
string operators =3D "";
- string columns =3D getGroupByParam(viewId);
+ string columns =3D getGroupByParam(reportId);
Logger.Log("getGroupOperatorsList: columns =3D " +columns , =
LogLevel.Trace);
string [] columnsTab =3D columns.Split(new char [] {','}); /=
/Get every single
=20
@@ -218,13 +218,12 @@
{
operators +=3D "4" + separator; //Always the same op
}
- =20
return operators;
}
=20
- private string getXmlGroupAttributes(int viewId, string separato=
r)
+ private string getXmlGroupAttributes(int reportId, string separa=
tor)
{
- string [] listAttGroup =3D getGroupAttributes(viewId);
+ string [] listAttGroup =3D getGroupAttributes(reportId);
string listAttGroupStr =3D "";
=20
for(int i=3D0;i<listAttGroup.Length;i++)
@@ -242,22 +241,49 @@
return res;
}
=20
- private bool isInArray(string value, string [] tab)
+ ///<summary>
+ ///Does two things. First says if a value is in a tab, getting o=
ut the source att for a pertinence. Example
+ /// Tab value | value
+ /// ------------------------- =20
+ /// 10001 | 10001 =3D> TRUE
+ /// 10002 | 10001 =3D> FALSE
+ ///10001^10016 | 10016 =3D> TRUE
+ ///The second thing is that if the search is succesfull then ful=
lValue receives the tabValue that
+ /// performed the search
+ ///<param name=3D"value">Value to search in the tab</param>
+ ///<param name=3D"tab">The tab</param>
+ ///<param name=3D"fullValue">the value updated if search is succ=
essful</param>
+ ///</summary>
+ private bool isInArray(string value, string [] tab, out string f=
ullValue)
{ =20
Logger.Log("isInArray:",LogLevel.Trace);
Logger.Log("value=3D " + value,LogLevel.Trace);
+ =20
for(int i=3D0;i<tab.Length;i++)
{
Logger.Log("tab[" + i + "]=3D " + tab[i],LogLevel.Trace)=
;
=20
- if(tab[i] =3D=3D value)
+ string valueToCompare; =20
+ string [] splitValue =3D tab[i].Split("^".ToCharArray())=
;
+ if(splitValue.Length > 1) //This is a pertinence attribu=
te, ie of the=20
{
+ valueToCompare =3D splitValue[1]; //Take only the ta=
rget of pertinence to do the comparation
+ }
+ else
+ {
+ valueToCompare =3D tab[i]; =20
+ }
+ =20
+ if(valueToCompare =3D=3D value)
+ {
Logger.Log("true",LogLevel.Trace);
- return true; =20
+ fullValue =3D tab[i];
+ return true; //Returns the full id
}
}
Logger.Log("false",LogLevel.Trace);
- return false;
+ fullValue =3D null;
+ return false; //no value founded
}
=20
//FIXME this function exists also (identically) in search.aspx.c=
s
@@ -309,9 +335,46 @@
return viewRes;
}
=20
+ =20
+ ///<summary>
+ ///Here is the problem: when building the xml in getXmlFromDatab=
leView, for the attributes we only get
+ ///the sysAttName that can be converted in a id. But if an attri=
bute is a pertinence, we need to add attFrom^attTo=20
+ ///where attTo is the id of attribute. The only of knowing it (f=
or me yet), is to build an association table using the view of
+ ///report and the list of group columns for the report itself at=
the same time...=20
+ ///[[[ Supposing of course that the order of the columns in the =
report is the same as the order of columns ]]]
+ ///[[[ in the datatable resulting from the view =
]]].
+ ///</summary>
+ ///<param name=3D"viewDt">The datatable resulting from the execu=
tion of the view</param>
+ ///<param name=3D"groupColumns">the list of group columns of the=
report</columns>
+ ///<param name=3D"idReport">The id of current report</param>
+ ///<returns>A NameValueCollection with the needed full ids of at=
tributes</returns>
+ private NameValueCollection getAttributesFullId(DataTable viewDt=
, string groupColumns, int idReport)
+ {
+ absCrud crud =3D Factory.Crud();
+ absComplex complex =3D crud.GetCore().Complex;
+ NameValueCollection res =3D new NameValueCollection();
+ DataRow dr =3D viewDt.Rows[0]; //Only take the first line be=
cause, only the columns matter
+ int index =3D 0;
+ string [] groupAttribs =3D getGroupAttributes(idReport);
+ foreach(DataColumn col in dr.Table.Columns)
+ {
+ string attId =3D Convert.ToString(complex.ConvertSysAttN=
ameToIdAttName(col.ColumnName));
+ string fullId;
+ if(isInArray(attId ,groupAttribs,out fullId)) //fullId i=
s updated
+ {
+ res.Add(Convert.ToString(index),fullId);
+ }
+ else
+ {
+ res.Add(Convert.ToString(index),attId); =20
+ }
+ index++;
+ }
+ return res;
+ }
+ =20
private string [] getReportParams(int reportId)
{
- //adapter dbAdapter =3D userCred.CoreAdapter;
absCrud crud =3D Factory.Crud();
absComplex complex =3D crud.GetCore().Complex;
=20
@@ -342,4 +405,5 @@
#endregion
=20
}
+ =20
}
Modified: humano2/trunk/web/portal/site/search.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/portal/site/search.aspx 2005-06-08 22:55:51 UTC (re=
v 1273)
+++ humano2/trunk/web/portal/site/search.aspx 2005-06-09 20:10:43 UTC (re=
v 1274)
@@ -1,5 +1,6 @@
<%@ Page language=3D"c#" Codebehind=3D"search.aspx.cs" AutoEventWireup=3D=
"false" Inherits=3D"Portal.site.search" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
+<!-- $Id$ -->
<HTML>
<HEAD>
<title>viewrelations</title>
Property changes on: humano2/trunk/web/portal/site/search.aspx
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: humano2/trunk/web/portal/site/search.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/search.aspx.cs 2005-06-08 22:55:51 UTC =
(rev 1273)
+++ humano2/trunk/web/portal/site/search.aspx.cs 2005-06-09 20:10:43 UTC =
(rev 1274)
@@ -7,7 +7,7 @@
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. =20
//
-// $Id: viewpertinencelist.aspx.cs 641 2005-04-14 05:32:13Z marijn $
+// $Id$
//
=20
using System;
Modified: humano2/trunk/web/portal/site/topbar.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/portal/site/topbar.aspx 2005-06-08 22:55:51 UTC (re=
v 1273)
+++ humano2/trunk/web/portal/site/topbar.aspx 2005-06-09 20:10:43 UTC (re=
v 1274)
@@ -1,4 +1,5 @@
<%@ Page language=3D"c#" Codebehind=3D"topbar.aspx.cs" AutoEventWireup=3D=
"false" Inherits=3D"Portal.site.topbar" %>
+<!-- $Id$ -->
<html>
<head>
<title>topbar</title>
Property changes on: humano2/trunk/web/portal/site/topbar.aspx
___________________________________________________________________
Name: svn:keywords
+ Id
|