Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 rsolanki 1
<%
2
'===================================================================
3
'							User Common
4
'===================================================================
5
%>
6
<!--#include file="../class/classTemplateManager.asp"-->
7
<!--#include file="../class/classTabControl.asp"-->
8
<!--#include file="../class/classActionButtonControl.asp"-->
9
<%
10
'------------ VARIABLE DEFINITION -------------
11
Dim parApp_id
12
Dim parUser_id
13
Dim objUserCollector
14
Dim objBtnControl
15
Dim aTabBtnsDef
16
'------------ CONSTANTS DECLARATION -----------
17
Const PARENT_TITLE = "User Accounts"
18
Const LIMG_ROLE = "<img src='images/i_role.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
19
Const LIMG_SPEC_ROLE = "<img src='images/i_spec_role.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
20
Const LIMG_DRILL_DOWN = "<img src='images/i_drill_down.gif' width='12' hspace='2' height='14' border='0'>"
21
Const LIMG_CONTROL = "<img src='images/i_control.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
22
Const LIMG_USER_LRG = "<img src='images/i_user_lrg.gif' width='13' height='17' hspace='2' border='0' align='absmiddle'>"
23
Const LIMG_USER_DISABLED_LRG = "<img src='images/i_user_disabled_lrg.gif' width='17' height='18' hspace='2' border='0' align='absmiddle'>"
24
Const LIMG_USER = "<img src='images/i_user.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
25
Const LIMG_USER_DISABLED = "<img src='images/i_user_disabled.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
26
Const LIMG_DISK = "<img src='images/i_disk.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
27
Const LMINUTES_SINCE_LAST_REQUEST = 20 'minutes
28
'------------ VARIABLE INIT -------------------
29
parUser_id = Request("user_id")
30
parApp_id = Request("app_id")
31
Set objUserCollector = CreateObject("Scripting.Dictionary")
32
Set objBtnControl = New ActionButtonControl
33
'------------ CONDITIONS ----------------------
34
'----------------------------------------------
35
%>
36
<%
37
'------------ RUN BEFORE PAGE RENDER ----------
38
objPMod.PersistInQryString ("user_id")
39
objPMod.PersistInQryString ("app_id")
40
objPMod.PersistInQryString ("tree")
41
'----------------------------------------------
42
%>
43
<%
44
'-----------------------------------------------------------------------------------------------------------------
45
Sub GetUserDetails ( nUser_id, ByRef outobjDetails )
46
	Dim rsQry, query
47
	query = "SELECT *  FROM   USERS  WHERE user_id = "& nUser_id
48
 
49
	Set rsQry = OraDatabase.DbCreateDynaset( query , ORADYN_DEFAULT )
50
 
51
	If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
52
		outobjDetails.Item ("user_id")   = rsQry("user_id")
53
		outobjDetails.Item ("full_name") = rsQry("full_name")
54
		outobjDetails.Item ("user_name") = rsQry("user_name")
55
		outobjDetails.Item ("is_disabled") = rsQry("is_disabled")
56
 
57
	Else
58
		Err.Raise 8, "Sub GetUserDetails", "Empty record set returned. nUser_id="& nUser_id
59
 
60
	End If
61
 
62
	rsQry.Close
63
	Set rsQry = Nothing
64
End Sub
65
'-----------------------------------------------------------------------------------------------------------------
66
Sub RenderTitle ( objCollector )
67
	If objCollector.Item("is_disabled") = enumDB_YES Then
68
		Response.write LIMG_USER_DISABLED_LRG
69
	Else
70
		Response.write LIMG_USER_LRG
71
	End If
72
 
73
	Response.write "<b>"& objCollector.Item("full_name") &" ["& objCollector.Item("user_name") &"]</b>"
74
 
75
End Sub
76
'--------------------------------------------------------------------------------------------------------------------------
77
Function UserOnlineIcon ( sUserOnlineIcon, nLastRequest )
78
	If NOT IsNull( sUserOnlineIcon ) Then
79
 
80
		If NOT IsNull( nLastRequest ) Then
81
 
82
 
83
			If (TIMER_VALUE - nLastRequest) < LMINUTES_SINCE_LAST_REQUEST Then
84
				' User is still online
85
				UserOnlineIcon = sUserOnlineIcon
86
			Else
87
				' User has not responded within MINUTES_SINCE_LAST_REQUEST
88
				UserOnlineIcon = NULL
89
			End If
90
 
91
		Else
92
			UserOnlineIcon = sUserOnlineIcon
93
		End If
94
 
95
	Else
96
		UserOnlineIcon = NULL
97
	End If
98
End Function
99
'--------------------------------------------------------------------------------------------------------------------------
100
Function LastRequest ( nLastRequest )
101
	Dim minDiff
102
 
103
	If NOT IsNull( nLastRequest ) Then
104
		minDiff = TIMER_VALUE - nLastRequest
105
 
106
		If minDiff < 60 Then
107
			' Show in Minutes
108
			LastRequest =  minDiff &" minutes ago"
109
 
110
		ElseIf minDiff < 1440 Then
111
			' Show in Hours
112
			LastRequest =  (minDiff \ 60) &" hours ago"
113
 
114
		ElseIf minDiff < 43800 Then
115
			' Show in Days
116
			LastRequest =  (minDiff \ 1440) &" days ago"
117
 
118
		ElseIf minDiff < 525600 Then
119
			' Show in Months
120
			LastRequest =  (minDiff \ 43800) &" months ago"
121
 
122
		Else
123
			' Show in Years
124
			LastRequest =  (minDiff \ 525600) &" years ago"
125
 
126
		End If
127
 
128
	Else
129
		LastRequest = NULL
130
	End If
131
End Function
132
'--------------------------------------------------------------------------------------------------------------------------
133
'-----------------------------------------------------------------------------------------------------------------
134
%>