Author: peter
Date: Sat Sep 19 16:33:58 2009
New Revision: 3430

Log:
allow user to enable any ISO639-2 language for the user interface. Fixes issue 
#272. fixes issue #925. Two related issues remain. See issue #961 & issue #962

Modified:
   trunk/apps/qubit/modules/settings/actions/updateAction.class.php
   trunk/apps/qubit/modules/settings/templates/listSuccess.php

Modified: trunk/apps/qubit/modules/settings/actions/updateAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/settings/actions/updateAction.class.php    Sat Sep 
19 15:32:58 2009        (r3429)
+++ trunk/apps/qubit/modules/settings/actions/updateAction.class.php    Sat Sep 
19 16:33:58 2009        (r3430)
@@ -46,7 +46,18 @@
     {
       // we are adding a new language
       sfLoader::loadHelpers(array('I18N'));
-
+      // Check to make sure that the selected language is supported with a 
Symfony i18n data file.
+      // If not it will cause a fatal error in the Language List component on 
every response.
+      // Can route the user to a warning page with more info in a later 
release, for now just
+      // return to the settings/list template without taking any action
+      try
+      {
+        format_language($this->getRequestParameter('language_code'), 
$this->getRequestParameter('language_code'));
+      }
+      catch (Exception $e)
+      {
+        return $this->redirect(array('module' => 'settings', 'action' => 
'list'));
+      }
       $setting = new QubitSetting;
       $setting->setName($this->getRequestParameter('language_code'));
       $setting->setScope('i18n_languages');
@@ -91,4 +102,4 @@
     $fileCache = new sfFileCache(array('cache_dir' => 
sfConfig::get('sf_app_cache_dir').'/settings'));
     $fileCache->clean();
   }
-}
\ No newline at end of file
+}

Modified: trunk/apps/qubit/modules/settings/templates/listSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/settings/templates/listSuccess.php Sat Sep 19 
15:32:58 2009        (r3429)
+++ trunk/apps/qubit/modules/settings/templates/listSuccess.php Sat Sep 19 
16:33:58 2009        (r3430)
@@ -173,8 +173,9 @@
           <?php echo format_language($setting->getName()) ?>
         </td>
         <td>
-          <?php if ($setting->isDeleteable()): ?>
-            <?php echo link_to(image_tag('delete', 'valign=top'), 
'settings/delete?id='.$setting->getId(), array('post' => 'true', 'confirm' => 
__('are you sure?'))) ?>
+          <?php if ($setting->deleteable): ?>
+
+            <?php echo link_to('x', 'settings/delete?id='.$setting->getId(), 
array('post' => 'true', 'confirm' => __('are you sure?'))) ?>
           <?php endif; ?>
         </td>
       </tr>
@@ -182,7 +183,7 @@
 
       <tr>
         <td colspan="2">
-          <?php echo select_tag('language_code', 
options_for_select($sf_data->getRaw('availableLanguages'))) ?>
+            <?php echo select_language_tag('language_code', null, 
array('include_blank' => true)) ?>
         </td>
         <td>
           <div style="float: right; margin: 3px 8px 0 0;">

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to