diff options
| author | Greg Roach <fisharebest@gmail.com> | 2017-12-30 13:44:05 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2017-12-30 13:44:58 +0000 |
| commit | c6e83c54c82a4223bbce242d10a4522ff2b7fcbc (patch) | |
| tree | cd61ba3ff2a04d0c05b6fea696ffeb8668e67ffa | |
| parent | 9607d27429396834ef0486bb3fb6e37b967a0802 (diff) | |
| download | webtrees-c6e83c54c82a4223bbce242d10a4522ff2b7fcbc.tar.gz webtrees-c6e83c54c82a4223bbce242d10a4522ff2b7fcbc.tar.bz2 webtrees-c6e83c54c82a4223bbce242d10a4522ff2b7fcbc.zip | |
Move admin scripts inline
| -rw-r--r-- | admin_trees_config.php | 4 | ||||
| -rw-r--r-- | admin_trees_manage.php | 27 | ||||
| -rw-r--r-- | assets/js-2.0.0/admin.js | 44 | ||||
| -rw-r--r-- | includes/session.php | 1 | ||||
| -rw-r--r-- | resources/views/layouts/administration.php | 1 |
5 files changed, 26 insertions, 51 deletions
diff --git a/admin_trees_config.php b/admin_trees_config.php index c650356c89..dc9f9778c6 100644 --- a/admin_trees_config.php +++ b/admin_trees_config.php @@ -231,9 +231,7 @@ default: return; } -$controller - ->pageHeader() - ->addExternalJavascript(WT_ADMIN_JS_URL); +$controller->pageHeader(); echo Bootstrap4::breadcrumbs([ route('admin-control-panel') => I18N::translate('Control panel'), diff --git a/admin_trees_manage.php b/admin_trees_manage.php index ebd42d4236..d53b281ec2 100644 --- a/admin_trees_manage.php +++ b/admin_trees_manage.php @@ -25,7 +25,6 @@ require 'includes/session.php'; $controller = new PageController; $controller - ->addExternalJavascript(WT_ADMIN_JS_URL) ->restrictAccess(Auth::isAdmin() || Auth::isManager($WT_TREE)) ->setPageTitle(I18N::translate('Manage family trees')); @@ -308,7 +307,31 @@ switch (Filter::get('action')) { </div> </div> </form> - <?php + + <script> + function checkGedcomImportForm (message) { + var oldFile = $('#gedcom_filename').val(); + var method = $('input[name=action]:checked').val(); + var newFile = method === 'replace_import' ? $('#import-server-file').val() : $('#import-computer-file').val(); + + // Some browsers include c:\fakepath\ in the filename. + newFile = newFile.replace(/.*[/\\]/, ''); + if (newFile !== oldFile && oldFile !== '') { + return window.confirm(message); + } else { + return true; + } + } + + document.getElementById("import-computer-file").addEventListener("click", function () { + document.getElementById("import-computer").checked = true; + }); + document.getElementById("import-server-file").addEventListener("focus", function () { + document.getElementById("import-server").checked = true; + }); + </script> + + <?php return; } diff --git a/assets/js-2.0.0/admin.js b/assets/js-2.0.0/admin.js deleted file mode 100644 index a095409dcd..0000000000 --- a/assets/js-2.0.0/admin.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * webtrees: online genealogy - * Copyright (C) 2017 webtrees development team - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -'use strict'; - -// Onsubmit validation for the import/upload GEDCOM form -function checkGedcomImportForm (message) { - var oldFile = $('#gedcom_filename').val(); - var method = $('input[name=action]:checked').val(); - var newFile = method === 'replace_import' ? $('#import-server-file').val() : $('#import-computer-file').val(); - -// Some browsers include c:\fakepath\ in the filename. - newFile = newFile.replace(/.*[/\\]/, ''); - if (newFile !== oldFile && oldFile !== '') { - return window.confirm(message); - } else { - return true; - } -} - -/** - * Add handlers to various screen elements - */ -$(document).ready(function () { - // Import from file on server/computer - $('#import-server-file').on('focus', function () { - $('#import-server').prop('checked', true); - }); - $('#import-computer-file').on('focus', function () { - $('#import-computer').prop('checked', true); - }); -}); diff --git a/includes/session.php b/includes/session.php index 164f42149e..cc4fc30f76 100644 --- a/includes/session.php +++ b/includes/session.php @@ -60,7 +60,6 @@ define('WT_JQUERY_WHEELZOOM_URL', 'assets/js-2.0.0/jquery.wheelzoom-3.1.2.js'); define('WT_CKEDITOR_BASE_URL', 'packages/ckeditor-4.5.2-custom/'); // Location of our own scripts -define('WT_ADMIN_JS_URL', 'assets/js-2.0.0/admin.js'); define('WT_WEBTREES_JS_URL', 'assets/js-2.0.0/webtrees.js'); define('WT_FONT_AWESOME_RTL_CSS_URL', 'assets/js-2.0.0/font-awesome-rtl.css'); diff --git a/resources/views/layouts/administration.php b/resources/views/layouts/administration.php index 5ab37e1168..7d5cf12fa1 100644 --- a/resources/views/layouts/administration.php +++ b/resources/views/layouts/administration.php @@ -78,7 +78,6 @@ <script src="<?= e(WT_MOMENT_JS_URL) ?>"></script> <script src="<?= e(WT_BOOTSTRAP_DATETIMEPICKER_JS_URL) ?>"></script> <script src="<?= e(WT_WEBTREES_JS_URL) ?>"></script> - <script src="<?= e(WT_ADMIN_JS_URL) ?>"></script> <?= DebugBar::render() ?> </body> |
