user package listing

This commit is contained in:
Serghey Rodin 2012-07-26 23:14:58 +03:00
commit 650c3f8507
12 changed files with 168 additions and 31 deletions

View file

@ -71,9 +71,9 @@ shell_list_pkgs() {
#----------------------------------------------------------# #----------------------------------------------------------#
# Defining fields # Defining fields
fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH
$BANDWIDTH $NS $SHELL $BACKUPS' $NS $SHELL $BACKUPS $TIME $DATE'
# Listing domains # Listing domains
case $format in case $format in

View file

@ -12,3 +12,5 @@ BANDWIDTH='100000'
NS='ns1.localhost,ns2.localhost' NS='ns1.localhost,ns2.localhost'
SHELL='nologin' SHELL='nologin'
BACKUPS='3' BACKUPS='3'
TIME='11:31:29'
DATE='2012-07-26'

View file

@ -12,3 +12,5 @@ BANDWIDTH='10000'
NS='ns1.localhost,ns2.localhost' NS='ns1.localhost,ns2.localhost'
SHELL='nologin' SHELL='nologin'
BACKUPS='1' BACKUPS='1'
TIME='11:31:30'
DATE='2012-07-26'

View file

@ -12,3 +12,5 @@ BANDWIDTH='50000'
NS='ns1.localhost,ns2.localhost' NS='ns1.localhost,ns2.localhost'
SHELL='nologin' SHELL='nologin'
BACKUPS='5' BACKUPS='5'
TIME='11:31:31'
DATE='2012-07-26'

View file

@ -12,3 +12,5 @@ BANDWIDTH='100000'
NS='ns1.localhost,ns2.localhost' NS='ns1.localhost,ns2.localhost'
SHELL='nologin' SHELL='nologin'
BACKUPS='3' BACKUPS='3'
TIME='11:31:32'
DATE='2012-07-26'

View file

@ -122,7 +122,7 @@ gen_password() {
# Package existance check # Package existance check
is_package_valid() { is_package_valid() {
if [ ! -e "$VESTA/data/packages/$package.pkg" ]; then if [ ! -e "$VESTA/data/packages/$package.pkg" ]; then
echo "Error: $package is not exist" echo "Error: package $package not exist"
log_event "$E_NOTEXIST $EVENT" log_event "$E_NOTEXIST $EVENT"
exit $E_NOTEXIST exit $E_NOTEXIST
fi fi

BIN
web/images/reload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

BIN
web/images/update.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

View file

@ -1,34 +1,28 @@
<?php <?php
// Init
error_reporting(NULL);
session_start(); session_start();
// Check user
if (!isset($_SESSION['user'])) {
header("Location: /login/");
}
// Set vairables
date_default_timezone_set('UTC');
$user = $_SESSION['user'];
$vesta_cmd="/usr/bin/sudo /usr/local/vesta/bin/";
$TAB = 'PACKAGES'; $TAB = 'PACKAGES';
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Define functions
require_once '../../inc/main.php';
// Header // Header
require_once '../../templates/header.html'; include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Top Menu // Panel
$command = "$vesta_cmd"."v_list_user '".$_SESSION['user']."' 'json'"; top_panel($user,$TAB);
exec ($command, $output, $return_var);
if ( $return_var > 0 ) { // Data
header("Location: /error/"); if ($_SESSION['user'] == 'admin') {
}
$panel = json_decode(implode('', $output), true); exec (VESTA_CMD."v_list_user_packages json", $output, $return_var);
if ( $_SESSION['user'] == 'admin' ) { check_error($return_var);
require_once '../../templates/admin/panel.html'; $data = json_decode(implode('', $output), true);
} else { $data = array_reverse($data);
require_once '../../templates/header.html'; unset($output);
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_packages.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_packages.html');
} }
require_once '../../templates/footer.html'; // Footer
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

View file

@ -0,0 +1,118 @@
<table class='data'>
<?php
foreach ($data as $key => $value) {
++$i;
?>
<tr class="data-row">
<script type="text/javascript">
$(function(){
$('#delete_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/delete/package/?package=<?php echo $key; ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#delete_link_<?php echo "$i" ?>').click(function(){
$('#delete_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
});
</script>
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
<table class="data-col1">
<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-active"><b>active</b></td></tr>
</table>
</td>
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<td></td>
<td class="data-controls" width="84px"><img src="/images/update.png" width="8px" height="8px"><a href="/propagate/package/?package=<?php echo $key ?>"> propagate</a></td>
<td class="data-controls" width="50px"><img src="/images/edit.png" width="8px" height="8px"><a href="/edit/package/?package=<?php echo $key ?>"> edit</a></td>
<td class="data-controls" width="70px">
<img src="/images/delete.png" width="7px" height="7px">
<a href="#" id="delete_link_<?php echo $i ?>"> delete</a>
<div id="delete_dialog_<?php echo $i ?>" title="Confirmation">
<p class="counter-value">Are you sure you want to delete <?php echo $key?> package?</p>
</div>
</td>
</tr></table>
<table class="data-col2" width="830px">
<tr><td colspan=3 class="username" style="padding: 10 0 0 4px;"><b><?php echo $key?></b></td></tr>
<td style="vertical-align:top;" >
<table>
<tr><td class="counter-name" style="padding: 4px 0px 0px 0;" width="68%">Defaul Template:</td>
<td class="counter-value" style="padding: 4px 0px 0px 0;"><?php echo $data[$key]['TEMPLATE'] ?></td></tr>
<tr><td class="counter-name" style="padding: 0px 0px 6px 0;"> System Shell:</td>
<td class="counter-value"><?php echo $data[$key]['SHELL'] ?></td></tr>
<tr><td class="chart1" colspan=2 style="padding: 0 0 0 2px;">Bandwidth: <?php echo humanize_usage($data[$key]['BANDWIDTH']) ?>
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;"><div style="width:100%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div></div></td></tr>
<tr><td class="chart1" colspan=2 style="padding: 0 0 0 2px;">Disk: <?php echo humanize_usage($data[$key]['DISK_QUOTA']) ?>
<div style="width:160px; height:6px; font-size:0;background-color:#c7d5b3;"><div style="width:100%; height:6px; background-color:#9bbb62; border-right:1px #9bbb62 solid;"></div></div></td></tr>
</table>
</td>
<td style="vertical-align:top;" width="320">
<table width="300">
<tr><td class="counter-name" width="37%">Web Domains:</td>
<td class="counter-value"><?php echo $data[$key]['WEB_DOMAINS'] ?></td></tr>
<tr><td class="counter-name">Web Aliases:</td>
<td class="counter-value"><?php echo $data[$key]['WEB_ALIASES'] ?> per domain</td></tr>
<tr><td class="counter-name">Dns Domains:</td>
<td class="counter-value"><?php echo $data[$key]['DNS_DOMAINS'] ?></td></tr>
<tr><td class="counter-name">Dns Records:</td>
<td class="counter-value"><?php echo $data[$key]['DNS_RECORDS'] ?> per domain</td></tr>
<tr><td class="counter-name">Name Servers:</td>
<td class="counter-value"><?php echo str_replace(',', ', ',$data[$key]['NS']) ?></td></tr>
</table></td>
<td style="vertical-align:top;" width="250">
<table class="data-col4" width="250">
<tr><td class="counter-name" width="43%">Mail Domains:</td>
<td class="counter-value"><?php echo $data[$key]['MAIL_DOMAINS'] ?></td></tr>
<tr><td class="counter-name">Mail Accounts:</td>
<td class="counter-value"><?php echo $data[$key]['MAIL_ACCOUNTS'] ?> per domain</td></tr>
<tr><td class="counter-name">Databases:</td>
<td class="counter-value"><?php echo $data[$key]['DATABASES'] ?></td></tr>
<tr><td class="counter-name">Cron Jobs:</td>
<td class="counter-value"><?php echo $data[$key]['CRON_JOBS'] ?></td></tr>
<tr><td class="counter-name">Backups:</td>
<td class="counter-value"><?php echo $data[$key]['BACKUPS'] ?></td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<?php
}
?>
</table>
<?php if ($i == 0) echo "<table class=\"data-null\"><tr><td></td></tr></table>"; ?>
<table class="data-count">
<tr>
<td>
<?php
if ( $i == 1) {
echo "1 month ";
} else {
echo "$i months ";
}
?>
listed</td>
</tr>
</table>
<?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:123px\"><tr><td></td></tr></table>"; ?>

View file

@ -0,0 +1,16 @@
<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/user/'">Add Package</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>propagate again</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

@ -2,9 +2,10 @@
<table class="top"> <table class="top">
<tr> <tr>
<td width="196px"><p class="hostname"><?php echo exec('hostname') ?></p></td> <td width="196px"><p class="hostname"><?php echo exec('hostname') ?></p></td>
<td width="88px"><b><a class="top-<?php if($TAB == 'PACKAGES' ) echo 's' ?>link" href="/list/packages/">Packages </a></b></td>
<td width="100px"><b><a class="top-<?php if($TAB == 'IP' ) echo 's' ?>link" href="/list/ip/">IP Adresses </a></b></td> <td width="100px"><b><a class="top-<?php if($TAB == 'IP' ) echo 's' ?>link" href="/list/ip/">IP Adresses </a></b></td>
<td width="110px"><b><a class="top-<?php if($TAB == 'RRD' ) echo 's' ?>link" href="/list/rrd/">RRD Graphics</a></b></td> <td width="110px"><b><a class="top-<?php if($TAB == 'RRD' ) echo 's' ?>link" href="/list/rrd/">RRD Graphics</a></b></td>
<td width="76px"><b><a class="top-<?php if($TAB == 'STATS' ) echo 's' ?>link" href="/list/stats/">Statistics</a></b></td> <td width="78px"><b><a class="top-<?php if($TAB == 'STATS' ) echo 's' ?>link" href="/list/stats/">Statistics</a></b></td>
<td width="90px"><b><a class="top-<?php if($TAB == 'LOG' ) echo 's' ?>link" href="/list/log/">History Log</a></b></td> <td width="90px"><b><a class="top-<?php if($TAB == 'LOG' ) echo 's' ?>link" href="/list/log/">History Log</a></b></td>
<td></td> <td></td>
<td width="260px"><b><?php if($user != $_SESSION['user']) echo 'admin / ' ?><?php echo $user ?></b><a class="top-link" style="padding: 0 0 0 6" href="/logout/">Log out</a></td> <td width="260px"><b><?php if($user != $_SESSION['user']) echo 'admin / ' ?><?php echo $user ?></b><a class="top-link" style="padding: 0 0 0 6" href="/logout/">Log out</a></td>