4 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
<table border="0" cellpadding="0" cellspacing="0">
<TMPL_LOOP NAME=FOLDERICONS_ROWS>
<tr>
<TMPL_LOOP NAME=FOLDERICONS_COLS>
<td><input type="radio" id="folderimage" name="folderimage" /></td>
<td><img src="<TMPL_VAR NAME=FOLDERICONSRC>" alt="<TMPL_VAR NAME=FOLDERICONALT>" width="<TMPL_VAR NAME=FOLDERICONX>" height="<TMPL_VAR NAME=FOLDERICONY>" /></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
sub callback_readfiles
{
my ($folder, $proc, @param) = @_;
my $count = 0;
my $dir = undef;
if(opendir($dir, $folder))
{
while(defined(my $file = readdir($dir)))
{
my $filepath = "$folder/$file";
next if $file =~ /^\.\.?$/;
next if -d $filepath;
$proc->($filepath, @param) if $proc;
$count++;
}
closedir($dir);
}
return $count;
}
sub get_filename
{
my ($file) = @_;
$file =~ s!\\!/!g;
my @parts = split(/\//, $file);
return pop @parts;
}
use constant FOLDER_FOLDERIMAGES => $Vars::CONFIG{'FOLDER_SKIN'}.'/Images/Folders';
use constant FOLDER_ICONWIDTH => 20;
use constant FOLDER_ICONHEIGHT => 20;
use constant FOLDER_MAXICONCOL => 5;
use vars qw($FOLDERCOL $FOLDERROW);
$FOLDERCOL = 0;
$FOLDERROW = 0;
sub enum_foldericons_cb
{
my ($filename, $retval) = @_;
my %data = ();
$data{FOLDERICONX} = FOLDER_ICONWIDTH;
$data{FOLDERICONY} = FOLDER_ICONHEIGHT;
$data{FOLDERICONSRC} = $filename;
$data{FOLDERICONALT} = Global::get_filename($filename);
$retval->[$FOLDERROW] = {} unless defined $retval->[$FOLDERROW];
$retval->[$FOLDERROW]->{FOLDERICONS_COLS} = [] unless defined $retval->[$FOLDERROW]->{FOLDERICONS_COLS};
push @{$retval->[$FOLDERROW]->{FOLDERICONS_COLS}}, \%data;
$FOLDERCOL++;
if($FOLDERCOL >= FOLDER_MAXICONCOL)
{
$FOLDERROW++;
$FOLDERCOL = 0;
}
}
sub enum_foldericons
{
my ($obj, $tpl) = @_;
my @loop = ();
Global::callback_readfiles(FOLDER_FOLDERIMAGES, \&enum_foldericons_cb, \@loop);
$tpl->param(FOLDERICONS_ROWS => \@loop);
}
1
2
3
4
5
6
7
8
9
10
<table border="0" cellpadding="0" cellspacing="0">
<TMPL_LOOP NAME=FOLDERICONS_ROWS>
<tr>
<TMPL_LOOP NAME=FOLDERICONS_COLS>
<td><input type="radio" id="folderimage" name="folderimage" /></td>
<td><img src="<TMPL_VAR NAME=FOLDERICONSRC>" alt="<TMPL_VAR NAME=FOLDERICONALT>" width="<TMPL_VAR NAME=FOLDERICONX>" height="<TMPL_VAR NAME=FOLDERICONY>" value="<TMPL_VAR NAME=FOLDERICONVALUE>" <TMPL_IF NAME=CHECKED>checked="checked"</TMPL_IF> /></td>" /></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>
4 Einträge, 1 Seite |