From 6ebb418eecda15417ab9c056260bd5fd7f958586 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 4 Dec 2012 09:07:54 +0000 Subject: [PATCH] Request Cash Advance is ready up to point where writing to db --- Site5/App_Code/FieldValidation.cs | 77 ++ Site5/Automation/FieldValidation.asmx | 1 + Site5/Master-v5.master | 5 +- .../Pages/v5/Finance/RequestCashAdvance.aspx | 36 +- Site5/Scripts/alertify.js | 734 +++++++++--------- Site5/Scripts/alertify.min.js | 24 +- Site5/Style/alertify.css | 27 +- Site5/Style/style-v5.css | 8 +- 8 files changed, 541 insertions(+), 371 deletions(-) create mode 100644 Site5/App_Code/FieldValidation.cs create mode 100644 Site5/Automation/FieldValidation.asmx diff --git a/Site5/App_Code/FieldValidation.cs b/Site5/App_Code/FieldValidation.cs new file mode 100644 index 00000000..6c9c7170 --- /dev/null +++ b/Site5/App_Code/FieldValidation.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.Services; + +/// +/// Summary description for FieldValidation +/// +[WebService(Namespace = "http://tempuri.org/")] +[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] +// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. +[System.Web.Script.Services.ScriptService] +public class FieldValidation : System.Web.Services.WebService { + + public FieldValidation () { + + //Uncomment the following line if using designed components + //InitializeComponent(); + } + + [WebMethod] + public bool IsAmountValid (string amount) + { + // Determine correct culture for parsing + + CultureInfo culture = null; + + // Set default culture (English, United States, but that doesn't work so fake it to GB) + + string preferredCulture = "en-GB"; + + // ----------- SET CULTURE ------------ + + // Does the user have a culture preference? + + if (HttpContext.Current.Request.Cookies["PreferredCulture"] != null) + { + // Yes, set it + preferredCulture = HttpContext.Current.Request.Cookies["PreferredCulture"].Value; + } + else + { + // No, determine from browser + string browserPreference = "en-GB"; + if (HttpContext.Current.Request.UserLanguages != null && HttpContext.Current.Request.UserLanguages.Length > 0) + { + browserPreference = HttpContext.Current.Request.UserLanguages[0]; + preferredCulture = browserPreference; + } + } + + try + { + culture = CultureInfo.CreateSpecificCulture(preferredCulture); + } + catch (Exception exception) + { + culture = CultureInfo.InvariantCulture; + } + + // Try to parse the string we got as a double + + try + { + Double.Parse(HttpUtility.UrlDecode(amount), NumberStyles.Number, culture); + return true; + } + catch (Exception) + { + } + + return false; + } +} diff --git a/Site5/Automation/FieldValidation.asmx b/Site5/Automation/FieldValidation.asmx new file mode 100644 index 00000000..ba3c486a --- /dev/null +++ b/Site5/Automation/FieldValidation.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="~/App_Code/FieldValidation.cs" Class="FieldValidation" %> diff --git a/Site5/Master-v5.master b/Site5/Master-v5.master index bd8a86e1..53634d6f 100644 --- a/Site5/Master-v5.master +++ b/Site5/Master-v5.master @@ -10,7 +10,6 @@ - @@ -317,7 +316,11 @@
+ + + + diff --git a/Site5/Pages/v5/Finance/RequestCashAdvance.aspx b/Site5/Pages/v5/Finance/RequestCashAdvance.aspx index 147bcb62..881922bc 100644 --- a/Site5/Pages/v5/Finance/RequestCashAdvance.aspx +++ b/Site5/Pages/v5/Finance/RequestCashAdvance.aspx @@ -11,21 +11,51 @@ $('input.combo-text').click(function () { $('span.combo-arrow').click(); }); - - alertify.success('test'); }); function validateFields() { var isValid = true; + isValid = validateTextField('#<%=this.TextAccount.ClientID %>', "Please state your bank account number.") && isValid; + isValid = validateTextField('#<%=this.TextClearing.ClientID %>', "Please enter your bank's clearing number.") && isValid; + isValid = validateTextField('#<%=this.TextBank.ClientID %>', "Please enter your bank's name.") && isValid; + if ($('#DropBudgets').combotree('tree').tree('getSelected') == null) { isValid = false; - alertify.error('test'); + alertify.error("Please select a budget."); } + isValid = validateTextField('#<%=this.TextPurpose.ClientID %>', "Please state the purpose of the cash advance.") && isValid; + + $.ajax({ + type: "POST", + url: "/Automation/FieldValidation.asmx/IsAmountValid", + data: "{'amount': '" + escape($('#<%=this.TextAmount.ClientID %>').val()) + "'}", + contentType: "application/json; charset=utf-8", + dataType: "json", + async: false, // blocks until function returns - race conditions otherwise + success: function (msg) { + if (msg.d != true) { + isValid = false; + alertify.error("Please enter the amount of money (in SEK) that you'd like to advance."); + $('#<%=this.TextAmount.ClientID %>').focus(); + } + } + }); + return isValid; } + + function validateTextField (fieldId, message) { + if ($(fieldId).val().length == 0) { + alertify.error(message); + $(fieldId).focus(); + return false; + } + + return true; + } diff --git a/Site5/Scripts/alertify.js b/Site5/Scripts/alertify.js index 6621ef89..0fb5bf13 100644 --- a/Site5/Scripts/alertify.js +++ b/Site5/Scripts/alertify.js @@ -1,347 +1,387 @@ -/** - * Alertify - * An unobtrusive customizable JavaScript notification system - * - * @author Fabien Doiron - * @copyright Fabien Doiron 2012 - * @license MIT - * @link http://www.github.com/fabien-d - * @module Alertify - * @version 0.1.1 - */ - -/*global define*/ -(function (global, undefined) { - "use strict"; - - var document = global.document, - Alertify; - - Alertify = function () { - - var $, addListeners, bind, build, close, hide, init, notify, setup, unbind, - dialog, extend, log, - cover, dialogs, delay, element, isopen, keys, labels, logElement, queue; - - dialogs = { - buttons : { - holder : "", - ok : "{{ok}}", - cancel : "{{cancel}}" - }, - input : "", - message : "

{{message}}

", - log : "
{{message}}
" - }; - - delay = 5000; - keys = { ENTER: 13, ESC: 27 }; - labels = { ok: "OK", cancel: "Cancel" }; - queue = []; - isopen = false; - - /** - * Shorthand for document.getElementById() - * - * @param {String} id A specific element ID - - * @return {Object} HTML element - */ - $ = function (id) { - return document.getElementById(id); - }; - - /** - * Set the proper button click events - * - * @param {Function} fn [Optional] Callback function - * - * @return {undefined} - */ - addListeners = function (fn) { - var btnOK = $("aOK") || undefined, - btnCancel = $("aCancel") || undefined, - input = $("aText") || undefined, - hasOK = (typeof btnOK !== "undefined"), - hasCancel = (typeof btnCancel !== "undefined"), - val = "", - ok, cancel, common, key; - - // ok event handler - ok = function (event) { - common(event); - if (typeof input !== "undefined") val = input.value; - if (typeof fn === "function") fn(true, val); - if (typeof event.preventDefault !== "undefined") event.preventDefault(); - }; - - // cancel event handler - cancel = function (event) { - common(event); - if (typeof fn === "function") fn(false); - if (typeof event.preventDefault !== "undefined") event.preventDefault(); - }; - - // common event handler (keyup, ok and cancel) - common = function (event) { - hide(); - unbind(document.body, "keyup", key); - }; - - // keyup handler - key = function (event) { - var keyCode = event.keyCode; - if (keyCode === keys.ENTER && hasOK) ok(event); - else if (keyCode === keys.ESC && hasCancel) cancel(event); - }; - - // handle OK click - if (hasOK) bind(btnOK, "click", ok); - // handle Cancel click - if (hasCancel) bind(btnCancel, "click", cancel); - - // clear focus off activeElement element to ensure - // the ENTER key triggers the correct behaviour - // Firefox has an issue if this isn't done and the current - // focus is an anchor - document.activeElement.blur(); - // listen for keys, OK => ENTER, Cancel => ESC - bind(document.body, "keyup", key); - }; - - /** - * Bind events to elements - * - * @param {Object} el HTML Object - * @param {Event} event Event to attach to element - * @param {Function} fn Callback function - * - * @return {undefined} - */ - bind = function (el, event, fn) { - if (typeof el.addEventListener === "function") { - el.addEventListener(event, fn, false); - } else if (el.attachEvent) { - el.attachEvent("on" + event, fn); - } - }; - - /** - * Build the proper message box - * - * @param {Object} item Current object in the queue - * @return {String} An HTML string of the message box - */ - build = function (item) { - var html = "", - type = item.type, - message = item.message; - - html += "
"; - html += "
"; - html += dialogs.message.replace("{{message}}", message); - - if (type === "prompt") { html += dialogs.input; } - - html += dialogs.buttons.holder; - html += "
"; - html += "
"; - - switch (type) { - case "confirm": - case "prompt": - html = html.replace("{{buttons}}", dialogs.buttons.cancel + dialogs.buttons.ok); - html = html.replace("{{ok}}", labels.ok).replace("{{cancel}}", labels.cancel); - break; - case "alert": - html = html.replace("{{buttons}}", dialogs.buttons.ok); - html = html.replace("{{ok}}", labels.ok); - break; - default: - break; - } - - element.className = "alertify alertify-show alertify-" + type; - cover.className = "alertify-cover"; - return html; - }; - - /** - * Close the log messages - * - * @return {undefined} - */ - close = function () { - setTimeout(function () { - var child = logElement.childNodes[logElement.childNodes.length - 1]; - if (typeof child !== "undefined") logElement.removeChild(child); - }, delay); - }; - - /** - * Hide the dialog and rest to defaults - * - * @return {undefined} - */ - hide = function () { - // remove reference from queue - queue.splice(0,1); - // if items remaining in the queue - if (queue.length > 0) setup(); - else { - isopen = false; - element.className = "alertify alertify-hide alertify-hidden"; - cover.className = "alertify-cover alertify-hidden"; - } - }; - - /** - * Initialize Alertify - * Create the 2 main elements - * - * @return {undefined} - */ - init = function () { - // ensure legacy browsers support html5 tags - document.createElement("nav"); - document.createElement("article"); - document.createElement("section"); - // cover - cover = document.createElement("div"); - cover.setAttribute("id", "alertifycover"); - cover.className = "alertify-cover alertify-hidden"; - document.body.appendChild(cover); - // main element - element = document.createElement("section"); - element.setAttribute("id", "alertify"); - element.className = "alertify alertify-hidden"; - document.body.appendChild(element); - // main element - logElement = document.createElement("section"); - logElement.setAttribute("id", "alertifylogs"); - logElement.className = "alertify-logs"; - document.body.appendChild(logElement); - }; - - /** - * Add new log message - * If a type is passed, a class name "alertify-log-{type}" will get added. - * This allows for custom look and feel for various types of notifications. - * - * @param {String} message The message passed from the callee - * @param {String} type [Optional] Type of log message - * - * @return {undefined} - */ - notify = function (message, type) { - var log = document.createElement("article"); - log.className = "alertify-log" + ((typeof type === "string" && type !== "") ? " alertify-log-" + type : ""); - log.innerHTML = message; - // prepend child - logElement.insertBefore(log, logElement.firstChild); - // triggers the CSS animation - setTimeout(function() { log.className = log.className + " alertify-log-show"; }, 50); - close(); - }; - - /** - * Initiate all the required pieces for the dialog box - * - * @return {undefined} - */ - setup = function () { - var item = queue[0]; - - isopen = true; - element.innerHTML = build(item); - addListeners(item.callback); - // adding focus to prompt input box - // doesn't work without a setTimeout... - if (item.type === "prompt") global.setTimeout(function () { document.getElementById("aText").focus(); }, 0); - }; - - /** - * Unbind events to elements - * - * @param {Object} el HTML Object - * @param {Event} event Event to detach to element - * @param {Function} fn Callback function - * - * @return {undefined} - */ - unbind = function (el, event, fn) { - if (typeof el.removeEventListener === "function") { - el.removeEventListener(event, fn, false); - } else if (el.detachEvent) { - el.detachEvent("on" + event, fn); - } - }; - - /** - * Create a dialog box - * - * @param {String} message The message passed from the callee - * @param {String} type Type of dialog to create - * @param {Function} fn [Optional] Callback function - * - * @return {Object} - */ - dialog = function (message, type, fn) { - // error catching - if (typeof message !== "string") throw new Error("message must be a string"); - if (typeof type !== "string") throw new Error("type must be a string"); - if (typeof fn !== "undefined" && typeof fn !== "function") throw new Error("fn must be a function"); - - queue.push({ type: type, message: message, callback: fn }); - if (!isopen) setup(); - - return this; - }; - - /** - * Extend the log method to create custom methods - * - * @param {String} type Custom method name - * @return {Function} - */ - extend = function (type) { - return function (message) { log(message, type); }; - }; - - /** - * Show a new log message box - * - * @param {String} message The message passed from the callee - * @param {String} type [Optional] Optional type of log message - * - * @return {Object} - */ - log = function (message, type) { - notify(message, type); - return this; - }; - - // Bootstrap - init(); - - return { - alert : function (message, fn) { dialog(message, "alert", fn); return this; }, - confirm : function (message, fn) { dialog(message, "confirm", fn); return this; }, - extend : extend, - log : log, - prompt : function (message, fn) { dialog(message, "prompt", fn); return this; }, - success : function (message) { log(message, "success"); return this; }, - error : function (message) { log(message, "error"); return this; }, - delay : delay, - labels : labels - }; - }; - - // AMD and window support - if (typeof define === "function") { - define([], function () { return new Alertify(); }); - } else { - if (typeof global.alertify === "undefined") { global.alertify = new Alertify(); } - } - -}(this)); \ No newline at end of file +/*global define*/ +(function (global, undefined) { + "use strict"; + + var document = global.document, + Alertify; + + Alertify = function () { + + var $, addListeners, bind, build, close, hide, init, notify, setup, unbind, + dialog, extend, log, + cover, dialogs, delay, element, isopen, keys, labels, logElement, queue; + + dialogs = { + buttons: { + holder: "", + submit: "", + ok: "{{ok}}", + cancel: "{{cancel}}" + }, + input: "", + message: "

{{message}}

", + log: "
{{message}}
" + }; + + delay = 5000; + keys = { ENTER: 13, ESC: 27, SPACE: 32 }; + labels = { ok: "OK", cancel: "Cancel" }; + queue = []; + isopen = false; + + /** + * Shorthand for document.getElementById() + * + * @param {String} id A specific element ID + + * @return {Object} HTML element + */ + $ = function (id) { + return document.getElementById(id); + }; + + /** + * Set the proper button click events + * + * @param {Function} fn [Optional] Callback function + * + * @return {undefined} + */ + addListeners = function (fn) { + var btnReset = $("aResetFocus"), + btnOK = $("aOK") || undefined, + btnCancel = $("aCancel") || undefined, + input = $("aText") || undefined, + form = $("aForm") || undefined, + hasOK = (typeof btnOK !== "undefined"), + hasCancel = (typeof btnCancel !== "undefined"), + hasInput = (typeof input !== "undefined"), + val = "", + ok, cancel, common, key, reset; + + // ok event handler + ok = function (event) { + common(event); + if (typeof input !== "undefined") val = input.value; + if (typeof fn === "function") fn(true, val); + if (typeof event.preventDefault !== "undefined") event.preventDefault(); + }; + + // cancel event handler + cancel = function (event) { + common(event); + if (typeof fn === "function") fn(false); + if (typeof event.preventDefault !== "undefined") event.preventDefault(); + }; + + // common event handler (keyup, ok and cancel) + common = function (event) { + hide(); + unbind(document.body, "keyup", key); + unbind(btnReset, "focus", reset); + if (hasInput) unbind(form, "submit", ok); + if (hasOK) unbind(btnOK, "click", ok); + if (hasCancel) unbind(btnCancel, "click", cancel); + }; + + // keyup handler + key = function (event) { + var keyCode = event.keyCode; + if (keyCode === keys.SPACE && !hasInput) ok(event); + if (keyCode === keys.ESC && hasCancel) cancel(event); + }; + + // reset focus to first item in the dialog + reset = function (event) { + if (hasInput) input.focus(); + else if (hasCancel) btnCancel.focus(); + else btnOK.focus(); + }; + + // handle reset focus link + // this ensures that the keyboard focus does not + // ever leave the dialog box until an action has + // been taken + bind(btnReset, "focus", reset); + // handle OK click + if (hasOK) bind(btnOK, "click", ok); + // handle Cancel click + if (hasCancel) bind(btnCancel, "click", cancel); + // listen for keys, Cancel => ESC + bind(document.body, "keyup", key); + // bind form submit + if (hasInput) bind(form, "submit", ok); + // set focus on OK button or the input text + global.setTimeout(function () { + if (input) input.focus(); + else btnOK.focus(); + }, 50); + }; + + /** + * Bind events to elements + * + * @param {Object} el HTML Object + * @param {Event} event Event to attach to element + * @param {Function} fn Callback function + * + * @return {undefined} + */ + bind = function (el, event, fn) { + if (typeof el.addEventListener === "function") { + el.addEventListener(event, fn, false); + } else if (el.attachEvent) { + el.attachEvent("on" + event, fn); + } + }; + + /** + * Build the proper message box + * + * @param {Object} item Current object in the queue + * @return {String} An HTML string of the message box + */ + build = function (item) { + var html = "", + type = item.type, + message = item.message; + + html += "
"; + + if (type === "prompt") html += "
"; + + html += "
"; + html += dialogs.message.replace("{{message}}", message); + + if (type === "prompt") html += dialogs.input; + + html += dialogs.buttons.holder; + html += "
"; + + if (type === "prompt") html += "
"; + + html += "Reset Focus"; + html += "
"; + + switch (type) { + case "confirm": + html = html.replace("{{buttons}}", dialogs.buttons.cancel + dialogs.buttons.ok); + html = html.replace("{{ok}}", labels.ok).replace("{{cancel}}", labels.cancel); + break; + case "prompt": + html = html.replace("{{buttons}}", dialogs.buttons.cancel + dialogs.buttons.submit); + html = html.replace("{{ok}}", labels.ok).replace("{{cancel}}", labels.cancel); + break; + case "alert": + html = html.replace("{{buttons}}", dialogs.buttons.ok); + html = html.replace("{{ok}}", labels.ok); + break; + default: + break; + } + + element.className = "alertify alertify-show alertify-" + type; + cover.className = "alertify-cover"; + return html; + }; + + /** + * Close the log messages + * + * @return {undefined} + */ + close = function (elem) { + bind(elem, "click", function () { + logElement.removeChild(elem); + }); + setTimeout(function () { + if (typeof elem !== "undefined" && elem.parentNode === logElement) logElement.removeChild(elem); + }, delay); + }; + + /** + * Hide the dialog and rest to defaults + * + * @return {undefined} + */ + hide = function () { + // remove reference from queue + queue.splice(0, 1); + // if items remaining in the queue + if (queue.length > 0) setup(); + else { + isopen = false; + element.className = "alertify alertify-hide alertify-hidden"; + cover.className = "alertify-cover alertify-hidden"; + } + }; + + /** + * Initialize Alertify + * Create the 2 main elements + * + * @return {undefined} + */ + init = function () { + // ensure legacy browsers support html5 tags + document.createElement("nav"); + document.createElement("article"); + document.createElement("section"); + // cover + cover = document.createElement("div"); + cover.setAttribute("id", "alertifycover"); + cover.className = "alertify-cover alertify-hidden"; + document.body.appendChild(cover); + // main element + element = document.createElement("section"); + element.setAttribute("id", "alertify"); + element.className = "alertify alertify-hidden"; + document.body.appendChild(element); + // main element + logElement = document.createElement("section"); + logElement.setAttribute("id", "alertifylogs"); + logElement.className = "alertify-logs"; + document.body.appendChild(logElement); + // clean up init method + delete this.init; + }; + + /** + * Add new log message + * If a type is passed, a class name "alertify-log-{type}" will get added. + * This allows for custom look and feel for various types of notifications. + * + * @param {String} message The message passed from the callee + * @param {String} type [Optional] Type of log message + * + * @return {undefined} + */ + notify = function (message, type) { + var log = document.createElement("article"); + log.className = "alertify-log" + ((typeof type === "string" && type !== "") ? " alertify-log-" + type : ""); + log.innerHTML = message; + // prepend child + logElement.insertBefore(log, logElement.firstChild); + // triggers the CSS animation + setTimeout(function () { log.className = log.className + " alertify-log-show"; }, 50); + close(log); + }; + + /** + * Initiate all the required pieces for the dialog box + * + * @return {undefined} + */ + setup = function () { + var item = queue[0]; + + isopen = true; + element.innerHTML = build(item); + addListeners(item.callback); + }; + + /** + * Unbind events to elements + * + * @param {Object} el HTML Object + * @param {Event} event Event to detach to element + * @param {Function} fn Callback function + * + * @return {undefined} + */ + unbind = function (el, event, fn) { + if (typeof el.removeEventListener === "function") { + el.removeEventListener(event, fn, false); + } else if (el.detachEvent) { + el.detachEvent("on" + event, fn); + } + }; + + /** + * Create a dialog box + * + * @param {String} message The message passed from the callee + * @param {String} type Type of dialog to create + * @param {Function} fn [Optional] Callback function + * + * @return {Object} + */ + dialog = function (message, type, fn) { + // check to ensure the alertify dialog element + // has been successfully created + var check = function () { + if (element && element.scrollTop !== null) return; + else check(); + }; + // error catching + if (typeof message !== "string") throw new Error("message must be a string"); + if (typeof type !== "string") throw new Error("type must be a string"); + if (typeof fn !== "undefined" && typeof fn !== "function") throw new Error("fn must be a function"); + // initialize alertify if it hasn't already been done + if (typeof this.init === "function") { + this.init(); + check(); + } + + queue.push({ type: type, message: message, callback: fn }); + if (!isopen) setup(); + + return this; + }; + + /** + * Extend the log method to create custom methods + * + * @param {String} type Custom method name + * @return {Function} + */ + extend = function (type) { + return function (message) { log(message, type); }; + }; + + /** + * Show a new log message box + * + * @param {String} message The message passed from the callee + * @param {String} type [Optional] Optional type of log message + * + * @return {Object} + */ + log = function (message, type) { + // check to ensure the alertify dialog element + // has been successfully created + var check = function () { + if (logElement && logElement.scrollTop !== null) return; + else check(); + }; + // initialize alertify if it hasn't already been done + if (typeof this.init === "function") { + this.init(); + check(); + } + notify(message, type); + return this; + }; + + return { + alert: function (message, fn) { dialog.call(this, message, "alert", fn); return this; }, + confirm: function (message, fn) { dialog.call(this, message, "confirm", fn); return this; }, + extend: extend, + init: init, + log: function (message, type) { log.call(this, message, type); return this; }, + prompt: function (message, fn) { dialog.call(this, message, "prompt", fn); return this; }, + success: function (message) { log.call(this, message, "success"); return this; }, + error: function (message) { log.call(this, message, "error"); return this; }, + delay: delay, + labels: labels + }; + }; + + // AMD and window support + if (typeof define === "function") { + define([], function () { return new Alertify(); }); + } else { + if (typeof global.alertify === "undefined") { global.alertify = new Alertify(); } + } + +} (this)); \ No newline at end of file diff --git a/Site5/Scripts/alertify.min.js b/Site5/Scripts/alertify.min.js index c5021233..fdfdfb8b 100644 --- a/Site5/Scripts/alertify.min.js +++ b/Site5/Scripts/alertify.min.js @@ -1,12 +1,12 @@ -/** - * Alertify - * An unobtrusive customizable JavaScript notification system - * - * @author Fabien Doiron - * @copyright Fabien Doiron 2012 - * @license MIT - * @link http://www.github.com/fabien-d - * @module Alertify - * @version 0.1.1 - */ -(function(e,t){"use strict";var n=e.document,r;r=function(){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T;return g={buttons:{holder:'',ok:'{{ok}}',cancel:'{{cancel}}'},input:'',message:'

{{message}}

',log:'
{{message}}
'},y=5e3,E={ENTER:13,ESC:27},S={ok:"OK",cancel:"Cancel"},T=[],w=!1,r=function(e){return n.getElementById(e)},i=function(e){var i=r("aOK")||t,o=r("aCancel")||t,u=r("aText")||t,f=typeof i!="undefined",l=typeof o!="undefined",c="",p,d,v,m;p=function(t){v(t),typeof u!="undefined"&&(c=u.value),typeof e=="function"&&e(!0,c),typeof t.preventDefault!="undefined"&&t.preventDefault()},d=function(t){v(t),typeof e=="function"&&e(!1),typeof t.preventDefault!="undefined"&&t.preventDefault()},v=function(e){a(),h(n.body,"keyup",m)},m=function(e){var t=e.keyCode;t===E.ENTER&&f?p(e):t===E.ESC&&l&&d(e)},f&&s(i,"click",p),l&&s(o,"click",d),n.activeElement.blur(),s(n.body,"keyup",m)},s=function(e,t,n){typeof e.addEventListener=="function"?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)},o=function(e){var t="",n=e.type,r=e.message;t+='
',t+='
',t+=g.message.replace("{{message}}",r),n==="prompt"&&(t+=g.input),t+=g.buttons.holder,t+="
",t+="
";switch(n){case"confirm":case"prompt":t=t.replace("{{buttons}}",g.buttons.cancel+g.buttons.ok),t=t.replace("{{ok}}",S.ok).replace("{{cancel}}",S.cancel);break;case"alert":t=t.replace("{{buttons}}",g.buttons.ok),t=t.replace("{{ok}}",S.ok);break;default:}return b.className="alertify alertify-show alertify-"+n,m.className="alertify-cover",t},u=function(){setTimeout(function(){var e=x.childNodes[x.childNodes.length-1];typeof e!="undefined"&&x.removeChild(e)},y)},a=function(){T.splice(0,1),T.length>0?c():(w=!1,b.className="alertify alertify-hide alertify-hidden",m.className="alertify-cover alertify-hidden")},f=function(){n.createElement("nav"),n.createElement("article"),n.createElement("section"),m=n.createElement("div"),m.setAttribute("id","alertifycover"),m.className="alertify-cover alertify-hidden",n.body.appendChild(m),b=n.createElement("section"),b.setAttribute("id","alertify"),b.className="alertify alertify-hidden",n.body.appendChild(b),x=n.createElement("section"),x.setAttribute("id","alertifylogs"),x.className="alertify-logs",n.body.appendChild(x)},l=function(e,t){var r=n.createElement("article");r.className="alertify-log"+(typeof t=="string"&&t!==""?" alertify-log-"+t:""),r.innerHTML=e,x.insertBefore(r,x.firstChild),setTimeout(function(){r.className=r.className+" alertify-log-show"},50),u()},c=function(){var t=T[0];w=!0,b.innerHTML=o(t),i(t.callback),t.type==="prompt"&&e.setTimeout(function(){n.getElementById("aText").focus()},0)},h=function(e,t,n){typeof e.removeEventListener=="function"?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)},p=function(e,t,n){if(typeof e!="string")throw new Error("message must be a string");if(typeof t!="string")throw new Error("type must be a string");if(typeof n!="undefined"&&typeof n!="function")throw new Error("fn must be a function");return T.push({type:t,message:e,callback:n}),w||c(),this},d=function(e){return function(t){v(t,e)}},v=function(e,t){return l(e,t),this},f(),{alert:function(e,t){return p(e,"alert",t),this},confirm:function(e,t){return p(e,"confirm",t),this},extend:d,log:v,prompt:function(e,t){return p(e,"prompt",t),this},success:function(e){return v(e,"success"),this},error:function(e){return v(e,"error"),this},delay:y,labels:S}},typeof define=="function"?define([],function(){return new r}):typeof e.alertify=="undefined"&&(e.alertify=new r)})(this); \ No newline at end of file +/** +* Alertify +* An unobtrusive customizable JavaScript notification system +* +* @author Fabien Doiron +* @copyright Fabien Doiron 2012 +* @license MIT +* @link http://www.github.com/fabien-d +* @module Alertify +* @version 0.2.4 +*/ +(function (e, t) { "use strict"; var n = e.document, r; r = function () { var r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T; return g = { buttons: { holder: '', submit: '', ok: '{{ok}}', cancel: '{{cancel}}' }, input: '', message: '

{{message}}

', log: '
{{message}}
' }, y = 5e3, E = { ENTER: 13, ESC: 27, SPACE: 32 }, S = { ok: "OK", cancel: "Cancel" }, T = [], w = !1, r = function (e) { return n.getElementById(e) }, i = function (i) { var o = r("aResetFocus"), u = r("aOK") || t, f = r("aCancel") || t, l = r("aText") || t, c = r("aForm") || t, p = typeof u != "undefined", d = typeof f != "undefined", v = typeof l != "undefined", m = "", g, y, b, w, S; g = function (e) { b(e), typeof l != "undefined" && (m = l.value), typeof i == "function" && i(!0, m), typeof e.preventDefault != "undefined" && e.preventDefault() }, y = function (e) { b(e), typeof i == "function" && i(!1), typeof e.preventDefault != "undefined" && e.preventDefault() }, b = function (e) { a(), h(n.body, "keyup", w), h(o, "focus", S), v && h(c, "submit", g), p && h(u, "click", g), d && h(f, "click", y) }, w = function (e) { var t = e.keyCode; t === E.SPACE && !v && g(e), t === E.ESC && d && y(e) }, S = function (e) { v ? l.focus() : d ? f.focus() : u.focus() }, s(o, "focus", S), p && s(u, "click", g), d && s(f, "click", y), s(n.body, "keyup", w), v && s(c, "submit", g), e.setTimeout(function () { l ? l.focus() : u.focus() }, 50) }, s = function (e, t, n) { typeof e.addEventListener == "function" ? e.addEventListener(t, n, !1) : e.attachEvent && e.attachEvent("on" + t, n) }, o = function (e) { var t = "", n = e.type, r = e.message; t += '
', n === "prompt" && (t += '
'), t += '
', t += g.message.replace("{{message}}", r), n === "prompt" && (t += g.input), t += g.buttons.holder, t += "
", n === "prompt" && (t += "
"), t += 'Reset Focus', t += "
"; switch (n) { case "confirm": t = t.replace("{{buttons}}", g.buttons.cancel + g.buttons.ok), t = t.replace("{{ok}}", S.ok).replace("{{cancel}}", S.cancel); break; case "prompt": t = t.replace("{{buttons}}", g.buttons.cancel + g.buttons.submit), t = t.replace("{{ok}}", S.ok).replace("{{cancel}}", S.cancel); break; case "alert": t = t.replace("{{buttons}}", g.buttons.ok), t = t.replace("{{ok}}", S.ok); break; default: } return b.className = "alertify alertify-show alertify-" + n, m.className = "alertify-cover", t }, u = function (e) { s(e, "click", function () { x.removeChild(e) }), setTimeout(function () { typeof e != "undefined" && e.parentNode === x && x.removeChild(e) }, y) }, a = function () { T.splice(0, 1), T.length > 0 ? c() : (w = !1, b.className = "alertify alertify-hide alertify-hidden", m.className = "alertify-cover alertify-hidden") }, f = function () { n.createElement("nav"), n.createElement("article"), n.createElement("section"), m = n.createElement("div"), m.setAttribute("id", "alertifycover"), m.className = "alertify-cover alertify-hidden", n.body.appendChild(m), b = n.createElement("section"), b.setAttribute("id", "alertify"), b.className = "alertify alertify-hidden", n.body.appendChild(b), x = n.createElement("section"), x.setAttribute("id", "alertifylogs"), x.className = "alertify-logs", n.body.appendChild(x), delete this.init }, l = function (e, t) { var r = n.createElement("article"); r.className = "alertify-log" + (typeof t == "string" && t !== "" ? " alertify-log-" + t : ""), r.innerHTML = e, x.insertBefore(r, x.firstChild), setTimeout(function () { r.className = r.className + " alertify-log-show" }, 50), u(r) }, c = function () { var e = T[0]; w = !0, b.innerHTML = o(e), i(e.callback) }, h = function (e, t, n) { typeof e.removeEventListener == "function" ? e.removeEventListener(t, n, !1) : e.detachEvent && e.detachEvent("on" + t, n) }, p = function (e, t, n) { var r = function () { if (b && b.scrollTop !== null) return; r() }; if (typeof e != "string") throw new Error("message must be a string"); if (typeof t != "string") throw new Error("type must be a string"); if (typeof n != "undefined" && typeof n != "function") throw new Error("fn must be a function"); return typeof this.init == "function" && (this.init(), r()), T.push({ type: t, message: e, callback: n }), w || c(), this }, d = function (e) { return function (t) { v(t, e) } }, v = function (e, t) { var n = function () { if (x && x.scrollTop !== null) return; n() }; return typeof this.init == "function" && (this.init(), n()), l(e, t), this }, { alert: function (e, t) { return p.call(this, e, "alert", t), this }, confirm: function (e, t) { return p.call(this, e, "confirm", t), this }, extend: d, init: f, log: function (e, t) { return v.call(this, e, t), this }, prompt: function (e, t) { return p.call(this, e, "prompt", t), this }, success: function (e) { return v.call(this, e, "success"), this }, error: function (e) { return v.call(this, e, "error"), this }, delay: y, labels: S} }, typeof define == "function" ? define([], function () { return new r }) : typeof e.alertify == "undefined" && (e.alertify = new r) })(this); diff --git a/Site5/Style/alertify.css b/Site5/Style/alertify.css index 34ea2226..a493fb2c 100644 --- a/Site5/Style/alertify.css +++ b/Site5/Style/alertify.css @@ -57,7 +57,7 @@ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; - font-size: 100%; + font-size: 18px; } .alertify-buttons { } @@ -82,11 +82,12 @@ } /** - * Default Look and Feel + * Default Look and Feel - modified for Activizr */ .alertify, .alertify-log { - font-family: sans-serif; + font-family: Ubuntu, sans-serif; + font-size: 15px; } .alertify { background: #FFF; @@ -143,13 +144,27 @@ padding: 15px; border-radius: 4px; color: #FFF; - text-shadow: -1px -1px 0 rgba(0,0,0,.5); + text-shadow: 0px 0px rgba(0,0,0,.5); } .alertify-log-error { - background: #FE1A00; - background: rgba(254,26,0,.9); + background-color: #FF8080; + background: hsla(0,89%,78%,.9); + border: 2px solid #FE1A00; + box-shadow: 0px 0px 1px 1px #D83526 inset, 0px 2px 3px 1px #400000; + font-weight: 400; + color: #A00000; } .alertify-log-success { background: #5CB811; background: rgba(92,184,17,.9); + } + + + + p.alertify-message { + margin-bottom: 18px; + } + + a#aResetFocus { + display: none; } \ No newline at end of file diff --git a/Site5/Style/style-v5.css b/Site5/Style/style-v5.css index ead9179b..8281b08e 100644 --- a/Site5/Style/style-v5.css +++ b/Site5/Style/style-v5.css @@ -880,9 +880,13 @@ div.RadToolTip table.rtWrapper td.rtWrapperContent /* COLOR SCHEME - #A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF -- blue (hue 240) - #FFBC37 #C78B15 #7F5500 #FFD580 #FFEDC8 -- orange (hue 60) + #A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF -- blue (hue 222) + #FFBC37 #C78B15 #7F5500 #FFD580 #FFEDC8 -- orange (hue 40) base dark xdark light xlight + + S36L100 S64-L78 S78-L49 S22B100 S11L100 -- blue (hue 222) + S78L100 S89-L78 S100L50 S50L100 S22L100 -- orange (hue 40) + */