| 1 | package WebEditor::OldFeatures::MakeHTML; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 0 | ▶ | sub makehtmlpage_additional { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makehtmlpage_additional: not called CC=18 SCAR=58.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my $root = $self->Root; | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | my $objdb = $root->ObjDB; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | my $c = $self->C; | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my(%args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | my $lang = $args{lang} || $c->project->sitelanguages->[0]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'lang'} || $c->project->sitelanguages->[0]
MC/DC0%0/2
$args{'lang'} || $c->project->sitelanguages->[0]
$args{'lang'}
$c->project->sitelanguages->[0]
Truth table0%0/3
A || B
A= $args{'lang'}B= $c->project->sitelanguages->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my $basedir = $args{basedir} || $c->paths->pubhtmldir; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'basedir'} || $c->paths->pubhtmldir
MC/DC0%0/2
$args{'basedir'} || $c->paths->pubhtmldir
$args{'basedir'}
$c->paths->pubhtmldir
Truth table0%0/3
A || B
A= $args{'basedir'}B= $c->paths->pubhtmldir
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | my($id, $mainid, $template, $addtemplatevars) = | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | @args{qw(id mainid template addtemplatevars)}; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $htmlfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | # Die Homepage noch einmal als index.html erzeugen | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $p = ($objdb->parents($mainid))[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if ($p) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($p->is_site && defined $p->IndexDoc && $p->IndexDoc eq $mainid) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$p->is_site and defined $p->IndexDoc and $p->IndexDoc eq $mainid
$p->is_site and defined $p->IndexDoc
MC/DC0%0/3
$p->is_site and defined $p->IndexDoc and $p->IndexDoc eq $mainid
$p->is_site
defined $p->IndexDoc
$p->IndexDoc eq $mainid
Truth table0%0/4
A and B and C
A= $p->is_siteB= defined $p->IndexDocC= $p->IndexDoc eq $mainid
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $htmlfile = $basedir."/html/".$lang."/index.html"; | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | ▶ | } elsif ($p->is_folder && defined $p->IndexDoc && $p->IndexDoc eq $mainid) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$p->is_folder and defined $p->IndexDoc and $p->IndexDoc eq $mainid
$p->is_folder and defined $p->IndexDoc
MC/DC0%0/3
$p->is_folder and defined $p->IndexDoc and $p->IndexDoc eq $mainid
$p->is_folder
defined $p->IndexDoc
$p->IndexDoc eq $mainid
Truth table0%0/4
A and B and C
A= $p->is_folderB= defined $p->IndexDocC= $p->IndexDoc eq $mainid
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $htmlfile = $basedir."/html/".$lang."/" . $p->Id . ".html"; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $msg = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $converter = $self->get_fh_charset_converter; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # gibt es von diesem Template noch ein Print-Template? | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # dann nochmal die Print-Version erzeugen: | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $printtemplate = $template; | |||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $printtemplate =~ s/\.tpl\.html$/_p\.tpl\.html/; | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if (-e $c->paths->site_templatebase."/$printtemplate") { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $msg .= "$printtemplate --- "; | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | require File::Compare; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $phtmlfile = $basedir."/html/".$lang."/".$mainid."_p.html"; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $msg .= "$phtmlfile --- "; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $tmpfile = "$phtmlfile~"; | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | open(HTML, ">$tmpfile") or die("Publish: can't write to $tmpfile: $!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $converter->(\*HTML); | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $self->_tpl("site", $printtemplate, $addtemplatevars, \*HTML); | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | close HTML; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if (File::Compare::compare($phtmlfile, $tmpfile) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # no change --- delete $tmpfile | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | unlink $tmpfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $msg .= " ($lang: keine Änderung) "; | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | unlink $phtmlfile; # do not fail --- maybe file does not exist | |||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | rename $tmpfile, $phtmlfile or die "Can't rename $tmpfile to $phtmlfile: $!"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | if (defined $htmlfile) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | require File::Compare; | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $tmpfile = "$htmlfile~"; | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | open(HTML, ">$tmpfile") or $self->error("Publish: can't writeopen $tmpfile: $!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $converter->(\*HTML); | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->_tpl("site", $template, $addtemplatevars, \*HTML); | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | close HTML; | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if (File::Compare::compare($htmlfile, $tmpfile) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # no change --- delete $tmpfile | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | unlink $tmpfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | unlink $htmlfile; # do not fail --- maybe file does not exist | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | rename $tmpfile, $htmlfile or die "Can't rename $tmpfile to $htmlfile: $!"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $msg = " ($lang: $htmlfile) "; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $msg; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||