Merge pull request #16893 from shucon/fix_16888

Fix #16888 - JS error on renaming tables in saved Designer page
This commit is contained in:
Maurício Meneghini Fauth 2021-05-28 18:43:07 -03:00 committed by GitHub
commit 7959ea51aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -128,13 +128,17 @@ DesignerPage.showNewPageTables = function (check) {
};
DesignerPage.loadHtmlForPage = function (pageId) {
DesignerPage.showNewPageTables(false);
DesignerPage.showNewPageTables(true);
DesignerPage.loadPageObjects(pageId, function (page, tblCords) {
$('#name-panel').find('#page_name').text(page.pageDescr);
DesignerMove.markSaved();
var tableMissing = false;
for (var t = 0; t < tblCords.length; t++) {
var tbId = db + '.' + tblCords[t].tableName;
var table = document.getElementById(tbId);
if (table === null) {
tableMissing = true;
continue;
}
table.style.top = tblCords[t].y + 'px';
table.style.left = tblCords[t].x + 'px';
@ -142,6 +146,11 @@ DesignerPage.loadHtmlForPage = function (pageId) {
checkbox.checked = true;
DesignerMove.visibleTab(checkbox, checkbox.value);
}
DesignerMove.markSaved();
if (tableMissing === true) {
DesignerMove.markUnsaved();
Functions.ajaxShowMessage(Messages.strSavedPageTableMissing);
}
selectedPage = page.pgNr;
});
};

View File

@ -538,6 +538,7 @@ final class JavaScriptMessagesController
'strSavePageAs' => __('Save page as'),
'strOpenPage' => __('Open page'),
'strDeletePage' => __('Delete page'),
'strSavedPageTableMissing' => __('Some tables saved in this page might have been renamed or deleted.'),
'strUntitled' => __('Untitled'),
'strSelectPage' => __('Please select a page to continue'),
'strEnterValidPageName' => __('Please enter a valid page name'),