diff --git a/js/tools.js b/js/tools.js index cc84ad854..5f851b0ea 100644 --- a/js/tools.js +++ b/js/tools.js @@ -294,6 +294,43 @@ function removeQuotes(value) return value; } +/** + * Display a MessageBox + * @param {string} msg + * @param {string} title (optional) + */ +function fancyMsgBox(msg, title) +{ + if (title) msg = "

" + title + "

" + msg + "

"; + msg += "

"; + $.fancybox( msg, {'autoDimensions': false, 'width': 500, 'height': 'auto', 'transitionIn': 'none', 'transitionOut': 'none'} ); +} + +/** + * Display a messageDialog with different buttons including a callback for each one + * @param {string} question + * @param {mixed} title Optional title for the dialog box. Send false if you don't want any title + * @param {object} buttons Associative array containg a list of {buttonCaption: callbackFunctionName, ...}. Use an empty space instead of function name for no callback + * @param {mixed} otherParams Optional data sent to the callback function + */ +function fancyChooseBox(question, title, buttons, otherParams) +{ + var msg, funcName, action; + if (title) msg = "

" + title + "

" + question + "

"; + msg += "

"; + var i = 0; + for (var caption in buttons) { + if (!buttons.hasOwnProperty(caption)) continue; + funcName = buttons[caption]; + otherParams = escape(JSON.stringify(otherParams)); + action = funcName ? "$.fancybox.close();window['" + funcName + "'](JSON.parse(unescape('" + otherParams + "')), " + i + ")" : "$.fancybox.close()"; + msg += ''; + i++; + } + msg += "

"; + $.fancybox( msg, {'autoDimensions': false, 'width': 500, 'height': 'auto', 'transitionIn': 'none', 'transitionOut': 'none'} ); +} + //On dom ready $().ready(function() { diff --git a/modules/sendtoafriend/sendtoafriend-extra.tpl b/modules/sendtoafriend/sendtoafriend-extra.tpl index 7437589fd..b438a4ad5 100755 --- a/modules/sendtoafriend/sendtoafriend-extra.tpl +++ b/modules/sendtoafriend/sendtoafriend-extra.tpl @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} -