Author: david
Date: Thu Dec  3 11:12:04 2009
New Revision: 4054

Log:
ISDF essential fields validation.

Modified:
   trunk/apps/qubit/modules/function/actions/showAction.class.php

Modified: trunk/apps/qubit/modules/function/actions/showAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/function/actions/showAction.class.php      Thu Dec 
 3 10:55:51 2009        (r4053)
+++ trunk/apps/qubit/modules/function/actions/showAction.class.php      Thu Dec 
 3 11:12:04 2009        (r4054)
@@ -29,6 +29,28 @@
 
     $this->maintenanceNotes = $this->func->getNotesByType(array('noteTypeId' 
=> QubitTerm::MAINTENANCE_NOTE_ID));
 
+     // ISDF validation rules
+    if (QubitAcl::check($this->func, QubitAclAction::UPDATE_ID))
+    {
+      $validatorSchema = new sfValidatorSchema;
+      $validatorSchema->type = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Type%2% - This is a 
mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-4#Structure_and_use_4.7";>', 
'%2%' => '</a>'))));
+      $validatorSchema->authorizedFormOfName = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authorized form of name%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-4#Structure_and_use_4.7";>', 
'%2%' => '</a>'))));
+      $validatorSchema->descriptionIdentifier = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Function description identifier%2% - This is a 
mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-4#Structure_and_use_4.7";>', 
'%2%' => '</a>'))));
+
+      try
+      {
+        $validatorSchema->clean(array(
+          'type' => $this->func->type,
+          'authorizedFormOfName' => $this->func->authorizedFormOfName,
+          'descriptionIdentifier' => $this->func->descriptionIdentifier
+        ));
+      }
+      catch (sfValidatorErrorSchema $e)
+      {
+        $this->errorSchema = $e;
+      }
+    }
+
     //$this->languageCodes = $this->func->getProperties($name = 
'language_of_func_description');
     //$this->scriptCodes = $this->func->getProperties($name = 
'script_of_func_description');
 

--

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.


Reply via email to