Skip to content

Commit 650c3f8

Browse files
committed
user package listing
1 parent 29d115b commit 650c3f8

File tree

12 files changed

+167
-30
lines changed

12 files changed

+167
-30
lines changed

bin/v_list_user_packages

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ shell_list_pkgs() {
7171
#----------------------------------------------------------#
7272

7373
# Defining fields
74-
fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
75-
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
76-
$BANDWIDTH $NS $SHELL $BACKUPS'
74+
fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES $DNS_DOMAINS $DNS_RECORDS
75+
$MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES $CRON_JOBS $DISK_QUOTA $BANDWIDTH
76+
$NS $SHELL $BACKUPS $TIME $DATE'
7777

7878
# Listing domains
7979
case $format in

data/packages/default.pkg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ BANDWIDTH='100000'
1212
NS='ns1.localhost,ns2.localhost'
1313
SHELL='nologin'
1414
BACKUPS='3'
15+
TIME='11:31:29'
16+
DATE='2012-07-26'

data/packages/gainsboro.pkg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ BANDWIDTH='10000'
1212
NS='ns1.localhost,ns2.localhost'
1313
SHELL='nologin'
1414
BACKUPS='1'
15+
TIME='11:31:30'
16+
DATE='2012-07-26'

data/packages/palegreen.pkg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ BANDWIDTH='50000'
1212
NS='ns1.localhost,ns2.localhost'
1313
SHELL='nologin'
1414
BACKUPS='5'
15+
TIME='11:31:31'
16+
DATE='2012-07-26'

data/packages/slategrey.pkg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ BANDWIDTH='100000'
1212
NS='ns1.localhost,ns2.localhost'
1313
SHELL='nologin'
1414
BACKUPS='3'
15+
TIME='11:31:32'
16+
DATE='2012-07-26'

func/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ gen_password() {
122122
# Package existance check
123123
is_package_valid() {
124124
if [ ! -e "$VESTA/data/packages/$package.pkg" ]; then
125-
echo "Error: $package is not exist"
125+
echo "Error: package $package not exist"
126126
log_event "$E_NOTEXIST $EVENT"
127127
exit $E_NOTEXIST
128128
fi

web/images/reload.png

215 Bytes
Loading

web/images/update.png

243 Bytes
Loading

web/list/packages/index.php

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
<?php
2+
// Init
3+
error_reporting(NULL);
24
session_start();
5+
$TAB = 'PACKAGES';
6+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
37

4-
// Check user
5-
if (!isset($_SESSION['user'])) {
6-
header("Location: /login/");
7-
}
8+
// Header
9+
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
810

9-
// Set vairables
10-
date_default_timezone_set('UTC');
11-
$user = $_SESSION['user'];
12-
$vesta_cmd="/usr/bin/sudo /usr/local/vesta/bin/";
13-
$TAB = 'PACKAGES';
11+
// Panel
12+
top_panel($user,$TAB);
1413

15-
// Define functions
16-
require_once '../../inc/main.php';
14+
// Data
15+
if ($_SESSION['user'] == 'admin') {
1716

18-
// Header
19-
require_once '../../templates/header.html';
17+
exec (VESTA_CMD."v_list_user_packages json", $output, $return_var);
18+
check_error($return_var);
19+
$data = json_decode(implode('', $output), true);
20+
$data = array_reverse($data);
21+
unset($output);
2022

21-
// Top Menu
22-
$command = "$vesta_cmd"."v_list_user '".$_SESSION['user']."' 'json'";
23-
exec ($command, $output, $return_var);
24-
if ( $return_var > 0 ) {
25-
header("Location: /error/");
26-
}
27-
$panel = json_decode(implode('', $output), true);
28-
if ( $_SESSION['user'] == 'admin' ) {
29-
require_once '../../templates/admin/panel.html';
30-
} else {
31-
require_once '../../templates/header.html';
23+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_packages.html');
24+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_packages.html');
3225
}
3326

34-
require_once '../../templates/footer.html';
27+
// Footer
28+
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<table class='data'>
2+
3+
<?php
4+
foreach ($data as $key => $value) {
5+
++$i;
6+
?>
7+
8+
<tr class="data-row">
9+
<script type="text/javascript">
10+
$(function(){
11+
$('#delete_dialog_<?php echo "$i" ?>').dialog({
12+
modal: true,
13+
autoOpen: false,
14+
width: 360,
15+
buttons: {
16+
"Ok": function(event, ui) {
17+
location.href = '/delete/package/?package=<?php echo $key; ?>';
18+
},
19+
"Cancel": function() {
20+
$(this).dialog("close");
21+
}
22+
}
23+
});
24+
$('#delete_link_<?php echo "$i" ?>').click(function(){
25+
$('#delete_dialog_<?php echo "$i" ?>').dialog('open');
26+
return false;
27+
});
28+
});
29+
</script>
30+
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
31+
<table class="data-col1">
32+
<tr><td style="padding: 18 0 4 18;"><input type="checkbox" name="object" ></td></tr>
33+
<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>
34+
<tr><td class="data-active"><b>active</b></td></tr>
35+
</table>
36+
</td>
37+
<td class="data-dotted" width="830px" style="vertical-align:top;">
38+
<table width="830px"><tr>
39+
<td></td>
40+
<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>
41+
<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>
42+
<td class="data-controls" width="70px">
43+
<img src="/images/delete.png" width="7px" height="7px">
44+
<a href="#" id="delete_link_<?php echo $i ?>"> delete</a>
45+
<div id="delete_dialog_<?php echo $i ?>" title="Confirmation">
46+
<p class="counter-value">Are you sure you want to delete <?php echo $key?> package?</p>
47+
</div>
48+
</td>
49+
</tr></table>
50+
51+
<table class="data-col2" width="830px">
52+
<tr><td colspan=3 class="username" style="padding: 10 0 0 4px;"><b><?php echo $key?></b></td></tr>
53+
<td style="vertical-align:top;" >
54+
<table>
55+
<tr><td class="counter-name" style="padding: 4px 0px 0px 0;" width="68%">Defaul Template:</td>
56+
<td class="counter-value" style="padding: 4px 0px 0px 0;"><?php echo $data[$key]['TEMPLATE'] ?></td></tr>
57+
<tr><td class="counter-name" style="padding: 0px 0px 6px 0;"> System Shell:</td>
58+
<td class="counter-value"><?php echo $data[$key]['SHELL'] ?></td></tr>
59+
60+
<tr><td class="chart1" colspan=2 style="padding: 0 0 0 2px;">Bandwidth: <?php echo humanize_usage($data[$key]['BANDWIDTH']) ?>
61+
<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>
62+
<tr><td class="chart1" colspan=2 style="padding: 0 0 0 2px;">Disk: <?php echo humanize_usage($data[$key]['DISK_QUOTA']) ?>
63+
<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>
64+
</table>
65+
</td>
66+
<td style="vertical-align:top;" width="320">
67+
<table width="300">
68+
<tr><td class="counter-name" width="37%">Web Domains:</td>
69+
<td class="counter-value"><?php echo $data[$key]['WEB_DOMAINS'] ?></td></tr>
70+
<tr><td class="counter-name">Web Aliases:</td>
71+
<td class="counter-value"><?php echo $data[$key]['WEB_ALIASES'] ?> per domain</td></tr>
72+
<tr><td class="counter-name">Dns Domains:</td>
73+
<td class="counter-value"><?php echo $data[$key]['DNS_DOMAINS'] ?></td></tr>
74+
<tr><td class="counter-name">Dns Records:</td>
75+
<td class="counter-value"><?php echo $data[$key]['DNS_RECORDS'] ?> per domain</td></tr>
76+
<tr><td class="counter-name">Name Servers:</td>
77+
<td class="counter-value"><?php echo str_replace(',', ', ',$data[$key]['NS']) ?></td></tr>
78+
</table></td>
79+
<td style="vertical-align:top;" width="250">
80+
<table class="data-col4" width="250">
81+
<tr><td class="counter-name" width="43%">Mail Domains:</td>
82+
<td class="counter-value"><?php echo $data[$key]['MAIL_DOMAINS'] ?></td></tr>
83+
<tr><td class="counter-name">Mail Accounts:</td>
84+
<td class="counter-value"><?php echo $data[$key]['MAIL_ACCOUNTS'] ?> per domain</td></tr>
85+
<tr><td class="counter-name">Databases:</td>
86+
<td class="counter-value"><?php echo $data[$key]['DATABASES'] ?></td></tr>
87+
<tr><td class="counter-name">Cron Jobs:</td>
88+
<td class="counter-value"><?php echo $data[$key]['CRON_JOBS'] ?></td></tr>
89+
<tr><td class="counter-name">Backups:</td>
90+
<td class="counter-value"><?php echo $data[$key]['BACKUPS'] ?></td></tr>
91+
</table>
92+
</td>
93+
</tr>
94+
</table>
95+
</td>
96+
</tr>
97+
98+
<?php
99+
}
100+
?>
101+
</table>
102+
<?php if ($i == 0) echo "<table class=\"data-null\"><tr><td></td></tr></table>"; ?>
103+
104+
<table class="data-count">
105+
<tr>
106+
<td>
107+
<?php
108+
if ( $i == 1) {
109+
echo "1 month ";
110+
} else {
111+
echo "$i months ";
112+
}
113+
?>
114+
listed</td>
115+
</tr>
116+
</table>
117+
<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
118+
<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:123px\"><tr><td></td></tr></table>"; ?>

0 commit comments

Comments
 (0)