Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Guilherme Filippo
ISPConfig 3
Commits
dfd4b8b8
Commit
dfd4b8b8
authored
Jul 03, 2013
by
Falko Timme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added website quota dashlet.
parent
6193781f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
1 deletion
+162
-1
interface/web/dashboard/dashboard.php
interface/web/dashboard/dashboard.php
+1
-1
interface/web/dashboard/dashlets/quota.php
interface/web/dashboard/dashlets/quota.php
+116
-0
interface/web/dashboard/dashlets/templates/quota.htm
interface/web/dashboard/dashlets/templates/quota.htm
+29
-0
interface/web/dashboard/lib/lang/de_dashlet_quota.lng
interface/web/dashboard/lib/lang/de_dashlet_quota.lng
+8
-0
interface/web/dashboard/lib/lang/en_dashlet_quota.lng
interface/web/dashboard/lib/lang/en_dashlet_quota.lng
+8
-0
No files found.
interface/web/dashboard/dashboard.php
View file @
dfd4b8b8
...
...
@@ -157,7 +157,7 @@ while ($file = @readdir ($handle)) {
/* Which dashlets in which column */
/******************************************************************************/
$leftcol_dashlets
=
array
(
'modules'
,
'invoices'
);
$leftcol_dashlets
=
array
(
'modules'
,
'invoices'
,
'quota'
);
$rightcol_dashlets
=
array
(
'limits'
);
/******************************************************************************/
...
...
interface/web/dashboard/dashlets/quota.php
0 → 100644
View file @
dfd4b8b8
<?php
class
dashlet_quota
{
function
show
()
{
global
$app
,
$conf
;
//* Loading Template
$app
->
uses
(
'tpl'
);
$tpl
=
new
tpl
;
$tpl
->
newTemplate
(
"dashlets/templates/quota.htm"
);
$wb
=
array
();
$lng_file
=
'lib/lang/'
.
$_SESSION
[
's'
][
'language'
]
.
'_dashlet_quota.lng'
;
if
(
is_file
(
$lng_file
))
include
(
$lng_file
);
$tpl
->
setVar
(
$wb
);
$tmp_rec
=
$app
->
db
->
queryAllRecords
(
"SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC"
);
$monitor_data
=
array
();
if
(
is_array
(
$tmp_rec
))
{
foreach
(
$tmp_rec
as
$tmp_mon
)
{
$monitor_data
=
array_merge_recursive
(
$monitor_data
,
unserialize
(
$app
->
db
->
unquote
(
$tmp_mon
[
'data'
])));
}
}
//print_r($monitor_data);
if
(
$_SESSION
[
"s"
][
"user"
][
"typ"
]
!=
'admin'
){
$sql_where
=
" AND sys_groupid = "
.
$_SESSION
[
's'
][
'user'
][
'default_group'
];
}
$has_quota
=
false
;
// select websites belonging to client
$sites
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM web_domain WHERE active = 'y'"
.
$sql_where
);
//print_r($sites);
if
(
is_array
(
$sites
)
&&
!
empty
(
$sites
)){
for
(
$i
=
0
;
$i
<
sizeof
(
$sites
);
$i
++
){
$username
=
$sites
[
$i
][
'system_user'
];
$sites
[
$i
][
'used'
]
=
$monitor_data
[
'user'
][
$username
][
'used'
];
$sites
[
$i
][
'soft'
]
=
$monitor_data
[
'user'
][
$username
][
'soft'
];
$sites
[
$i
][
'hard'
]
=
$monitor_data
[
'user'
][
$username
][
'hard'
];
$sites
[
$i
][
'files'
]
=
$monitor_data
[
'user'
][
$username
][
'files'
];
if
(
!
is_numeric
(
$sites
[
$i
][
'used'
])){
if
(
$sites
[
$i
][
'used'
][
0
]
>
$sites
[
$i
][
'used'
][
1
]){
$sites
[
$i
][
'used'
]
=
$sites
[
$i
][
'used'
][
0
];
}
else
{
$sites
[
$i
][
'used'
]
=
$sites
[
$i
][
'used'
][
1
];
}
}
if
(
!
is_numeric
(
$sites
[
$i
][
'soft'
]))
$sites
[
$i
][
'soft'
]
=
$sites
[
$i
][
'soft'
][
1
];
if
(
!
is_numeric
(
$sites
[
$i
][
'hard'
]))
$sites
[
$i
][
'hard'
]
=
$sites
[
$i
][
'hard'
][
1
];
if
(
!
is_numeric
(
$sites
[
$i
][
'files'
]))
$sites
[
$i
][
'files'
]
=
$sites
[
$i
][
'files'
][
1
];
// colours
$sites
[
$i
][
'display_colour'
]
=
'#000000'
;
if
(
$sites
[
$i
][
'soft'
]
>
0
){
$used_ratio
=
$sites
[
$i
][
'used'
]
/
$sites
[
$i
][
'soft'
];
}
else
{
$used_ratio
=
0
;
}
if
(
$used_ratio
>=
0.8
)
$sites
[
$i
][
'display_colour'
]
=
'#fd934f'
;
if
(
$used_ratio
>=
1
)
$sites
[
$i
][
'display_colour'
]
=
'#cc0000'
;
if
(
$sites
[
$i
][
'used'
]
>
1024
)
{
$sites
[
$i
][
'used'
]
=
round
(
$sites
[
$i
][
'used'
]
/
1024
,
2
)
.
' MB'
;
}
else
{
if
(
$sites
[
$i
][
'used'
]
!=
''
)
$sites
[
$i
][
'used'
]
.
=
' KB'
;
}
if
(
$sites
[
$i
][
'soft'
]
>
1024
)
{
$sites
[
$i
][
'soft'
]
=
round
(
$sites
[
$i
][
'soft'
]
/
1024
,
2
)
.
' MB'
;
}
else
{
$sites
[
$i
][
'soft'
]
.
=
' KB'
;
}
if
(
$sites
[
$i
][
'hard'
]
>
1024
)
{
$sites
[
$i
][
'hard'
]
=
round
(
$sites
[
$i
][
'hard'
]
/
1024
,
2
)
.
' MB'
;
}
else
{
$sites
[
$i
][
'hard'
]
.
=
' KB'
;
}
if
(
$sites
[
$i
][
'soft'
]
==
" KB"
)
$sites
[
$i
][
'soft'
]
=
$app
->
lng
(
'unlimited'
);
if
(
$sites
[
$i
][
'hard'
]
==
" KB"
)
$sites
[
$i
][
'hard'
]
=
$app
->
lng
(
'unlimited'
);
/*
if(!strstr($sites[$i]['used'],'M') && !strstr($sites[$i]['used'],'K')) $sites[$i]['used'].= ' B';
if(!strstr($sites[$i]['soft'],'M') && !strstr($sites[$i]['soft'],'K')) $sites[$i]['soft'].= ' B';
if(!strstr($sites[$i]['hard'],'M') && !strstr($sites[$i]['hard'],'K')) $sites[$i]['hard'].= ' B';
*/
if
(
$sites
[
$i
][
'soft'
]
==
'0 B'
||
$sites
[
$i
][
'soft'
]
==
'0 KB'
||
$sites
[
$i
][
'soft'
]
==
'0'
)
$sites
[
$i
][
'soft'
]
=
$app
->
lng
(
'unlimited'
);
if
(
$sites
[
$i
][
'hard'
]
==
'0 B'
||
$sites
[
$i
][
'hard'
]
==
'0 KB'
||
$sites
[
$i
][
'hard'
]
==
'0'
)
$sites
[
$i
][
'hard'
]
=
$app
->
lng
(
'unlimited'
);
}
$has_quota
=
true
;
$tpl
->
setloop
(
'quota'
,
$sites
);
}
//print_r($sites);
$tpl
->
setVar
(
'has_quota'
,
$has_quota
);
return
$tpl
->
grab
();
}
}
?>
\ No newline at end of file
interface/web/dashboard/dashlets/templates/quota.htm
0 → 100644
View file @
dfd4b8b8
<div
style=
"float: left;"
>
<h2>
{tmpl_var name='quota_txt'}
</h2>
<div
style=
"width:320px;"
>
<table
class=
"list"
>
<thead>
<tr>
<td>
{tmpl_var name='domain_txt'}
</td>
<td>
{tmpl_var name='used_txt'}
</td>
<td>
{tmpl_var name='soft_txt'}
</td>
<td>
{tmpl_var name='hard_txt'}
</td>
</tr>
</thead>
<tmpl_if
name=
"has_quota"
>
<tmpl_loop
name=
'quota'
>
<tr
class=
"tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"
>
<td
style=
"color:{tmpl_var name='display_colour'}"
>
{tmpl_var name='domain'}
</td>
<td
style=
"color:{tmpl_var name='display_colour'}"
>
{tmpl_var name='used'}
</td>
<td
style=
"color:{tmpl_var name='display_colour'}"
>
{tmpl_var name='soft'}
</td>
<td
style=
"color:{tmpl_var name='display_colour'}"
>
{tmpl_var name='hard'}
</td>
</tr>
</tmpl_loop>
<tmpl_else>
<tr>
<td
colspan=
"4"
style=
"text-align:center;"
>
{tmpl_var name='no_sites_txt'}
</td>
</tr>
</tmpl_if>
</table>
</div>
</div>
\ No newline at end of file
interface/web/dashboard/lib/lang/de_dashlet_quota.lng
0 → 100644
View file @
dfd4b8b8
<?php
$wb
[
"quota_txt"
]
=
'Webseiten-Speicherplatz'
;
$wb
[
"domain_txt"
]
=
'Domain / Webseite'
;
$wb
[
"used_txt"
]
=
'Verwendet'
;
$wb
[
"hard_txt"
]
=
'Hard Limit'
;
$wb
[
"soft_txt"
]
=
'Soft Limit'
;
$wb
[
"no_sites_txt"
]
=
'Keine Webseite gefunden.'
;
?>
\ No newline at end of file
interface/web/dashboard/lib/lang/en_dashlet_quota.lng
0 → 100644
View file @
dfd4b8b8
<?php
$wb
[
"quota_txt"
]
=
'Website Harddisk Quota'
;
$wb
[
"domain_txt"
]
=
'Domain / Website'
;
$wb
[
"used_txt"
]
=
'Used space'
;
$wb
[
"hard_txt"
]
=
'Hard limit'
;
$wb
[
"soft_txt"
]
=
'Soft limit'
;
$wb
[
"no_sites_txt"
]
=
'No web sites found.'
;
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment