[set page_perm]page[/set] [set page_title][L]Clone component sets to multiple pages[/L][/set] [set ui_class]Content[/set] [set help_name]page.editor[/set] [set icon_name]icon_pages.gif[/set] @_UI_STD_HEAD_@ [if cgi push] [perl] my $source = $CGI->{source}; my @things = split /\0/, $CGI->{target}; my $out = 'cloning '; if(! $CGI->{source}) { return "

> No source!

"; } elsif(! $CGI->{target}) { return "

> No targets!

"; } my $sfile = $Tag->file($source); $sfile =~ m{(\[control\s+reset=1\].*?\[control\s+reset=1\])}si; my $scomp = $1; my $count = 0; for(@things) { $Tag->backup_file($_) if $CGI->{backup}; my $dat = $Tag->file($_); $dat =~ s{\[control\s+reset=1\].*?\[control\s+reset=1\]}{$scomp}si; $Tag->write_relative_file($_, $dat) and $count++; } return "

> $count files updated.

"; [/perl] [/if] [form-session-id]

[L]Source[/L]
| [L]Select page to clone. Only pages matching the template type of the source page will be allowed.[/L]

[L]Targets[/L]

[table-organize columns=3 columnize=1 interplate=1] [calc] my $i = 0; my @out; my @dirout; %dirs = (); for(@qualify) { my ($fn, $lab, $dir, $type) = @$_; if($dir) { my $htm = $dirs{$dir}; my $dirclass = $dir; my $levels = $dir =~ tr:/:/:; my $spacer = ''; $spacer = '' x $levels if $levels; $dirclass =~ s/\W/_/g; if( ! $htm) { $htm = $dirs{$dir} = []; push @dirout, <<EOF;
EOF } push @$htm, <<EOF; $lab EOF } else { push @out, <<EOF;
EOF } $i++; } return join "", @dirout, @out; [/calc] [/table-organize]
$spacer $dir | $lab

[calc] my @out; for(keys %dirs) { my $ary = $dirs{$_}; my $dirclass = $_; $dirclass =~ s/\W/_/g; my $elstring = join "
", @$ary; my $out = <<EOF;
Files in $_
$elstring
EOF push @out, $out; } return join "\n", @out; [/calc]

[L]Check all[/L] [L]Uncheck all[/L] Back files up @_UI_STD_FOOTER_@