Subversion Repositories DevTools

Rev

Rev 5061 | Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                ADMIN Page                         |
'|               Build Service                       |
'|                                                   |
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->

<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim active
Dim FileSystemObject
Dim dpkgArchiveAvailable

'------------ Constants Declaration -----------
'------------ Variable Init -------------------
active = canActionControl("ConfigureBuildService")

'   Determine if dpkg_archive can be accessed directly via a UNC
If testArchiveAccessPkg("","") Then
    dpkgArchiveAvailable = "Exists" 
Else
    dpkgArchiveAvailable = "Not Accessible" 
End If

'----------------------------------------------
function testFromRegistry (strRegistryKey )
    Dim WSHShell, value

    On Error Resume Next
    Set WSHShell = CreateObject("WScript.Shell")
    value = WSHShell.RegRead( strRegistryKey )

    testFromRegistry = NOT (err.number <> 0)

    set WSHShell = nothing
end function

Function makeAjaxButton( text, script )
    If active Then
        makeAjaxButton = "&nbsp;&nbsp;<a id="""&script &""" href="""" class=""form_btn"" title=""" &text& """ onclick="""&script&"();return false;"">"&text&"</a>"
    Else
        makeAjaxButton = "&nbsp;&nbsp;<a class=""form_btn_disabled"" title=""" &text& """>"&text&"</a>"
    End If
End Function
%>
<script type="text/javascript" src="scripts/json2.js"></script>
<script language="JavaScript" src="scripts/remote_scripting.js"></script>
<script type="text/javascript" charset="utf-8">
///////////////////////////////////////////////
//  Function:    ajaxOpr
//  Description: Perform an ajax operation
//  Args       :    prog        - Progam to invoke
//                  args        - Part of URL to pass to script
//                  callback    - Callback on success
//                  ecall       - Callback on error            
//
function ajaxOpr(prog, args, callback, ecall)
{
    var xmlHttp 
    xmlHttp=GetXmlHttpObject(function(){ ajaxOprCallback(xmlHttp,callback, ecall);});
    if (xmlHttp==null)
    {
      alert ("Your browser does not support AJAX!");
      return;
    }

    var url = prog + "?" + args;

    // Use async request, otherwise the spinner will not work
    xmlHttp.open("GET",url,true);  // `false` makes the request synchronous
    xmlHttp.send(null);
}
///////////////////////////////////////////////
//  Function:    ajaxOprCallback
//  Description: Perform an Ajax operation generic error handling
//  Args       :    xmlHttp  - Ajax Object
//                  callback - Function to process json results
//                             Json has been decoded and is a javascript object
//                             Handle errors for the user
//                  ecall    - Function called on error. 
//                             User should indicate failure
//                             This function will issue an alert for the caller
//
function ajaxOprCallback(xmlHttp,callback, ecall)
{
    //readyState of 4 or 'complete' represents that data has been returned
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
    {
        // alert("Got to getAllProjectKeysDone"+ xmlHttp.responseText);
        if (xmlHttp.status !== 200) {
            ecall('Bad Status');
            alert("Internal AJAX error: " + xmlHttp.status);
        }
        else
        {
            // Gather the results from the callback
            var str = xmlHttp.responseText;
            try {
                var myJson = JSON.parse(str);
                //alert("ajaxOprCallback:" + str);
                if (myJson.result != 0) {
                    ecall('Error');
                    alert("AJAX request error: " + myJson.emsgSummary);
                }
                else {
                    callback(myJson);
                }
            }
            catch(e) {
                ecall('Error');
                alert("JSON Parse Error: " + e);
            }
        }
    }
}

///////////////////////////////////////////////
//  Function:       jiraTest   
//  Description:    Get the list of projects from the Jira Server
//
function jiraTest()
{
    //  Show that testing has started
    var el = document.getElementById("jiraTest");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_jiraIssues.asp',
            'Opr=getAllKeys', 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       zipTest   
//  Description:    Test that the server can ZIP a file
//
function zipTest()
{
    //  Show that testing has started
    var el = document.getElementById("zipTest");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            'Opr=zipTest', 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       eventTest   
//  Description:    Test that the server can send an Event
//
function eventTest()
{
    //  Show that testing has started
    var el = document.getElementById("eventTest");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            'Opr=eventTest', 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       emailTest   
//  Description:    Test that the server can send an email
//
function emailTest()
{
    //  Show that testing has started
    var el = document.getElementById("emailTest");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            'Opr=emailTest', 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}
///////////////////////////////////////////////
//  Function:       emailTest1   
//  Description:    Test that the server can send an email with an attachment
//
function emailTest1()
{
    //  Show that testing has started
    var el = document.getElementById("emailTest1");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            'Opr=emailTest&Mode=Attach', 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       emailTest2
//  Description:    Test that the server can send an email from a WSH script
//
function emailTest2()
{
    //  Show that testing has started
    var el = document.getElementById("emailTest2");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            'Opr=emailWshTest', 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       ddpTest
//  Description:    
//
function ddpTest()
{
    //  Show that testing has started
    var el = document.getElementById("ddpTest");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            'Opr=ddpTest', 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}


///////////////////////////////////////////////
//  Function:       remExec
//  Description:    Test Remote Execution (Wsh)
//
function remExec()
{
    //  Show that testing has started
    var el = document.getElementById("remExec");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            'Opr=remExecTest', 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       pkgAccess
//  Description:    Test Remote Execution (Wsh)
//
function pkgAccess()
{
    //  Show that testing has started
    var el = document.getElementById("pkgAccess");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            'Opr=pkgAccessTest', 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

</script>
<html>
<head>

<title>Admin Test Page</title>

<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
<link rel="stylesheet" href="images/navigation.css" type="text/css">
<script language="JavaScript" src="images/common.js"></script>
<!-- DROPDOWN MENUS -->
<!--#include file="_menu_def.asp"-->
<script language="JavaScript1.2" src="images/popup_menu.js"></script>
<!-- StyleSheet Extensions -->
<style>
.pagebody {margin-left:auto; margin-right:auto; width:50%;border-width: 0px;border-spacing: 2px; background-color: rgb(255, 204, 0)}
.pagebody td{white-space:nowrap;vertical-align: top;text-align: left;padding-left: 3px;padding-right: 3px; background: #f2f0e4}
.tablehdr td{background-color: rgb(255, 204, 0)}
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
<!-- MENU LAYERS -------------------------------------->
<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)">
</div>
<!-- TIPS LAYERS -------------------------------------->
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
<!-- HEADER -->
<!--#include file="_header.asp"-->
<p>
<!-- Body of the page -->
<table class="pagebody">
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_col tablehdr">
      <td>Test</td>
      <td>Result</td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>User ID</td>
      <td><%=objAccessControl.UserId%></td>
   </tr>
   <tr class="body_row">
      <td>User Name</td>
      <td><%=objAccessControl.UserName%></td>
   </tr>
   <tr class="body_row">
      <td>User Email</td>
      <td><%=objAccessControl.UserEmail%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>DataBase Name</td>
      <td><%=OraDatabase.DatabaseName%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Archive Server</td>
      <td><%=archive_server%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Archive Root: <%=dpkg_archiveURL%></td>
      <td><%=dpkgArchiveAvailable%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Package Archive Access - Map File System</td>
      <td><%=makeAjaxButton("Test", "pkgAccess")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Package Archive Access - Remote cmd execution</td>
      <td><%=makeAjaxButton("Test", "remExec")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
   <%
       Dim sKey1, sKey2, sValue1, sValue2, kFragment
       kFragment = "rsa2@22:" & archive_server
       sKey1 = "HKEY_USERS\S-1-5-20\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
       sKey2 = "HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
       sValue1 = testFromRegistry(sKey1)
       sValue2 = testFromRegistry(sKey2)
   %>
      <td>Plink Key [<%=sKey1%>]</td>
      <td><%=sValue1%></td>
   </tr>
   <tr class="body_row">
      <td>Plink Key [<%=sKey2%>]</td>
      <td><%=sValue2%></td>
   </tr>
   
  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
     <td>Zip File</td>
     <td><%=makeAjaxButton("Test", "zipTest")%></td>
   </tr>

  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Email Server</td>
      <td><%=MAIL_SERVER%></td>
   </tr>
   <tr class="body_row">
      <td>Admin Email</td>
      <td><%=adminEmail%></td>
   </tr>
   <tr class="body_row">
      <td>Send Email</td>
      <td><%=makeAjaxButton("eMail", "emailTest")%></td>
   </tr>
   <tr class="body_row">
      <td>Send Email With attachment</td>
      <td><%=makeAjaxButton("eMail", "emailTest1")%></td>
   </tr>
   <tr class="body_row">
     <td>Send Email from WSH script</td>
     <td><%=makeAjaxButton("eMail", "emailTest2")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
    <td>Generate error event</td>
    <td><%=makeAjaxButton("Event", "eventTest")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Jira Server</td>
      <td><%=JIRA_URL%></td>
   </tr>
   <tr class="body_row">
      <td>Jira Test</td>
      <td><%=makeAjaxButton("Test", "jiraTest")%></td>
   </tr>

   <tr class="body_row">
     <td>DDP TESTING</td>
     <td><%=makeAjaxButton("ddpTest", "ddpTest")%></td>
   </tr>


   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_col tablehdr">
      <td>End of Tests</td>
      <td><a class="form_btn" href="admin_build_test_page.asp" title="Refresh Page">Refresh</a></td>
   </tr>
   
</table>
<input type="hidden" name="action" value="true">
<p>
</body>
</html>
<!-- FOOTER -->
<!--#include file="_footer.asp"-->
<%
Call Destroy_All_Objects
%>