forked from webmin/webmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list_worlds.cgi
executable file
·52 lines (47 loc) · 1.33 KB
/
list_worlds.cgi
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
#!/usr/local/bin/perl
# Show all known world directories
use strict;
use warnings;
require './minecraft-lib.pl';
our (%in, %text, %config);
&ui_print_header(undef, $text{'worlds_title'}, "");
my @worlds = &list_worlds();
my $conf = &get_minecraft_config();
my $def = &find_value("level-name", $conf);
my @links = ( &ui_link("edit_world.cgi?new=1",$text{'worlds_new'}) );
if (@worlds) {
my @tds = ( "width=5%" );
print &ui_form_start("change_world.cgi");
print &ui_links_row(\@links);
print &ui_columns_start([
$text{'worlds_def'},
$text{'worlds_name'},
$text{'worlds_size'},
$text{'worlds_players'},
], undef, 0, \@tds);
foreach my $w (@worlds) {
my @p = @{$w->{'players'}};
if (@p > 5) {
@p = ( @p[0..4], "..." );
}
print &ui_columns_row([
&ui_oneradio("d", $w->{'name'}, "",
$w->{'name'} eq $def),
"<a href='edit_world.cgi?name=".&urlize($w->{'name'}).
"'>".&html_escape($w->{'name'})."</a>",
&nice_size($w->{'size'}),
join(" , ", @p),
], \@tds);
}
print &ui_columns_end();
print &ui_links_row(\@links);
print &ui_form_end([ [ undef, $text{'worlds_change'} ],
&is_minecraft_server_running() ?
( [ 'apply', $text{'worlds_change2'} ] ) :
( ) ]);
}
else {
print "<b>$text{'worlds_none'}</b><p>\n";
print &ui_links_row(\@links);
}
&ui_print_footer("", $text{'index_return'});