refactoring db section: new html formating

This commit is contained in:
Serghey Rodin 2012-09-17 13:45:36 +03:00
commit e4d1350569
11 changed files with 677 additions and 492 deletions

View file

@ -67,7 +67,6 @@ top_panel($user,$TAB);
$db_types = json_decode(implode('', $output), true);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_db.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);

View file

@ -68,7 +68,6 @@ top_panel($user,$TAB);
}
}
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_db.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);

View file

@ -13,24 +13,16 @@ top_panel($user,$TAB);
// Data
if ($_SESSION['user'] == 'admin') {
exec (VESTA_CMD."v_list_databases $user json", $output, $return_var);
check_error($return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_db.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_db.html');
} else {
exec (VESTA_CMD."v_list_databases $user json", $output, $return_var);
check_error($return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data);
unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_db.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_db.html');
}

View file

@ -1,4 +1,25 @@
<script type="text/javascript">
<table class="sub-menu" style="background: white;">
<tr>
<td style="padding: 12px 2px 16px 0;" ><a class="add-name"><b>Adding Database</b></a>
<?php
if (!empty($_SESSION['error_msg'])) {
echo "<a class=\"add-error\"> → ".$_SESSION['error_msg']."</a>";
} else {
if (!empty($_SESSION['ok_msg'])) {
echo "<a class=\"add-ok\"> → ".$_SESSION['ok_msg']."</a>";
}
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<form id="vstobjects" name="v_add_db" method="post">
<script type="text/javascript">
function elementHideShow(elementToHideOrShow) {
var el = document.getElementById(elementToHideOrShow);
if (el.style.display == "block") {
@ -7,7 +28,6 @@
el.style.display = "block";
}
}
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 10;
@ -16,33 +36,67 @@
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.v_add_user.v_password.value = randomstring;
document.v_add_db.v_password.value = randomstring;
}
</script>
</script>
<table class='data'>
<tr class="data-add">
<table class='data'>
<tr class="data-add">
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
<table class="data-col1">
<tr><td style="padding: 18 0 4 18;"></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<table width="830px">
<tr>
<td></td>
</tr></table>
</tr>
</table>
<table class="data-col2" width="600px">
<form method="post" name="v_add_user">
<tr><td style="padding: 10 0 0 2px; color:99a7af;" >Prefix "<?php echo $user."_"; ?>" will be automaticaly added to database name and database user</td></tr>
<tr><td class="add-text" style="padding: 10 0 0 2px;">Database</td></tr>
<tr><td><input type="text" size="20" class="add-input" name="v_database" <?php if (!empty($v_database)) echo "value=".$v_database; ?>></td></tr>
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Username</td></tr>
<tr><td></span><input type="text" size="20" class="add-input" name="v_dbuser" <?php if (!empty($v_dbuser)) echo "value=".$v_dbuser; ?>></tr>
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Password <a href="javascript:randomString();" class="genpass">generate</a></td></tr>
<tr><td><input type="text" size="20" class="add-input" name="v_password"></td></tr>
<tr><td class="add-text" style="padding: 10 0 0 2px;">Type</td></tr>
<tr><td><select class="add-list" name="v_type">
<tr>
<td style="padding: 10 0 0 2px; color:99a7af;" >
Prefix "<?php echo $user."_"; ?>" will be automaticaly added to database name and database user
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Database
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_database" <?php if (!empty($v_database)) echo "value=".$v_database; ?>>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10px 0 0 2px;">
Username
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_dbuser" <?php if (!empty($v_dbuser)) echo "value=".$v_dbuser; ?>>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10px 0 0 2px;">
Password <a href="javascript:randomString();" class="genpass">generate</a>
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_password">
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Type
</td>
</tr>
<tr>
<td>
<select class="add-list" name="v_type">
<?php
foreach ($db_types as $key => $value) {
echo "\t\t\t\t<option value=\"".$value."\"";
@ -50,9 +104,17 @@
echo ">".$value."</option>\n";
}
?>
</select></td></tr>
<tr><td class="add-text" style="padding: 10 0 0 2px;">Charset</td></tr>
<tr><td><select class="add-list" name="v_charset">
</select>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Charset
</td>
</tr>
<tr>
<td>
<select class="add-list" name="v_charset">
<option value=big5 <?php if ((!empty($v_charset)) && ( $v_charset == 'big5')) echo 'selected';?> >big5</option>
<option value=dec8 <?php if ((!empty($v_charset)) && ( $v_charset == 'dec8')) echo 'selected';?> >dec8</option>
<option value=cp850 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp850')) echo 'selected';?> >cp850</option>
@ -89,13 +151,17 @@
<option value=geostd8 <?php if ((!empty($v_charset)) && ( $v_charset == 'geostd8')) echo 'selected';?> >geostd8</option>
<option value=cp932 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp932')) echo 'selected';?> >cp932</option>
<option value=eucjpms <?php if ((!empty($v_charset)) && ( $v_charset == 'eucjpms')) echo 'selected';?> >eucjpms</option>
</td></tr>
<tr><td style="padding: 24px 0 0 0;">
<input type="submit" name="ok" value="OK" class="add-button"></form>
<input type="button" class="add-button" value="Cancel" onClick="location.href='/list/db/'">
</td></tr>
</select>
</td>
</tr>
<tr>
<td style="padding: 24px 0 0 0;">
<input type="submit" name="ok" value="OK" class="button">
<input type="button" class="button" value="Cancel" onclick="location.href='/list/db/'">
</td>
</tr>
</table>
</td>
</tr>
</table>
</tr>
</table>
</form>

View file

@ -1,4 +1,25 @@
<script type="text/javascript">
<table class="sub-menu" style="background: white;">
<tr>
<td style="padding: 12px 2px 16px 0;" ><a class="add-name"><b>Editing Database</b></a>
<?php
if (!empty($_SESSION['error_msg'])) {
echo "<a class=\"add-error\"> → ".$_SESSION['error_msg']."</a>";
} else {
if (!empty($_SESSION['ok_msg'])) {
echo "<a class=\"add-ok\"> → ".$_SESSION['ok_msg']."</a>";
}
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<form id="vstobjects" name="v_edit_db" method="post">
<script type="text/javascript">
function elementHideShow(elementToHideOrShow) {
var el = document.getElementById(elementToHideOrShow);
if (el.style.display == "block") {
@ -7,7 +28,6 @@
el.style.display = "block";
}
}
function randomString() {
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 10;
@ -16,13 +36,12 @@
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
document.v_add_user.v_password.value = randomstring;
document.v_edit_db.v_password.value = randomstring;
}
</script>
</script>
<table class='data'>
<tr class="data-add">
<table class='data'>
<tr class="data-add">
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
<table class="data-col1">
<tr><td style="padding: 24px 0 2px 4px;"><a class="data-date" ?><?php echo date("d M Y", strtotime($v_date))?></a></td></tr>
@ -31,28 +50,80 @@
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<table width="830px">
<tr>
<td></td>
</tr></table>
</tr>
</table>
<table class="data-col2" width="600px">
<form method="post" name="v_add_user">
<tr><td class="add-text" style="padding: 10 0 0 2px;">Database</td></tr>
<tr><td><input type="text" size="20" class="add-input" name="v_database" <?php if (!empty($v_database)) echo "value=".$v_database; ?> disabled></td></tr>
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Username</td></tr>
<tr><td></span><input type="text" size="20" class="add-input" name="v_dbuser" <?php if (!empty($v_dbuser)) echo "value=".$v_dbuser; ?> disabled></tr>
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Password <a href="javascript:randomString();" class="genpass">generate</a></td></tr>
<tr><td><input type="text" size="20" class="add-input" name="v_password" <?php if (!empty($v_password)) echo "value=".$v_password; ?>></td></tr>
<tr><td class="add-text" style="padding: 10 0 0 2px;">Type</td></tr>
<tr><td></span><input type="text" size="20" class="add-input" name="v_type" <?php if (!empty($v_type)) echo "value=".$v_type; ?> disabled></tr>
<tr><td class="add-text" style="padding: 10 0 0 2px;">Host</td></tr>
<tr><td></span><input type="text" size="20" class="add-input" name="v_host" <?php if (!empty($v_host)) echo "value=".$v_host; ?> disabled></tr>
<tr><td class="add-text" style="padding: 10 0 0 2px;">Charset</td></tr>
<tr><td></span><input type="text" size="20" class="add-input" name="v_charset" <?php if (!empty($v_charset)) echo "value=".$v_charset; ?> disabled></tr>
<tr><td style="padding: 24px 0 0 0;">
<input type="submit" name="save" value="Save" class="add-button"></form>
<input type="button" class="add-button" value="Cancel" onClick="location.href='/list/db/'">
</td></tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Database
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_database" <?php if (!empty($v_database)) echo "value=".$v_database; ?> disabled>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10px 0 0 2px;">
Username
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_dbuser" <?php if (!empty($v_dbuser)) echo "value=".$v_dbuser; ?> disabled>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10px 0 0 2px;">
Password <a href="javascript:randomString();" class="genpass">generate</a>
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_password" <?php if (!empty($v_password)) echo "value=".$v_password; ?>>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Type
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_type" <?php if (!empty($v_type)) echo "value=".$v_type; ?> disabled>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Host
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_host" <?php if (!empty($v_host)) echo "value=".$v_host; ?> disabled>
</td>
</tr>
<tr>
<td class="add-text" style="padding: 10 0 0 2px;">
Charset
</td>
</tr>
<tr>
<td>
<input type="text" size="20" class="add-input" name="v_charset" <?php if (!empty($v_charset)) echo "value=".$v_charset; ?> disabled>
</td>
</tr>
<tr>
<td style="padding: 24px 0 0 0;">
<input type="submit" name="save" value="Save" class="button">
<input type="button" class="button" value="Cancel" onclick="location.href='/list/db/'">
</td>
</tr>
</table>
</td>
</tr>
</table>
</tr>
</table>
</form>

View file

@ -1,8 +1,38 @@
<table class='data'>
<?php
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
foreach ($data as $key => $value) {
<table class="sub-menu" style="background: white;">
<tr>
<td style="padding: 12px 0 8px 6px">
<div style="float:left">
<button style="width:120px; padding: 2px 0px;" onclick="location.href='/add/db/'"> Add Database </button>
</div>
<div style="text-align: right; float: right;">
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;">
<button> Search </button>
</div>
<div style="float:left; padding-left: 26px;">
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
<select style="margin:0 2px 0 0px;" >
<option>apply to selected</option>
<option>rebuild</option>
<option>update counters</option>
<option>suspend</option>
<option>unsuspend</option>
<option>delete</option>
</select>
<button style="width:27px;"> </button>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<form id="vstobjects">
<table class='data'>
<?php
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$status = 'suspended';
@ -16,9 +46,7 @@ foreach ($data as $key => $value) {
if ($data[$key]['TYPE'] == 'pgsql') $db_admin = "phpPgAdmin";
if ($data[$key]['TYPE'] == 'pgsql') $db_admin_link = "http://".$http_host."/phpPgAdmin/";
?>
<tr class="data-row">
<tr class="data-row">
<script type="text/javascript">
$(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog({
@ -38,7 +66,6 @@ foreach ($data as $key => $value) {
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
$('#delete_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
@ -63,11 +90,11 @@ foreach ($data as $key => $value) {
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="object" ></td></tr>
<tr><td><a class="data-date" title="<?php echo $data[$key]['DATE']." ".$data[$key]['TIME'] ?>"><?php echo date("d M Y", strtotime($data[$key]['DATE'])) ?></td></tr>
<tr><td class="data-<?php echo $status ?>"><b><?php echo $status ?></b></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<table width="830px">
<tr>
<td></td>
<td class="data-controls" width="126px"><img src="/images/new_window.png" width="8px" height="8px"> <a href="<?php echo $db_admin_link; ?>" target="_blank"> open <?php echo $db_admin ?> </a></td>
<td class="data-controls" width="50px"><img src="/images/edit.png" width="8px" height="8px"><a href="/edit/db/?database=<?php echo $key ?>"> edit</a></td>
@ -85,43 +112,78 @@ foreach ($data as $key => $value) {
<p class="counter-value">Are you sure you want to delete <b><?php echo "$key" ?></b> database?</p>
</div>
</td>
</tr></table>
</tr>
</table>
<table class="data-col2" width="830px">
<tr><td colspan=3 class="domain" style="padding: 0 0 0 4px;"><b><?php echo $key ?></b></td></tr>
<tr>
<td colspan=3 class="domain" style="padding: 0 0 0 4px;">
<b><?php echo $key ?></b>
</td>
</tr>
<tr>
<td style="vertical-align:top;" >
<table>
<tr><td class="counter-name" style="padding: 2px 0 4px 2px">[<?php echo $data[$key]['TYPE'] ?>] database</td></tr>
<tr><td class="chart1" style="padding: 0px 0 0px 2px">Disk: <?php echo humanize_usage($data[$key]['U_DISK']) ?>
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;"><div style="width:<?php echo get_percentage($data[$key]['U_DISK'],$panel[$user]['DISK_QUOTA']) ?>%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div></div></td></tr>
<tr>
<td class="counter-name" style="padding: 2px 0 4px 2px">
[<?php echo $data[$key]['TYPE'] ?>] database
</td>
</tr>
<tr>
<td class="chart1" style="padding: 0px 0 0px 2px">Disk: <?php echo humanize_usage($data[$key]['U_DISK']) ?>
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;">
<div style="width:<?php echo get_percentage($data[$key]['U_DISK'],$panel[$user]['DISK_QUOTA']) ?>%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div>
</div>
</td>
</tr>
</table>
</td>
<td style="vertical-align:top;" width="250">
<table>
<tr><td class="counter-name">User: </td><td class="counter-value"><?php echo $data[$key]['DBUSER'] ?></td></tr>
<tr><td class="counter-name">Host: </td><td class="counter-value"><?php echo $data[$key]['HOST'] ?></td></tr>
<tr>
<td class="counter-name">
User:
</td>
<td class="counter-value">
<?php echo $data[$key]['DBUSER'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Host:
</td>
<td class="counter-value">
<?php echo $data[$key]['HOST'] ?>
</td>
</tr>
</table>
</td>
<td rowspan=4 style="vertical-align:top;" width="300">
<table>
<tr><td class="counter-name">Charset:</td><td class="counter-value"><?php echo $data[$key]['CHARSET'] ?></td></tr>
<tr>
<td class="counter-name">
Charset:
</td>
<td class="counter-value">
<?php echo $data[$key]['CHARSET'] ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</tr>
<?php
}
?>
</table>
<?php if ($i == 0) echo "<table class=\"data-null\"><tr><td></td></tr></table>"; ?>
<table class="data-count">
<tr>
<td>
}
?>
</table>
<?php if ($i == 0) echo "<table class=\"data-null\"><tr><td></td></tr></table>"; ?>
<table class="data-count">
<tr>
<td width="160px"></td>
<td>
<?php
if ( $i == 1) {
echo "1 database ";
@ -130,9 +192,10 @@ foreach ($data as $key => $value) {
}
?>
</td>
</tr>
</table>
</form>
<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:166px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:43px\"><tr><td></td></tr></table>"; ?>
</tr>
</table>
</form>
<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:166px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:43px\"><tr><td></td></tr></table>"; ?>

View file

@ -1,15 +0,0 @@
<table class="sub-menu">
<tr>
<td style="padding: 14px 0 24px 0;" ><a class="add-name"><b>Adding Database</b></a>
<?php
if (!empty($_SESSION['error_msg'])) {
echo "<a class=\"add-error\"> → ".$_SESSION['error_msg']."</a>";
} else {
if (!empty($_SESSION['ok_msg'])) {
echo "<a class=\"add-ok\"> → ".$_SESSION['ok_msg']."</a>";
}
}
?>
</td>
</tr>
</table>

View file

@ -1,41 +0,0 @@
<?php
if (!empty($_SESSION['error_msg'])) {
?>
<script type="text/javascript">
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-message" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>
<div id="dialog-message" title="Error">
<p><?php echo $_SESSION['error_msg'] ?>.</p>
</div>
<?php
unset($_SESSION['error_msg']);
}
?>
<table class="sub-menu">
<tr>
<td width="142px" style="padding: 16px 0 16px 6px">
<button style="width:120px; padding: 2px 0px 2px 0px;" onclick="location.href='/add/db/'">Add Database</button>
<td><a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
<select style="margin:0 0 0 0px">
<option>apply to selected</option>
<option>rebuild</option>
<option>suspend</option>
<option>unsuspend</option>
<option>delete</option>
</select> <button> > </button></td>
</td>
<td style="text-align: right;"><input type="text" size="30" style="padding: 3px 80px 3px 0;"> <button> Search </button></td>
</tr><tr>
</tr>
</table>
<form id="vstobjects">

View file

@ -1,15 +0,0 @@
<table class="sub-menu">
<tr>
<td style="padding: 14px 0 24px 0;" ><a class="add-name"><b>Editing Database</b></a>
<?php
if (!empty($_SESSION['error_msg'])) {
echo "<a class=\"add-error\"> → ".$_SESSION['error_msg']."</a>";
} else {
if (!empty($_SESSION['ok_msg'])) {
echo "<a class=\"add-ok\"> → ".$_SESSION['ok_msg']."</a>";
}
}
?>
</td>
</tr>
</table>

View file

@ -1,8 +1,38 @@
<table class='data'>
<?php
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
foreach ($data as $key => $value) {
<table class="sub-menu" style="background: white;">
<tr>
<td style="padding: 12px 0 8px 6px">
<div style="float:left">
<button style="width:120px; padding: 2px 0px;" onclick="location.href='/add/db/'"> Add Database </button>
</div>
<div style="text-align: right; float: right;">
<input type="text" size="30" style="padding: 3px 80px 3px 0; margin: 0 2px 0 0;">
<button> Search </button>
</div>
<div style="float:left; padding-left: 26px;">
<a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
<select style="margin:0 2px 0 0px;" >
<option>apply to selected</option>
<option>rebuild</option>
<option>update counters</option>
<option>suspend</option>
<option>unsuspend</option>
<option>delete</option>
</select>
<button style="width:27px;"> </button>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<form id="vstobjects">
<table class='data'>
<?php
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$status = 'suspended';
@ -11,16 +41,31 @@ foreach ($data as $key => $value) {
$status = 'active';
$spnd_action = 'suspend' ;
}
if ($data[$key]['TYPE'] == 'mysql') $db_admin = "phpMyAdmin";
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpMyAdmin/";
if ($data[$key]['TYPE'] == 'pgsql') $db_admin = "phpPgAdmin";
if ($data[$key]['TYPE'] == 'pgsql') $db_admin_link = "http://".$http_host."/phpPgAdmin/";
?>
<tr class="data-row">
<tr class="data-row">
<script type="text/javascript">
$(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/<?php echo $spnd_action ?>/db/?database=<?php echo "$key" ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#<?php echo $spnd_action ?>_link_<?php echo "$i" ?>').click(function(){
$('#<?php echo $spnd_action ?>_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
$('#delete_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
@ -45,13 +90,13 @@ foreach ($data as $key => $value) {
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="object" ></td></tr>
<tr><td><a class="data-date" title="<?php echo $data[$key]['DATE']." ".$data[$key]['TIME'] ?>"><?php echo date("d M Y", strtotime($data[$key]['DATE'])) ?></td></tr>
<tr><td class="data-<?php echo $status ?>"><b><?php echo $status ?></b></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<table width="830px">
<tr>
<td></td>
<td class="data-controls" width="120px"><img src="/images/new_window.png" width="8px" height="8px"> <a href="<?php echo $db_admin_link; ?>" target="_blank"> open web admin</a></td>
<td class="data-controls" width="126px"><img src="/images/new_window.png" width="8px" height="8px"> <a href="<?php echo $db_admin_link; ?>" target="_blank"> open <?php echo $db_admin ?> </a></td>
<td class="data-controls" width="50px"><img src="/images/edit.png" width="8px" height="8px"><a href="/edit/db/?database=<?php echo $key ?>"> edit</a></td>
<td class="data-controls" width="70px">
<img src="/images/delete.png" width="7px" height="7px">
@ -60,43 +105,78 @@ foreach ($data as $key => $value) {
<p class="counter-value">Are you sure you want to delete <b><?php echo "$key" ?></b> database?</p>
</div>
</td>
</tr></table>
</tr>
</table>
<table class="data-col2" width="830px">
<tr><td colspan=3 class="domain" style="padding: 0 0 0 4px;"><b><?php echo $key ?></b></td></tr>
<tr>
<td colspan=3 class="domain" style="padding: 0 0 0 4px;">
<b><?php echo $key ?></b>
</td>
</tr>
<tr>
<td style="vertical-align:top;" >
<table>
<tr><td class="counter-name" style="padding: 2px 0 4px 2px">[<?php echo $data[$key]['TYPE'] ?>] database</td></tr>
<tr><td class="chart1" style="padding: 0px 0 0px 2px">Disk: <?php echo humanize_usage($data[$key]['U_DISK']) ?>
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;"><div style="width:<?php echo get_percentage($data[$key]['U_DISK'],$panel[$user]['DISK_QUOTA']) ?>%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div></div></td></tr>
<tr>
<td class="counter-name" style="padding: 2px 0 4px 2px">
[<?php echo $data[$key]['TYPE'] ?>] database
</td>
</tr>
<tr>
<td class="chart1" style="padding: 0px 0 0px 2px">Disk: <?php echo humanize_usage($data[$key]['U_DISK']) ?>
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;">
<div style="width:<?php echo get_percentage($data[$key]['U_DISK'],$panel[$user]['DISK_QUOTA']) ?>%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div>
</div>
</td>
</tr>
</table>
</td>
<td style="vertical-align:top;" width="250">
<table>
<tr><td class="counter-name">User: </td><td class="counter-value"><?php echo $data[$key]['DBUSER'] ?></td></tr>
<tr><td class="counter-name">Host: </td><td class="counter-value"><?php echo $data[$key]['HOST'] ?></td></tr>
<tr>
<td class="counter-name">
User:
</td>
<td class="counter-value">
<?php echo $data[$key]['DBUSER'] ?>
</td>
</tr>
<tr>
<td class="counter-name">
Host:
</td>
<td class="counter-value">
<?php echo $data[$key]['HOST'] ?>
</td>
</tr>
</table>
</td>
<td rowspan=4 style="vertical-align:top;" width="300">
<table>
<tr><td class="counter-name">Charset:</td><td class="counter-value"><?php echo $data[$key]['CHARSET'] ?></td></tr>
<tr>
<td class="counter-name">
Charset:
</td>
<td class="counter-value">
<?php echo $data[$key]['CHARSET'] ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</tr>
<?php
}
?>
</table>
<?php if ($i == 0) echo "<table class=\"data-null\"><tr><td></td></tr></table>"; ?>
<table class="data-count">
<tr>
<td>
}
?>
</table>
<?php if ($i == 0) echo "<table class=\"data-null\"><tr><td></td></tr></table>"; ?>
<table class="data-count">
<tr>
<td width="160px"></td>
<td>
<?php
if ( $i == 1) {
echo "1 database ";
@ -105,9 +185,10 @@ foreach ($data as $key => $value) {
}
?>
</td>
</tr>
</table>
</form>
<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:166px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:43px\"><tr><td></td></tr></table>"; ?>
</tr>
</table>
</form>
<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:166px\"><tr><td></td></tr></table>"; ?>
<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:43px\"><tr><td></td></tr></table>"; ?>

View file

@ -1,15 +0,0 @@
<table class="sub-menu">
<tr>
<td width="142px" style="padding: 16px 0 16px 6px">
<button style="width:120px; padding: 2px 0px 2px 0px;" onclick="location.href='/add/db/'">Add Database</button>
<td><a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
<select style="margin:0 0 0 0px">
<option>apply to selected</option>
<option>delete</option>
</select> <button> > </button></td>
</td>
<td style="text-align: right;"><input type="text" size="30" style="padding: 3px 80px 3px 0;"> <button> Search </button></td>
</tr><tr>
</tr>
</table>
<form id="vstobjects">