|
From: <sv...@de...> - 2005-05-20 17:21:38
|
Author: svera
Date: 2005-05-20 13:21:06 -0400 (Fri, 20 May 2005)
New Revision: 1115
Modified:
humano2/trunk/components/webTools/Adapter.cs
humano2/trunk/web/portal/site/Data_structured.aspx
humano2/trunk/web/portal/site/search.aspx.cs
humano2/trunk/web/portal/site/showView.aspx
humano2/trunk/web/portal/site/showView.aspx.cs
humano2/trunk/web/portal/site/xsl/showview.xsl
Log:
* Fix Bug #117 and #118
Modified: humano2/trunk/components/webTools/Adapter.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/Adapter.cs 2005-05-20 16:47:54 UTC =
(rev 1114)
+++ humano2/trunk/components/webTools/Adapter.cs 2005-05-20 17:21:06 UTC =
(rev 1115)
@@ -273,7 +273,7 @@
/// <param name=3D"viewId">The id of the view to be retrieved into the=
datatable.</param>
/// <param name=3D"iniClass">The Id of the class that the view has rel=
evance over.</param>
/// <returns>A DataTable with the structure of the view referenced by =
the viewId.</returns>
- public DataTable GetViewDataTableFromId(int viewId, out int iniCla=
ss)
+ public DataTable GetViewDataTableFromId(int viewId, out int iniClas=
s)
{
iniClass =3D 0;
=20
@@ -371,8 +371,8 @@
Logger.Log("ExecViewFromDataTable: page: " + page , LogLevel.Trace)=
;
=20
vt.Page =3D 1; // Do Pageing
- vt.RowsView =3D 20; // Number of rows per page.
- //vt.RowsView =3D 2; // Number of rows per page.
+ //vt.RowsView =3D 20; // Number of rows per page.
+ vt.RowsView =3D 2; // Number of rows per page.
vt.PageView =3D page; // Set the current page
}
Logger.Log("ExecViewFromDataTable: vtTable.Rows[0][\"order\"=
]=3D " + vtTable.Rows[0]["order"],LogLevel.Trace);
Modified: humano2/trunk/web/portal/site/Data_structured.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/Data_structured.aspx 2005-05-20 16:47:5=
4 UTC (rev 1114)
+++ humano2/trunk/web/portal/site/Data_structured.aspx 2005-05-20 17:21:0=
6 UTC (rev 1115)
@@ -95,23 +95,20 @@
obj.className =3D "altButtonNormal2"
}=09
=20
- =09
-
function redirect_Page(){
Param =3D Param.replace()
var re =3D /&/g
Param =3D Param.replace(re,"&")
=09
if(textToSearch!=3D''){
- document.getElementById("FrameSHowView").src=3D'search.aspx?'+P=
aram;
+ document.getElementById("FrameSHowView").src=3D'showView.aspx?i=
sSearch=3D1&classId=3D' + classId + '&'+ Param;
}else{
if(display=3D=3D'')
document.getElementById("FrameSHowView").src=3D'showView.aspx?i=
d_entity=3D'+id_entity+'&classId=3D'+classId;
else{
document.getElementById("FrameSHowView").src=3D'instance.aspx?i=
d_entity=3D'+id_entity+'&display=3D'+display+'&idView=3D'+idView+'&action=
=3D'+action+'&classId=3D'+classId+"&formsId=3D"+formsId;
}
- } =20
- =09
+ } =09
}
=09
function New_instance(){
@@ -124,10 +121,6 @@
window.location.href=3D'Data_structured.aspx?display=3DcreateXslt.asp=
x&idView=3D'+idView+'&action=3Dcreate&id_entity=3D'+classId+'&classId=3D'=
+classId+"&formsId=3D"+id;
}
=20
- =09
- =09
- =09
-
function Edit_instance(){
window.location.href=3D'Data_structured.aspx?display=3DreadXslt.aspx&=
idView=3D'+idView+'&action=3Dupdate&id_entity=3D'+id_entity+'&classId=3D'=
+classId
}
@@ -216,10 +209,9 @@
if (total <=3D 0) total =3D 1
document.getElementById("CantRegBottom").innerHTML =3D total
}
- } =20
+ } =20
}
- }
- =09
+ } =09
=20
=20
function nextPage() {
@@ -259,8 +251,6 @@
}
}
=20
-
- =09
</script>
</head>
=09
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-05-20 16:47:54 UTC =
(rev 1114)
+++ humano2/trunk/web/portal/site/search.aspx.cs 2005-05-20 17:21:06 UTC =
(rev 1115)
@@ -72,7 +72,17 @@
string idAttributes=3D Request["idAttribute"]; //The attribu=
tes to filter with
string idOperators =3D Request["idOPerator"]; //The operator=
s (<=3D,=3D,>=3D etc...)
string valuesToSearch =3D Request["textToSearch"]; //The val=
ues to compare with
- =20
+/*******************
+ * Codigo para paginacion SVERA =3D> 20052005
+ * */
+ string orderArr =3D Convert.ToString(Request.QueryString["order"]);
+ int currPage =3D Convert.ToInt32(Request.QueryString["page"]);
+ if(currPage =3D=3D 0)=20
+ {
+ currPage =3D 1;
+ }
+//***************
+ =20
Logger.Log("iniClass=3D" + Convert.ToString(iniClass),LogLev=
el.Trace);
Logger.Log("idAttributes=3D" + idAttributes,LogLevel.Trace);
Logger.Log("idOperator=3D" + idOperators,LogLevel.Trace);
@@ -92,7 +102,13 @@
=20
dtParam.Rows.Add(dr);
=20
- dt1 =3D dbAdapter1.GetDataTableView(dtParam, iniClass);
+ //dt1 =3D dbAdapter1.GetDataTableView(dtParam, iniClass);
+/************************
+ * Codigo para paginacion SVERA 20052005
+ * */
+ dt1 =3D dbAdapter1.ExecViewFromDataTable(iniClass,dtParam,iniClass,or=
derArr,1,1);
+ int pageCount=3D dbAdapter1.NumberOfPagesInPagedView;
+//********************
=20
string xmlString =3D""; //the result string
=20
@@ -158,11 +174,8 @@
xmlString +=3D "</update>";
xmlString +=3D "</url>";
}
- else if(col.ColumnName =3D=3D "id_entity") //Get the id_entity: for=
now it is not needed,=20
- { //but it may be useful later.
- //xmlString +=3D "<id_entity>" =
=20
- //+ "</id_entity>";
-
+ else if(col.ColumnName =3D=3D "id_entity")=20
+ { =20
xmlString +=3D "<value>"
+ "<text>" + row[col] + "</text>";
//Now check if the attribute is Primary
@@ -200,6 +213,20 @@
} =20
xmlString +=3D "</instance>";
}
+/************************
+ * Codigo para paginacion SVERA 20052005
+ * */
+ xmlString +=3D "<infoView>";
+ xmlString +=3D "<page>" + currPage + "</page>";
+ xmlString +=3D "<order>" + orderArr + "</order>";
+ xmlString +=3D "<recordCount>" + pageCount + "</recordCount>";
+ xmlString +=3D "<id_entity>" + iniClass + "</id_entity>";
+ xmlString +=3D "<classId>" + iniClass + "</classId>";
+ xmlString +=3D "<nextPage>true</nextPage>";
+ xmlString +=3D "<prevPage>true</prevPage>";
+ xmlString +=3D "</infoView>";
+//***********************
+
xmlString +=3D "</instances>";
=20
//Add the header
Modified: humano2/trunk/web/portal/site/showView.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/showView.aspx 2005-05-20 16:47:54 UTC (=
rev 1114)
+++ humano2/trunk/web/portal/site/showView.aspx 2005-05-20 17:21:06 UTC (=
rev 1115)
@@ -33,8 +33,19 @@
var idEntity =3D document.Form1.id_entity.value;
var classId =3D document.Form1.classId.value;
var order =3D document.Form1.order.value;
+ var isSearch =3D document.Form1.isSearch.value;
+ var idAttributes =3D document.Form1.idAttribute.value;
+ var idOperators =3D document.Form1.idOPerator.value;
+ var valuesToSearch =3D document.Form1.textToSearch.value;
+ var iniClass =3D document.Form1.iniClass.value;
//alert("order =3D " + order);
- var url =3D "showView.aspx?id_entity=3D" +idEntity+ "&classId=3D" +c=
lassId+ "&order=3D" +order+ "&page=3D" + newPage;
+ var strParam =3D "";
+ strParam =3D "id_entity=3D" +idEntity+ "&classId=3D" +classId;
+ strParam +=3D "&order=3D" +order+ "&page=3D" + newPage;
+ strParam +=3D "&isSearch=3D" +isSearch+ "&idAttribute=3D" + idAttrib=
utes;
+ strParam +=3D "&idOPerator=3D" +idOperators+ "&textToSearch=3D" + va=
luesToSearch;
+ strParam +=3D "&iniClass=3D" +iniClass;
+ var url =3D "showView.aspx?" + strParam;
=20
location.href =3D url;
//alert("url =3D " + url);
Modified: humano2/trunk/web/portal/site/showView.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/showView.aspx.cs 2005-05-20 16:47:54 UT=
C (rev 1114)
+++ humano2/trunk/web/portal/site/showView.aspx.cs 2005-05-20 17:21:06 UT=
C (rev 1115)
@@ -79,8 +79,32 @@
absComplex complex =3D crud.GetCore().Complex;
=20
iniClass =3D 0;
+
+/************************
+ * Datos usados por Search SVERA 20052005
+ */
+ iniClass =3D Convert.ToInt32(Request["iniClass"]);
+ string idAttributes=3D Request["idAttribute"]; //The attribu=
tes to filter with
+ string idOperators =3D Request["idOPerator"]; //The operator=
s (<=3D,=3D,>=3D etc...)
+ string valuesToSearch =3D Request["textToSearch"]; //The val=
ues to compare with
+ int isSearch =3D Convert.ToInt32(Request["isSearch"]);
+ DataTable viewTable =3D null;
+ int idEntity =3D 0;
+
+ string xmlSearch =3D "";
+
+ //***********************
+
//Mandamos el id de la instancia "vista"
- int idEntity =3D Convert.ToInt32(Request.QueryString["id_ent=
ity"]);
+ if (isSearch =3D=3D 0)
+ {
+ idEntity =3D Convert.ToInt32(Request.QueryString["id_entity"]);
+ }
+ else
+ {
+ idEntity =3D iniClass;
+ }
+
string orderArr =3D Convert.ToString(Request.QueryString["or=
der"]);
=20
int currPage =3D Convert.ToInt32(Request.QueryString["page"]=
);
@@ -90,8 +114,14 @@
}
=20
//Logger.Log("showView createXml: currPage" + currPage, LogL=
evel.Trace);
-
- DataTable viewTable =3D dbAdapter.GetViewDataTableFromId(idE=
ntity, out iniClass);
+ if(isSearch =3D=3D 0)
+ {
+ viewTable =3D dbAdapter.GetViewDataTableFromId(idEntity, out iniClas=
s);
+ }
+ else
+ {
+ viewTable =3D getStructForSearch(iniClass,idAttributes,idOperators,v=
aluesToSearch);
+ }
=20
// If there are multiple "order" arguments, they should be s=
eperated by ",";
// The framework already puts a "," between multiple "order =
arguments.
@@ -149,7 +179,14 @@
xmlString +=3D "<nextPage>" + nextPage + "</nextPage>";
xmlString +=3D "<prevPage>" + prevPage + "</prevPage>";
xmlString +=3D "</infoView>";
- =09
+ xmlSearch +=3D "<searchFields>";
+ xmlSearch +=3D String.Format("<isSearch>{0}</isSearch>",isSearch);
+ xmlSearch +=3D String.Format("<idAttributes><![CDATA[{0}]]></idAttrib=
utes>",idAttributes);
+ xmlSearch +=3D String.Format("<idOperators><![CDATA[{0}]]></idOperato=
rs>",idOperators);
+ xmlSearch +=3D String.Format("<valuesToSearch><![CDATA[{0}]]></values=
ToSearch>",valuesToSearch);
+ xmlSearch +=3D String.Format("<iniClass><![CDATA[{0}]]></iniClass>",i=
niClass);
+ xmlSearch +=3D "</searchFields>";
+ xmlString +=3D xmlSearch;
xmlString +=3D "</instances>";
=20
=20
@@ -160,6 +197,82 @@
=20
return xmlString;
}
+
+ private DataTable getStructForSearch(int iniClass,string idAttributes,=
string idOperators,string valuesToSearch)
+ {
+ DataTable dtParam =3D this.makeDataTableInViewTools();
+ DataRow dr =3D dtParam.NewRow();
+
+ dr["columna"] =3D getAttributeListForClass(iniClass);
+ //Logger.Log("search: list of attributes =3D " + dr["columna"],LogLev=
el.Trace);
+ =20
+ //Explicacion de los filtros...
+ char separator =3D '^';
+ dr["filtros"] =3D getFilters(idAttributes,idOperators,valuesToSearch,=
separator);
+ Logger.Log("search: filtros =3D " + dr["filtros"],LogLevel.Trace);
+ =20
+ =20
+ dtParam.Rows.Add(dr);
+ return dtParam;
+ }
+
+ private string getAttributeListForClass(int classId)
+ {
+ string columnsList =3D "0,";
+ DataTable res =3D userCred.CoreAdapter.GetAttributesFromClass(classId=
);
+
+ foreach(DataRow row in res.Rows)
+ {
+ columnsList +=3D row["id_entity"] + ","; =20
+ }
+ =20
+ columnsList =3D columnsList.Substring(0,columnsList.Length-1); //Remo=
ve last ","
+ =20
+ return columnsList;
+ }
+ private string getFilters(string idAttributes, string idOperators, str=
ing valuesToCompare, char separator)
+ {
+ string filter =3D"";
+ Logger.Log("getFilters: Step1", LogLevel.Trace);
+ string [] idAttributesArr =3D idAttributes.Split(new char [] {separat=
or});
+ string [] idOperatorsArr =3D idOperators.Split(new char [] {separator=
});
+ string [] valuesToCompareArr =3D valuesToCompare.Split(new char [] {s=
eparator});
+ =20
+ if(idAttributesArr.Length =3D=3D 1) //There is no separator (ie norma=
l search)
+ {
+ filter =3D idAttributesArr[0] + "|" + idOperatorsArr[0] + "|'" + val=
uesToCompareArr[0] + "'|0|0"; =20
+ }
+ else //Search for report
+ {
+ for(int i=3D0;i<idAttributesArr.Length-2;i++) //The last is a bit di=
fferent
+ {
+ filter +=3D idAttributesArr[i] + "|" + idOperatorsArr[i] + "|'" + v=
aluesToCompareArr[i] + "'|1|0;"; =20
+ }
+ Logger.Log("getFilters: Step2", LogLevel.Trace);
+ int lastIndex =3D idAttributesArr.Length-2; //The index idAttributes=
Arr.Length-1 is empty because of split
+ filter +=3D idAttributesArr[lastIndex] + "|" + idOperatorsArr[lastIn=
dex] + "|'" + valuesToCompareArr[lastIndex] + "'|0|0"; =20
+ }
+ return filter;
+ }
+ private DataTable makeDataTableInViewTools()
+ {
+ DataTable dt1 =3D new DataTable();
+ DataColumn dc1;
+ dc1 =3D new DataColumn("columna",typeof(string));
+ dt1.Columns.Add(dc1);
+ dc1 =3D new DataColumn("filtros",typeof(string));
+ dt1.Columns.Add(dc1);
+ dc1 =3D new DataColumn("group",typeof(string));
+ dt1.Columns.Add(dc1);
+ dc1 =3D new DataColumn("having",typeof(string));
+ dt1.Columns.Add(dc1);
+ dc1 =3D new DataColumn("order",typeof(string));
+ dt1.Columns.Add(dc1);
+ dc1 =3D new DataColumn("claves",typeof(string));
+ dt1.Columns.Add(dc1);
+ return dt1;
+ }
+
#region xml
private string xml_GetAttributes(DataTable viewRes,absComplex complex)
{
Modified: humano2/trunk/web/portal/site/xsl/showview.xsl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/xsl/showview.xsl 2005-05-20 16:47:54 UT=
C (rev 1114)
+++ humano2/trunk/web/portal/site/xsl/showview.xsl 2005-05-20 17:21:06 UT=
C (rev 1115)
@@ -165,6 +165,11 @@
<xsl:variable name=3D"classId" select=3D"/instances/infoView/classId"/=
>
<xsl:variable name=3D"nextPage" select=3D"/instances/infoView/nextPage=
"/>
<xsl:variable name=3D"prevPage" select=3D"/instances/infoView/prevPage=
"/>
+ <xsl:variable name=3D"isSearch" select=3D"/instances/searchFields/isSe=
arch"/>
+ <xsl:variable name=3D"idAttributes" select=3D"/instances/searchFields/=
idAttributes"/>
+ <xsl:variable name=3D"idOperators" select=3D"/instances/searchFields/i=
dOperators"/>
+ <xsl:variable name=3D"valuesToSearch" select=3D"/instances/searchField=
s/valuesToSearch"/>
+ <xsl:variable name=3D"iniClass" select=3D"/instances/searchFields/iniC=
lass"/>
<xsl:choose>
<xsl:when test=3D"$RowCount > 0 ">
<table width=3D"100%" border=3D"0" cellspacing=3D"0" cellpadding=3D=
"0">
@@ -241,6 +246,12 @@
<input type=3D"hidden" name=3D"recordCount" value=3D"{$recordCoun=
t}" />=20
<input type=3D"hidden" name=3D"id_entity" value=3D"{$idEntity}" /=
>=20
<input type=3D"hidden" name=3D"classId" value=3D"{$classId}" />=20
+ <input type=3D"hidden" name=3D"isSearch" value=3D"{$isSearch}" />=
=20
+ <input type=3D"hidden" name=3D"idAttribute" value=3D"{$idAttribut=
es}" />=20
+ <input type=3D"hidden" name=3D"idOPerator" value=3D"{$idOperators=
}" />=20
+ <input type=3D"hidden" name=3D"textToSearch" value=3D"{$valuesToS=
earch}" />=20
+ <input type=3D"hidden" name=3D"iniClass" value=3D"{$iniClass}" />=
=20
+
</td></tr></table>
</xsl:when>
<xsl:when test=3D"$RowCount =3D 0 ">
|