diff --git a/module/common/view/datepicker.html.php b/module/common/view/datepicker.html.php index cb3e6a5be6..cecdd9a97f 100755 --- a/module/common/view/datepicker.html.php +++ b/module/common/view/datepicker.html.php @@ -48,5 +48,7 @@ $(function() { $(this).find('.form-date, .form-datetime, .form-time').datetimepicker('show').focus(); }); + + window.datepickerOptions = options; }); diff --git a/module/todo/css/batchcreate.css b/module/todo/css/batchcreate.css index 1f638429aa..3abce5740d 100755 --- a/module/todo/css/batchcreate.css +++ b/module/todo/css/batchcreate.css @@ -1,2 +1,6 @@ #datepicker {position: relative; top: -6px; margin-left: 10px;} .input-group > .form-control:first-child {border-right: 0} + +.body-modal .outer > form, .body-modal .outer > .container > form {margin: 0;padding: 0 20px 20px;} +.body-modal #titlebar {margin: 0 -20px 20px} +.body-modal #titlebar + .table-form {border: 1px solid #ddd} diff --git a/www/js/my.full.js b/www/js/my.full.js index 23cf439046..da7b539b8b 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -858,89 +858,16 @@ function setModal() name: $e.data('name') || 'modalIframe', cssClass: $e.data('class'), headerless: $e.data('headerless') || false, - center: $e.data('center') || true, - } - options = $.extend(options, setting); - - if(isNum(options.height.toString())) options.height += 'px'; - if(isNum(options.width.toString())) options.width += 'px'; - if(options.size == 'fullscreen') - { - var $w = $(window); - options.width = $w.width(); - options.height = $w.height(); - options.cssClass += ' fullscreen'; - } - if(options.headerless) - { - options.cssClass += ' hide-header'; - } + center: $e.data('center') || true + }; if(options.icon == '?') { var i = $e.find("[class^='icon-']"); options.icon = i.length ? i.attr('class').substring(5) : 'file-text'; } - var modal = $('#ajaxModal').addClass('modal-loading').data('first', true); - modal.html("
".format(options)); - var modalBody = modal.find('.modal-body'), dialog = modal.find('.modal-dialog'); - if(options.cssClass) - { - dialog.addClass(options.cssClass); - } - var frame = document.getElementById(options.name); - frame.onload = frame.onreadystatechange = function() - { - if (this.readyState && this.readyState != 'complete') return; - if(!modal.data('first')) modal.addClass('modal-loading'); - - modalBody.css('height', options.height - modal.find('.modal-header').outerHeight()); - - try - { - var $frame = $(window.frames[options.name].document); - if($frame.find('#titlebar').length) - { - modal.addClass('with-titlebar'); - if(options.size == 'fullscreen') - { - modalBody.css('height', options.height); - } - } - if(options.height == 'auto') - { - var $framebody = $frame.find('body'); - setTimeout(function() - { - var fbH = $framebody.addClass('body-modal').outerHeight(); - if(typeof fbH == 'object') fbH = $framebody.height(); - modalBody.css('height', fbH); - if(options.center) dialog.css('margin-top', Math.max(0, (modal.height() - dialog.height())/3)); - modal.removeClass('modal-loading'); - if(modal.data('first')) modal.data('first', false); - }, 100); - - if(navigator.userAgent.indexOf("MSIE 8.0") < 0) - { - $framebody.resize(function() - { - var fbH = $framebody.addClass('body-modal').outerHeight(); - if(typeof fbH == 'object') fbH = $framebody.height(); - modalBody.css('height', fbH); - }); - } - } - - var iframe$ = window.frames[options.name].$; - if(iframe$) - { - iframe$.extend({'closeModal': $.closeModal}); - } - } - catch(e){modal.removeClass('modal-loading');} - } - modal.modal('show'); + showIframeModal($.extend(options, setting)); } else { @@ -965,6 +892,106 @@ function setModal() }); } + function showIframeModal(settings) + { + var options = + { + width: 800, + height: 'auto', + icon: '?', + title: '', + name: 'modalIframe', + cssClass: '', + headerless: false, + center: true + } + + if(typeof(settings) == 'string') + { + options.url = settings; + } + else + { + options = $.extend(options, settings); + } + + if(isNum(options.height.toString())) options.height += 'px'; + if(isNum(options.width.toString())) options.width += 'px'; + if(options.size == 'fullscreen') + { + var $w = $(window); + options.width = $w.width(); + options.height = $w.height(); + options.cssClass += ' fullscreen'; + } + if(options.headerless) + { + options.cssClass += ' hide-header'; + } + + var modal = $('#ajaxModal').addClass('modal-loading').data('first', true); + + modal.html("
".format(options)); + + var modalBody = modal.find('.modal-body'), dialog = modal.find('.modal-dialog'); + if(options.cssClass) + { + dialog.addClass(options.cssClass); + } + var frame = document.getElementById(options.name); + frame.onload = frame.onreadystatechange = function() + { + if (this.readyState && this.readyState != 'complete') return; + if(!modal.data('first')) modal.addClass('modal-loading'); + + modalBody.css('height', options.height - modal.find('.modal-header').outerHeight()); + + try + { + var $frame = $(window.frames[options.name].document); + if($frame.find('#titlebar').length) + { + modal.addClass('with-titlebar'); + if(options.size == 'fullscreen') + { + modalBody.css('height', options.height); + } + } + if(options.height == 'auto') + { + var $framebody = $frame.find('body'); + setTimeout(function() + { + var fbH = $framebody.addClass('body-modal').outerHeight(); + if(typeof fbH == 'object') fbH = $framebody.height(); + modalBody.css('height', fbH); + if(options.center) dialog.css('margin-top', Math.max(0, (modal.height() - dialog.height())/3)); + modal.removeClass('modal-loading'); + if(modal.data('first')) modal.data('first', false); + }, 100); + + if(navigator.userAgent.indexOf("MSIE 8.0") < 0) + { + $framebody.resize(function() + { + var fbH = $framebody.addClass('body-modal').outerHeight(); + if(typeof fbH == 'object') fbH = $framebody.height(); + modalBody.css('height', fbH); + }); + } + } + + var iframe$ = window.frames[options.name].$; + if(iframe$) + { + iframe$.extend({'closeModal': $.closeModal}); + } + } + catch(e){modal.removeClass('modal-loading');} + } + modal.modal('show'); + } + function initModalFrame(setting) { if($('#ajaxModal').length) @@ -1001,6 +1028,10 @@ function setModal() if(setting.afterHidden && $.isFunction(setting.afterHidden)) $ajaxModal.on('hidden.bs.modal', setting.afterHidden); } + $.extend({modalTrigger: showIframeModal}); + + + $('[data-toggle=modal], a.iframe').modalTrigger(); }