Subversion Repositories DevTools

Rev

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
110
    Set objWSH = Server.CreateObject("WScript.Shell")
4246 dpurdie 111
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestArchiveAccess", 0, TRUE)
4028 dpurdie 112
    Set objWSH = Nothing
113
    If rv = 0 Then
4246 dpurdie 114
        rvRemExec = "OK"
4028 dpurdie 115
    Else
4246 dpurdie 116
        rvRemExec = "Error ("&rv&")"
4028 dpurdie 117
    End IF
118
End If
119
 
3610 dpurdie 120
%>
4240 dpurdie 121
<script type="text/javascript" src="scripts/json2.js"></script>
122
<script language="JavaScript" src="scripts/remote_scripting.js"></script>
123
<script type="text/javascript" charset="utf-8">
124
///////////////////////////////////////////////
125
//  Function:    ajaxOpr
126
//  Description: Perform an ajax operation
127
//  Args       :    args - Part of URL to pass to script
128
//                  callback    - Callback on success
129
//                  ecall       - Callback on error            
130
//
131
function ajaxOpr(args, callback, ecall)
132
{
133
    xmlHttp=GetXmlHttpObject(function(){ ajaxOprCallback(callback, ecall);});
134
    if (xmlHttp==null)
135
    {
136
      alert ("Your browser does not support AJAX!");
137
      return;
138
    }
3610 dpurdie 139
 
4240 dpurdie 140
    var url = "_json_jiraIssues.asp?" + args;
141
 
142
    // Use async request, otherwise the spinner will not work
143
    xmlHttp.open("GET",url,true);  // `false` makes the request synchronous
144
    xmlHttp.send(null);
145
}
146
///////////////////////////////////////////////
147
//  Function:    ajaxOprCallback
148
//  Description: Perform an Ajax operation generic error handling
149
//  Args       : callback - Function to process json results
150
//                          Json has been decoded and is a javascript object
151
//                          Handle errors for the user
152
//
153
function ajaxOprCallback(callback, ecall)
154
{
155
    //readyState of 4 or 'complete' represents that data has been returned
156
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
157
    {
158
        // alert("Got to getAllProjectKeysDone"+ xmlHttp.responseText);
159
        if (xmlHttp.status !== 200) {
160
            ecall('Bad Status');
161
            alert("Internal AJAX error: " + xmlHttp.status);
162
        }
163
        else
164
        {
165
            // Gather the results from the callback
166
            var str = xmlHttp.responseText;
167
            try {
168
                var myJson = JSON.parse(str);
169
                //alert("ajaxOprCallback:" + str);
170
                if (myJson.result != 0) {
171
                    ecall('Error');
172
                    alert("AJAX request error: " + myJson.emsgSummary);
173
                }
174
                else {
175
                    callback(myJson);
176
                }
177
            }
178
            catch(e) {
179
            }
180
        }
181
    }
182
}
183
 
184
///////////////////////////////////////////////
185
//  Function:       jiraTest   
186
//  Description:    Get the list of projects from the Jira Server
187
//
188
function jiraTest()
189
{
190
    //  Show that testing has started
191
    var el = document.getElementById("jiraTest");
192
    el.innerText = 'Testing';
193
 
194
    ajaxOpr('Opr=getAllKeys', 
195
            function(myJson){ el.innerText = 'Test OK'; },
196
            function(txt){ el.innerText = "Test Failed:" + txt}
197
           );
198
 
199
}
200
</script>
3610 dpurdie 201
<html>
202
<head>
203
 
204
<title>Admin Test Page</title>
205
 
206
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
207
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
208
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
209
<link rel="stylesheet" href="images/navigation.css" type="text/css">
210
<script language="JavaScript" src="images/common.js"></script>
211
<!-- DROPDOWN MENUS -->
212
<!--#include file="_menu_def.asp"-->
213
<script language="JavaScript1.2" src="images/popup_menu.js"></script>
214
</head>
215
 
216
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
217
<!-- MENU LAYERS -------------------------------------->
218
<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)">
219
</div>
220
<!-- TIPS LAYERS -------------------------------------->
221
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
222
<!-- HEADER -->
223
<!--#include file="_header.asp"-->
224
 
225
   <%
226
   '-- FROM START ---------------------------------------------------------------------------------------------------------
227
   %>
228
   <tr>
229
      <td background="images/bg_login.gif">
230
         <table width="100%"  border="0" cellspacing="0" cellpadding="0">
231
            <tr>
232
               <td><%=ProgressBar%></td>
233
               <td align="right">&nbsp;          </td>
234
            </tr>
235
         </table>
236
      </td>
237
   </tr>
238
   <tr>
239
      <td>
3611 dpurdie 240
         <table style="margin-left:auto; margin-right:auto; width:50%"  border="0" cellpadding="0" cellspacing="2" bgcolor="#FFCC00">
3610 dpurdie 241
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
242
            <tr>
3611 dpurdie 243
               <td valign="top" nowrap class="body_col">Test</td>
244
               <td valign="top" nowrap class="body_col">Result</td>
3610 dpurdie 245
            </tr>
246
 
247
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
248
            <tr>
4028 dpurdie 249
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">User ID</td>
250
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=objAccessControl.UserId%></td>
251
            </tr>
252
            <tr>
253
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">User Name</td>
254
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=objAccessControl.UserName%></td>
255
            </tr>
256
            <tr>
257
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">User Email</td>
258
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=objAccessControl.UserEmail%></td>
259
            </tr>
260
 
261
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
262
            <tr>
3611 dpurdie 263
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">DataBase Name</td>
264
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=OraDatabase.DatabaseName%></td>
265
            </tr>
266
 
267
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
268
            <tr>
269
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Archive Server</td>
270
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=archive_server%></td>
271
            </tr>
272
 
273
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
274
            <tr>
3610 dpurdie 275
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package Archive Access - Map File System</td>
276
            <%
277
 
278
            Dim objWSH,rv,result
279
            Set objWSH = Server.CreateObject("WScript.Shell")
4246 dpurdie 280
            rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestMapArchive", 0, TRUE)
3610 dpurdie 281
            Set objWSH = Nothing
282
            If rv = 0 Then
283
                result = "OK"
284
            Else
285
                result = "Error ("&rv&")"
286
            End IF
287
 
288
            %>
289
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=result%></td>
290
            </tr>
3959 dpurdie 291
 
292
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
293
            <tr>
4246 dpurdie 294
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package Archive Access - Remote cmd execution</td>
295
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
296
                    <%=makeButton("Test", "remExec",rvRemExec)%>
297
                </td>
298
            </tr>
299
 
300
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
301
            <tr>
3959 dpurdie 302
            <%
303
                Dim sKey1, sKey2, sValue1, sValue2, kFragment
304
                kFragment = "rsa2@22:" & archive_server
305
                sKey1 = "HKEY_USERS\S-1-5-20\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
306
                sKey2 = "HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
307
                sValue1 = testFromRegistry(sKey1)
308
                sValue2 = testFromRegistry(sKey2)
309
            %>
310
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Plink Key [<%=sKey1%>]</td>
311
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=sValue1%></td>
312
            </tr>
313
            <tr>
314
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Plink Key [<%=sKey2%>]</td>
315
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=sValue2%></td>
316
            </tr>
3610 dpurdie 317
 
4246 dpurdie 318
           <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
3610 dpurdie 319
            <tr>
4028 dpurdie 320
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Email Server</td>
321
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=MAIL_SERVER%></td>
3610 dpurdie 322
            </tr>
4028 dpurdie 323
            <tr>
324
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Admin Email</td>
325
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=adminEmail%></td>
326
            </tr>
327
            <tr>
328
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Send Email</td>
329
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
330
                    <%=makeButton("eMail", "email",rvEmail)%>
331
              </td>
332
            </tr>
333
            <tr>
334
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Send Email With attachment</td>
335
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
336
                    <%=makeButton("eMail", "email1",rvEmail1)%>
337
            </tr>
4246 dpurdie 338
            <tr>
339
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Send Email from WSH script</td>
340
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
341
                    <%=makeButton("eMail", "email2",rvEmail2)%>
342
            </tr>
3611 dpurdie 343
 
3610 dpurdie 344
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
345
            <tr>
4246 dpurdie 346
             <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Generate error event</td>
347
             <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
348
                    <%=makeButton("event", "event",rvEvent)%>
349
            </tr>
350
 
351
 
352
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
353
            <tr>
4240 dpurdie 354
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Jira Server</td>
355
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"><%=JIRA_URL%></td>
356
            </tr>
357
            <tr>
358
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Jira Test</td>
359
               <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
360
                    <%=makeAjaxButton("Test", "jiraTest")%>
361
              </td>
362
            </tr>
363
 
364
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
365
            <tr>
3610 dpurdie 366
               <td valign="top" nowrap class="body_col">End of Tests</td>
4028 dpurdie 367
               <td><a class="form_btn" href="admin_build_test_page.asp" title="Refresh Page">Refresh</a></td>
3610 dpurdie 368
            </tr>
369
 
370
         </table>
371
      </td>
372
  </tr>
373
  <input type="hidden" name="action" value="true">
3611 dpurdie 374
  <p>
3610 dpurdie 375
</body>
376
</html>
377
<!-- FOOTER -->
378
<!--#include file="_footer.asp"-->
379
<%
380
Call Destroy_All_Objects
381
%>