home *** CD-ROM | disk | FTP | other *** search
/ Online Praxis 1998 March / Image.iso / CD-ROM / NETSCAPE / CCK / ASE.Z / nci.js < prev    next >
Encoding:
Text File  |  1997-08-21  |  3.4 KB  |  116 lines

  1. <!--  to hide script contents from old browsers
  2.  
  3. // the file that includes this must also include settings.js!
  4.  
  5. //THE FOLLOWING FUNCTION IS LOCATION DEPENDANT
  6. //returns the filename that we are working with - from the 
  7. //editfield in the parent's "config" frame
  8. function getNCINameFromOpener()
  9. {
  10.     var outValue = "";
  11.     
  12.     var tempValue = parent.nciglobals.GetNameValuePair("ACCTSET.INI", "Mode Selection", "ExistingSRFile");
  13.     if ((tempValue != null))
  14.         outValue = tempValue;
  15.     return outValue;
  16.     
  17. }
  18.  
  19.  
  20. function refreshNCIList()
  21. {
  22.     formName = "NCICONFIGSELECT";
  23.  
  24.     fillSelectListWithConfigFiles(formName, "NCICONFIGLIST", ".NCI", true);
  25. }
  26.  
  27. function setNCIList(inFileName)
  28. {
  29.     formName = "NCICONFIGSELECT";
  30.     setSelectList(formName, "NCICONFIGLIST", inFileName);
  31. }
  32.  
  33. //this is the onLoad event handler
  34. function loadData()
  35. {
  36.     if (parent.nciglobals && parent.nciglobals.getText)
  37.     {
  38.         refreshNCIList();
  39.     
  40.         var openerConfigName = getNCINameFromOpener();
  41.         //debug("Opener Config Name: " + openerConfigName);
  42.         if ((openerConfigName != null) && (openerConfigName != ""))
  43.         {
  44.             setNCIList(openerConfigName);
  45.             parent.nciglobals.readFileData(openerConfigName);
  46.         }
  47.     }
  48.     else
  49.         setTimeout("loadData()",500);
  50.     
  51. }
  52.  
  53. function saveData()
  54. {
  55.     //do nothing
  56. }
  57.  
  58. function setSelectList(formName, selectListName, inValue)
  59. {
  60.     if (inValue != null)
  61.     { 
  62.          for (var i = (document[formName][selectListName].length - 1); i >= 0 ; i--)
  63.          {
  64.              if(inValue.toString() == (document[formName][selectListName].options[i].value.toString()))
  65.              {
  66.                  //debug("Found select list Match (" + i + ")(" + inValue + ")");
  67.                  document[formName][selectListName].options[i].selected = true;
  68.              }
  69.          }
  70.     }    
  71. }
  72.  
  73. function fillSelectListWithConfigFiles(formName, selectListName, fileSuffix, offerNew)
  74. {
  75.     var curConfigName = "";
  76.     var curConfigDescription = "";
  77.  
  78.     //blank out old list
  79.     for (var i = (document[formName][selectListName].length -1); i >= 0 ; i--)
  80.     {
  81.         document[formName][selectListName].options[i] = null;
  82.     }    
  83.     
  84.     //make a blank so the user can choose nothing
  85.     document[formName][selectListName].options[0] = new Option("< None Selected >","",false, false); 
  86.     
  87.     //Only offer a new if we said so
  88.     if (offerNew == true)
  89.         document[formName][selectListName].options[1] = new Option("< New Configuration >","_new_",false, false); 
  90.  
  91.     // Get a list of the files in the Config folder
  92.     fileList = parent.nciglobals.getFileListFromConfigFolder(fileSuffix);
  93.     
  94.     //debug( "filelist: " + fileList);
  95.     
  96.     if (fileList != null)    {
  97.         for (var i=0; i<fileList.length; i++)    {
  98.                 curConfigName             = parent.nciglobals.GetNameValuePair(fileList[i], "Dial-In Configuration", "SiteName");
  99.                 curConfigDescription     = parent.nciglobals.GetNameValuePair(fileList[i], "Dial-In Configuration", "Description");
  100.  
  101.                 if ((curConfigName != null)  && (curConfigName != ""))
  102.                     document[formName][selectListName].options[document[formName][selectListName].length] = new Option(curConfigName,fileList[i], false, false);
  103.                 else if ((curConfigDescription != null) && (curConfigDescription != ""))
  104.                     document[formName][selectListName].options[document[formName][selectListName].length] = new Option(curConfigDescription,fileList[i], false, false);
  105.                 else
  106.                     document[formName][selectListName].options[document[formName][selectListName].length] = new Option(fileList[i],fileList[i], false, false);
  107.                     
  108.             }
  109.         }
  110. }
  111.  
  112.  
  113.  
  114.  
  115. // end hiding contents from old browsers  -->
  116.