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