Subversion Repositories DevTools

Rev

Rev 5506 | Rev 7063 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5098 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'                  NEW VERSION
5
'       Build Daemon enquiries
6
'       Designed to be called via AJAX and to return
7
'       JSON formatted data to dynamic page
8
'=====================================================
9
%>
10
<%
11
Option explicit
12
' Essential to get UTF through all the hoops. ie: VÄSTTRAFIK (VTK)
13
Response.ContentType = "text/html"
14
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
15
Response.CodePage = 65001
16
Response.CharSet = "UTF-8"
17
%>
18
<!--#include file="common/conf.asp"-->
19
<!--#include file="common/globals.asp"-->
20
<!--#include file="common/qstr.asp"-->
21
<!--#include file="common/common_subs.asp"-->
22
<SCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="class/classaspJSON.vbs"></SCRIPT> 
23
<%
24
'------------ Variable Definition -------------
25
Dim parOpr
26
Dim result
27
Dim SqlQry
28
Dim rsQry
29
 
30
parOpr = QStrPar("opr")
31
result = -1
32
 
33
' Init the output JSON class
34
'   Operations can add data
35
'   Default data will be added at the end
36
Dim oJSON
37
Set oJSON = New aspJSON
38
Dim newitem
39
 
40
'   
41
'   Perform the body of the operations within a Sub and use
42
'   On Error Resule Next to catch errors that accur in the code
43
'
44
On Error Resume Next
45
If (parOpr = "indefPause") Then
46
    indefPause
47
 
48
Else
49
    oJSON.data("error") = 1
50
    oJSON.data("emsgSummary") = "Unknown JSON Operation"
51
    oJSON.data("emsgDetails") = "The Requested JSON operation is not supported: " & parOpr
52
End If
53
 
54
 
55
' SQL error detection and reporting
56
If objEH.LastOraFailed Then
57
    oJSON.data("error") = 1
58
    result = -1
59
 
60
    oJSON.data("emsgSummary") = objEH.MessageSummary
61
    oJSON.data("emsgDetails") = objEH.MessageDetails
62
    oJSON.data("SqlQry") = SqlQry
63
'
64
'   Detect program errors
65
ElseIf Err.number <> 0 Then
66
    result = -3
67
    oJSON.data("error") = 2
68
    oJSON.data("errnum") = Err.number
69
    oJSON.data("errtxt") = Err.description
70
    oJSON.data("errsrc") = Err.source
71
    oJSON.data("emsgSummary") = "Internal VBScript Error:" & Err.number &  ":" & Err.description
72
End If
73
On error goto 0
74
'Write single value
75
oJSON.data("result") = result
76
 
77
'function Sleep(seconds)
78
'    dim oshell, cmd
79
'    set oShell = CreateObject("Wscript.Shell")
80
'    cmd = "cmd.exe /c timeout " & seconds & " /nobreak"
81
'    oShell.Run cmd,0,1
82
'End function
83
'
84
'Sleep(2)
85
 
86
 
87
' DEBUG: A Hash of the user provided requests
88
<!--oJSON.data("QueryString") = Request.QueryString       -->
89
<!--                                                      -->
90
<!--Dim requestSet : Set requestSet = oJSON.Collection()  -->
91
<!--Set oJSON.data("Request") = requestSet                -->
92
<!--Dim variableName                                      -->
93
<!--for each variableName in Request.QueryString          -->
94
<!--    requestSet.add variableName, Request(variableName)-->
95
<!--next                                                  -->
96
<!--for each variableName in Request.Form                 -->
97
<!--    requestSet.add variableName, Request(variableName)-->
98
<!--next                                                  -->
99
 
100
 
101
'Return the object
102
Response.Write oJSON.JSONoutput()
5957 dpurdie 103
Set oJSON = Nothing
104
Call Destroy_All_Objects
5098 dpurdie 105
%>
106
<%
107
'-------------------------------------------------
108
' Function:    indefPause
109
' Description: Determine if daemons are paused
110
Sub indefPause
111
    '   Get Data for an existing entry
112
    '   Setup for the database access
113
 
114
    SqlQry = "select * from run_level_schedule rls where rls.indefinite_pause = 'P'"
115
 
116
    objEH.ErrorRedirect = FALSE
117
    objEH.TryORA ( OraSession )
118
    On Error Resume Next
119
    Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )
120
    objEH.CatchORA ( OraSession )
121
 
122
    oJSON.data("indefPause") = rsQry.RecordCount
123
    result = 0
124
    rsQry.Close
125
    Set rsQry = Nothing
126
 
127
End Sub
128
%>