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