cvs: docweb /include lib_proj_lang.inc.php /templates/all/www users.tpl.php

[email protected] ("Vincent Gevers")
Newsgroups php.doc.web
Message-ID <cvsvincent1122821780@cvsserver>
vincent		Sun Jul 31 10:56:20 2005 EDT

  Modified files:              
    /docweb/include	lib_proj_lang.inc.php 
    /docweb/templates/all/www	users.tpl.php 
  Log:
  Country selection
  
  
http://cvs.php.net/diff.php/docweb/include/lib_proj_lang.inc.php?r1=1.3&r2=1.4&ty=u
Index: docweb/include/lib_proj_lang.inc.php
diff -u docweb/include/lib_proj_lang.inc.php:1.3 docweb/include/lib_proj_lang.inc.php:1.4
--- docweb/include/lib_proj_lang.inc.php:1.3	Sat May 21 04:58:19 2005
+++ docweb/include/lib_proj_lang.inc.php	Sun Jul 31 10:56:19 2005
@@ -19,7 +19,7 @@
 |                   Gabor Hojtsy <[email protected]>                        |
 |                   Sean Coates <[email protected]>                         |
 +----------------------------------------------------------------------+
-$Id: lib_proj_lang.inc.php,v 1.3 2005/05/21 08:58:19 nlopess Exp $
+$Id: lib_proj_lang.inc.php,v 1.4 2005/07/31 14:56:19 vincent Exp $
 */
 
 // split from lib_general.inc.php
@@ -68,4 +68,62 @@
     'en'    => 'English',
 );
 
+$COUNTRIES = array(
+    "US" => "United States",
+    "AI" => "Anguilla",
+    "AR" => "Argentina",
+    "AU" => "Australia",
+    "AT" => "Austria",
+    "BE" => "Belgium",
+    "BR" => "Brazil",
+    "CA" => "Canada",
+    "CL" => "Chile",
+    "C2" => "China",
+    "CR" => "Costa Rica",
+    "CY" => "Cyprus",
+    "CZ" => "Czech Republic",
+    "DK" => "Denmark",
+    "DO" => "Dominican Republic",
+    "EC" => "Ecuador",
+    "EE" => "Estonia",
+    "FI" => "Finland",
+    "FR" => "France",
+    "DE" => "Germany",
+    "GR" => "Greece",
+    "HK" => "Hong Kong",
+    "HU" => "Hungary",
+    "IS" => "Iceland",
+    "IN" => "India",
+    "IE" => "Ireland",
+    "IL" => "Israel",
+    "IT" => "Italy",
+    "JM" => "Jamaica",
+    "JP" => "Japan",
+    "LV" => "Latvia",
+    "LT" => "Lithuania",
+    "LU" => "Luxembourg",
+    "MY" => "Malaysia",
+    "MT" => "Malta",
+    "MX" => "Mexico",
+    "NL" => "Netherlands",
+    "NZ" => "New Zealand",
+    "NO" => "Norway",
+    "PL" => "Poland",
+    "PT" => "Portugal",
+    "SG" => "Singapore",
+    "SK" => "Slovakia",
+    "SI" => "Slovenia",
+    "ZA" => "South Africa",
+    "KR" => "South Korea",
+    "ES" => "Spain",
+    "SE" => "Sweden",
+    "CH" => "Switzerland",
+    "TW" => "Taiwan",
+    "TH" => "Thailand",
+    "TR" => "Turkey",
+    "GB" => "United Kingdom",
+    "UY" => "Uruguay",
+    "VE" => "Venezuela",
+);
+
 ?>
http://cvs.php.net/diff.php/docweb/templates/all/www/users.tpl.php?r1=1.2&r2=1.3&ty=u
Index: docweb/templates/all/www/users.tpl.php
diff -u docweb/templates/all/www/users.tpl.php:1.2 docweb/templates/all/www/users.tpl.php:1.3
--- docweb/templates/all/www/users.tpl.php:1.2	Sun Jul 31 09:57:02 2005
+++ docweb/templates/all/www/users.tpl.php	Sun Jul 31 10:56:20 2005
@@ -16,15 +16,26 @@
     default:
         $errors = '';
 }
+$countries = '';
+foreach ($GLOBALS['COUNTRIES'] as $code => $cntry) {
+if ($info['country'] == $code) {
+    $selected = ' selected="selected" ';
+} else {
+    $selected = '';
+}
+    $countries .= "<option value=\"".$code."\"$selected>".$cntry."</option>\n";
+}
 echo <<< HTML
-<h3>$info[username], you can edit your info here</h3>
+<h3>$info[name], you can edit your info here</h3>
 $errors
 <form enctype="multipart/form-data" action="$_SERVER[REQUEST_URI]" method="post">
 <table>
 <tr><td>&docweb.users.name;</td><td>
     <input type="text" name="name" value="$info[name]" /></td></tr>
 <tr><td>&docweb.users.country;</td><td>
-    <input type="text" name="country" value="$info[country]" /></td></tr>
+<select name="country">
+$countries
+</select></td></tr>
 <tr><td>&docweb.users.website;</td><td>
     <input type="text" name="site" value="$info[site]" /></td></tr>
 <tr><td>&docweb.users.wishlist;</td><td>
@@ -36,10 +47,11 @@
 HTML;
 
 } else {
+$cntrycode = $GLOBALS['COUNTRIES'][$info['country']];
 echo <<< HTML
 <p><strong>&docweb.users.username;</strong>: $info[username]<br />
 <strong>&docweb.users.name;</strong>: $info[name]<br />
-<strong>&docweb.users.country;</strong>: $info[country]<br />
+<strong>&docweb.users.country;</strong>: $cntrycode<br />
 <strong>&docweb.users.website;</strong>: <a href="$info[site]">$info[site]</a><br />
 HTML;
 
@@ -51,5 +63,9 @@
 
 echo '</p>';
 
+if ($info['username'] == $GLOBALS['userid']) {
+    echo '<p><a href="'.$info['username'].'/edit">Edit Your profile</a>';
+}
+
 }
 ?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.