Revision a1b5f9b6
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
bin/mozilla/menuXML.pl | ||
---|---|---|
46 | 46 |
# end of main |
47 | 47 |
|
48 | 48 |
sub display { |
49 |
print $form->create_http_response('content_type' => 'text/xml', |
|
50 |
'charset' => 'iso-8859-1'); |
|
51 |
print qq|<?xml version="1.0" encoding="iso-8859-1"?>\n|; |
|
52 |
print qq|<?xml-stylesheet href="xslt/xulmenu.xsl" type="text/xsl"?>\n|; |
|
53 |
print qq|<!DOCTYPE doc [ |
|
54 |
<!ENTITY szlig "?"> |
|
55 |
<!ENTITY auml "?"> |
|
56 |
<!ENTITY uuml "?"> |
|
57 |
<!ENTITY ouml "?"> |
|
58 |
]>|; |
|
59 |
print qq|<doc>|; |
|
60 |
print qq|<name>|; |
|
61 |
print %myconfig->{name}; |
|
62 |
print qq|</name>|; |
|
63 |
print qq|<db>|; |
|
64 |
print %myconfig->{dbname}; |
|
65 |
print qq|</db>|; |
|
66 |
print qq|<favorites>|; |
|
67 |
my $fav=%myconfig->{favorites}; |
|
68 |
my @favorites = split(/;/, $fav); |
|
49 |
$locale = Locale->new($language, "menu"); |
|
50 |
my $charset = $dbcharset || 'ISO-8859-1'; |
|
51 |
|
|
52 |
my $text = $form->create_http_response('content_type' => 'text/xml', |
|
53 |
'charset' => $charset) |
|
54 |
. qq|<?xml version="1.0" encoding="${charset}"?> |
|
55 |
<?xml-stylesheet href="xslt/xulmenu.xsl" type="text/xsl"?> |
|
56 |
<!DOCTYPE doc [ |
|
57 |
<!ENTITY szlig "| . $locale->{iconv_iso8859}->convert('?') . qq|"> |
|
58 |
<!ENTITY auml "| . $locale->{iconv_iso8859}->convert('?') . qq|"> |
|
59 |
<!ENTITY uuml "| . $locale->{iconv_iso8859}->convert('?') . qq|"> |
|
60 |
<!ENTITY ouml "| . $locale->{iconv_iso8859}->convert('?') . qq|"> |
|
61 |
]> |
|
62 |
|
|
63 |
<doc> |
|
64 |
<name>$myconfig{name}</name> |
|
65 |
|
|
66 |
<db>$myconfig{dbname}</db> |
|
67 |
|
|
68 |
<favorites>|; |
|
69 |
|
|
70 |
my $fav = $myconfig{favorites}; |
|
71 |
my @favorites = split m/;/, $fav; |
|
69 | 72 |
foreach (@favorites) { |
70 |
print qq|<link name="$_"/>|;
|
|
73 |
$text .= qq|<link name="$_"/>|;
|
|
71 | 74 |
} |
72 |
print qq|</favorites>|; |
|
73 |
print qq|<menu>|; |
|
74 |
my $isoencodedmenu=&acc_menu($menu); |
|
75 |
print encode("iso-8859-1",$isoencodedmenu ); |
|
76 |
|
|
77 |
print qq|</menu>|; |
|
78 |
print qq|</doc>|; |
|
79 |
|
|
75 |
|
|
76 |
$text .= qq|</favorites>\n| |
|
77 |
. qq|<menu>\n| |
|
78 |
. acc_menu() |
|
79 |
. qq|</menu>\n| |
|
80 |
. qq|</doc>\n|; |
|
81 |
|
|
82 |
print $text; |
|
83 |
|
|
84 |
$main::lxdebug->message(0, "text $text"); |
|
80 | 85 |
} |
81 | 86 |
|
82 | 87 |
|
83 | 88 |
sub acc_menu { |
84 |
$locale = Locale->new($language, "menu"); |
|
85 |
|
|
86 | 89 |
$mainlevel = $form->{level}; |
87 | 90 |
$mainlevel =~ s/$mainlevel--//g; |
88 | 91 |
my $menu = new Menu "$menufile"; |
Auch abrufbar als: Unified diff
Das XUL/XML-Menü muss auch bei Verwendung von UTF-8 als Zeichensatz richtig codiert werden.