From 244e3ecba72099fb4fb8a76c5827a77d15353692 Mon Sep 17 00:00:00 2001
From: ansuz <ansuz@transitiontech.ca>
Date: Wed, 13 Sep 2017 12:32:30 +0200
Subject: [PATCH] support forefront flag in alert config

---
 customize.dist/src/less2/include/alertify.less | 10 +++++++---
 www/common/common-interface.js                 | 11 ++++++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/customize.dist/src/less2/include/alertify.less b/customize.dist/src/less2/include/alertify.less
index 16688f179..8bc53a2a0 100644
--- a/customize.dist/src/less2/include/alertify.less
+++ b/customize.dist/src/less2/include/alertify.less
@@ -3,6 +3,7 @@
 @import (once) "./modal-theme.less";
 
 .alertify_main () {
+    @max-z-index: 2147483647;
     @alertify-fore: @colortheme_modal-fg;
     @alertify-base: @colortheme_modal-bg;
 
@@ -27,7 +28,7 @@
     // These show only once
 
     .alertify-logs {
-        z-index:10000;
+        z-index:10000; // alertify logs
         @media print {
             visibility: hidden;
         }
@@ -63,7 +64,10 @@
         bottom: 0;
         width: 100%;
         height: 100%;
-        z-index: 99999;
+        z-index: 99999; // alertify container
+        &.forefront {
+            z-index: @max-z-index; // alertify max forefront
+        }
 
         .message {
             h1, h2, h3, h4, h5, h6 {
@@ -236,7 +240,7 @@
     .alertify-logs {
 
         position: fixed;
-        z-index: 99999;
+        z-index: 99999; // alertify logs
 
         &.bottom, &:not(.top) {
             bottom: 16px;
diff --git a/www/common/common-interface.js b/www/common/common-interface.js
index 467cad4ab..2e7b6e640 100644
--- a/www/common/common-interface.js
+++ b/www/common/common-interface.js
@@ -209,7 +209,15 @@ define([
         return tagger;
     };
 
-    UI.alert = function (msg, cb, force) {
+    UI.alert = function (msg, cb, opt) {
+        var force = false;
+        if (typeof(opt) === 'object') {
+            force = opt.force || false;
+        } else if (typeof(opt) === 'boolean') {
+            force = opt;
+            opt = {};
+        }
+
         cb = cb || function () {};
 
         var message;
@@ -228,6 +236,7 @@ define([
             dialog.nav(ok),
         ]);
 
+        if (opt.forefront) { $(frame).addClass('forefront'); }
         var listener;
         var close = Util.once(function () {
             $(frame).fadeOut(150, function () { $(this).remove(); });