[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fedora-directory-commits
Subject:    [Fedora-directory-commits] esc/src/app/xul/esc/chrome/content/esc
From:       "Jack Magne" (jmagne) <fedora-directory-commits () redhat ! com>
Date:       2006-10-25 4:03:37
Message-ID: 200610250403.k9P43bTm012589 () cvs-int ! fedora ! redhat ! com
[Download RAW message or body]

Author: jmagne

Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12564

Modified Files:
	ESC.js GenericAuth.xul TRAY.js advancedinfo.xul certinfo.xul 
	config.xul esc.xul password.xul settings.xul 
Log Message:
Latest mac/win fixes.


Index: ESC.js
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/ESC.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ESC.js	27 Sep 2006 17:31:51 -0000	1.3
+++ ESC.js	25 Oct 2006 04:03:34 -0000	1.4
@@ -43,12 +43,25 @@
 const  SERVICES_TAG      = "Services";
 const  ISSUER_TAG        = "IssuerName"; 
 const  SERVICE_INFO_TAG  = "ServiceInfo";
+const  ENROLLED_TOKEN_BROWSER_URL = "EnrolledTokenBrowserURL";
+const  RESET_PHONE_HOME  = "ResetPhoneHome";
+const  ESC_IGNORE_TOKEN_BROWSER_URL = "esc.ignore.token.browser.url";
+const  ESC_TOKEN_BROWSER_URL_ESTABLISHED = "esc.token.browser.established";
+const  ESC_IGNORE_KEY_ISSUER_INFO = "esc.ignore.key.issuer.info";
 
 const  UNINITIALIZED        = 1;
 const  UNINITIALIZED_NOAPPLET = 2;
 const  ESC_ENROLL_WIDTH  = 600;
 const  ESC_ENROLL_HEIGHT = 570;
 
+//Enrolled Token Browser constants
+
+const MAC_PROG_OPEN = "/usr/bin/open";
+const LINUX_PROG_OPEN = "/usr/bin/gnome-open";
+const WIN_XP_PROG_OPEN = "C:\\Windows\\system32\\cmd.exe";
+const WIN_2000_PROG_OPEN = "C:\\WINNT\\system32\\cmd.exe";
+
+
 //Window names
 
 const ENROLL_WINDOW      = "esc.xul";
@@ -224,6 +237,8 @@
 {
   var callback = function (aResult) {
 
+    recordMessage("In DoPhoneHome callback");
+
     var issuer = "";
     if(aResult == true)
     {
@@ -232,6 +247,21 @@
             issuer = getBundleString("unknownIssuer");
         TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer \
+"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
  UpdateRowWithPhoneHomeData(keyType,keyID);
+
+        recordMessage("cached issuer " + issuer);
+
+        var browserURL =  GetCachedEnrolledTokenBrowserURL(keyID);
+
+        recordMessage("Cached browserURL " + browserURL);
+
+        if(browserURL)
+        {
+            DoCoolKeySetConfigValue(ESC_TOKEN_BROWSER_URL_ESTABLISHED,"yes");
+
+            DoHandleEnrolledBrowserLaunch();
+
+        }
+
     }
     else
     {
@@ -245,6 +275,15 @@
   {
       issuer = GetCachedIssuer(keyID);
       TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" \
+ " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
 +
+      var launchBrowserURL =  GetCachedEnrolledTokenBrowserURL(keyID);
+
+      if(launchBrowserURL && GetCoolKeyIsEnrolled(keyType, keyID) )
+      {
+          recordMessage("About to attempt to launch Browser URL.");
+          openEnrolledTokenURLBrowser(keyID); 
+      }
+
       return true;
   }
 
@@ -317,6 +356,7 @@
 
     var name = this.name;
 
+    recordMessage("DoPhoneHomeConfigClose()  name " + name + " opener " + \
window.opener);  if(window.opener && name)
     {
         window.opener.UpdateRowWithPhoneHomeData(1,name);
@@ -593,7 +633,7 @@
    keyUITable[aKeyID] = aUiData;
    keyTypeTable[aKeyID] = aKeyType;
 
-   var child =  window.open("chrome://esc/content/GenericAuth.xul", aKeyID, \
"chrome,width=400,height=250"); +   var child =  \
window.open("chrome://esc/content/GenericAuth.xul", aKeyID, \
"chrome,centerscreen,width=400,height=250");  
    curChildWindow = child; 
 
@@ -830,6 +870,7 @@
 
     textDump +=   arr.length + "\n\n" ;
 
+    var i = 0;
     for(i = 0 ; i < arr.length ; i++)
     {
        keyID = arr[i][1];
@@ -842,7 +883,7 @@
        if(!issuer)
            issuer = getBundleString("unknownIssuer");
 
-       textDump += "***" + getBundleString("smartCardU") + " " + i + ":" + "***" + \
"\n\n"; +       textDump += getBundleString("smartCardU") + " " + i + ":"  + "\n\n";
 
        textDump += "  " + getBundleString("appletVersion") + " " + appletVerMaj + \
"." + appletVerMin + "\n";  
@@ -881,11 +922,11 @@
        if(nicknames)
        {
            var cert_info = null;
-           for (i = 0; i < nicknames.length ; i ++)
+           for (j = 0; j < nicknames.length ; j ++)
            {
-                textDump += "    " + getBundleString("certificateNickname") + " " + \
nicknames[i] + " \n\n"; +                textDump += "    " + \
getBundleString("certificateNickname") + " " + nicknames[j] + " \n\n";  
-                cert_info = GetCoolKeyCertInfo(keyType,keyID,nicknames[i]);
+                cert_info = GetCoolKeyCertInfo(keyType,keyID,nicknames[j]);
 
                 var cert_split = cert_info.split("\n");
 
@@ -1919,7 +1960,6 @@
   gEnrollmentPage = 1;
   UpdateCoolKeyAvailabilityForEnrollment();
   UpdateButtonStates();
-  //showOrHideEscOnLaunch();
   window.setTimeout("showOrHideTabsUI()",2);
 }
 
@@ -1927,7 +1967,6 @@
 {
   UpdateBindingTableAvailability();
   UpdateButtonStates();
-  //showOrHideEscOnLaunch();
 }
 
 function InitializeAdminBindingList()
@@ -1937,8 +1976,9 @@
 
  UpdateAdminBindingListAvailability();
  UpdateButtonStates();
- //showOrHideEscOnLaunch();
- //showOrHideTabsUI();
+
+ DoSetEnrolledBrowserLaunchState(); 
+ DoHandleEnrolledBrowserLaunch();
 }
 
 //Window related functions
@@ -1952,7 +1992,9 @@
   // We do want notify events though
   var doPreserveNotify = true;
 
+  
   SetMenuItemsText(); 
+  HideWindow();
   TrayRemoveWindow(doPreserveNotify);
 }
 
@@ -2267,6 +2309,10 @@
 
 function SelectRow(row)
 {
+
+  if(!row)
+      return;
+
   var theID = row.getAttribute("id");
   if (!row || gCurrentSelectedRow == row)
     return;
@@ -3208,16 +3254,14 @@
 
   var uninitialized = 0;
 
+  recordMessage("Key insterted!");
+
   if(gHiddenPage)
   {
       TrayShowNotificationIcon();
   }
 
-  if (GetCoolKeyIsEnrolled(keyType, keyID))
-  {
-      openEnrolledTokenURLBrowser();
-  }
-  else
+  if (!GetCoolKeyIsEnrolled(keyType, keyID) )
   {
        uninitialized = 1;
   }
@@ -3627,8 +3671,78 @@
 // Special feature to open a default browser to
 // a configurable URL. 
 
-function openEnrolledTokenURLBrowser()
+
+function DoSetEnrolledBrowserLaunchState()
+{
+
+    var launch_id = document.getElementById("enrolled_key_browser");
+
+    if(launch_id)
+    {
+
+        var doIgnoreBrowserUrl = \
DoCoolKeyGetConfigValue(ESC_IGNORE_TOKEN_BROWSER_URL); +
+        recordMessage("DoSetEnrolledBrowserLaunchState: doIgnore: " + \
doIgnoreBrowserUrl); +        var checked= "false";
+
+        if(doIgnoreBrowserUrl == "yes")
+        {
+
+            checked = "true";
+        }
+        else
+        {
+            checked = "false";
+        }
+     
+        launch_id.setAttribute("checked",checked); 
+    }
+
+}
+
+
+function DoHandleEnrolledBrowserLaunch()
+{
+
+    var launch_id = document.getElementById("enrolled_key_browser");
+
+    var doShow = DoCoolKeyGetConfigValue(ESC_TOKEN_BROWSER_URL_ESTABLISHED);
+    
+    if(launch_id)
+    {
+
+      if(doShow == "yes")
+      {
+          ShowItem(launch_id);
+      }
+      else
+      {
+          HideItem(launch_id);
+      }
+
+      var checked = launch_id.getAttribute("checked");
+
+      recordMessage("DoHandleEnrolledBrowserLaunch checked: " + checked );
+      if(checked == "true")
+      {
+          recordMessage("DoHandleEnrolledBrowserLaunch Setting ESC_IGNORE to yes");
+          DoCoolKeySetConfigValue(ESC_IGNORE_TOKEN_BROWSER_URL,"yes");
+      }
+      else
+      {
+          recordMessage("DoHandleEnrolledBrowserLaunch Setting ESC_IGNORE to no");
+          DoCoolKeySetConfigValue(ESC_IGNORE_TOKEN_BROWSER_URL,"no");
+      }
+
+    }
+}
+
+function openEnrolledTokenURLBrowser(aKeyID)
 {
+
+    if(!gHiddenPage)
+        return;
+
     var agent = navigator.userAgent.toLowerCase();
 
     var doWindows = 0;
@@ -3636,35 +3750,46 @@
     var platform = null;
     var executable = null;
 
+    //Check to see if we should ignore this
+
+     var doIgnoreBrowserUrl = DoCoolKeyGetConfigValue(ESC_IGNORE_TOKEN_BROWSER_URL);
+
+     if(doIgnoreBrowserUrl == "yes")
+     {
+         recordMessage("openEnrolledTokenURLBrowser don't open browser because \
config param is set to ignore!"); +
+         return;
+     }
+
     if(agent && agent.indexOf("mac") != -1)
     {
         platform = "mac";
-        executable = "/usr/bin/open" ;
+        executable = MAC_PROG_OPEN ;
     }
 
     if(agent && agent.indexOf("linux") != -1)
     {
        platform = "linux";
-       executable = "/usr/bin/firefox";
+       executable = LINUX_PROG_OPEN ;
     }
 
     if(agent && agent.indexOf("nt 5.0") != -1)
     {
         platform = "windows";
-        executable = "C:\\WINNT\\system32\\cmd.exe" ;
+        executable = WIN_2000_PROG_OPEN ;
         doWindows = 1;
     }
 
     if(agent && agent.indexOf("nt 5.1") != -1)
     {
         platform = "windows";
-        executable = "C:\\Windows\\system32\\cmd.exe" ;
+        executable = WIN_XP_PROG_OPEN ;
         doWindows = 1;
     }
 
+    recordMessage("openEnrolledTokenURLBrowser platform: " + platform);
     if(!platform)
     {
-        MyAlert(getBundleString("errorFindESCPlatform"));
         return;
     }
 
@@ -3672,22 +3797,16 @@
 
     var enrolled_token_uri = null;
 
-   if(netkey)
-   {
-             try {
-                    \
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                
-                enrolled_token_uri = \
netkey.GetCoolKeyConfigValue("esc.enrolled.token.url"); +    if(netkey)
+    {
+        enrolled_token_uri = GetCachedEnrolledTokenBrowserURL(aKeyID); 
 
-            } catch(e) {
-                MyAlert(getBundleString("errorConfigValue") + e);
-               
-            }
+        recordMessage("openEnrolledTokenURLBrowser uri: " + enrolled_token_uri);
 
         if(!enrolled_token_uri)
         {
             return; 
         }
-
     }
 
     // create an nsILocalFile for the executable
@@ -3712,7 +3831,6 @@
 
     if(doWindows)
     {
-
         args = ["/c","start",enrolled_token_uri];
     }
     else
@@ -3905,6 +4023,18 @@
 {
     var url = null;
 
+    //Back door for testing, ignore the value if so configured
+
+    var ignoreIssuer =  DoCoolKeyGetConfigValue(ESC_IGNORE_KEY_ISSUER_INFO);
+
+    recordMessage("DoCoolKeyGetIssuerUrl ignoreIssuer: " + ignoreIssuer);
+
+    if(ignoreIssuer == "yes")
+    {
+        recordMessage("Ignoring issuer url returning null!");
+        return url;
+    }
+
     try {
       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
       url =  netkey.GetCoolKeyIssuerInfo(keyType, keyID);
@@ -3954,7 +4084,30 @@
 
 function launchCONFIG(keyType,keyID)
 {
-    var wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=yes");
 +
+    var agent = navigator.userAgent.toLowerCase();
+
+    var platform = "";
+
+    if(agent && agent.indexOf("mac") != -1)
+    {
+        platform = "mac";
+    }
+
+    var wind = null;
+
+
+    if(platform == "mac")
+    {
+
+        wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=no");
 +    }
+    else
+    {
+        wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=yes");
 +
+
+    }
 }
 
 function launchCertViewer()
@@ -4119,6 +4272,30 @@
     return true;
 }
 
+function GetCachedPhoneHomeValue(aKeyID,aValue)
+{
+     var retValue = null;
+
+     if(!aKeyID || ! aValue)
+         return null;
+
+     var theValue = ConfigValueWithKeyID(aKeyID,aValue);
+
+
+     if(!theValue)
+         return null;
+
+     retValue = DoCoolKeyGetConfigValue(theValue);
+
+     return retValue;
+}
+
+function GetCachedEnrolledTokenBrowserURL(aKeyID)
+{
+
+     return GetCachedPhoneHomeValue(aKeyID,ENROLLED_TOKEN_BROWSER_URL);
+}
+
 function GetCachedPhoneHomeURL(aKeyID)
 {
      var url = null;
@@ -4289,14 +4466,29 @@
 
                     if(cValue)
                     {
+                        recordMessage("Writing out config : " +cValue + " value: " + \
value);  DoCoolKeySetConfigValue(cValue,value);
                     }
                 }
                
             }
 
+            recordMessage("Done writing out phone home config cache.");
+
+            var browserURL =  GetCachedEnrolledTokenBrowserURL(aKeyID);
+
+            recordMessage("Cached browserURL " + browserURL);
+
+            if(browserURL)
+            {
+                DoCoolKeySetConfigValue(ESC_TOKEN_BROWSER_URL_ESTABLISHED,"yes");
+                DoHandleEnrolledBrowserLaunch();
+
+            }
+
             if(resultCB)
             {
+                recordMessage("About to write out KEY_ISSUER_URL value.");
                //Manually write out entry for phone home url
 
                 var issuer_config_value = \
ConfigValueWithKeyID(aKeyID,KEY_ISSUER_URL); @@ -4483,3 +4675,14 @@
     MyAlert(getBundleString("dataCopiedToClipboard") );
 
 }
+
+
+function recordMessage( message ) {
+
+  var consoleService = Components
+  .classes['@mozilla.org/consoleservice;1']
+  .getService( Components.interfaces.nsIConsoleService );
+
+  if(consoleService)
+      consoleService.logStringMessage("esc: " + message  + "\n");
+}


Index: GenericAuth.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/GenericAuth.xul,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GenericAuth.xul	27 Sep 2006 17:31:51 -0000	1.2
+++ GenericAuth.xul	25 Oct 2006 04:03:35 -0000	1.3
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under


Index: TRAY.js
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/TRAY.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TRAY.js	27 Sep 2006 17:31:51 -0000	1.3
+++ TRAY.js	25 Oct 2006 04:03:35 -0000	1.4
@@ -88,6 +88,8 @@
 
 TrayAddWindow();
 
+TrayShowTooltip(getBundleString("escTitle"));
+
 function getBaseWindow(  ) {
     var rv;
     try
@@ -278,6 +280,7 @@
 
             gTray.add(gBaseWindow);
 
+
             } catch(e) {
                 // no need to bother the user if the tray fails
 
@@ -357,7 +360,7 @@
 
         try {
 
-        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         gTray.settooltipmsg(getBundleString("escTitle"));
         gTray.showicon();
 
@@ -369,6 +372,29 @@
 
 }
 
+function TrayShowTooltip(aMessage)
+{
+    if(!aMessage)
+        return;
+
+    if(gTray && gBaseWindow)
+    {
+
+        try {
+
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
+;
+        gTray.settooltipmsg(aMessage);
+
+        } catch(e) {
+            return;
+        }
+
+    }
+
+}
+
+
 function SetMenuItemsText()
 {
 


Index: advancedinfo.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/advancedinfo.xul,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- advancedinfo.xul	27 Sep 2006 17:24:32 -0000	1.1
+++ advancedinfo.xul	25 Oct 2006 04:03:35 -0000	1.2
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under


Index: certinfo.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/certinfo.xul,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- certinfo.xul	13 Sep 2006 17:56:49 -0000	1.2
+++ certinfo.xul	25 Oct 2006 04:03:35 -0000	1.3
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under


Index: config.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/config.xul,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- config.xul	27 Sep 2006 17:31:51 -0000	1.3
+++ config.xul	25 Oct 2006 04:03:35 -0000	1.4
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under


Index: esc.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/esc.xul,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- esc.xul	27 Sep 2006 17:31:51 -0000	1.3
+++ esc.xul	25 Oct 2006 04:03:35 -0000	1.4
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under


Index: password.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/password.xul,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- password.xul	27 Sep 2006 17:31:18 -0000	1.1
+++ password.xul	25 Oct 2006 04:03:35 -0000	1.2
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under


Index: settings.xul
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/settings.xul,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- settings.xul	27 Sep 2006 17:31:51 -0000	1.3
+++ settings.xul	25 Oct 2006 04:03:35 -0000	1.4
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/"  type="text/css"?>
 <?xml-stylesheet href="esc.css" type="text/css"?>
 <!-- ***** BEGIN COPYRIGHT BLOCK *****
  * This Program is free software; you can redistribute it and/or modify it under
@@ -150,8 +151,12 @@
                           <button class="buttonText" id="advancedbtn" \
label="&advancedInfo;" disabled="true" hidden="false" \
oncommand="DoShowAdvancedInfo();"/>  
             <spacer flex = "1"/>
+
+            <checkbox id="enrolled_key_browser" label="&dontLaunchBrowser;" \
checked="false" oncommand="DoHandleEnrolledBrowserLaunch(); " hidden="true" \
disabled="false" />   +            <spacer flex = "1"/>
             <button class="buttonText" id="closebtn" label ="&closeAdminLater;" \
oncommand="HideAdminPage();"/>  <spacer class="horSpacerShort"/>
+
          </hbox>
   <!-- </groupbox> -->
 </window>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic