home *** CD-ROM | disk | FTP | other *** search
/ Adephia Powerlink / AdephiaPowerlink-030102.iso / pc / Install / WorkFlow / Bin / SetProfileData.dll / GUI_INFO / 135 next >
Encoding:
Text File  |  2002-11-15  |  10.0 KB  |  383 lines

  1. <html>
  2. <head>
  3. <STYLE>
  4. body{
  5.     font-size : medium;
  6.     }
  7. td    {
  8.     font-size : medium;
  9.     }
  10. </STYLE>
  11. </head>
  12.  
  13. <body bgcolor="silver" text="maroon">
  14.  
  15. <h1><div align="center">Configure SetProfileData Worknode</div></h1><!--<form method="POST"  action="http://">-->
  16. <form method="post" name="configure" action="CALLBACKID-ConfigureWorknode">
  17. <P>
  18. Enter the instance name:  
  19. <input name="instance_name" size=50 maxlength=80 > </P>
  20. <P>
  21. <TABLE cellSpacing=1 cellPadding=1 width="75%" border=0>
  22.   
  23.   <TR>
  24.     <TD noWrap>Profile Hive</TD>
  25.     <TD noWrap><SELECT id="profile_hive" name="profile_hive" 
  26.      > <OPTION value=System 
  27.         selected>System</OPTION><OPTION value=User>User</OPTION><OPTION 
  28.         value=Agent>Agent</OPTION><OPTION 
  29.         value=Subscriber>Subscriber</OPTION></SELECT></TD></TR>
  30.   <TR>
  31.     <TD noWrap>Profile Path</TD>
  32.     <TD noWrap><INPUT style="WIDTH: 335px; HEIGHT: 22px" size=40 
  33.       name="profile_path"></TD></TR>
  34.   <TR>
  35.     <TD noWrap>Value</TD>
  36.     <TD noWrap><INPUT style="WIDTH: 335px; HEIGHT: 22px" size=40 
  37.       name="value"></TD></TR>
  38.   <TR>
  39.     <TD noWrap>Data Type</TD>
  40.     <TD noWrap><SELECT id="data_type" name="data_type"> 
  41.         <OPTION value=str selected>String</OPTION><OPTION 
  42.         value=int>Integer</OPTION><OPTION 
  43.         value=dbl>Double</OPTION><OPTION 
  44.   value=bool>Boolean</OPTION></SELECT></TD></TR></TABLE></P>
  45. <P>
  46. <input type="button" name="Key_ADD" value="Add" style="WIDTH: 55px; HEIGHT: 24px" onClick="Add();">
  47. <input type="button" name="Key_Option" value="Clear" style="WIDTH: 55px; HEIGHT: 24px" onClick="HandleOption();">
  48. <br><br>
  49. List of Keys:....<br>
  50. <SELECT id="Key_Select" name="Key_Select" size=2 style="WIDTH: 350px; HEIGHT: 170px"> 
  51. </SELECT>
  52. <input type="hidden" name="KeyRepository" >
  53. <br>
  54. <input type="button" name="Key_REMOVE" value="Remove" onClick="Remove();">
  55. <input type="button" name="Key_EDIT" value="Edit" style="WIDTH: 63px; HEIGHT: 24px" onClick="Edit();"> 
  56. </P>
  57.  
  58. <p> 
  59.  
  60. <P><input type="button" name="config" value="Configure" onClick="ConfigClick();">
  61.  
  62. </form><hr>
  63.  
  64. <form method="post" name="cancel_config" action="CALLBACKID-CancelConfigure">
  65. <P><input type="submit" name="cancel" value="Cancel">
  66. </form><hr>
  67.  
  68. <BR>
  69.  
  70. <A target=_blank href="ConfigHelp.html">Click here for help</A>
  71.  
  72. </body>
  73. </html>
  74.  
  75. <SCRIPT LANGUAGE="JavaScript">
  76. var nCurrentlyEditing = -1;
  77. var strCurrentlyEditing = "";
  78. var strInstanceName="";
  79. var strKeysRepository = "";
  80.  
  81. /*VARS*/
  82.  
  83. /*ENDVARS*/
  84. document.forms[0].instance_name.value = strInstanceName;
  85. document.forms[0].KeyRepository.value = strKeysRepository;
  86.  
  87. PopulateSelectBox(document.forms[0].KeyRepository.value, document.forms[0].Key_Select);
  88.  
  89.  
  90. function Add()
  91. {
  92.     var strProfileHive;
  93.     var strProfilePath;    
  94.     var strValue;
  95.     var strDataType;
  96.     var bReleaseGUI;
  97.     var KeyDisplayName;
  98.     var index;
  99.     
  100.     index = document.forms[0].profile_hive.selectedIndex;    
  101.     strProfileHive = document.forms[0].profile_hive.options[index].value;
  102.     strProfilePath = document.forms[0].profile_path.value;    
  103.     strValue = document.forms[0].value.value;
  104.     index = document.forms[0].data_type.selectedIndex;
  105.     strDataType = document.forms[0].data_type.options[index].value;
  106.         
  107.     KeyDisplayName = strProfileHive + "," + strProfilePath;
  108.  
  109.     if (IsStringEmpty(strProfilePath))
  110.     {
  111.         document.forms[0].profile_path.value = "";
  112.         alert("Please enter a Profile Path.");
  113.     }
  114.     else if(strProfilePath.charAt(0) == '/')
  115.     {
  116.         alert("Please enter a Valid profile path (should not start with '/').");
  117.     }
  118.     else if (IsStringEmpty(strValue))
  119.     {
  120.         document.forms[0].value.value = "";
  121.         alert("Please enter a Value.");
  122.     }    
  123.     else if (IsValidKey(KeyDisplayName))
  124.     {
  125.         
  126.         UpdateRepository(strProfileHive, strProfilePath, strValue, strDataType);
  127.         document.forms[0].profile_path.value = "";
  128.         document.forms[0].value.value = "";        
  129.     }    
  130. }
  131.  
  132. function Remove()
  133. {
  134.     var nIndex = document.forms[0].Key_Select.selectedIndex;
  135.     var strArray;
  136.     var strTemp;
  137.     var strKeyRepository;
  138.     var nLength;
  139.     
  140.     if(nIndex > -1)
  141.     {
  142.         strKeyRepository = new String(document.forms[0].KeyRepository.value.toString());
  143.         nLength = strKeyRepository.length - 2;
  144.         strTemp = strKeyRepository.substring(0, nLength);    //knock off trailing delimeters
  145.         strArray = strTemp.split(";~");
  146.         
  147.         if (strArray.length == 1)
  148.         {
  149.             strKeyRepository = "";
  150.         }
  151.         else
  152.         {    
  153.             strArray = RemoveArrayElement(strArray, nIndex);
  154.             strKeyRepository = strArray.join(";~") + ";~"; 
  155.             HandleOption();
  156.         }
  157.         
  158.         document.forms[0].KeyRepository.value = strKeyRepository;    
  159.         
  160.         document.forms[0].Key_Select.options[nIndex] = null;
  161.     }
  162. }
  163.  
  164. function UpdateRepository(strNewProfileHive, strNewProfilePath, strNewValue, strNewDataType)
  165. {
  166.     var strRepository;
  167.         
  168.     if (nCurrentlyEditing > -1)
  169.     {
  170.         var strArray;
  171.         var strTemp;
  172.         var nLength;
  173.         var strNewValPair;
  174.         var strNewdisplayValue;
  175.     
  176.         strNewValPair = strNewProfileHive + "=" + strNewProfilePath + "=" + strNewValue + "=" + strNewDataType;
  177.         strRepository = new String(document.forms[0].KeyRepository.value.toString());
  178.         nLength = strRepository.length - 2;
  179.         strTemp = strRepository.substring(0, nLength);    
  180.         strArray = strRepository.split(";~");
  181.         strArray[nCurrentlyEditing] = strNewValPair;
  182.         strRepository = strArray.join(";~"); 
  183.         
  184.         
  185.         strNewdisplayValue = strNewProfileHive + "," + strNewProfilePath;
  186.         document.forms[0].KeyRepository.value = strRepository;
  187.         document.forms[0].Key_Select.options[nCurrentlyEditing].text = strNewdisplayValue;
  188.         
  189.         document.forms[0].Key_ADD.value = "Add";
  190.         document.forms[0].Key_Option.value = "Clear";
  191.         nCurrentlyEditing = -1;
  192.         strCurrentlyEditing = "";
  193.     }
  194.     else
  195.     {
  196.         var opOption = new Option;
  197.         
  198.         strRepository = document.forms[0].KeyRepository.value + strNewProfileHive + "=" + strNewProfilePath  + "=" + strNewValue + "=" + strNewDataType + ";~";
  199.         document.forms[0].KeyRepository.value = strRepository;
  200.     
  201.         
  202.         strNewdisplayValue = strNewProfileHive + "," + strNewProfilePath;
  203.         opOption.text = strNewdisplayValue;
  204.         document.forms[0].Key_Select.options[document.forms[0].Key_Select.options.length] = opOption;
  205.     }    
  206. }
  207.  
  208. function Edit()
  209. {
  210.     var nIndex = document.forms[0].Key_Select.selectedIndex;
  211.     var strArray;
  212.     var strTemp;
  213.     var strRepository;
  214.     var nLength;
  215.     var strStringToEdit;
  216.     
  217.     if(nIndex > -1)
  218.     {
  219.         strRepository = new String(document.forms[0].KeyRepository.value.toString());
  220.         nLength = strRepository.length - 2;
  221.         strTemp = strRepository.substring(0, nLength);    
  222.         strArray = strRepository.split(";~");
  223.         
  224.         strStringToEdit = strArray[nIndex];
  225.         strArray = strStringToEdit.split("=");
  226.         nCurrentlyEditing = nIndex;
  227.         
  228.         document.forms[0].Key_ADD.value = "Update";
  229.         document.forms[0].Key_Option.value = "Cancel";
  230.         if(strArray[0] == "System")
  231.             document.forms[0].profile_hive.selectedIndex = 0;
  232.         else if (strArray[0] == "User")
  233.             document.forms[0].profile_hive.selectedIndex = 1;
  234.         else if (strArray[0] == "Agent")
  235.             document.forms[0].profile_hive.selectedIndex = 2;
  236.         else if (strArray[0] == "Subscriber")
  237.             document.forms[0].profile_hive.selectedIndex = 3;
  238.             
  239.         document.forms[0].profile_path.value = strArray[1];    
  240.         document.forms[0].value.value = strArray[2];    
  241.         if(strArray[3] == "str")
  242.             document.forms[0].data_type.selectedIndex = 0;
  243.         else if (strArray[3] == "int")
  244.             document.forms[0].data_type.selectedIndex = 1;
  245.         else if (strArray[3] == "dbl")
  246.             document.forms[0].data_type.selectedIndex = 2;
  247.         else if (strArray[3] == "bool")
  248.             document.forms[0].data_type.selectedIndex = 3;    
  249.         strCurrentlyEditing = strArray[0] + "," + strArray[1];
  250.     }    
  251. }
  252.  
  253. function HandleOption()
  254. {
  255.     if (nCurrentlyEditing > -1)
  256.     {
  257.         nCurrentlyEditing = -1;
  258.         strCurrentlyEditing = "";
  259.         document.forms[0].Key_Option.value = "Clear";
  260.         document.forms[0].Key_ADD.value = "Add";
  261.     }
  262.     document.forms[0].profile_path.value = "";
  263.     document.forms[0].value.value = "";    
  264. }
  265.  
  266. function RemoveArrayElement(strArray, nIndex)
  267. {
  268.     var tempArray = new Array();
  269.     var nCounter;
  270.     var nArrCounter;
  271.     var nLength;
  272.     
  273.     nArrCounter = 0;
  274.     nLength = strArray.length;
  275.     nCounter = 0;
  276.     while (nCounter < nLength)
  277.     {
  278.         if ((strArray[nCounter].length != 0) && (nCounter != nIndex))
  279.         {
  280.             tempArray[nArrCounter] = strArray[nCounter];
  281.             nArrCounter = nArrCounter + 1;
  282.         }
  283.         nCounter = nCounter + 1;
  284.     }
  285.     
  286.     return tempArray;
  287. }
  288.  
  289.  
  290. function PopulateSelectBox(strValues, selectBox)
  291. {
  292.     var strArray;
  293.     var strTemp;
  294.     var nLength;
  295.     var strStringToAdd;
  296.     var nCounter=0;
  297.     var aTempArray;
  298.     var tempOption;
  299.         
  300.     if (strValues == "")
  301.     {
  302.         return;
  303.     }
  304.     nLength = strValues.length - 2;
  305.     strTemp = strValues.substring(0, nLength);    
  306.     strArray = strTemp.split(";~");
  307.     nLength = strArray.length;
  308.     
  309.     while (nCounter < nLength)
  310.     {
  311.         tempOption = new Option();
  312.         aTempArray = strArray[nCounter].split("=");
  313.         tempOption.text = aTempArray[0] + "," + aTempArray[1];
  314.         selectBox.options[selectBox.length] = tempOption;
  315.         nCounter = nCounter + 1;
  316.     }
  317. }
  318.  
  319. function IsValidKey(strKeyDisplayName)
  320. {
  321.     var nLength;
  322.     var nCounter = 0;
  323.     var tempdisplayname;
  324.     
  325.     nLength = document.forms[0].Key_Select.length;
  326.     while (nCounter < nLength)
  327.     {
  328.         if ((strKeyDisplayName == document.forms[0].Key_Select.options[nCounter].text) && (strKeyDisplayName != strCurrentlyEditing))
  329.         {
  330.             window.alert("Duplicate Key already exists.");
  331.             return false;
  332.         }
  333.         nCounter++;
  334.     }
  335.     
  336.     return true;
  337. }
  338.  
  339. function IsStringEmpty(strString)
  340. {
  341.     var nCounter = 0;
  342.     var nLength = strString.length;
  343.     
  344.     while (nCounter < nLength)
  345.     {
  346.         if (strString.charAt(nCounter) != ' ')
  347.         {
  348.             return false;
  349.         }
  350.         
  351.         nCounter++;
  352.     }
  353.         
  354.     return true;
  355. }
  356.  
  357. </SCRIPT>
  358.  
  359. <SCRIPT LANGUAGE="VBScript">
  360. Function ConfigClick()
  361.     if (VerifyData()) then
  362.         if (document.forms(0).onSubmit()) then
  363.             document.forms(0).submit()
  364.         end if
  365.     end if
  366. end function
  367.  
  368. Function VerifyData()
  369.     dim strInstanceName
  370.     dim bReturn
  371.     
  372.     bReturn = True
  373.     
  374.     strInstanceName = document.forms(0).instance_name.value
  375.     
  376.     if (strInstanceName="") then
  377.         MsgBox("Please enter an Instance Name")
  378.         bReturn = False    
  379.     end if    
  380.     VerifyData = bReturn
  381. end function
  382.  
  383. </SCRIPT>