hiromipaw commited on 2017-11-16 21:03:12
Zeige 3 geänderte Dateien mit 38 Einfügungen und 51 Löschungen.
... | ... |
@@ -114,7 +114,44 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), |
114 | 114 |
} |
115 | 115 |
} |
116 | 116 |
}:> |
117 |
+ # LANGUAGE SWITCH CGI |
|
118 |
+ <li> |
|
119 |
+ # this is a cgi trampoline to bounce us to the right page |
|
120 |
+ # alternately, if the client supports javascript we can redirect that way |
|
121 |
+ # noscript does not block onclick but clients may have disabled javascript completely |
|
122 |
+ # |
|
123 |
+ # for this to work we need to know the relative path from the document root |
|
124 |
+ # to the current directory that wml is in. |
|
125 |
+ <form action="$(DOCROOT)/cgi-bin/languageswitch.cgi"> |
|
126 |
+ <select name="Language" id="lang"> |
|
127 |
+ <:{ |
|
128 |
+ #import "perl-globals.wmi"; |
|
129 |
+ use Cwd; |
|
130 |
+ use Cwd 'abs_path'; |
|
131 |
+ use File::Spec; |
|
132 |
+ my $urlbase = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)")); |
|
133 |
+ my $LANGUAGES; |
|
134 |
+ my $page = $WML_SRC_FILENAME; |
|
135 |
+ opendir(DIR, getcwd()) or die $!; |
|
136 |
+ # take a look and see what language support we have |
|
137 |
+ while (my $file = readdir(DIR)) { |
|
138 |
+ if (-d $file) { |
|
139 |
+ if (-e "$file/$page") { |
|
140 |
+ my $url = $urlbase.'/'.$WML_SRC_BASENAME.'.html.'.$file; |
|
141 |
+ my $url2js = $WML_SRC_BASENAME.'.html.'.$file; |
|
142 |
+ print '<option value="'.$url.'" onclick="window.location=\''.$url2js.'\'">'.$LANGUAGES{$file}.'</option>'."\n" unless not defined $LANGUAGES{$file}; |
|
143 |
+ } |
|
144 |
+ } |
|
145 |
+ } |
|
146 |
+ closedir(DIR); |
|
147 |
+ }:> |
|
148 |
+ </select> |
|
149 |
+ <input class="go" type="submit" name="submit" value="Go"> |
|
150 |
+ </form> |
|
151 |
+ </li> |
|
152 |
+ # |
|
117 | 153 |
</ul> |
154 |
+ |
|
118 | 155 |
</div> |
119 | 156 |
<!-- END NAV --> |
120 | 157 |
# end navigation generation |
... | ... |
@@ -65,56 +65,6 @@ |
65 | 65 |
</div> |
66 | 66 |
<!-- END COL --> |
67 | 67 |
|
68 |
- <!-- List available languages --> |
|
69 |
- <div class="col wider"> |
|
70 |
- <h4>Languages</h4> |
|
71 |
- <: if (has_translations()) { :> |
|
72 |
- <p> |
|
73 |
- This page is also available in the following languages: |
|
74 |
- <: print list_translations() :>.<br /> |
|
75 |
- How to set <a href="http://www.debian.org/intro/cn#howtoset">the default document language</a>. |
|
76 |
- </p> |
|
77 |
- <: }; :> |
|
78 |
- </div> |
|
79 |
- |
|
80 |
-# LANGUAGE SWITCH CGI |
|
81 |
- <div class="col wider"> |
|
82 |
- <h4>Languages</h4> |
|
83 |
- # this is a cgi trampoline to bounce us to the right page |
|
84 |
- # alternately, if the client supports javascript we can redirect that way |
|
85 |
- # noscript does not block onclick but clients may have disabled javascript completely |
|
86 |
- # |
|
87 |
- # for this to work we need to know the relative path from the document root |
|
88 |
- # to the current directory that wml is in. |
|
89 |
- <form action="$(DOCROOT)/cgi-bin/languageswitch.cgi"> |
|
90 |
- <select name="Language" id="lang"> |
|
91 |
- <:{ |
|
92 |
- #import "perl-globals.wmi"; |
|
93 |
- use Cwd; |
|
94 |
- use Cwd 'abs_path'; |
|
95 |
- use File::Spec; |
|
96 |
- my $urlbase = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)")); |
|
97 |
- my $LANGUAGES; |
|
98 |
- my $page = $WML_SRC_FILENAME; |
|
99 |
- opendir(DIR, getcwd()) or die $!; |
|
100 |
- # take a look and see what language support we have |
|
101 |
- while (my $file = readdir(DIR)) { |
|
102 |
- if (-d $file) { |
|
103 |
- if (-e "$file/$page") { |
|
104 |
- my $url = $urlbase.'/'.$WML_SRC_BASENAME.'.html.'.$file; |
|
105 |
- my $url2js = $WML_SRC_BASENAME.'.html.'.$file; |
|
106 |
- print '<option value="'.$url.'" onclick="window.location=\''.$url2js.'\'">'.$LANGUAGES{$file}.'</option>'."\n" unless not defined $LANGUAGES{$file}; |
|
107 |
- } |
|
108 |
- } |
|
109 |
- } |
|
110 |
- closedir(DIR); |
|
111 |
- }:> |
|
112 |
- </select> |
|
113 |
- <input class="go" type="submit" name="submit" value="Go"> |
|
114 |
- </form> |
|
115 |
- <p>Questions on this? Visit <a href="http://www.debian.org/intro/cn#howtoset">how to set the default document language</a>.</p> |
|
116 |
- </div> |
|
117 |
-# |
|
118 | 68 |
</div> |
119 | 69 |
<!-- END FOOTER --> |
120 | 70 |
|