Novell Home

Remote Console from inside iManager

Novell Cool Solutions: Trench
By Cade Carvell

Digg This - Slashdot This

Posted: 28 Sep 2004
 

I needed the ability to remote console from within the iManager framework to a desktop in our company. I have seen many little .exes out there that allow you to remote control the end user workstation for ZfD4, but none that were web based. So, I wrote my own that uses iManager 2.0.2. I simply created a new task via the Plugin Studio, and then modified the source code to do what I wanted.

I am by no means proficient at JavaScript/JSP/VB Script, but I was able to accomplish this task in about two days. Longest part was understanding how the iManager system worked, and where things were located. I think Novell could have done a much better job on this, but that is what we get paid for - to understand how it works, and bend it to our way. Try that with Microsoft products !!!

Anyway, I have included the entire file that I used. You should be able to read through it and pick up the added extras - it is commented fairly well. I would export this so that you could simply add it to iManager, but I don't know how to do that.

Example

<%@  page pageEncoding="utf-8"
 contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit,
                  java.util.ResourceBundle,
                  com.novell.emframe.dev.eMFrameUtils" %>

<%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>
<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>


<iman:stringtable bundle="DevResources"/>
<x:parse xml="${edas}" var="edasXml"/>


<HTML>
<HEAD>
   <TITLE><iman:string key="ProductName"/></TITLE>
   <LINK rel="stylesheet" href="<c:out value="${ContextPath}" />/portal/modules/dev/css/hf_style.css">
   <iman:include page="fw/UiHandlerTools.jsp" />


   <iman:include page="dev/eMFrameScripts_inc.jsp"/>
   <iman:include page="dev/MVStringEditorScripts_inc.jsp"/>
   <iman:include page="dev/ValidateIntegerScripts_inc.jsp"/>
   <iman:calendarScripts/>
   <iman:include page="dev/OSScripts_inc.jsp"/>
   <iman:include page="dev/OctetStringTextBoxScripts_inc.jsp"/>
   <iman:include page="dev/MVNetworkAddrScripts_inc.jsp"/>

   <SCRIPT>
   
      function onInit()
      {
         var form = document.forms[0];
         returnFromOS();
      }

      function onExit()
      {
         var form = document.forms[0];
         return notifyAllOfExit();
      }
      
      /* This was added by Cade Carvell for parsing the IP address to one that we can use
      Removes the IP: from it 
      This is the original function that the onclick of the Remote button uses
      */
      function ParseIPAddress()
      {
        var st=document.forms[0]._Network_Address.value
	var res=st.substring(3,st.length)
	run(res)
      }
      
   </SCRIPT>
   
   <script language="VBScript">

   Dim objShell
   /*  This Sub is used to actually create the Script object to all
   Us to run the RCCOnsole.exe file from IE.  
   Notice all the """" these are needed to allow us to put words in 
   "" for the RCCOnsole to rip open and use.
   */
   Sub Run(IPADDR)
     Set objShell = CreateObject("WScript.Shell")
     filetorun="C:\Novell\ConsoleOne\1.3.6\bin\zen\RCLaunch\RCConsole.exe"
     filetorun=filetorun & " -c" & """" & "Remote Control" & """" & " -a" 
	 & """" & trim(IPADDR) & """" & " -t" & """" & "0" & """" & " -s" & """" 
	 & "2" & """" & " -n" & """" & "NMDP" & """"
     objShell.Run filetorun
     On Error Resume Next
     Set objShell = Nothing  
   End Sub
   
</script>
</HEAD>

<body text="#000000" bgcolor="#ffffff" onLoad="onInit();">
<FORM name="form" method="post" action="webacc" onSubmit="return onExit();">

   <%-- - edas and system variables  - --%>
   <INPUT type="hidden" name="taskId" value="<c:out value="${taskId}"/>">
   <INPUT type="hidden" name="eDirCommand" value="Write">
   <INPUT type="hidden" name="eDir$target" value="<c:out value="${param.eDir$target}"/>">
   <INPUT type="hidden" name="merge" value="dev.GenConf">
   <INPUT type="hidden" name="error" value="dev.GenErr">


   <iman:taskHeader title="${requestScope['Task.displayName']}:  ${requestScope['Task.targetDisplayName']}"
    iconUrl="dir/${requestScope['TaskHeader.iconUrl']}"
	 iconAlt="${requestScope['TaskHeader.iconAlt']}"/><BR>



   <TABLE class="mediumtext" border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0">


      <%-- Full Name --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="Full Name"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Full_Name" scope="request"/>
            <iman:mved readonly="true" name="_Full_Name"            />
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/Full_Name[mode]"/>
            <iman:mooMode name="_Full_Name_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- Title --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="${TitleDisplayName}"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Title" scope="request"/>
            <iman:mved readonly="true" name="_Title"            />
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/Title[mode]"/>
            <iman:mooMode name="_Title_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- Login Time --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="${Login_TimeDisplayName}"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <INPUT name="_Login_Time" readonly size=<iman:string key="UI.textboxSize"/>
			 style="width:<iman:string key="UI.textboxPixel"/>"><iman:calendar name="_Login_Time"
			  onLoadCallback="onLoadCalendar" returnCallback="returnFromCalendar"/><A href="#"
			   onClick="document.form._Login_Time.value='';" alt="<iman:string key="Button.Clear.alt"/>"
			    title="<iman:string key="Button.Clear.alt"/>"><IMG src="<c:out
				 value="${ContextPath}"/>/portal/modules/dev/images/delete16.gif" border="0"></A>
            <INPUT name="_Login_Time_ms" type="hidden" value="<x:out select="$edasXml/edas/Login_Time/value"/>" >
            <SCRIPT>
               if("<x:out select="$edasXml/edas/Login_Time/value"/>"!="")
               {
                  var date = new Date(<x:out select="$edasXml/edas/Login_Time/value"/>);
                  document.forms[0]._Login_Time.value = date.toLocaleString()
               }
            </SCRIPT>
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/Login_Time[mode]"/>
            <iman:mooMode name="_Login_Time_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- zenwmLoggedInWorkstation --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="Logged in Workstation Name"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/zenwmLoggedInWorkstation" scope="request"/>
            <iman:mved readonly="true" name="_zenwmLoggedInWorkstation"            />
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/zenwmLoggedInWorkstation[mode]"/>
            <iman:mooMode name="_zenwmLoggedInWorkstation_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- DM:Remote Audible Signal --%>
      <TR>
         <TD align=left>
            <INPUT name="_eDir$target$DM_Remote_Audible_Signal" type="checkbox" DISABLED <x:if select="$edasXml/edas/DM_Remote_Audible_Signal/value='true'">checked</x:if>>
            <c:out value="Remote Signal Alert to User"/>
         </TD>
         <TD>
            <x:set var="mode" select="$edasXml/edas/DM_Remote_Audible_Signal[mode]"/>
            <iman:mooMode name="_DM_Remote_Audible_Signal_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- DM:Remote Visible Signal --%>
      <TR>
         <TD align=left>
            <INPUT name="_eDir$target$DM_Remote_Visible_Signal" type="checkbox" DISABLED <x:if select="$edasXml/edas/DM_Remote_Visible_Signal/value='true'">checked</x:if>>
            <c:out value="Remote Visible to User"/>
         </TD>
         <TD>
            <x:set var="mode" select="$edasXml/edas/DM_Remote_Visible_Signal[mode]"/>
            <iman:mooMode name="_DM_Remote_Visible_Signal_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- EMail Address --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="${EMail_AddressDisplayName}"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/EMail_Address" scope="request"/>
            <iman:mved readonly="true" name="_EMail_Address"            />
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/EMail_Address[mode]"/>
            <iman:mooMode name="_EMail_Address_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- telexNumber --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="Telephone Number"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <INPUT type="text" name="_telexNumber" value="<x:out select="$edasXml/edas/telexNumber/value"/>" size=<iman:string key="UI.textboxSize"/> style="width:<iman:string key="UI.textboxPixel"/>" DISABLED>

         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/telexNumber[mode]"/>
            <iman:mooMode name="_telexNumber_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- otherPhoneNumber --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="Other Phone Number"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/otherPhoneNumber" scope="request"/>
            <iman:mved readonly="true" name="_otherPhoneNumber"            />
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/otherPhoneNumber[mode]"/>
            <iman:mooMode name="_otherPhoneNumber_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- zenzfdVersion --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="ZFD Version"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <INPUT type="text" name="_zenzfdVersion" value="<x:out select="$edasXml/edas/zenzfdVersion/value"/>" size=<iman:string key="UI.textboxSize"/> style="width:<iman:string key="UI.textboxPixel"/>" DISABLED>
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/zenzfdVersion[mode]"/>
            <iman:mooMode name="_zenzfdVersion_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- roomNumber --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="Cube Number"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/roomNumber" scope="request"/>
            <iman:mved readonly="true" name="_roomNumber"            />
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/roomNumber[mode]"/>
            <iman:mooMode name="_roomNumber_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

      <%-- Network Address --%>
      <TR>
         <TD align="left" colspan="2">
            <c:out value="${Network_AddressDisplayName}"/>:  
         </TD>
      </TR>
      <TR>
         <TD>
            <c:set var="MVNetworkAddr_name" value="_Network_Address"  scope="request"/>
            <c:set var="MVNetworkAddr_readonly" value="true"  scope="request"/>
            <x:set var="MVNetworkAddr_xmlNodeSet" select="$edasXml/edas/Network_Address" scope="request"/>
            <iman:include page="dev/MVNetworkAddr_inc.jsp"/>
         </TD>
         <TD valign="top">
            <x:set var="mode" select="$edasXml/edas/Network_Address[mode]"/>
            <iman:mooMode name="_Network_Address_mode" value="${mode}" multi="true" />
         </TD>
      </TR>
      <TR><TD height="9"></TD></TR>

   </TABLE>


   <iman:include page="dev/Bar_inc.jsp"/>
   <%-- Here I modifed the buttons.  The btnRemote_en.gif is a custom button   
   I basicly took the cancel button, wiped the text off it, and added
   the text for remote.  When they click this button
   it runs the ParseIPAddress command that does 
   what it states, then it runs the Run command that 
   executes the RCCOnsole.exe with the Parameters.
   You will need to have the RCConsole app local - Part of Console One.
   --%>
   <a href="javascript:ParseIPAddress()"><img
    alt="Remote the Desktop of this user" src="https://10.200.5.53/nps/portal/modules/dev/images/en/btnRemote_en.gif"
    style="border: 0px solid "></a>
   <%--<iman:button key="OK" onClick="if(onExit() != false) document.forms[0].submit();"/> --%> <iman:cancelBtn/>

</FORM>
<iman:include page="dev/OSFooter_inc.jsp"/>
</BODY>
</HTML>

If you have any questions, please feel free to contact me at ccarvell@nmdp.org


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell