Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3610 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|                ADMIN Page                         |
6
'|               Build Service                       |
7
'|                                                   |
8
'=====================================================
9
%>
10
<%
11
Option explicit
12
' Good idea to set when using redirect
13
Response.Expires = 0   ' always load the page, dont store
14
%>
15
<!--#include file="common/conf.asp"-->
16
<!--#include file="common/globals.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
 
20
<%
21
'------------ ACCESS CONTROL ------------------
22
%>
23
<!--#include file="_access_control_general.asp"-->
24
<%
25
'------------ Variable Definition -------------
4028 dpurdie 26
Dim parTest
27
Dim LocalPath
4246 dpurdie 28
Dim rvRemExec
4028 dpurdie 29
Dim rvEmail
30
Dim rvEmail1
4246 dpurdie 31
Dim rvEmail2
32
Dim rvEvent
4028 dpurdie 33
Dim active
34
 
3610 dpurdie 35
'------------ Constants Declaration -----------
36
'------------ Variable Init -------------------
4028 dpurdie 37
parTest = QStrPar("test")
4246 dpurdie 38
rvRemExec = ""
4028 dpurdie 39
rvEmail = ""
40
rvEmail1 = ""
4246 dpurdie 41
rvEmail2 = ""
42
rvEvent = ""
4028 dpurdie 43
active = objAccessControl.IsActive("ConfigureBuildService")
44
if NOT active Then parTest = ""
45
 
3610 dpurdie 46
'----------------------------------------------
3959 dpurdie 47
 
48
function testFromRegistry (strRegistryKey )
49
    Dim WSHShell, value
50
 
51
    On Error Resume Next
52
    Set WSHShell = CreateObject("WScript.Shell")
53
    value = WSHShell.RegRead( strRegistryKey )
54
 
55
    testFromRegistry = NOT (err.number <> 0)
56
 
57
    set WSHShell = nothing
4028 dpurdie 58
end function
59
 
60
Function makeButton( text, test, result )
61
    If result <> "" Then result = "&nbsp;" & result
62
    If active Then
63
        makeButton = "&nbsp;&nbsp;<a class=""form_btn"" href=""admin_build_test_page.asp?test="&test&""" title=""" &text& """>"&text&"</a>" & result
64
    Else
65
        makeButton = "&nbsp;&nbsp;<a class=""form_btn_disabled"" title=""" &text& """>"&text&"</a>" & result
66
    End If
67
End Function
68
 
4240 dpurdie 69
Function makeAjaxButton( text, script )
70
    If active Then
4246 dpurdie 71
        makeAjaxButton = "&nbsp;&nbsp;<a id="""&script &""" href="""" class=""form_btn"" title=""" &text& """ onclick="""&script&"();return false;"">"&text&"</a>"
4240 dpurdie 72
    Else
4246 dpurdie 73
        makeAjaxButton = "&nbsp;&nbsp;<a class=""form_btn_disabled"" title=""" &text& """>"&text&"</a>"
4240 dpurdie 74
    End If
75
End Function
76
 
4028 dpurdie 77
'-------------------------------------------
78
' Perform tests on request
79
'
80
If parTest = "email" Then
81
    Call Send_Email ( "Release Manager Notification", adminEmail, objAccessControl.UserEmail, "Test Email", "This is a Test Email generated by the Release Manager Test.", Null )
82
    rvEmail = "Sent"
83
 
84
ElseIf parTest = "email1" Then
85
    LocalPath = Server.MapPath("images\img_reports_admin.jpg")
86
    Call Send_Email ( "Release Manager Notification", adminEmail, objAccessControl.UserEmail, "Test Email", "This is a Test Email generated by the Release Manager Test. This email has an attachment", LocalPath )
87
    rvEmail1 = "Sent"
88
 
4246 dpurdie 89
ElseIf parTest = "email2" Then
90
    Set objWSH = Server.CreateObject("WScript.Shell")
91
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestMail", 0, TRUE)
92
    Set objWSH = Nothing
93
    If rv = 0 Then
94
        rvEmail2 = "OK"
95
    Else
96
        rvEmail2 = "Error ("&rv&")"
97
    End IF
98
 
99
ElseIf parTest = "event" Then
100
    Set objWSH = Server.CreateObject("WScript.Shell")
101
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onRaiseEvent", 0, TRUE)
102
    Set objWSH = Nothing
103
    If rv = 0 Then
104
        rvEvent = "OK"
105
    Else
106
        rvEvent = "Error ("&rv&")"
107
    End IF
108
 
4028 dpurdie 109
ElseIf parTest = "remExec" Then
4481 dpurdie 110
    rvRemExec = "Testing"
4028 dpurdie 111
    Set objWSH = Server.CreateObject("WScript.Shell")
4246 dpurdie 112
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestArchiveAccess", 0, TRUE)
4028 dpurdie 113
    Set objWSH = Nothing
114
    If rv = 0 Then
4246 dpurdie 115
        rvRemExec = "OK"
4028 dpurdie 116
    Else
4246 dpurdie 117
        rvRemExec = "Error ("&rv&")"
4028 dpurdie 118
    End IF
119
End If
120
 
3610 dpurdie 121
%>
4240 dpurdie 122
<script type="text/javascript" src="scripts/json2.js"></script>
123
<script language="JavaScript" src="scripts/remote_scripting.js"></script>
124
<script type="text/javascript" charset="utf-8">
125
///////////////////////////////////////////////
126
//  Function:    ajaxOpr
127
//  Description: Perform an ajax operation
4477 dpurdie 128
//  Args       :    prog        - Progam to invoke
129
//                  args        - Part of URL to pass to script
4240 dpurdie 130
//                  callback    - Callback on success
131
//                  ecall       - Callback on error            
132
//
4477 dpurdie 133
function ajaxOpr(prog, args, callback, ecall)
4240 dpurdie 134
{
135
    xmlHttp=GetXmlHttpObject(function(){ ajaxOprCallback(callback, ecall);});
136
    if (xmlHttp==null)
137
    {
138
      alert ("Your browser does not support AJAX!");
139
      return;
140
    }
3610 dpurdie 141
 
4477 dpurdie 142
    var url = prog + "?" + args;
4240 dpurdie 143
 
144
    // Use async request, otherwise the spinner will not work
145
    xmlHttp.open("GET",url,true);  // `false` makes the request synchronous
146
    xmlHttp.send(null);
147
}
148
///////////////////////////////////////////////
149
//  Function:    ajaxOprCallback
150
//  Description: Perform an Ajax operation generic error handling
151
//  Args       : callback - Function to process json results
152
//                          Json has been decoded and is a javascript object
153
//                          Handle errors for the user
154
//
155
function ajaxOprCallback(callback, ecall)
156
{
157
    //readyState of 4 or 'complete' represents that data has been returned
158
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
159
    {
160
        // alert("Got to getAllProjectKeysDone"+ xmlHttp.responseText);
161
        if (xmlHttp.status !== 200) {
162
            ecall('Bad Status');
163
            alert("Internal AJAX error: " + xmlHttp.status);
164
        }
165
        else
166
        {
167
            // Gather the results from the callback
168
            var str = xmlHttp.responseText;
169
            try {
170
                var myJson = JSON.parse(str);
171
                //alert("ajaxOprCallback:" + str);
172
                if (myJson.result != 0) {
173
                    ecall('Error');
174
                    alert("AJAX request error: " + myJson.emsgSummary);
175
                }
176
                else {
177
                    callback(myJson);
178
                }
179
            }
180
            catch(e) {
4477 dpurdie 181
                ecall('Error');
182
                alert("JSON Parse Error: " + e);
4240 dpurdie 183
            }
184
        }
185
    }
186
}
187
 
188
///////////////////////////////////////////////
189
//  Function:       jiraTest   
190
//  Description:    Get the list of projects from the Jira Server
191
//
192
function jiraTest()
193
{
194
    //  Show that testing has started
195
    var el = document.getElementById("jiraTest");
4399 dpurdie 196
    el.innerHTML = 'Testing';
4240 dpurdie 197
 
4477 dpurdie 198
    ajaxOpr('_json_jiraIssues.asp',
199
            'Opr=getAllKeys', 
4399 dpurdie 200
            function(myJson){ el.innerHTML = 'Test OK'; },
201
            function(txt){ el.innerHTML = "Test Failed:" + txt}
4240 dpurdie 202
           );
203
}
4477 dpurdie 204
 
205
///////////////////////////////////////////////
206
//  Function:       zipTest   
207
//  Description:    Test that the server can ZIP a file
208
//
209
function zipTest()
210
{
211
    //  Show that testing has started
212
    var el = document.getElementById("zipTest");
213
    el.innerHTML = 'Testing';
214
 
215
    ajaxOpr('_json_RmTests.asp',
216
            'Opr=zipTest', 
217
            function(myJson){ el.innerHTML = 'Test OK'; },
218
            function(txt){ el.innerHTML = "Test Failed:" + txt}
219
           );
220
}
221
 
222
 
4240 dpurdie 223
</script>
3610 dpurdie 224
<html>
225
<head>
226
 
227
<title>Admin Test Page</title>
228
 
229
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
230
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
231
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
232
<link rel="stylesheet" href="images/navigation.css" type="text/css">
233
<script language="JavaScript" src="images/common.js"></script>
234
<!-- DROPDOWN MENUS -->
235
<!--#include file="_menu_def.asp"-->
236
<script language="JavaScript1.2" src="images/popup_menu.js"></script>
4399 dpurdie 237
<!-- StyleSheet Extensions -->
238
<style>
239
.pagebody {margin-left:auto; margin-right:auto; width:50%;border-width: 0px;border-spacing: 2px; background-color: rgb(255, 204, 0)}
240
.pagebody td{white-space:nowrap;vertical-align: top;text-align: left;padding-left: 3px;padding-right: 3px; background: #f2f0e4}
241
.tablehdr td{background-color: rgb(255, 204, 0)}
242
</style>
3610 dpurdie 243
</head>
244
 
245
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
246
<!-- MENU LAYERS -------------------------------------->
247
<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)">
248
</div>
249
<!-- TIPS LAYERS -------------------------------------->
250
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
251
<!-- HEADER -->
252
<!--#include file="_header.asp"-->
4399 dpurdie 253
<p>
254
<!-- Body of the page -->
255
<table class="pagebody">
256
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
257
   <tr class="body_col tablehdr">
258
      <td>Test</td>
259
      <td>Result</td>
260
   </tr>
3610 dpurdie 261
 
4399 dpurdie 262
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
263
   <tr class="body_row">
264
      <td>User ID</td>
265
      <td><%=objAccessControl.UserId%></td>
3610 dpurdie 266
   </tr>
4399 dpurdie 267
   <tr class="body_row">
268
      <td>User Name</td>
269
      <td><%=objAccessControl.UserName%></td>
270
   </tr>
271
   <tr class="body_row">
272
      <td>User Email</td>
273
      <td><%=objAccessControl.UserEmail%></td>
274
   </tr>
3610 dpurdie 275
 
4399 dpurdie 276
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
277
   <tr class="body_row">
278
      <td>DataBase Name</td>
279
      <td><%=OraDatabase.DatabaseName%></td>
280
   </tr>
4028 dpurdie 281
 
4399 dpurdie 282
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
283
   <tr class="body_row">
284
      <td>Archive Server</td>
285
      <td><%=archive_server%></td>
286
   </tr>
3611 dpurdie 287
 
4399 dpurdie 288
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
289
   <tr class="body_row">
290
      <td>Package Archive Access - Map File System</td>
291
   <%
3611 dpurdie 292
 
4399 dpurdie 293
   Dim objWSH,rv,result
294
   Set objWSH = Server.CreateObject("WScript.Shell")
295
   rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestMapArchive", 0, TRUE)
296
   Set objWSH = Nothing
297
   If rv = 0 Then
298
       result = "OK"
299
   Else
300
       result = "Error ("&rv&")"
301
   End IF
3610 dpurdie 302
 
4399 dpurdie 303
   %>
304
      <td><%=result%></td>
305
   </tr>
3610 dpurdie 306
 
4399 dpurdie 307
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
308
   <tr class="body_row">
309
      <td>Package Archive Access - Remote cmd execution</td>
310
      <td><%=makeButton("Test", "remExec",rvRemExec)%></td>
311
   </tr>
3959 dpurdie 312
 
4399 dpurdie 313
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
314
   <tr class="body_row">
315
   <%
316
       Dim sKey1, sKey2, sValue1, sValue2, kFragment
317
       kFragment = "rsa2@22:" & archive_server
318
       sKey1 = "HKEY_USERS\S-1-5-20\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
319
       sKey2 = "HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
320
       sValue1 = testFromRegistry(sKey1)
321
       sValue2 = testFromRegistry(sKey2)
322
   %>
323
      <td>Plink Key [<%=sKey1%>]</td>
324
      <td><%=sValue1%></td>
325
   </tr>
326
   <tr class="body_row">
327
      <td>Plink Key [<%=sKey2%>]</td>
328
      <td><%=sValue2%></td>
329
   </tr>
330
 
331
  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
332
   <tr class="body_row">
4477 dpurdie 333
     <td>Zip File</td>
334
     <td><%=makeAjaxButton("Test", "zipTest")%></td>
335
   </tr>
336
 
337
  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
338
   <tr class="body_row">
4399 dpurdie 339
      <td>Email Server</td>
340
      <td><%=MAIL_SERVER%></td>
341
   </tr>
342
   <tr class="body_row">
343
      <td>Admin Email</td>
344
      <td><%=adminEmail%></td>
345
   </tr>
346
   <tr class="body_row">
347
      <td>Send Email</td>
348
      <td><%=makeButton("eMail", "email",rvEmail)%></td>
349
   </tr>
350
   <tr class="body_row">
351
      <td>Send Email With attachment</td>
352
      <td><%=makeButton("eMail", "email1",rvEmail1)%></td>
353
   </tr>
354
   <tr class="body_row">
355
     <td>Send Email from WSH script</td>
356
     <td><%=makeButton("eMail", "email2",rvEmail2)%></td>
357
   </tr>
4246 dpurdie 358
 
4399 dpurdie 359
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
360
   <tr class="body_row">
361
    <td>Generate error event</td>
362
    <td><%=makeButton("event", "event",rvEvent)%></td>
363
   </tr>
3611 dpurdie 364
 
4246 dpurdie 365
 
4399 dpurdie 366
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
367
   <tr class="body_row">
368
      <td>Jira Server</td>
369
      <td><%=JIRA_URL%></td>
370
   </tr>
371
   <tr class="body_row">
372
      <td>Jira Test</td>
373
      <td><%=makeAjaxButton("Test", "jiraTest")%></td>
374
   </tr>
4246 dpurdie 375
 
4399 dpurdie 376
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
377
   <tr class="body_col tablehdr">
378
      <td>End of Tests</td>
379
      <td><a class="form_btn" href="admin_build_test_page.asp" title="Refresh Page">Refresh</a></td>
380
   </tr>
381
 
382
</table>
383
<input type="hidden" name="action" value="true">
384
<p>
3610 dpurdie 385
</body>
386
</html>
387
<!-- FOOTER -->
388
<!--#include file="_footer.asp"-->
389
<%
390
Call Destroy_All_Objects
391
%>