|
From: <sv...@de...> - 2005-06-08 16:07:31
|
Author: pcamacho
Date: 2005-06-08 12:07:32 -0400 (Wed, 08 Jun 2005)
New Revision: 1263
Modified:
humano2/trunk/web/builder/site/js/webfxtree.js
humano2/trunk/web/portal/site/leftbar.aspx.cs
humano2/trunk/web/portal/site/xsl/leftbar.xsl
Log:
FIX: #165. Simplification of leftbar.aspx.cs and leftbar.xsl.
Modified: humano2/trunk/web/builder/site/js/webfxtree.js
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/js/webfxtree.js 2005-06-08 15:45:13 UT=
C (rev 1262)
+++ humano2/trunk/web/builder/site/js/webfxtree.js 2005-06-08 16:07:32 UT=
C (rev 1263)
@@ -7,22 +7,11 @@
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. =20
//
-// $Id: webfxtree.js 1255 2005-06-07 20:07:17Z pcamacho $
+// $Id$
*/
=20
//FIXME: put the name of the real author of this great webFXTree tool
=20
-/**
- * This is a javascript that allows to show links in a dynamic tree.
- * Here is an example of use:
- * //Init the tree
- * var tree =3D new WebFXTree('');
- * tree.setBehavior('classic');
- * tree.setTarget('mainFrame');
- * tree.setJSLoading('Loading...');
- *
- */
-
var imgFolder =3D 'gfx/webfxtree';
var webFXTreeConfig =3D=20
{
Property changes on: humano2/trunk/web/builder/site/js/webfxtree.js
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: humano2/trunk/web/portal/site/leftbar.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/leftbar.aspx.cs 2005-06-08 15:45:13 UTC=
(rev 1262)
+++ humano2/trunk/web/portal/site/leftbar.aspx.cs 2005-06-08 16:07:32 UTC=
(rev 1263)
@@ -56,7 +56,7 @@
=20
if (Mode !=3D "1" && Mode !=3D "2") //Barra Explorar
{
- xmlString =3D genExploreList(dbAdapter);
+ xmlString =3D getClassList(dbAdapter);
}
else if(Mode =3D=3D "2") //Barra Explorar System Class
{
@@ -92,9 +92,7 @@
=20
foreach(DataRow Dr in dtResult.Rows) //Recorre Folders
{
-
string urlCreate =3D Html.genAbsoluteUrl("/portal/site/Data_structu=
red.aspx?action=3Dcreate&display=3DcreateXslt.aspx&id_entity=3D" =
+ Dr[0]);
- =20
xmlString +=3D "<class>";
xmlString +=3D "<classId>" + Dr[0] +"</classId>";
xmlString +=3D "<className>" + Dr[1] + "</className>";
@@ -106,14 +104,13 @@
xmlString +=3D"</classes>";
xmlString +=3D "</views>";
=09
- }else{ //Barra Folder
+ }
+ else
+ { //Barra Folder
string Forms=3D"";
- string filtro =3D String.Format("34|0|'{0}'|0|0",userCred.DomainIds[=
userCred.CurrentDomainIndex]);
- =09
+ string filtro =3D String.Format("34|4|'{0}'|0|0",userCred.DomainIds[=
userCred.CurrentDomainIndex]);
DataTable DTFolder =3D Folder.GetFoldersInTreeOrder(userCred);
-
DataTable DTView =3D dbAdapter.GenerateViewTools(1011,"0,1017,1018",=
filtro,"","","",0);
-
DataTable DTReport =3D dbAdapter.GenerateViewTools(1300,"0,1307",fil=
tro,"","","",0);
=20
filtro =3D String.Format("1201|4|'CREATE'|1|0;{0}",filtro);
@@ -189,64 +186,79 @@
return xmlString;
}
=20
- private string genExploreList(adapter dbAdapter)
+ ///<summary>
+ ///Generate the list of class, with all its views and forms (the=
n will be added the reports)
+ ///</summary>
+ ///<param name=3D"dbAdapter">The adapter to have access to viewt=
ools</param>
+ ///<returns>the xml string with all info about every user class<=
/returns>
+ private string getClassList(adapter dbAdapter)
{
- string xmlString;
+ string xmlString =3D "";
=20
- // View information.
- int[] viewId;
- string[] viewName;
- int[] viewClassId;
-
- //Barra Explorar Class
- dbAdapter.ViewsByDomainId(userCred.DomainIds[userCred.CurrentDomainIn=
dex],out viewName,out viewId,out viewClassId);
- =09
- //Sus view
- xmlString=3D"<views>";
- xmlString +=3D"<reload>true</reload>";
- xmlString +=3D"<links>";
- for (int j=3D0;viewId!=3Dnull && j<viewId.Length;j++)
- {
- xmlString +=3D "<link>"=20
- + "<classId>"
- + viewClassId[j] =20
- + "</classId>"
- + "<href>"
- + ViewPages.showViewPage + viewId[j] + "&iniC=
lass=3D" + viewClassId[j] =20
- + "</href>"
- + "<text>"
- + viewName[j]
- + "</text>"
- + "</link>";
- }
- xmlString +=3D"</links>";
- xmlString +=3D"<classes>";
- for (int j=3D0;j<viewId.Length;j++)
- {
- if(!isInTabBeforePos(viewClassId[j],j,viewClassId))
- {
- =20
- //string urlCreate =3D Html.genAbsoluteUrl("/portal/site/instance.a=
spx?action=3Dcreate&display=3DreadXslt.aspx&id_entity=3D" + viewC=
lassId[j]);
- string urlCreate =3D Html.genAbsoluteUrl("/portal/site/Data_structu=
red.aspx?action=3Dcreate&display=3DcreateXslt.aspx&id_entity=3D" =
+ viewClassId[j]);
- =20
- string className =3D dbAdapter.GetClassNameById(viewCla=
ssId[j]);
- =20
- if(className =3D=3D "")=20
- { // Si no tenemos un nombre (la clase es borrado) no m=
uestre la clase.
- continue;=20
- }
- =09
- xmlString +=3D "<class>";
- xmlString +=3D "<classId>" + Convert.ToString(viewClassId[j]=
) +"</classId>";
- xmlString +=3D "<className>" + className + "</className>";
- xmlString +=3D "<urlCreate>" + urlCreate + "</urlCreate>";
- xmlString +=3D "</class>";
- }
- }
- xmlString +=3D"</classes>";
- =20
- xmlString +=3D "</views>";
- =09
+ //Get the list of all user classId
+ string filter =3D "0|2|'10000'|0|0"; //Select only user clas=
s (id_entity > 10000)
+ DataTable DTClassList =3D dbAdapter.GenerateViewTools(2,"0",=
filter,"","","",0);
+ xmlString +=3D "<classes>";
+ xmlString +=3D"<reload>true</reload>";
+ =20
+ =20
+ foreach(DataRow dr in DTClassList.Rows)
+ {
+ //General class info
+ int classId =3D Convert.ToInt32(dr["id_entity"]);
+ string className =3D dbAdapter.GetClassNameById(classId)=
;
+ xmlString +=3D "<class>";
+ xmlString +=3D "<name>";
+ xmlString +=3D className;
+ xmlString +=3D "</name>";
+ xmlString +=3D "<id>";
+ xmlString +=3D classId;
+ xmlString +=3D "</id>";
+ =20
+ //Get the views for the class
+ xmlString +=3D "<views>";
+ string viewFilter =3D "1017|4|'" + classId + "'|0|0";=20
+ DataTable DTViews =3D dbAdapter.GenerateViewTools(1011,"=
0,1018",viewFilter,"","","",0);
+ foreach(DataRow viewDr in DTViews.Rows)
+ {
+ int viewId =3D Convert.ToInt32(viewDr["id_entity"]);
+ string viewName =3D Convert.ToString(viewDr["viewNam=
e"]);
+ xmlString +=3D "<view>";
+ xmlString +=3D "<link>";
+ xmlString +=3D ViewPages.showViewPage + viewI=
d + "&iniClass=3D" + classId;
+ xmlString +=3D "</link>";
+ xmlString +=3D "<text>";
+ xmlString +=3D viewName; =20
+ xmlString +=3D "</text>";
+ xmlString +=3D "</view>";
+ }
+ xmlString +=3D"</views>";
+ =20
+ //Get the forms
+ =20
+ xmlString +=3D "<forms>";
+ string formFilter =3D "1203|4|'" + classId + "'|0|0";
+ DataTable DTForms =3D dbAdapter.GenerateViewTools(1200,"=
0,1202",formFilter,"","","",0);
+ foreach(DataRow formDr in DTForms.Rows)
+ {
+ int formId =3D Convert.ToInt32(formDr["id_entity"]);
+ string formName =3D Convert.ToString(formDr["formNam=
e"]);
+ xmlString +=3D "<form>";
+ xmlString +=3D "<link>";
+ xmlString +=3D "Data_structured.aspx?action=3D=
create&display=3DreadXslt.aspx&id_entity=3D" + classId + "&fo=
rmsId=3D" + formId;
+ xmlString +=3D "</link>";
+ xmlString +=3D "<text>";
+ xmlString +=3D formName; =20
+ xmlString +=3D "</text>";
+ xmlString +=3D "</form>"; =20
+ }
+ xmlString +=3D"</forms>";
+ =20
+ xmlString +=3D"</class>";
+ }
+ xmlString +=3D "</classes>";
+ =20
+ Logger.Log("=3D=3D leftbar.aspx.cs =3D=3D. getClassList=3D "=
+ xmlString,LogLevel.Trace);
return xmlString; =20
}
=20
Modified: humano2/trunk/web/portal/site/xsl/leftbar.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/leftbar.xsl 2005-06-08 15:45:13 UTC=
(rev 1262)
+++ humano2/trunk/web/portal/site/xsl/leftbar.xsl 2005-06-08 16:07:32 UTC=
(rev 1263)
@@ -20,45 +20,35 @@
tree.setTarget('mainFrame');
tree.setJSLoading('Loading...');
=20
- <xsl:if test=3D"views">
- <xsl:for-each select=3D"views/classes/class">
- <xsl:variable name=3D"classId">
- <xsl:value-of select=3D"classId" />
- </xsl:variable>
- <xsl:variable name=3D"className">
- <xsl:value-of select=3D"className" />
- </xsl:variable>
- <!--
- <xsl:variable name=3D"classId">
- <xsl:value-of select=3D"classId" />
- </xsl:variable>-->
- <xsl:variable name=3D"classVarName"><!-- the classId does not h=
ave spaces -->
- <xsl:value-of select=3D"concat('class',$classId)" />
- </xsl:variable>
- var action =3D "javascript:void(0);"; //do nothing when clickin=
g on a class name. Can not send return (JS exception).
- <xsl:if test=3D"$classId !=3D ''"> <!-- If the class does not e=
xist anymore do not try to show its views -->
- var <xsl:value-of select=3D"$classVarName" /> =3D new WebFXTree=
Item('<xsl:value-of select=3D"$className" />',action);
- tree.add(<xsl:value-of select=3D"$classVarName" />);
- =20
- <!-- Add here the create link -->
- <xsl:variable name=3D"linkCreate">
- <xsl:value-of select=3D"urlCreate"/>
- </xsl:variable>
- =20
- <!-- Later we will add the forms ins=
tead
- var titleLink =3D 'Create instance of <xsl:value-of select=3D"$=
className" />';
- var contentLink =3D '<xsl:value-of select=3D"$linkCreate"/>';
-
- <xsl:value-of select=3D"$classVarName" />.add(new WebFXTreeItem=
(titleLink,contentLink,'','img/webfxtree/crearinstance.jpeg'));
- -->
- =20
- <xsl:for-each select=3D"/views/links=
/link[classId =3D$classId]">
- var content =3D '<xsl:value-of select=3D"href"/>';
- var title =3D '<xsl:value-of select=3D"text"/>'
- <xsl:value-of select=3D"$classVarName" />.add(new WebFXTreeIte=
m(title,content,'','img/webfxtree/view.jpeg'));
- </xsl:for-each>
- </xsl:if>
- </xsl:for-each>
+ <xsl:if test=3D"classes">
+ <xsl:for-each select=3D"classes/class">
+ <xsl:variable name=3D"classId">
+ <xsl:value-of select=3D"id" />
+ </xsl:variable>
+ <xsl:variable name=3D"className">
+ <xsl:value-of select=3D"name" />
+ </xsl:variable>
+ <xsl:variable name=3D"classVarName"><!--=
the classId does not have spaces -->
+ <xsl:value-of select=3D"concat('clas=
s',$classId)" />
+ </xsl:variable>
+ var action =3D "javascript:void(0);"; //=
do nothing when clicking on a class name. Can not send return (JS excepti=
on).
+ <xsl:if test=3D"$classId !=3D ''"> <!-- =
If the class does not exist anymore do not try to show its views -->
+ var <xsl:value-of select=3D"$classVa=
rName" /> =3D new WebFXTreeItem('<xsl:value-of select=3D"$className" />',=
action);
+ tree.add(<xsl:value-of select=3D"$cl=
assVarName" />);
+ <!--List all views for class -->
+ <xsl:for-each select=3D"views/view">
+ var content =3D '<xsl:value-of s=
elect=3D"link"/>';
+ var title =3D '<xsl:value-of sel=
ect=3D"text"/>';
+ <xsl:value-of select=3D"$classVa=
rName" />.add(new WebFXTreeItem(title,content,'','img/webfxtree/view.jpeg=
'));
+ </xsl:for-each>
+ <!--List all forms for class -->
+ <xsl:for-each select=3D"forms/form">
+ var content =3D '<xsl:value-of s=
elect=3D"link"/>';
+ var title =3D '<xsl:value-of sel=
ect=3D"text"/>';
+ <xsl:value-of select=3D"$classVa=
rName" />.add(new WebFXTreeItem(title,content,'','img/webfxtree/crearinst=
ance.jpeg'));
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
</xsl:if>
=20
<xsl:if test=3D"folders"><!--Para Folders-->
|