* index: support to open zin modal from old page.

This commit is contained in:
sunhao
2024-03-08 13:03:01 +08:00
parent cd6bd5bdf3
commit ca1e476dfa
5 changed files with 73 additions and 13 deletions
+14
View File
@@ -64,6 +64,20 @@ class index extends control
$this->display();
}
/**
* 通过 iframe 的形式打开对话框。
* Open url in iframe modal.
*
* @param string $url base64 encode string.
* @access public
* @return void
*/
public function iframeModal(string $url = '')
{
$this->view->url = helper::safe64Decode($url);
$this->display();
}
/**
* Get the log record according to the version.
*
+5
View File
@@ -0,0 +1,5 @@
body {--zt-page-bg: var(--color-canvas)}
.modal-actions > [data-dismiss="modal"] {display: none;}
.modal-dialog {box-shadow: none!important;}
.modal-content, .modal-dialog {height: auto!important; max-height: none!important}
.modal-body {overflow: visible!important;}
+31
View File
@@ -0,0 +1,31 @@
$.fn.triggerHandler = $.fn.trigger;
$(function()
{
$('.zin-page-css').appendTo('head');
function resizeModal()
{
const $modal = $('.modal-body');
const width = $modal.outerWidth();
const height = $modal.outerHeight();
$modal.closest('body').height(height);
const $iframe = parent.$('iframe[name="' + window.name + '"]');
$iframe.closest('.modal-dialog').css({width: width + 10});
}
$.ajax(
{
url: modalOpenUrl,
headers: {'X-ZUI-Modal': 'true'},
success: function(data)
{
const $body = $('body');
$body.html(data);
const resizeOb = new ResizeObserver(resizeModal);
resizeOb.observe($('.modal-body')[0]);
resizeModal();
$body.removeClass('invisible');
}
});
});
+15 -13
View File
@@ -834,19 +834,21 @@ $.get($.createLink('index', 'app'), html =>
$.apps = $.extend(apps,
{
openApp: openApp,
open: openApp, // Compatiable with old version.
reloadApp: reloadApp,
showApp: showApp,
updateApp: updateApp,
getLastApp: getLastApp,
goBack: goBack,
logout: logout,
isOldPage: isOldPage,
getAppCode: getAppCode,
updateAppsMenu: updateAppsMenu,
changeAppsLang: changeAppsLang,
changeAppsTheme: changeAppsTheme,
openedApps: apps.openedMap,
openApp: openApp,
open: openApp,
reloadApp: reloadApp,
showApp: showApp,
updateApp: updateApp,
updateUrl: function(appCode, url, title) {return updateApp(appCode, url, title)},
getLastApp: getLastApp,
goBack: goBack,
logout: logout,
isOldPage: isOldPage,
getAppCode: getAppCode,
updateAppsMenu: updateAppsMenu,
changeAppsLang: changeAppsLang,
changeAppsTheme: changeAppsTheme,
updateUserToolbar: updateUserToolbar
});
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace zin;
set::zui(true);
set::bodyClass('invisible');
jsVar('modalOpenUrl', $url);
render('pagebase');