From 16a5a9716015029f8ffed675353ebfe8b3478f66 Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Tue, 22 Nov 2022 18:45:35 +0800 Subject: [PATCH] * Improve instance view page. --- frontend/module/instance/js/view.js | 18 ++++++++++++++++++ frontend/module/instance/lang/zh-cn.php | 2 ++ frontend/module/instance/view/advance.html.php | 10 +++++----- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/frontend/module/instance/js/view.js b/frontend/module/instance/js/view.js index 45387589..57d39bf7 100644 --- a/frontend/module/instance/js/view.js +++ b/frontend/module/instance/js/view.js @@ -108,6 +108,24 @@ $(function() $('#customBtn').on('click', function(event) { + var errors = ''; + $("#customForm").find("input[type=text]").each(function(index, item) + { + if($(item).val().trim().length == 0) + { + errors += $(item).attr('placeholder') + instanceNotices.required + '
'; + } + }); + if(errors.length > 0) + { + bootbox.alert( + { + title: instanceNotices.error, + message: errors, + }); + return; + } + bootbox.confirm(instanceNotices.confirmCustom, function(result) { if(!result) return; diff --git a/frontend/module/instance/lang/zh-cn.php b/frontend/module/instance/lang/zh-cn.php index 41d55212..1c651f8b 100644 --- a/frontend/module/instance/lang/zh-cn.php +++ b/frontend/module/instance/lang/zh-cn.php @@ -201,6 +201,7 @@ $lang->instance->notices = array(); $lang->instance->notices['success'] = '成功'; $lang->instance->notices['fail'] = '失败'; +$lang->instance->notices['error'] = '错误'; $lang->instance->notices['confirmStart'] = '确定启动该应用吗?'; $lang->instance->notices['confirmStop'] = '确定关闭该应用吗?'; $lang->instance->notices['confirmUninstall'] = '确定卸载该应用吗?'; @@ -247,6 +248,7 @@ $lang->instance->notices['enableSMTPSuccess'] = '启用SMTP成功'; $lang->instance->notices['disableSMTPSuccess'] = '禁用SMTP成功'; $lang->instance->notices['confirmCustom'] = '修改自定义配置后请手动重启服务以使配置生效。'; +$lang->instance->notices['required'] = '不能为空'; $lang->instance->nameChangeTo = ' %s 修改为 %s 。'; $lang->instance->versionChangeTo = ' %s 升级为 %s 。'; diff --git a/frontend/module/instance/view/advance.html.php b/frontend/module/instance/view/advance.html.php index 471561d9..09fa79e5 100644 --- a/frontend/module/instance/view/advance.html.php +++ b/frontend/module/instance/view/advance.html.php @@ -40,11 +40,11 @@ system->hasSystemLDAP();?> ldapSnippetName ? 'true' : '' ;?> - $lang->instance->enableLDAP), $enableLDAP, ($LDAPInstalled ? '' : 'disabled'));?> + $lang->instance->enableLDAP), $enableLDAP, ($LDAPInstalled ? '' : 'disabled'));?> instance->systemLDAPInactive;?> - instance->toSystemLDAP, '', "class='btn btn-link'");?> + instance->toSystemLDAP, '', "class='btn btn-default'");?> @@ -71,11 +71,11 @@ system->isSMTPEnabled();?> smtpSnippetName ? 'true' : '' ;?> - $lang->instance->enableSMTP), $enableSMTP, ($SMTPInstalled ? '' : 'disabled'));?> + $lang->instance->enableSMTP), $enableSMTP, ($SMTPInstalled ? '' : 'disabled'));?> instance->systemSMTPInactive;?> - instance->toSystemSMTP, '', "class='btn btn-link'");?> + instance->toSystemSMTP, '', "class='btn btn-default'");?> @@ -103,7 +103,7 @@ label;?> - name, $item->default, "class='form-control'");?> + name, $item->default, "class='form-control' placeholder='{$item->label}'");?>