|
25 | 25 |
|
26 | 26 | var ui = MeadCo.createNS("MeadCo.ScriptX.Print.UI"); |
27 | 27 |
|
28 | | - ui.moduleversion = "1.4.8.0"; |
| 28 | + ui.moduleversion = "1.5.7.0"; |
29 | 29 |
|
30 | 30 | // MeadCo.ScriptX.Print.UI.AttachPrintAction( |
31 | 31 | // el - clickable html element |
|
59 | 59 | }); |
60 | 60 |
|
61 | 61 | // MeadCo.ScriptX.Print.UI.PageSetup() |
62 | | - ui.PageSetup = function () { |
| 62 | + ui.PageSetup = function (fnCallBack) { |
| 63 | + var bAccepted = false; |
| 64 | + |
63 | 65 | // page setup modal to attach to the page |
64 | 66 | if (!$('#dlg-printoptions').length) { |
65 | 67 | var dlg = '<style>' + |
|
224 | 226 | '<!-- /.modal -->'; |
225 | 227 | $('body').append(dlg); |
226 | 228 |
|
227 | | - $('#btn-saveoptions').click(function (ev) { |
228 | | - ev.preventDefault(); |
229 | | - savePageSetup(); |
230 | | - $('#dlg-printoptions').modal('hide'); |
231 | | - }); |
232 | | - |
233 | 229 | $('[name="fld-measure"]').on('change', function () { |
234 | 230 | switch ($(this).val()) { |
235 | 231 | case '2': // mm from inches |
|
251 | 247 | } |
252 | 248 | } |
253 | 249 |
|
| 250 | + // reattach click handler as callback function scoped variables may (probably will) have changed |
| 251 | + $('#btn-saveoptions') |
| 252 | + .off("click") |
| 253 | + .on("click", function (ev) { |
| 254 | + ev.preventDefault(); |
| 255 | + savePageSetup(); |
| 256 | + bAccepted = true; |
| 257 | + $('#dlg-printoptions').modal('hide'); |
| 258 | + }); |
| 259 | + |
| 260 | + $("#dlg-printoptions") |
| 261 | + .off('hidden.bs.modal') |
| 262 | + .on('hidden.bs.modal', function () { |
| 263 | + if (typeof fnCallBack === "function") { |
| 264 | + fnCallBack(bAccepted); |
| 265 | + } |
| 266 | + }); |
| 267 | + |
254 | 268 | var $dlg = $('#dlg-printoptions'); |
255 | 269 | var settings = MeadCo.ScriptX.Print.HTML.settings; |
256 | 270 |
|
|
289 | 303 |
|
290 | 304 | // MeadCo.ScriptX.Print.UI.PrinterSettings() |
291 | 305 | ui.PrinterSettings = function (fnCallBack) { |
| 306 | + var bAccepted = false; |
292 | 307 | // printer settings modal to attach to the page |
293 | 308 | if (!$('#dlg-printersettings').length) { |
294 | 309 | var dlg = '<style>' + |
|
387 | 402 | .on("click", function (ev) { |
388 | 403 | ev.preventDefault(); |
389 | 404 | savePrinterSettings(); |
| 405 | + bAccepted = true; |
390 | 406 | $('#dlg-printersettings').modal('hide'); |
391 | | - if (typeof fnCallBack === "function") { |
392 | | - fnCallBack(true); |
393 | | - } |
394 | 407 | }); |
395 | 408 |
|
396 | 409 | $("#dlg-printersettings") |
397 | 410 | .off('hidden.bs.modal') |
398 | 411 | .on('hidden.bs.modal', function () { |
399 | 412 | if (typeof fnCallBack === "function") { |
400 | | - fnCallBack(false); |
| 413 | + fnCallBack(bAccepted); |
401 | 414 | } |
402 | 415 | }); |
403 | 416 |
|
|
526 | 539 | $el.val(((parseFloat($el.val()) * 2540) / 100).toFixed(2)); |
527 | 540 | } |
528 | 541 |
|
529 | | - // convery the current mm value in the control to inches |
| 542 | + // convert the current mm value in the control to inches |
530 | 543 | function convertAndDisplayMMtoInches($el) { |
531 | 544 | $el.val(((parseFloat($el.val()) * 100) / 2540).toFixed(2)); |
532 | 545 | } |
|
0 commit comments