9ccdfb
diff -up ./esc/src/app/xul/esc/application.ini.fix22 ./esc/src/app/xul/esc/application.ini
9ccdfb
--- ./esc/src/app/xul/esc/application.ini.fix22	2013-11-27 14:14:24.118638587 -0800
9ccdfb
+++ ./esc/src/app/xul/esc/application.ini	2013-11-27 14:14:24.132638588 -0800
9ccdfb
@@ -25,11 +25,11 @@ Vendor=RedHat
9ccdfb
 Name=ESC
9ccdfb
 ;
9ccdfb
 ; This field specifies your application's version.  This field is optional.
9ccdfb
-Version=1.1.0-25
9ccdfb
+Version=1.1.0-26
9ccdfb
 ;
9ccdfb
 ; This field specifies your application's build ID (timestamp).  This field is
9ccdfb
 ; required.
9ccdfb
-BuildID=0000001025
9ccdfb
+BuildID=0000001026
9ccdfb
 ;
9ccdfb
 ; This ID is just an example.  Every XUL app ought to have it's own unique ID.
9ccdfb
 ; You can use the microsoft "guidgen" or "uuidgen" tools, or go on
9ccdfb
diff -up ./esc/src/app/xul/esc/chrome/content/esc/ESC.js.fix22 ./esc/src/app/xul/esc/chrome/content/esc/ESC.js
9ccdfb
--- ./esc/src/app/xul/esc/chrome/content/esc/ESC.js.fix22	2013-11-27 14:14:24.016638584 -0800
9ccdfb
+++ ./esc/src/app/xul/esc/chrome/content/esc/ESC.js	2013-11-27 14:30:07.758668142 -0800
9ccdfb
@@ -57,6 +57,7 @@ const  ESC_SECURITY_URL="esc.security.ur
9ccdfb
 const  ESC_SECURE_URL="esc.secure.url";
9ccdfb
 const  ESC_GLOBAL_PHONE_HOME_URL= "esc.global.phone.home.url";
9ccdfb
 const  ESC_HIDE_FORMAT="esc.hide.format";
9ccdfb
+const  ESC_ALLOW_NOTIFICATIONS="esc.allow.notifications";
9ccdfb
 
9ccdfb
 const  CLEAN_TOKEN = "cleanToken";
9ccdfb
 const  UNINITIALIZED        = 1;
9ccdfb
@@ -76,6 +77,7 @@ const ENROLL_WINDOW      = "esc.xul";
9ccdfb
 const ADMIN_WINDOW       = "settings.xul";
9ccdfb
 const HIDDEN_WINDOW      = "hiddenWindow.xul";
9ccdfb
 const SECURITY_WINDOW    = "security.xul";
9ccdfb
+const PHONE_WINDOW       = "config.xul";
9ccdfb
 
9ccdfb
 
9ccdfb
 //Log level constants
9ccdfb
@@ -230,10 +232,14 @@ var Status_Messages = new Array(
9ccdfb
 function DoPhoneHome(keyType,keyID)
9ccdfb
 {
9ccdfb
   CoolKeyLogMsg(PR_LOG_ALWAYS,"Attempting to phone home for Key " + keyID); 
9ccdfb
+  var allowNotify = null;
9ccdfb
   var callback = function (aResult) {
9ccdfb
 
9ccdfb
     recordMessage("In DoPhoneHome callback");
9ccdfb
 
9ccdfb
+    var allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
9ccdfb
+
9ccdfb
+
9ccdfb
     var issuer = "";
9ccdfb
     if(aResult == true)
9ccdfb
     {
9ccdfb
@@ -241,7 +247,10 @@ function DoPhoneHome(keyType,keyID)
9ccdfb
         if(!issuer)
9ccdfb
             issuer = getBundleString("unknownIssuer");
9ccdfb
         recordMessage("In DoPhoneHome callback success issuer " + issuer);
9ccdfb
-        TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+
9ccdfb
+        if(allowNotify == "yes") {
9ccdfb
+            TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+        }
9ccdfb
         LogKeyInfo(keyType,keyID,"Key Inserted ...");
9ccdfb
         UpdateRowWithPhoneHomeData(keyType,keyID);
9ccdfb
         recordMessage("cached issuer " + issuer);
9ccdfb
@@ -262,7 +271,9 @@ function DoPhoneHome(keyType,keyID)
9ccdfb
         if(!issuer)
9ccdfb
             issuer = getBundleString("unknownIssuer");
9ccdfb
         recordMessage("Phone home callback failed , issuer " + issuer);
9ccdfb
-        TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+        if (allowNotify == "yes") {
9ccdfb
+            TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+        }
9ccdfb
         LogKeyInfo(keyType,keyID,"Key Inserted ...");
9ccdfb
     }
9ccdfb
   }
9ccdfb
@@ -271,6 +282,7 @@ function DoPhoneHome(keyType,keyID)
9ccdfb
 
9ccdfb
   var home = DoCoolKeyGetIssuerUrl(keyType,keyID);
9ccdfb
 
9ccdfb
+  //home = null;
9ccdfb
   recordMessage("Returned IssuerURL " + home);
9ccdfb
 
9ccdfb
   if(IsPhoneHomeCached(keyID) && home)
9ccdfb
@@ -279,7 +291,12 @@ function DoPhoneHome(keyType,keyID)
9ccdfb
 
9ccdfb
       recordMessage("Phone home info cached...");
9ccdfb
       issuer = GetCoolKeyIssuer(keyType,keyID);
9ccdfb
-      TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+
9ccdfb
+      allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
9ccdfb
+      if (allowNotify == "yes") {
9ccdfb
+          TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+      }
9ccdfb
+
9ccdfb
       LogKeyInfo(keyType,keyID,"Key Inserted ...");
9ccdfb
 
9ccdfb
       var launchBrowserURL =  GetCachedEnrolledTokenBrowserURL(keyID);
9ccdfb
@@ -534,7 +551,11 @@ function GetAuthDataFromPopUp(aKeyType,a
9ccdfb
    keyUITable[aKeyID] = aUiData;
9ccdfb
    keyTypeTable[aKeyID] = aKeyType;
9ccdfb
 
9ccdfb
-   var child =  window.open("chrome://esc/content/GenericAuth.xul", aKeyID, "chrome,centerscreen,width=400,height=250");
9ccdfb
+   var child =  window.open("chrome://esc/content/GenericAuth.xul", aKeyID, "chrome,centerscreen,width=400,height=250,dialog");
9ccdfb
+
9ccdfb
+   if (child) {
9ccdfb
+       child.setTimeout("focus()", 1000);
9ccdfb
+   }
9ccdfb
  
9ccdfb
    curChildWindow = child; 
9ccdfb
 }
9ccdfb
@@ -1275,7 +1296,7 @@ function UpdateEnrollmentArea(keyType,ke
9ccdfb
 
9ccdfb
       var numUnenrolledKeys = DoGetNumUnenrolledCoolKeys();
9ccdfb
 
9ccdfb
-      //alert("inserted " + inserted + " showFulUI " + showFullUI + " showExternalUI " + showExternalUI + " already enrolled " + alreadyEnrolled + " numUnenrolledKeys " + numUnenrolledKeys);
9ccdfb
+     // alert("inserted " + inserted + " showFulUI " + showFullUI + " showExternalUI " + showExternalUI + " already enrolled " + alreadyEnrolled + " numUnenrolledKeys " + numUnenrolledKeys);
9ccdfb
 
9ccdfb
 
9ccdfb
      var ui_id = document.getElementById("esc-ui");
9ccdfb
@@ -1290,7 +1311,7 @@ function UpdateEnrollmentArea(keyType,ke
9ccdfb
          {
9ccdfb
              if(!numUnenrolledKeys)
9ccdfb
              {
9ccdfb
-               ui_id.setAttribute("src",null);
9ccdfb
+                ui_id.setAttribute("src","");
9ccdfb
              }
9ccdfb
              else
9ccdfb
              {
9ccdfb
@@ -1427,14 +1448,19 @@ function UpdateEnrollmentArea(keyType,ke
9ccdfb
          HideItem(no_key_area);
9ccdfb
      }
9ccdfb
 
9ccdfb
+
9ccdfb
     if(!alreadyEnrolled  && inserted && showExternalUI)
9ccdfb
      {
9ccdfb
          UpdateESCSize();
9ccdfb
+         gEnrollmentPage.setTimeout("focus();",3500);
9ccdfb
          return;
9ccdfb
      }
9ccdfb
 
9ccdfb
      if(!showExternalUI)
9ccdfb
          UpdateESCSize();
9ccdfb
+
9ccdfb
+     gEnrollmentPage.setTimeout("focus();",3500);
9ccdfb
+     
9ccdfb
 }
9ccdfb
 
9ccdfb
 //Evaulate Password Quality
9ccdfb
@@ -2006,7 +2032,7 @@ function SelectESCPage(keyType,keyID,pho
9ccdfb
        break;
9ccdfb
    }
9ccdfb
 
9ccdfb
-   //alert("SelectESCPage  initialized " + keyUninitialized + " gEnrollmentPage " + gEnrollmentPage + " gFactoryMode " + gFactoryMode + " gHiddenPage " + gHiddenPage);
9ccdfb
+   //alert("SelectESCPage  uninitialized " + keyUninitialized + " gEnrollmentPage " + gEnrollmentPage + " gFactoryMode " + gFactoryMode + " gHiddenPage " + gHiddenPage + " phoneHomeFailed " + phoneHomeFailed + " no_launch_external_ui " + no_launch_external_ui);
9ccdfb
 
9ccdfb
    //Get the primary page windows if present
9ccdfb
 
9ccdfb
@@ -2022,14 +2048,7 @@ function SelectESCPage(keyType,keyID,pho
9ccdfb
 
9ccdfb
    if(keyUninitialized == UNINITIALIZED && !phoneHomeFailed && !no_launch_external_ui )  //formatted uninitialized card
9ccdfb
    {
9ccdfb
-       if(enrollWnd)   //Enrollment window is  already up
9ccdfb
-       {
9ccdfb
-          enrollWnd.focus();
9ccdfb
-       }
9ccdfb
-       else
9ccdfb
-       {
9ccdfb
-          launchESC();
9ccdfb
-       }
9ccdfb
+       launchESC();
9ccdfb
    }
9ccdfb
    else
9ccdfb
    {
9ccdfb
@@ -2975,8 +2994,9 @@ function OnCoolKeyInserted(keyType, keyI
9ccdfb
 
9ccdfb
   var uninitialized = 0;
9ccdfb
 
9ccdfb
-  recordMessage("Key inserted!" + "Window " + IdentifyWindow());
9ccdfb
+  var allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
9ccdfb
 
9ccdfb
+  recordMessage("Key inserted!" + "Window " + IdentifyWindow());
9ccdfb
   if(gHiddenPage)
9ccdfb
   {
9ccdfb
       TrayShowNotificationIcon();
9ccdfb
@@ -2993,6 +3013,7 @@ function OnCoolKeyInserted(keyType, keyI
9ccdfb
 
9ccdfb
         gCurrentSelectedRow = row;
9ccdfb
         UpdateEnrollmentArea(keyType,keyID,1);
9ccdfb
+
9ccdfb
    }
9ccdfb
 
9ccdfb
    if(gAdminPage)
9ccdfb
@@ -3017,7 +3038,9 @@ function OnCoolKeyInserted(keyType, keyI
9ccdfb
           if(!issuer )
9ccdfb
               issuer = getBundleString("unknownIssuer");
9ccdfb
 
9ccdfb
-          TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+          if( allowNotify) {
9ccdfb
+              TraySendNotificationMessage(getBundleString("keyInserted"),"\"" + issuer +"\"" + " " + getBundleString("keyInsertedComputer"),3,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+          }
9ccdfb
 
9ccdfb
       }
9ccdfb
 
9ccdfb
@@ -3037,6 +3060,8 @@ function OnCoolKeyRemoved(keyType, keyID
9ccdfb
 
9ccdfb
   var  row = GetRowForKey(keyType, keyID);
9ccdfb
 
9ccdfb
+  var allowNotify = DoCoolKeyGetConfigValue(ESC_ALLOW_NOTIFICATIONS);
9ccdfb
+
9ccdfb
   if(gHiddenPage)
9ccdfb
   {
9ccdfb
       if(curChildWindow)
9ccdfb
@@ -3047,7 +3072,9 @@ function OnCoolKeyRemoved(keyType, keyID
9ccdfb
       var issuer = GetCoolKeyIssuer(keyType,keyID);
9ccdfb
       if(!issuer)
9ccdfb
           issuer = getBundleString("unknownIssuer");
9ccdfb
-      TraySendNotificationMessage(getBundleString("keyRemoved"),"\"" + issuer + "\"" + " " + getBundleString("keyRemovedComputer"),1,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+      if (allowNotify == "yes") {
9ccdfb
+          TraySendNotificationMessage(getBundleString("keyRemoved"),"\"" + issuer + "\"" + " " + getBundleString("keyRemovedComputer"),1,4000,GetESCNotifyIconPath(keyType,keyID));
9ccdfb
+      }
9ccdfb
        LogKeyInfo(keyType,keyID, "Key Removed ...");
9ccdfb
 
9ccdfb
   }
9ccdfb
@@ -3345,6 +3372,7 @@ uiListener =
9ccdfb
 
9ccdfb
             if(url != esc_enroll_uri)
9ccdfb
             {
9ccdfb
+
9ccdfb
                 MyAlert(getBundleString("errorEnrollmentUI"));
9ccdfb
 
9ccdfb
                 if(uiListener)
9ccdfb
@@ -3978,17 +4006,24 @@ function launchCONFIG(keyType,keyID)
9ccdfb
         platform = "mac";
9ccdfb
     }
9ccdfb
 
9ccdfb
-    var wind = null;
9ccdfb
+    var wind  = IsPageWindowPresent(PHONE_WINDOW);
9ccdfb
 
9ccdfb
-    if(platform == "mac")
9ccdfb
-    {
9ccdfb
-        wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=no");
9ccdfb
-    }
9ccdfb
-    else
9ccdfb
-    {
9ccdfb
-        wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=yes");
9ccdfb
+    if (!wind) {
9ccdfb
+        if(platform == "mac")
9ccdfb
+        {
9ccdfb
+            wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable,modal=no");
9ccdfb
+        }
9ccdfb
+        else
9ccdfb
+        {
9ccdfb
+            wind = window.openDialog("chrome://esc/content/config.xul",keyID,"chrome,centerscreen,resizable");
9ccdfb
+
9ccdfb
+        }
9ccdfb
+    } 
9ccdfb
 
9ccdfb
+    if(wind) {
9ccdfb
+        wind.setTimeout("focus();",1500);
9ccdfb
     }
9ccdfb
+    
9ccdfb
 }
9ccdfb
 
9ccdfb
 //Launch cert viewer if key has certs
9ccdfb
@@ -4046,12 +4081,12 @@ function launchESC()
9ccdfb
 
9ccdfb
     if(!enrollWnd)
9ccdfb
     {
9ccdfb
-        var wind = window.open("chrome://esc/content/esc.xul","","chrome,resizable,centerscreen,dialog");
9ccdfb
+        enrollWnd = window.open("chrome://esc/content/esc.xul","","chrome,resizable,centerscreen,dialog");
9ccdfb
 
9ccdfb
     }
9ccdfb
-    else
9ccdfb
-    {
9ccdfb
-        enrollWnd.focus();
9ccdfb
+
9ccdfb
+    if(enrollWnd) {
9ccdfb
+         enrollWnd.setTimeout("focus();",1500);
9ccdfb
     }
9ccdfb
 
9ccdfb
 }
9ccdfb
diff -up ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js.fix22 ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js
9ccdfb
--- ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js.fix22	2009-03-28 17:54:57.000000000 -0700
9ccdfb
+++ ./esc/src/app/xul/esc/defaults/preferences/esc-prefs.js	2013-11-27 14:14:24.133638588 -0800
9ccdfb
@@ -29,6 +29,10 @@ pref("esc.tps.message.timeout","90");
9ccdfb
 
9ccdfb
 pref("esc.windows.do.capi","yes");
9ccdfb
 
9ccdfb
+#Do we allow card notifications? Default no.
9ccdfb
+
9ccdfb
+pref("esc.allow.notifications", "no");
9ccdfb
+
9ccdfb
 
9ccdfb
 #Sample Security Officer Enrollment UI
9ccdfb