Revision 50365526
Von Sven Schöling vor fast 14 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
616 | 616 |
|
617 | 617 |
|
618 | 618 |
sub header { |
619 |
$main::lxdebug->enter_sub();
|
|
619 |
$::lxdebug->enter_sub;
|
|
620 | 620 |
|
621 |
# extra code ist currently only used by menuv3 and menuv4 to set their css.
|
|
621 |
# extra code is currently only used by menuv3 and menuv4 to set their css. |
|
622 | 622 |
# it is strongly deprecated, and will be changed in a future version. |
623 | 623 |
my ($self, $extra_code) = @_; |
624 |
|
|
625 |
if ($self->{header}) { |
|
626 |
$main::lxdebug->leave_sub(); |
|
627 |
return; |
|
628 |
} |
|
629 |
|
|
630 |
my ($stylesheet, $favicon, $pagelayout); |
|
631 |
|
|
632 |
if ($ENV{HTTP_USER_AGENT}) { |
|
633 |
my $doctype; |
|
634 |
|
|
635 |
if ($ENV{'HTTP_USER_AGENT'} =~ m/MSIE\s+\d/) { |
|
636 |
# Only set the DOCTYPE for Internet Explorer. Other browsers have problems displaying the menu otherwise. |
|
637 |
$doctype = qq|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n|; |
|
638 |
} |
|
639 |
|
|
640 |
my $stylesheets = "$self->{stylesheet} $self->{stylesheets}"; |
|
641 |
|
|
642 |
$stylesheets =~ s|^\s*||; |
|
643 |
$stylesheets =~ s|\s*$||; |
|
644 |
foreach my $file (split m/\s+/, $stylesheets) { |
|
645 |
$file =~ s|.*/||; |
|
646 |
next if (! -f "css/$file"); |
|
647 |
|
|
648 |
$stylesheet .= qq|<link rel="stylesheet" href="css/$file" TYPE="text/css" TITLE="Lx-Office stylesheet">\n|; |
|
649 |
} |
|
650 |
|
|
651 |
$self->{favicon} = "favicon.ico" unless $self->{favicon}; |
|
652 |
|
|
653 |
if ($self->{favicon} && (-f "$self->{favicon}")) { |
|
654 |
$favicon = |
|
655 |
qq|<LINK REL="shortcut icon" HREF="$self->{favicon}" TYPE="image/x-icon"> |
|
656 |
|; |
|
657 |
} |
|
658 |
|
|
659 |
my $db_charset = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET; |
|
660 |
|
|
661 |
if ($self->{landscape}) { |
|
662 |
$pagelayout = qq|<style type="text/css"> |
|
663 |
\@page { size:landscape; } |
|
664 |
</style>|; |
|
665 |
} |
|
666 |
|
|
667 |
my $fokus = qq| |
|
668 |
<script type="text/javascript"> |
|
669 |
<!-- |
|
670 |
function fokus() { |
|
671 |
document.$self->{fokus}.focus(); |
|
672 |
} |
|
673 |
//--> |
|
674 |
</script> |
|
675 |
| if $self->{"fokus"}; |
|
676 |
|
|
677 |
# if there is a title, we put some JavaScript in to the page, wich writes a |
|
678 |
# meaningful title-tag for our frameset. |
|
679 |
my $title_hack; |
|
680 |
if ($self->{"title"}){ |
|
681 |
$title_hack = qq| |
|
682 |
<script type="text/javascript"> |
|
683 |
<!-- |
|
684 |
// Write a meaningful title-tag for our frameset. |
|
685 |
top.document.title="| . $self->{"title"} . qq| - | . $self->{"login"} . qq| - | . $::myconfig{dbname} . qq| - V| . $self->{"version"} . qq|"; |
|
686 |
//--> |
|
687 |
</script> |
|
688 |
|; |
|
689 |
} |
|
690 |
|
|
691 |
#Set Calendar |
|
692 |
my $jsscript = ""; |
|
693 |
if ($self->{jsscript} == 1) { |
|
694 |
|
|
695 |
$jsscript = qq| |
|
696 |
<script type="text/javascript" src="js/jquery.js"></script> |
|
697 |
<script type="text/javascript" src="js/common.js"></script> |
|
698 |
<style type="text/css">\@import url(js/jscalendar/calendar-win2k-1.css);</style> |
|
699 |
<script type="text/javascript" src="js/jscalendar/calendar.js"></script> |
|
700 |
<script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script> |
|
701 |
<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script> |
|
702 |
$self->{javascript} |
|
703 |
|; |
|
704 |
} |
|
705 |
|
|
706 |
$self->{titlebar} = |
|
707 |
($self->{title}) |
|
708 |
? "$self->{title} - $self->{titlebar}" |
|
709 |
: $self->{titlebar}; |
|
710 |
my $ajax = ""; |
|
711 |
for my $item (@ { $self->{AJAX} || [] }) { |
|
712 |
$ajax .= $item->show_javascript(); |
|
713 |
} |
|
714 |
|
|
715 |
print $self->create_http_response('content_type' => 'text/html', |
|
716 |
'charset' => $db_charset,); |
|
717 |
print qq|${doctype}<html> |
|
718 |
<head> |
|
719 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=${db_charset}"> |
|
624 |
my $db_charset = $::dbcharset || Common::DEFAULT_CHARSET; |
|
625 |
my @header; |
|
626 |
|
|
627 |
$::lxdebug->leave_sub and return if !$ENV{HTTP_USER_AGENT} || $self->{header}++; |
|
628 |
|
|
629 |
$self->{favicon} ||= "favicon.ico"; |
|
630 |
$self->{titlebar} = "$self->{title} - $self->{titlebar}" if $self->{title}; |
|
631 |
|
|
632 |
# build includes |
|
633 |
if ($self->{refresh_url} || $self->{refresh_time}) { |
|
634 |
my $refresh_time = $self->{refresh_time} || 3; |
|
635 |
my $refresh_url = $self->{refresh_url} || $ENV{REFERER}; |
|
636 |
push @header, "<meta http-equiv='refresh' content='$refresh_time;$refresh_url'>"; |
|
637 |
} |
|
638 |
|
|
639 |
push @header, "<link rel='stylesheet' href='css/$_' type='text/css' title='Lx-Office stylesheet'>" |
|
640 |
for grep { -f "css/$_" } apply { s|.*/|| } $self->{stylesheet}, $self->{stylesheets}; |
|
641 |
|
|
642 |
push @header, "<style type='text/css'>\@page { size:landscape; }</style>" if $self->{landscape}; |
|
643 |
push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>" if -f $self->{favicon}; |
|
644 |
push @header, '<script type="text/javascript" src="js/jquery.js"></script>', |
|
645 |
'<script type="text/javascript" src="js/common.js"></script>', |
|
646 |
'<style type="text/css">\@import url(js/jscalendar/calendar-win2k-1.css);</style>', |
|
647 |
'<script type="text/javascript" src="js/jscalendar/calendar.js"></script>', |
|
648 |
'<script type="text/javascript" src="js/jscalendar/lang/calendar-de.js"></script>', |
|
649 |
'<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>', |
|
650 |
'<script type="text/javascript" src="js/part_selection.js"></script>'; |
|
651 |
push @header, $self->{javascript} if $self->{javascript}; |
|
652 |
push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] }; |
|
653 |
push @header, "<script type='text/javascript'>function fokus(){ document.$self->{fokus}.focus(); }</script>" if $self->{fokus}; |
|
654 |
push @header, sprintf "<script type='text/javascript'>top.document.title='%s';</script>", |
|
655 |
join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->{version} if $self->{title}; |
|
656 |
|
|
657 |
# output |
|
658 |
print $self->create_http_response(content_type => 'text/html', charset => $db_charset); |
|
659 |
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>\n" |
|
660 |
if $ENV{'HTTP_USER_AGENT'} =~ m/MSIE\s+\d/; # Other browsers may choke on menu scripts with DOCTYPE. |
|
661 |
print <<EOT; |
|
662 |
<html> |
|
663 |
<head> |
|
664 |
<meta http-equiv="Content-Type" content="text/html; charset=$db_charset"> |
|
720 | 665 |
<title>$self->{titlebar}</title> |
721 |
$stylesheet |
|
722 |
$pagelayout |
|
723 |
$favicon |
|
724 |
$jsscript |
|
725 |
$ajax |
|
726 |
$fokus |
|
727 |
$title_hack |
|
728 |
|
|
666 |
EOT |
|
667 |
print " $_\n" for @header; |
|
668 |
print <<EOT; |
|
729 | 669 |
<link rel="stylesheet" href="css/jquery.autocomplete.css" type="text/css" /> |
730 |
|
|
731 | 670 |
<meta name="robots" content="noindex,nofollow" /> |
732 |
|
|
671 |
<script type="text/javascript" src="js/highlight_input.js"></script> |
|
733 | 672 |
<link rel="stylesheet" type="text/css" href="css/tabcontent.css" /> |
734 | 673 |
<script type="text/javascript" src="js/tabcontent.js"> |
735 | 674 |
|
... | ... | |
740 | 679 |
***********************************************/ |
741 | 680 |
|
742 | 681 |
</script> |
743 |
|
|
744 | 682 |
$extra_code |
745 |
</head> |
|
683 |
</head>
|
|
746 | 684 |
|
747 |
|; |
|
748 |
} |
|
749 |
$self->{header} = 1; |
|
685 |
EOT |
|
750 | 686 |
|
751 |
$main::lxdebug->leave_sub();
|
|
687 |
$::lxdebug->leave_sub;
|
|
752 | 688 |
} |
753 | 689 |
|
754 | 690 |
sub ajax_response_header { |
Auch abrufbar als: Unified diff
Form::header
1. Code aufgeräumt. Viele der alten Idiome einheitlich gemacht und sortiert.
Alle prints finden jetzt am Ende statt, fall jemand das ganze mal auf return
umbauen will. Alle Header werden vorher zusammengebaut.
2. jsscript flag entfernt. Javascripte werden jetzt immer mit ausgegeben.
3. Support für http redirect.
Conflicts: