Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Langages serveur > ASP
ASP Forum sur la programmation ASP. Avant de poster : Cours ASP, FAQ ASP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/10/2006, 14h25   #1
Expert Confirmé
 
Avatar de pc75
 
Inscription : septembre 2004
Messages : 2 810
Détails du profil
Informations personnelles :
Âge : 56
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : septembre 2004
Messages : 2 810
Points : 3 011
Points : 3 011
Par défaut TreeView en ASP

Bonjour,

Je cherche à afficher des données à la manière d'un TreeView. J'ai bien trouvé sur ce forum le principe de récursivité : http://www.developpez.net/forums/sho...light=treeview
Mes données s'affichent correctement.

Ce que je souhaite réaliser, correspond à ce que j'ai trouvé sur ce site :
http://aspwebsolution.com/articles/c.../asp/index.htm

C'est à dire, pouvoir développer des branches par un clic sur un item, comme les dossiers de l'explorateur Windows, par exemple.

Si quelqu'un avait une astuce ou un exemple de code, je suis preneur. Sachant que l'exemple de aspwebsolution.com ne m'affiche pas tous mes noeuds.

Merci par avance.
__________________
Par principe, je ne réponds pas aux messages URGENT.
Il n'y a pas de choses urgentes, il n'y a que des choses en retard. (un inconnu)
pc75 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/10/2006, 14h33   #2
Membre éprouvé
 
Inscription : septembre 2004
Messages : 368
Détails du profil
Informations forums :
Inscription : septembre 2004
Messages : 368
Points : 402
Points : 402
Salut

J'ai bien ca dans les cartons en javascript
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<script type="text/javascript">
   function activateSection(section)
   {
      var sectionID;
      sectionID = section.id;
      var oSectionContent;
      oSectionContent = eval('document.all.' + sectionID + '_content');
 
      var oSectionImage;
      oSectionImage = eval('document.all.' + sectionID + '_image');
 
      if (oSectionContent.style.display == 'none')
      {
         oSectionImage.src = "/img/minus.gif";  
		 oSectionContent.style.bakcground = '#ccc';;  
         oSectionContent.style.display = '';
 
      }
      else
      {
         oSectionImage.src = "/img/plus.gif";    
         oSectionContent.style.display = 'none';
      }
      event.cancelBubble = false;
   }
</script>
j'avais mis le menu dans un tableau, et le code d'appel suivant dans chaque tr

Code :
onClick=""activateSection(this);
Mais il doit ya voir soucis selon le nombre de noeud de ton arbre
Gwenn est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/10/2006, 15h07   #3
Expert Confirmé
 
Avatar de pc75
 
Inscription : septembre 2004
Messages : 2 810
Détails du profil
Informations personnelles :
Âge : 56
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : septembre 2004
Messages : 2 810
Points : 3 011
Points : 3 011
Re,

Merci.

J'ai oublié de préciser que je peux avoir jusqu'à 7 niveaux dans mon arbre.

Ma deuxième contrainte est que je dois le construire à partir d'une base de données :

Id (PK)
Libelle
ParentId (FK)

J'ai posé une relation entre Id et ParentId.
__________________
Par principe, je ne réponds pas aux messages URGENT.
Il n'y a pas de choses urgentes, il n'y a que des choses en retard. (un inconnu)
pc75 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/10/2006, 17h57   #4
Membre Expert
 
Avatar de NoisetteProd
 
Inscription : janvier 2003
Messages : 1 912
Détails du profil
Informations forums :
Inscription : janvier 2003
Messages : 1 912
Points : 1 925
Points : 1 925
Envoyer un message via MSN à NoisetteProd
Si tu peux utiliser du javascript, je ne peux que te conseiller cet execelent treeview : http://membres.lycos.fr/tafelmak/arbre.php

Je l'utilise en ASP avec autant de profondeur que je lke souhaites de nombreux objets différents, des drags and drop etc et tout cela en liaison avec une BDD.

Le site est un peu lent, mais ça vaut le coup
__________________
Fais cogiter ta Noisette !!

Participez à la page SOURCES Delphi !

Découvrez le Défi Delphi

Mon Mail
NoisetteProd est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/10/2006, 08h30   #5
Expert Confirmé
 
Avatar de pc75
 
Inscription : septembre 2004
Messages : 2 810
Détails du profil
Informations personnelles :
Âge : 56
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : septembre 2004
Messages : 2 810
Points : 3 011
Points : 3 011
Re,

Merci de ta réponse.

Je peux effectivement utiliser du javascript, mais dans ce domaine, je ne suis pas un pro.

Tu dis que tu utilises ce script en liaison avec une BDD. Pourrais-tu me donner un peu d'infos ou me mettre sur la voie qui va bien, parce que là, je ne sais pas trop comment organiser tout ça ?

Merci encore.
__________________
Par principe, je ne réponds pas aux messages URGENT.
Il n'y a pas de choses urgentes, il n'y a que des choses en retard. (un inconnu)
pc75 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/10/2006, 08h34   #6
Expert Confirmé
 
Avatar de pc75
 
Inscription : septembre 2004
Messages : 2 810
Détails du profil
Informations personnelles :
Âge : 56
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : septembre 2004
Messages : 2 810
Points : 3 011
Points : 3 011
Re,

Me serais-je trompé de forum ?
__________________
Par principe, je ne réponds pas aux messages URGENT.
Il n'y a pas de choses urgentes, il n'y a que des choses en retard. (un inconnu)
pc75 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/10/2006, 11h25   #7
Membre Expert
 
Avatar de NoisetteProd
 
Inscription : janvier 2003
Messages : 1 912
Détails du profil
Informations forums :
Inscription : janvier 2003
Messages : 1 912
Points : 1 925
Points : 1 925
Envoyer un message via MSN à NoisetteProd
Citation:
Envoyé par pc75
Re,
Me serais-je trompé de forum ?


Pour ce qui est de l'exemple avec une BDD, il suffit de renvoyer une structure pour l'arbre en fonction ce qu'il y a dans ta BDD

genre :

Code JAVASCRIPT :
1
2
3
4
5
6
7
var struc = [
		{'id':'1',
		'txt':' <b>ROOT</b>',
		'img':'root.gif'
		<%getBDDChild(1)%>
		}
	];

ou struc est la structure JSON de mon arbre

La fonction pour peupler mon arbre :

Code ASP :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
sub getBDDChild(id)
	DIM rs, nb, deb
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.ActiveConnection = Application("ConnectString")
	rs.Source = "SELECT    * from matable where ..."
	rs.CursorType = 3
	rs.CursorLocation = 2
	rs.LockType = 1
	rs.Open()
	nb=0
	if not(rs.BOF and rs.EOF) then 
		rs.movefirst
		response.Write ", 'items':[ "& vbCrlf
		deb = 1
	end if
	While (NOT rs.EOF)
		if nb = 0 then
			response.Write "{ "  & vbCrlf
		else
			response.Write ", { "& vbCrlf
		end if
		response.Write "'id':'" & rs("ID_CHILD") &"'," & vbCrlf
		response.Write "'txt':'" & rs("TXT") &"',"& vbCrlf
		response.Write "'title':'" & rs("NAME") &"',"& vbCrlf
		response.Write "'open' : false,"& vbCrlf
		response.Write "'img':'folder.gif',"& vbCrlf
		response.Write "'imgopen':'folderopen.gif',"& vbCrlf
		response.Write "'imgclose':'folder.gif',"& vbCrlf
		response.Write "'editable':true,"& vbCrlf
		response.Write "'onedit':updateName,"& vbCrlf
		response.Write "'onopenpopulate' :  myOpenPopulate,"& vbCrlf
		response.Write "'openlink' : '../include/xhtmlrequest/populate_tree.asp',"& vbCrlf
		response.Write "'canhavechildren' : true "
		nb = nb +1
		response.Write "}"& vbCrlf
		rs.movenext
	wend
	if deb = 1 then response.Write "]"& vbCrlf end if
	Set rs = nothing
end sub

Voilà, si tu as des questions précises, n'hésite pas.
__________________
Fais cogiter ta Noisette !!

Participez à la page SOURCES Delphi !

Découvrez le Défi Delphi

Mon Mail
NoisetteProd est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/10/2006, 16h05   #8
Expert Confirmé
 
Avatar de pc75
 
Inscription : septembre 2004
Messages : 2 810
Détails du profil
Informations personnelles :
Âge : 56
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : septembre 2004
Messages : 2 810
Points : 3 011
Points : 3 011
Re,

C'est bon, je m'en suis sorti autrement.

Merci
__________________
Par principe, je ne réponds pas aux messages URGENT.
Il n'y a pas de choses urgentes, il n'y a que des choses en retard. (un inconnu)
pc75 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/10/2006, 21h41   #9
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Salut pc75,

Ce sujet est interessant, tu peux nous dire comment tu as fait?

Merci
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/10/2006, 08h18   #10
Expert Confirmé
 
Avatar de pc75
 
Inscription : septembre 2004
Messages : 2 810
Détails du profil
Informations personnelles :
Âge : 56
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : septembre 2004
Messages : 2 810
Points : 3 011
Points : 3 011
Bonjour,

Citation:
Envoyé par Immobilis
Salut pc75,

Ce sujet est interessant, tu peux nous dire comment tu as fait?

Merci
Pas de problème.

Tout d'abord, la description de ma table :
ID
LibID
ParentId

et le code (que j'ai récupéré sur le net et qui n'est pas encore "nettoyé") :

Le fichier principal :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
<%@LANGUAGE=VBScript %>
<%
'--------------------------------------------------------------------
' Description:	The page where is displayed the Tree. Here is read
'				from database the tree structure only at session
'				start time. And is read the selected node.
' Arguments:	None
'
'
' Error number: None
'
' Note:			Copyright © Iulian Iuga, iulian_iuga@yahoo.com
'--------------------------------------------------------------------
%>
 
<!-- #Include File="GlobalSettings.asp" -->
<!-- #Include File="ErrorHandling.asp" -->
<!-- #Include File="TreeWork.asp" -->
 
<%
Response.Expires = -1
 
' test if this session just started
if session("Session_JustStarted") <> false then
	ReadTreeContent cstrConnectionString, cstrQuery
	session("Session_JustStarted") = false
end if
 
dim objFormContent
dim intDotIndex
dim intSelectedFolder
intSelectedFolder = -1
 
' get the folder IDNode
for each objFormContent in Request.Form
	if Mid(objFormContent,1,6) = "Folder" then
		intDotIndex = InStr(7,objFormContent,".")
'		intSelectedFolder = CInt(Mid(objFormContent,7,intDotIndex - 7))
		intSelectedFolder = Mid(objFormContent,7,intDotIndex - 7)
 
		exit for
	end if
next
 
if len(Request.Form("Str_Pos")) = 0 then
	Pos = 0
else
	Pos = Request.Form("Str_Pos")
end if
%>
 
 
 
<html>
<body bgcolor="#fefceb" onload="scrollTo(0,<%=Pos%>)" onscroll="recupPosAsc(document.body.scrollTop)" vlink="#000000" alink="#000000" link="#000000">
 
<head>
<script type="text/javascript">
function recupPosAsc(valAsc)
{
document.frmDisplayTree.Str_Pos.value = valAsc;
}
</script>
</head>
<form name="frmDisplayTree" id="frmDisplayTree" action="DisplayTree.asp" method="POST">
 
<table align="center" width="100%">
	<tr>
		<td align="left">
			<img SRC="images/logomdp.gif" WIDTH="243" HEIGHT="38">
		</td>
		<td align="center">
			<font face="arial" size="6" color="MediumBlue">
			<strong>
			<img SRC="images/Eff.gif" WIDTH="22" HEIGHT="21">
			Les effectifs
			<img SRC="images/Eff.gif" WIDTH="22" HEIGHT="21">
			</strong>
			</font>
		</td>
		<td align="right">
			<img SRC="images/logomdp.gif" WIDTH="243" HEIGHT="38">
		</td>
	</tr>
</table>
<br>
<input type="hidden" name="Str_Pos">
<%
	DisplayTree intSelectedFolder
%>
</form>
</body>
</html>
Les include :

GlobalSettings.asp
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
<%
'--------------------------------------------------------------------
' Description:	Global settings for global variables and functions
'				declarations for global functions
'
' Arguments:	None
'
'
' Error number:	None
'
' Note:			Copyright © Iulian Iuga, iulian_iuga@yahoo.com
'--------------------------------------------------------------------
%>
<%
' Global functions template description
 
 
' Functions header
'*********************************************************************************
' Description:	
' Assumptions:	
' Effects:		
' Arguments:	
' Returns:		
' Version:		
'*********************************************************************************
 
' Declare global session variables names
Const SESSION_BACKGROUND_COLOR	= "BackgroundColor"
Const SESSION_ERROR_MESSAGE		= "ErrorMessage"
 
' Declare global error messages
Const ERR_CANNOT_CREATE_CONNECTION_OBJECT	= "Error, can not create the Connection object. "
Const ERR_CANNOT_CREATE_RECORDSET_OBJECT	= "Error, can not create the Recordset object. "
Const ERR_CANNOT_CREATE_DICTIONARY_OBJECT	= "Error, can not create the Dictionary object. "
Const ERR_CANNOT_OPEN_DATABASE				= "Error, can not open the database. "
Const ERR_CANNOT_EXECUTE_QUERY				= "Error, can not execute query. "
Const ERR_GENERAL_ERROR_MESSAGE				= "Error, general error. Watch the code! "
 
%>
ErrorHandling.asp
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
<%
'--------------------------------------------------------------------
' Description:	The file contain RedirectToError function description
'
'
' Arguments:	None
'
' 
' Error number:	None
'
' Note:			Copyright © Iulian Iuga, iulian_iuga@yahoo.com
'--------------------------------------------------------------------
%>
<%
'*********************************************************************************
' Description:	Redirect to the Error page
' Assumptions:	None
' Effects:		None
' Arguments:	[p_strErrorMessage] - string that contain the error message
'				[p_blnSessionAbandon] - boolean value
' Returns:		None
' Version:		
'*********************************************************************************
 
sub RedirectToError (p_strErrorMessage, p_blnSessionAbandon)
 
	Session(SESSION_ERROR_MESSAGE) = p_strErrorMessage
	Response.Redirect "Error.asp?sa=" & p_blnSessionAbandon
end sub
 
 
%>
TreeWork.asp
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
 
<%
'--------------------------------------------------------------------
' Description:	Contain all functions declarations that work with
'				the tree
'
' Arguments:	None
'
'
' Error number: 1
'
' Note:			Copyright © Iulian Iuga, iulian_iuga@yahoo.com
'--------------------------------------------------------------------
%>
 
<%
'*****************************************************************************************
' Global declarations
'*****************************************************************************************
 
'Const adCmdText = 1
'Const cstrConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\inetpub\wwwroot\EffectifsHR\TV\EffectifsHR.mdb;"
Const cstrConnectionString = "EFF_HR"
'Const cstrQuery = "SELECT * FROM UOBIS ORDER BY LIBL_UO, PARENT_UO"
 
 
Const cstrQuery = "SELECT DISTINCT UOBIS.UO, UOBIS.PARENT_UO, UOBIS.LIBL_UO, UOBIS.NIVEAU_UO, TBL_EFFECTIFS.UO_CODE As UoEff FROM UOBIS LEFT JOIN TBL_EFFECTIFS ON UOBIS.UO = TBL_EFFECTIFS.UO_CODE ORDER BY LIBL_UO, PARENT_UO"
 
 
Const cstrTreeNodeColor = "#B0E0E6" ' 176, 224, 230
 
Const cstrChildFolderMisplaced = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
 
Const cstrTreeStartContainer = "<table border='0' cellpadding='0' cellspacing='2' bgcolor='#FFFFE0' width='100%'>"
Const cstrTreeEndContainer = "</table>"
 
'*****************************************************************************************
' Description:	Read the tree stucture from the database
' Assumptions:	None
' Efects:		None
' Arguments:	[p_strConnectionString] - string, data connection string
'				[p_strQuery] - string, data query string
' Return:		None
' Version:		[ - Iulian Iuga]
'*****************************************************************************************
 
sub ReadTreeContent(p_strConnectionString, p_strQuery)
 
'	On Error Resume Next
 
	dim objConn
	dim objRS
 
	set objConn = server.CreateObject("ADODB.Connection")
	if Err.number <> 0 then
		RedirectToError ERR_CANNOT_CREATE_CONNECTION_OBJECT & "(1.1)", false
	end if
 
	objConn.Open p_strConnectionString
	if Err.number <> 0 then
		RedirectToError ERR_CANNOT_OPEN_DATABASE & "(1.2)", false
	end if
 
'	set objRS = objConn.Execute(p_strQuery,,adCmdText)
	set objRS = objConn.Execute(p_strQuery,,1)
	if Err.number <> 0 then
		RedirectToError ERR_CANNOT_EXECUTE_QUERY & "(1.3)", false
	end if
 
	if not objRS.EOF then
		StoreTreeContent objRS
	end if
 
	set objRS = nothing
	set objConn = nothing
end sub
 
'*****************************************************************************************
' Description:	Iterate into the recordset and store the tree values in 4 dictionary
'				objects. These objects will be store in session variable.
' Assumptions:	None
' Efects:		None
' Arguments:	[p_objRS] - object, record set
' Return:		None
' Version:		[ - Iulian Iuga]
'*****************************************************************************************
 
sub StoreTreeContent(p_objRS)
 
'	On Error Resume Next
 
	dim objDicParentCorespondence
	dim objDicCaptionCorespondence
	dim objDicTypeCorespondence
	dim objDicActionCorespondence
 
	set objDicParentCorespondence = server.CreateObject("Scripting.Dictionary")
	set objDicCaptionCorespondence = server.CreateObject("Scripting.Dictionary")
	set objDicTypeCorespondence = server.CreateObject("Scripting.Dictionary")
	set objDicActionCorespondence = server.CreateObject("Scripting.Dictionary")
 
	if Err.number <> 0 then
		RedirectToError ERR_CANNOT_CREATE_DICTIONARY_OBJECT & "(1.4)", false
	end if	
 
	while not p_objRS.EOF
		dim intIDNode
		dim intIDParentNode
		dim strNodeCaption
		dim strNodeType
		dim strNodeAction
 
'		intIDNode = p_objRS("IDNode")
		intIDNode = p_objRS("UO")
 
'		intIDParentNode = p_objRS("IDParentNode")
		intIDParentNode = p_objRS("Parent_UO")
'		if intIDParentNode < 0 then
		if p_objRS("NIVEAU_UO") = 4 then
			intIDParentNode = -1
		end if
 
'		strNodeCaption = p_objRS("NodeCaption")
		strNodeCaption = "<a href='ListeCorps.asp?UO=" & p_objRS("UO") & "'>" & p_objRS("UO") & " - " & p_objRS("LIBL_UO") & "</a>"
		if Not IsNull(p_objRS("UoEff")) then
			strNodeCaption = strNodeCaption & "<font face=arial size=4 color=red>"
			strNodeCaption = strNodeCaption & "<strong>"
			strNodeCaption = strNodeCaption & "&nbsp;&nbsp;&nbsp;*"
			strNodeCaption = strNodeCaption & "</strong>"
			strNodeCaption = strNodeCaption & "</font>"
		end if
 
'		strNodeType = UCase(p_objRS("NodeType"))
'		strNodeType = UCase(p_objRS("NIVEAU_UO"))
'		if strNodeType <> "F" and strNodeType <> "I" then
			strNodeType = "F"
'		end if
 
'		strNodeAction = p_objRS("NodeAction")
		strNodeAction = p_objRS("LIBL_UO")
		if IsNull(strNodeAction) then
			strNodeAction = "A"
		end if
 
		objDicParentCorespondence.Add intIDNode, intIDParentNode
		objDicCaptionCorespondence.Add intIDNode, strNodeCaption
		objDicTypeCorespondence.Add intIDNode, strNodeType
		objDicActionCorespondence.Add intIDNode, strNodeAction
 
		p_objRS.MoveNext
		if Err.number <> 0 then
			RedirectToError ERR_CANNOT_OPEN_DATABASE & "(1.4)", false
		end if		
	wend
 
	set session("DicParentCorespondence") = objDicParentCorespondence
	set session("DicCaptionCorespondence") = objDicCaptionCorespondence
	set session("DicTypeCorespondence") = objDicTypeCorespondence
	set session("DicActionCorespondence") = objDicActionCorespondence
 
	set objDicParentCorespondence = nothing
	set objDicCaptionCorespondence = nothing
	set objDicTypeCorespondence = nothing
	set objDicActionCorespondence = nothing
end sub
 
'*****************************************************************************************
' Description:	Display the current tree structure.
' Assumptions:	None
' Efects:		None
' Arguments:	[p_intSelectedFolder] - integer, 
' Return:		None
' Version:		[ - Iulian Iuga]
'*****************************************************************************************
 
sub DisplayTree(p_intSelectedFolder)
 
'	On Error Resume Next
 
	dim aKeys
	dim intKeysCount
	dim index
 
	aKeys = session("DicParentCorespondence").Keys
	intKeysCount = session("DicParentCorespondence").Count
	if Err.number <> 0 then
		RedirectToError ERR_GENERAL_ERROR_MESSAGE & "(1.5)", true
	end if
 
	if p_intSelectedFolder = -1 then
		Response.Write cstrTreeStartContainer
		for index = 0 to intKeysCount - 1
			if session("DicParentCorespondence").Item(aKeys(index)) = -1 then
				DisplayNode -1, aKeys, index, false
			end if
		next
		Response.Write cstrTreeEndContainer
	else		
		dim aExpandedNodes()
		dim intNrOfNodes
 
		GetCurrentPath p_intSelectedFolder, aExpandedNodes, intNrOfNodes
 
		Response.Write cstrTreeStartContainer
 
		ExpandTree 0, intNrOfNodes, aExpandedNodes
 
		Response.Write cstrTreeEndContainer
	end if	
end sub
 
'*****************************************************************************************
' Description:	Get the path to the selected folder
' Assumptions:	None
' Efects:		None
' Arguments:	[p_intSelectedFolder] - integer, 
'				<out> [p_aExpandedNodes] - array, list with nodes that must be expanded
'				<out> [p_intNrOfNodes] - integer, number of expanded node
' Return:		None
' Version:		[ - Iulian Iuga]
'*****************************************************************************************
 
sub GetCurrentPath(p_intSelectedFolder, byref p_aExpandedNodes, byref p_intNrOfNodes)
 
'	On Error Resume Next
 
	dim intSelectedFolder
	dim intNrOfNodes
	dim index
	dim intTmpValue
 
	intNrOfNodes = 1
	redim preserve p_aExpandedNodes(intNrOfNodes)
 
	p_aExpandedNodes(intNrOfNodes - 1) = p_intSelectedFolder
 
	intSelectedFolder = session("DicParentCorespondence").Item(p_intSelectedFolder)
	if Err.number <> 0 then
		RedirectToError ERR_GENERAL_ERROR_MESSAGE & "(1.6)", true
	end if
 
	while intSelectedFolder <> -1
		intNrOfNodes = intNrOfNodes + 1
		redim preserve p_aExpandedNodes(intNrOfNodes)
 
		p_aExpandedNodes(intNrOfNodes - 1) = intSelectedFolder
		intSelectedFolder = session("DicParentCorespondence").Item(intSelectedFolder)
		if Err.number <> 0 then
			RedirectToError ERR_GENERAL_ERROR_MESSAGE & "(1.7)", true
		end if		
	wend
 
	p_intNrOfNodes = intNrOfNodes - 1
 
	' change list elements order
	intNrOfNodes = p_intNrOfNodes \ 2
	for index = 0 to intNrOfNodes
		intTmpValue = p_aExpandedNodes(index)
		p_aExpandedNodes(index) = p_aExpandedNodes(p_intNrOfNodes - index)
		p_aExpandedNodes(p_intNrOfNodes - index) = intTmpValue
	next
end sub
 
'*****************************************************************************************
' Description:	Expand the tree for the current path
' Assumptions:	None
' Efects:		None
' Arguments:	[p_intCurrentLevel] - integer, 
'				[p_intMaxLevel] - integer, 
'				[p_aExpandedNodes] - array, 
' Return:		None
' Version:		[ - Iulian Iuga]
'*****************************************************************************************
 
sub ExpandTree(p_intCurrentLevel, p_intMaxLevel, p_aExpandedNodes)
 
	'On Error Resume Next
 
	dim aKeys
	dim intKeysCount
	dim index
	dim index1
 
	dim intCurrentFolder
	dim intCurrentFolderParent
 
	aKeys = session("DicParentCorespondence").Keys
	intKeysCount = session("DicParentCorespondence").Count
 
	intCurrentFolder = p_aExpandedNodes(p_intCurrentLevel)
	intCurrentFolderParent = session("DicParentCorespondence").Item(intCurrentFolder)
	if Err.number <> 0 then
		RedirectToError ERR_GENERAL_ERROR_MESSAGE & "(1.8)", true
	end if
 
	for index = 0 to intKeysCount - 1
		if aKeys(index) = intCurrentFolder then
			' display selected folder
			DisplayNode p_intCurrentLevel - 1, aKeys, index, true
 
			if p_intCurrentLevel < p_intMaxLevel then
				' expand tree
				ExpandTree p_intCurrentLevel + 1, p_intMaxLevel, p_aExpandedNodes
			else
				' display all folders that are children of selected folder
				for index1 = 0 to intKeysCount - 1
					if session("DicParentCorespondence").Item(aKeys(index1)) = intCurrentFolder then
						DisplayNode p_intCurrentLevel, aKeys, index1, false
					end if
				next			
			end if
		else
			' display all folders that have the same parent folder like current folder
			if session("DicParentCorespondence").Item(aKeys(index)) = intCurrentFolderParent then
				DisplayNode p_intCurrentLevel - 1, aKeys, index, false
			end if
		end if
	next	
end sub
 
'*****************************************************************************************
' Description:	Disply each node with his level into the page
' Assumptions:	None
' Efects:		Write tree nodes into page
' Arguments:	[p_intLevel] - integer, 
'				[p_aKeys] - array,
'				[p_index] - integer, 
'				[p_blnSelectedFolder] - boolean, 
' Return:		None
' Version:		[ - Iulian Iuga]
'*****************************************************************************************
 
sub DisplayNode(p_intLevel, p_aKeys, p_index, p_blnSelectedFolder)
 
'	On Error Resume Next
 
	dim index
	dim strKeyAction
 
	strKeyAction = session("DicActionCorespondence").Item(p_aKeys(p_index))
	if Err.number <> 0 then
		RedirectToError ERR_GENERAL_ERROR_MESSAGE & "(1.9)", true
	end if
 
	Response.Write "<tr bgcolor='" & cstrTreeNodeColor & "'><td>"
 
	for index = 0 to p_intLevel
		Response.Write cstrChildFolderMisplaced
	next
 
	if session("DicTypeCorespondence").Item(p_aKeys(p_index)) = "F" then
		Response.Write "<input type='image' "
		if p_blnSelectedFolder then
			Response.Write "src='.\images\Openfold.gif'"
		else
			Response.Write "src='.\images\Clsdfold.gif'"
		end if
		Response.Write " name='Folder" & p_aKeys(p_index) & "' id='Folder" & p_aKeys(p_index) & "' border='0'>"
		Response.Write "<b>&nbsp;" & session("DicCaptionCorespondence").Item(p_aKeys(p_index)) & "</b>"
	else
'		Response.Write "<a href='" & strKeyAction & "' style='text-decoration: none;' "
		Response.Write "<a href='" & strKeyAction & "' style='text-decoration: none;' "
		if UCase(Mid(strKeyAction,1,10)) = "JAVASCRIPT" then
			Response.Write ">"
		else
			Response.Write "target='frmActionView'>"
		end if
		Response.Write session("DicCaptionCorespondence").Item(p_aKeys(p_index)) & "</a>"
	end if
 
	Response.Write "</td></tr>"
end sub
%>
__________________
Par principe, je ne réponds pas aux messages URGENT.
Il n'y a pas de choses urgentes, il n'y a que des choses en retard. (un inconnu)
pc75 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 17h10.


 
 
 
 
Partenaires

Hébergement Web