Author: sevein
Date: Wed Aug 1 15:12:50 2012
New Revision: 12028
Log:
Add client and server validation for the authority record related sources
dialog, an information object must be present otherwise the resource will be
ignored. Fixes issue 2389.
Modified:
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/eventComponent.class.php
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
Modified:
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/eventComponent.class.php
==============================================================================
---
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/eventComponent.class.php
Wed Aug 1 15:11:19 2012 (r12027)
+++
trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/actions/eventComponent.class.php
Wed Aug 1 15:12:50 2012 (r12028)
@@ -34,7 +34,7 @@
switch ($name)
{
case 'informationObject':
- $this->form->setValidator($name, new sfValidatorString);
+ $this->form->setValidator($name, new
sfValidatorString(array('required' => true)));
$this->form->setWidget($name, new sfWidgetFormSelect(array('choices'
=> array())));
break;
@@ -62,6 +62,7 @@
unset($this->event->informationObject);
$value = $this->form->getValue('informationObject');
+
if (isset($value))
{
$params = $this->context->routing->parse(Qubit::pathInfo($value));
Modified: trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
==============================================================================
--- trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
Wed Aug 1 15:11:19 2012 (r12027)
+++ trunk/plugins/sfIsaarPlugin/modules/sfIsaarPlugin/templates/_event.php
Wed Aug 1 15:12:50 2012 (r12028)
@@ -81,11 +81,22 @@
return this.renderField(fname);
}
+ // Add validator to make sure that an information object is selected
+ var validator = function (data)
+ {
+ var informationObject = data['editEvent[informationObject]'];
+ if (!informationObject.length)
+ {
+ return false;
+ }
+ }
+
// Define dialog
var dialog = new QubitDialog('resourceRelation', {
'displayTable': 'relatedEvents',
'handleFieldRender': handleFieldRender,
- 'newRowTemplate': $rowTemplate });
+ 'newRowTemplate': $rowTemplate,
+ 'validator': validator });
// Add edit button to rows
jQuery('#relatedEvents tr[id]', context)
--
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.com/group/qubit-commits?hl=en.