Browse Source

inserting a dropdown list to pick the country from, and set the user's language selection dynamically

tags/contribute2018
Max Mehl 5 months ago
parent
commit
7218c614c0
Signed by: max.mehl <max.mehl@fsfe.org> GPG Key ID: 2704E4AB371E2E92

+ 2
- 3
contribute/spreadtheword.en.xhtml View File

@@ -156,8 +156,7 @@
156 156
 			
157 157
       
158 158
 			<form class="highlight labeledform" id="orderpromo" method="post" action="/cgi-bin/promotion.php" accept-charset="utf-8">
159
-        <!-- Translators: please set the value for the language to your language code -->
160
-        <input type="hidden" name="language" value="en" />
159
+        <add-language />
161 160
         <h3>Order promotional material</h3>
162 161
         <p>Fields marked with * are mandatory.</p>
163 162
         <fieldset>
@@ -186,7 +185,7 @@
186 185
           </div>
187 186
           <div>
188 187
             <span class="formlabel">Country*:</span>
189
-            <input type="text" name="country" size="20" required="required" />
188
+            <country-list />
190 189
           </div>
191 190
         </fieldset>
192 191
         <fieldset>

+ 1
- 0
contribute/spreadtheword.sources View File

@@ -1,2 +1,3 @@
1 1
 contribute/promoitems/active-items:[]
2 2
 contribute/promoitems/info-:[]
3
+tools/countries:[]

+ 21
- 0
contribute/spreadtheword.xsl View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 4
   <xsl:import href="../fsfe.xsl" />
5
+  <xsl:import href="../tools/xsltsl/countries.xsl" />
5 6
   <xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
6 7
 
7 8
   <!-- Fill dynamic content -->
@@ -226,4 +227,24 @@
226 227
     
227 228
   </xsl:template>
228 229
 
230
+  <!-- Dropdown list of countries requiring a choice -->
231
+  <!-- when copying this, remember importing the xsl, and editing the .source file -->
232
+  <xsl:template match="country-list">
233
+    <xsl:call-template name="country-list">
234
+      <xsl:with-param name="required" select="'yes'"/>
235
+    </xsl:call-template>
236
+  </xsl:template>
237
+
238
+  <!-- Add a hidden field to the form to identify the language used. -->
239
+  <xsl:template match="add-language">
240
+    <xsl:element name="input">
241
+      <xsl:attribute name="type">hidden</xsl:attribute>
242
+      <xsl:attribute name="id">lang</xsl:attribute>
243
+      <xsl:attribute name="name">lang</xsl:attribute>
244
+      <xsl:attribute name="value">
245
+        <xsl:value-of select="/buildinfo/document/@language" />
246
+      </xsl:attribute>
247
+    </xsl:element>
248
+  </xsl:template>
249
+
229 250
 </xsl:stylesheet>

Loading…
Cancel
Save