home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 April / VPR0004B.BIN / DRIVER / COMPAQ / SP12255 / sp12255.exe / DMWEBC1.CAB / Lcdefine.tpl < prev    next >
Text File  |  1999-03-23  |  5KB  |  219 lines

  1. <!-- $Id: LCDEFINE.TPL 1.26 1998/11/18  $ -->
  2. <!-- Copyright (C) 1998 Compaq Computer Corporation -->
  3.  
  4. <!-- Define global constants and variables for Lite Console -->
  5. <SCRIPT LANGUAGE="JavaScript">
  6.  
  7. //-----------------------------------------------------------------------------------------
  8. // Cookie and page configuration stuff
  9. //-----------------------------------------------------------------------------------------
  10.  
  11. function Cookie( document, name, days, path, domain, secure )
  12. {
  13.     this.$document = document;
  14.     this.$name = name;
  15.  
  16.     if(days)
  17.     {
  18.     this.$expiration = new Date((new Date()).getTime() + days*24*3600000);
  19.     }
  20.     else
  21.     {
  22.     this.$expiration = null;
  23.     }
  24.  
  25.     this.$path = ( path ? path : null );
  26.     this.$domain = ( domain ? domain : null );
  27.     this.$secure = ( secure ? secure : null );
  28. }
  29.  
  30.  
  31. function _Cookie_store()
  32. {
  33.     var cookieval = "";
  34.     var cookie;
  35.     var prop;
  36.  
  37.     for( prop in this )
  38.     {
  39.     if (("$" == prop.charAt(0)) || ("function" == typeof(this[prop])))
  40.     {
  41.         continue;
  42.     }
  43.  
  44.     if( "" != cookieval )
  45.     {
  46.         cookieval += "&";
  47.     }
  48.  
  49.     cookieval += prop + ":" + escape( this[prop] );
  50.     }
  51.     cookie = this.$name + "=" + cookieval;
  52.     if(this.$expiration)
  53.     {
  54.     cookie += "; expires=" + this.$expiration.toGMTString();
  55.     }
  56.  
  57.     if(this.$path)
  58.     {
  59.     cookie += "; path=" + this.$path;
  60.     }
  61.  
  62.     if(this.$domain)
  63.     {
  64.     cookie += "; domain=" + this.$domain;
  65.     }
  66.  
  67.     if(this.$secure)
  68.     {
  69.     cookie += "; secure";
  70.     }
  71.  
  72.     this.$document.cookie = cookie;
  73. }
  74.  
  75.  
  76. function _Cookie_load()
  77. {
  78.     var allcookies = this.$document.cookie;
  79.     var end;
  80.     var cookieval;
  81.     var a;
  82.     var i;
  83.  
  84.     if("" == allcookies)
  85.     {
  86.     return false;
  87.     }
  88.     start = allcookies.indexOf(this.$name + "=");
  89.     if( -1 == start )
  90.     {
  91.     return false;
  92.     }
  93.  
  94.     start += this.$name.length + 1;
  95.     end = allcookies.indexOf(";", start);
  96.  
  97.     if( -1 == end )
  98.     {
  99.     end = allcookies.length;
  100.     }
  101.  
  102.     cookieval = allcookies.substring(start, end);
  103.  
  104.     a = cookieval.split("&");
  105.     for(i=0; i<a.length; i++)
  106.     {
  107.     a[i] = a[i].split(":");
  108.     this[ a[i][0] ] = unescape( a[i][1] );
  109.     }
  110.  
  111.     return true;
  112. }
  113.  
  114.  
  115. function _Cookie_remove()
  116. {
  117.     var cookie;
  118.  
  119.     cookie = this.$name + "=";
  120.  
  121.     if(this.$path)
  122.     {
  123.     cookie += "; path=" + this.$path;
  124.     }
  125.  
  126.     if(this.$domain)
  127.     {
  128.     cookie += "; domain=" + this.$domain;
  129.     }
  130.  
  131.     cookie += "; expires=Fri, 02-Jan-1970 00:00:00 GMT";
  132.  
  133.     this.$document.cookie = cookie;
  134. }
  135.  
  136. //new Cookie();
  137.  
  138. Cookie.prototype.store =    _Cookie_store;
  139. Cookie.prototype.load =     _Cookie_load;
  140. Cookie.prototype.remove =   _Cookie_remove;
  141.  
  142.     LcVersion = "LcVersion";
  143.     LcPcName = "LcPcName";
  144.     LcAlertId = "LcAlertId";
  145.     LcAlertDate = "LcAlertDate";    
  146.     LcMenu = "LcMenu";
  147.  
  148.     LcCbFull = "LcCbFull";
  149.     LcCbStandard = "LcCbStandard";
  150.     LcCbFailed = "LcCbFailed";
  151.     LcCbDegraded = "LcCbDegraded";
  152.     LcCbNormal = "LcCbNormal";
  153.     LcCbUnknown = "LcCbUnknown";
  154.     LcCbNonmanaged = "LcCbNonmanaged";
  155.  
  156.     LcPcName = "LcPcName";
  157.     LcIp1 = "LcIp1";
  158.     LcIp2 = "LcIp2";
  159.     LcIp3 = "LcIp3";
  160.     LcIp4 = "LcIp4";
  161.  
  162.     LcIpFrom1 = "LcIpFrom1";
  163.     LcIpFrom2 = "LcIpFrom2";
  164.     LcIpFrom3 = "LcIpFrom3";
  165.     LcIpFrom4 = "LcIpFrom4";
  166.     LcIpTo1 = "LcIpTo1";
  167.     LcIpTo2 = "LcIpTo2";
  168.     LcIpTo3 = "LcIpTo3";
  169.     LcIpTo4 = "LcIpTo4";
  170.  
  171.     LcWorkgroupName = "LcWorkgroupName";
  172.     LcDomainName = "LcDomainName";
  173.  
  174.     LcNetIpFrom1 = "LcNetIpFrom1";
  175.     LcNetIpFrom2 = "LcNetIpFrom2";
  176.     LcNetIpFrom3 = "LcNetIpFrom3";
  177.     LcNetIpFrom4 = "LcNetIpFrom4";
  178.  
  179.     LcNetIpTo1 = "LcNetIpTo1";
  180.     LcNetIpTo2 = "LcNetIpTo2";
  181.     LcNetIpTo3 = "LcNetIpTo3";
  182.     LcNetIpTo4 = "LcNetIpTo4";
  183.  
  184.     LC_MANAGER = "LC_MANAGER";
  185.  
  186.     LcFilterMode = "LcFilterMode";
  187.  
  188.     LcNetworkMode = "LcNetworkMode";
  189.     SelectedPc = "SelectedPc";
  190.     LcSubMenu = "LcSubMenu";
  191.  
  192.     LiteConsoleInfo = new Cookie(document, "LiteConsoleInfo", 30);
  193.     LiteConsoleInfo.load();
  194.  
  195. function configSet( configItem, itemValue )
  196. {
  197.    LiteConsoleInfo[configItem] = itemValue;
  198.    LiteConsoleInfo.store();
  199. }
  200.  
  201.  
  202. function configGet( configItem )
  203. {
  204.     var itemValue = null;
  205.  
  206. //    if( "undefined" == typeof( LiteConsoleInfo[ configItem ] ))
  207. //    {
  208. //        if( "undefined"!=typeof( configDefaults[ configItem ] ))
  209. //        {
  210. //            itemValue = configDefaults[ configItem ];
  211. //        }
  212.  
  213. //        configSet( configItem, itemValue );
  214. //    }
  215.  
  216.     return LiteConsoleInfo[ configItem ];
  217. }
  218.  
  219. </SCRIPT>