Author: david
Date: 2008-10-16 15:00:31 -0700 (Thu, 16 Oct 2008)
New Revision: 1468

Modified:
   trunk/qubit/apps/qubit/modules/settings/actions/listAction.class.php
   trunk/qubit/apps/qubit/modules/settings/templates/listSuccess.php
   trunk/qubit/lib/form/SettingsGlobalForm.class.php
   trunk/qubit/web/css/graphic.css
Log:
Move "version" and "upload_dir" settings into SettingsGlobalForm, as disabled 
fields, to prevent global errors from showing up in the middle of the panel, 
add tooltip help via form helps, and make it easier to enable updating them in 
the future.  Add "disabled" css class to grey-out field background/text in IE 
(not done by default). Make tooltips 'sentence' case.

Modified: trunk/qubit/apps/qubit/modules/settings/actions/listAction.class.php
===================================================================
--- trunk/qubit/apps/qubit/modules/settings/actions/listAction.class.php        
2008-10-16 21:56:33 UTC (rev 1467)
+++ trunk/qubit/apps/qubit/modules/settings/actions/listAction.class.php        
2008-10-16 22:00:31 UTC (rev 1468)
@@ -61,7 +61,12 @@
     // Validate submitted data, and forward to 'updateAction' if validation 
succeeds
     if ($request->isMethod('post'))
     {
-      $this->globalForm->bind($request->getParameter('settings'));
+      // Hack to populate "version" and "upload_dir" fields if validation 
fails.
+      // By default, their values are not included in $request->parameterHolder
+      // (and thus are not bound) because their <input> field is disabled.
+      $version = (null !== $setting = 
QubitSetting::getSettingByName('version')) ? 
$setting->getValue(array('sourceCulture'=>true)) : null;
+      $uploadDir = (null !== $setting = 
QubitSetting::getSettingByName('upload_dir')) ? 
$setting->getValue(array('sourceCulture'=>true)) : null;   
+      $this->globalForm->bind(array_merge($request->getParameter('settings'), 
array('version'=>$version, 'upload_dir'=>$uploadDir)));
       if ($this->globalForm->isValid())
       {
         
$this->redirect('settings/update?'.http_build_query($this->globalForm->getValues()));
@@ -77,6 +82,8 @@
         
     // Set defaults for global form
     $this->globalForm->setDefaults(array(
+      'version' => (isset($version)) ? 
$version->getValue(array('sourceCulture'=>true)) : null,
+      'upload_dir' => (isset($uploadDir)) ? 
$uploadDir->getValue(array('sourceCulture'=>true)) : null,
       'reference_image_maxwidth' => (isset($refImageMaxWidth)) ? 
$refImageMaxWidth->getValue(array('sourceCulture'=>true)) : null,
       'hits_per_page' => (isset($hitsPerPage)) ? 
$hitsPerPage->getValue(array('sourceCulture'=>true)) : null,
       'multi_repository' => (isset($multiRepository)) ? 
intval($multiRepository->getValue(array('sourceCulture'=>true))) : 1
@@ -97,7 +104,5 @@
     // make vars available to template
     $this->settingsGroups = $settingsGroups;
     $this->availableLanguages = self::$availableLanguges;
-    $this->version = (isset($version)) ? 
$version->getValue(array('sourceCulture'=>true)) : '';
-    $this->uploadDir = (isset($uploadDir)) ? 
$uploadDir->getValue(array('sourceCulture'=>true)) : '';
   }
 }

Modified: trunk/qubit/apps/qubit/modules/settings/templates/listSuccess.php
===================================================================
--- trunk/qubit/apps/qubit/modules/settings/templates/listSuccess.php   
2008-10-16 21:56:33 UTC (rev 1467)
+++ trunk/qubit/apps/qubit/modules/settings/templates/listSuccess.php   
2008-10-16 22:00:31 UTC (rev 1468)
@@ -14,14 +14,6 @@
     </tr>
   </thead>
   <tbody>
-    <tr>
-      <td><label for="settings_version"><?php echo __('application 
version')?></label></td>
-      <td id="settings_version"><?php echo $version ?></td>
-    </tr>
-    <tr>
-      <td><label for="settings_upload_dir"><?php echo __('uploads 
directory')?></label></td>
-      <td id="settings_version"><?php echo $uploadDir.'/' ?></td>
-    </tr>
     <?php echo $globalForm ?>
     <tr>
       <td>&nbsp;</td>

Modified: trunk/qubit/lib/form/SettingsGlobalForm.class.php
===================================================================
--- trunk/qubit/lib/form/SettingsGlobalForm.class.php   2008-10-16 21:56:33 UTC 
(rev 1467)
+++ trunk/qubit/lib/form/SettingsGlobalForm.class.php   2008-10-16 22:00:31 UTC 
(rev 1468)
@@ -39,6 +39,8 @@
   {
     // Build widgets
     $this->setWidgets(array(
+      'version' => new sfWidgetFormInput(array(), array('class'=>'disabled', 
'disabled'=>true)),
+      'upload_dir' => new sfWidgetFormInput(array(), 
array('class'=>'disabled', 'disabled'=>true)),
       'reference_image_maxwidth' => new sfWidgetFormInput,
       'hits_per_page' => new sfWidgetFormInput,
       'multi_repository' => new 
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')))
@@ -46,6 +48,8 @@
     
     // Add labels
     $this->widgetSchema->setLabels(array(
+      'version' => 'application version',
+      'upload_dir' => 'upload directory',
       'reference_image_maxwidth' => 'maximum image width (pixels)',
       'hits_per_page' => 'results per page',
       'multi_repository' => 'multiple repositories'
@@ -53,9 +57,11 @@
     
     // Add helper text
     $this->widgetSchema->setHelps(array(
-      'reference_image_maxwidth' => 'the maximum width for derived reference 
images',
-      'hits_per_page' => 'the number of results shown per page on list pages',
-      'multi_repository' => 'when set to &quot;yes&quot;, the related 
repository name will be shown in some labels (e.g. archival descriptions) and 
the context menu'
+      'version' => 'The current version of the application',
+      'upload_dir' => 'The destination directory for uploaded digital object 
files',
+      'reference_image_maxwidth' => 'The maximum width for derived reference 
images',
+      'hits_per_page' => 'The number of results shown per page on list pages',
+      'multi_repository' => 'When set to &quot;yes&quot;, the related 
repository name will be shown in some labels (e.g. archival descriptions) and 
the context menu'
     ));
     
     // Reference image max. width validator
@@ -86,6 +92,8 @@
       )
     );
     
+    $this->validatorSchema['version'] = new sfValidatorString(array('required' 
=> false));
+    $this->validatorSchema['upload_dir'] = new 
sfValidatorString(array('required' => false));
     $this->validatorSchema['multi_repository'] = new 
sfValidatorNumber(array('required' => false));
     
     // Set decorator

Modified: trunk/qubit/web/css/graphic.css
===================================================================
--- trunk/qubit/web/css/graphic.css     2008-10-16 21:56:33 UTC (rev 1467)
+++ trunk/qubit/web/css/graphic.css     2008-10-16 22:00:31 UTC (rev 1468)
@@ -231,6 +231,13 @@
 border-bottom: 2px solid #a5bcca;
 }
 
+/*disabled element*/
+.disabled
+{
+       background-color: #CCC;
+       color: #666;
+}
+
 /*********************************************************
                 SEARCH/BROWSE RESULTS LIST
 **********************************************************/


--~--~---------~--~----~------------~-------~--~----~
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