-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwrite_custom_config.php
105 lines (93 loc) · 3.6 KB
/
write_custom_config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/*****************************************************************************
*
* This file is part of kvmadmin, a php-based KVM virtual machine management
* platform.
*
* kvmadmin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* kvmadmin 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with kvmadmin. If not, see <http://www.gnu.org/licenses/>.
* @license GNU Lesser General Public License
*
* CopyRight 2010-2012 QIU Jian ([email protected])
*
****************************************************************************/
?>
<?php
print_header("KVM Administration Platform - 初始配置");
?>
<h1 align='center' style='padding:30px;'>KVM管理平台初始化设置</h1>
<div id='_raw_init_panel' align='center'></div>
<script language='JavaScript'>
<!--
function init_raw_panel_callback(msg) {
if(isErrorMsg(msg)) {
showAlert(msg);
}else {
refresh();
}
}
function init_raw_panel_validate(form) {
with(form) {
if(!checkDOM(_admin_password, ".+", '必须输入管理员密码!')) {
return false;
}
if(!checkDOM(_admin_password2, "^" + _admin_password.value + "$", '管理员密码不一致!')) {
return false;
}
if(!checkDOM(_mysql_host, ".+", '请输入MySQL服务器地址!')) {
return false;
}
if(!checkDOM(_mysql_user, ".+", '请输入MySQL账号!')) {
return false;
}
if(!checkDOM(_mysql_password, ".+", '请输入MySQL账号密码!')) {
return false;
}
if(!checkDOM(_mysql_port, ".+", '请输入MySQL服务器端口号!')) {
return false;
}
if(!checkDOM(_mysql_db, ".+", '请输入MySQL数据库名称!')) {
return false;
}
}
return true;
}
function init_raw_panel(panel) {
var form = newRPCForm({
action: 'RAW_INIT',
callback: 'init_raw_panel_callback',
onsubmit: init_raw_panel_validate
}, panel);
var tbl = newTableElement("", 0, 0, 2, '', 8, 2, 'right', 'middle', form);
tblCell(tbl, 0, 0).innerHTML = '管理员密码:';
tblCell(tbl, 0, 1).appendChild(newInputElement('password', '_admin_password', ''));
tblCell(tbl, 1, 0).innerHTML = '重复密码:';
tblCell(tbl, 1, 1).appendChild(newInputElement('password', '_admin_password2', ''));
tblCell(tbl, 2, 0).innerHTML = 'MySQL服务器地址:';
tblCell(tbl, 2, 1).appendChild(newInputElement('text', '_mysql_host', '<?php echo $_mysql_host; ?>'));
tblCell(tbl, 3, 0).innerHTML = 'MySQL账号:';
tblCell(tbl, 3, 1).appendChild(newInputElement('text', '_mysql_user', '<?php echo $_mysql_user; ?>'));
tblCell(tbl, 4, 0).innerHTML = 'MySQL账号密码:';
tblCell(tbl, 4, 1).appendChild(newInputElement('password', '_mysql_password', ''));
tblCell(tbl, 5, 0).innerHTML = 'MySQL端口号:';
tblCell(tbl, 5, 1).appendChild(newInputElement('text', '_mysql_port', '<?php echo $_mysql_port; ?>'));
tblCell(tbl, 6, 0).innerHTML = 'MySQL数据库:';
tblCell(tbl, 6, 1).appendChild(newInputElement('text', '_mysql_db', '<?php echo $_mysql_db; ?>'));
tblCell(tbl, 7, 1).align = 'center';
tblCell(tbl, 7, 1).appendChild(newInputElement('submit', '', '提交'));
}
EventManager.Add(window, 'load', function(ev, obj) {
init_raw_panel(document.getElementById('_raw_init_panel'));
});
//-->
</script>