Author: david
Date: 2008-11-26 17:23:09 -0800 (Wed, 26 Nov 2008)
New Revision: 1626
Modified:
trunk/qubit/lib/form/SettingsGlobalForm.class.php
Log:
Switch to sfValidatorInteger() for global form fields containing numbers to
avoid numbers being converted to 5 digit floats. Fix whitespace to comply with
pre-commit code validator.
Modified: trunk/qubit/lib/form/SettingsGlobalForm.class.php
===================================================================
--- trunk/qubit/lib/form/SettingsGlobalForm.class.php 2008-11-27 00:04:21 UTC
(rev 1625)
+++ trunk/qubit/lib/form/SettingsGlobalForm.class.php 2008-11-27 01:23:09 UTC
(rev 1626)
@@ -21,20 +21,20 @@
/**
* Global form definition for settings module - with validation.
- *
+ *
* @package qubit
* @subpackage settings
* @version svn: $Id$
* @author David Juhasz <[EMAIL PROTECTED]>
*/
class SettingsGlobalForm extends sfForm
-{
+{
protected static $refImageMaxWidthMin = 100;
protected static $refImageMaxWidthMax = 2000;
-
+
protected static $hitsPerPageMin = 5;
protected static $hitsPerPageMax = 50;
-
+
public function configure()
{
// Build widgets
@@ -45,7 +45,7 @@
'hits_per_page' => new sfWidgetFormInput,
'multi_repository' => new
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')),
array('class'=>'radio'))
));
-
+
// Add labels
$this->widgetSchema->setLabels(array(
'version' => 'application version',
@@ -54,7 +54,7 @@
'hits_per_page' => 'results per page',
'multi_repository' => 'multiple repositories'
));
-
+
// Add helper text
$this->widgetSchema->setHelps(array(
'version' => 'The current version of the application',
@@ -63,12 +63,12 @@
'hits_per_page' => 'The number of records shown per page on list pages',
'multi_repository' => 'When set to "yes", the related
repository name will be shown in some labels (e.g. archival descriptions) and
the context menu'
));
-
+
// Reference image max. width validator
- $this->validatorSchema['reference_image_maxwidth'] = new sfValidatorNumber(
+ $this->validatorSchema['reference_image_maxwidth'] = new
sfValidatorInteger(
array(
'required' => true,
- 'min' => self::$refImageMaxWidthMin,
+ 'min' => self::$refImageMaxWidthMin,
'max' => self::$refImageMaxWidthMax
),
array(
@@ -77,12 +77,12 @@
'max' => 'The value can not be more than %max% pixels'
)
);
-
+
// Hits per page validator
- $this->validatorSchema['hits_per_page'] = new sfValidatorNumber(
+ $this->validatorSchema['hits_per_page'] = new sfValidatorInteger(
array(
'required' => true,
- 'min' => self::$hitsPerPageMin,
+ 'min' => self::$hitsPerPageMin,
'max' => self::$hitsPerPageMax
),
array(
@@ -91,16 +91,16 @@
'max'=> 'You cannot show more than %max% hits per page'
)
);
-
+
$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));
-
+ $this->validatorSchema['multi_repository'] = new
sfValidatorInteger(array('required' => false));
+
// Set decorator
$decorator = new QubitWidgetFormSchemaFormatterList($this->widgetSchema);
$this->widgetSchema->addFormFormatter('list', $decorator);
$this->widgetSchema->setFormFormatterName('list');
-
+
// Set wrapper text for global form settings
$this->widgetSchema->setNameFormat('global_settings[%s]');
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---