Author: jablko
Date: Fri Oct 22 18:01:09 2010
New Revision: 8393

Log:
Factor maintenance notes into ISDF object, like ISAAR

Added:
   trunk/plugins/sfIsdfPlugin/lib/
   trunk/plugins/sfIsdfPlugin/lib/sfIsdfPlugin.class.php
      - copied, changed from r8390, 
trunk/plugins/sfIsaarPlugin/lib/sfIsaarPlugin.class.php
Modified:
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/actions/editAction.class.php
   trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php

Copied and modified: trunk/plugins/sfIsdfPlugin/lib/sfIsdfPlugin.class.php 
(from r8390, trunk/plugins/sfIsaarPlugin/lib/sfIsaarPlugin.class.php)
==============================================================================
--- trunk/plugins/sfIsaarPlugin/lib/sfIsaarPlugin.class.php     Fri Oct 22 
16:30:57 2010        (r8390, copy source)
+++ trunk/plugins/sfIsdfPlugin/lib/sfIsdfPlugin.class.php       Fri Oct 22 
18:01:09 2010        (r8393)
@@ -3,13 +3,13 @@
 /*
  */
 
-class sfIsaarPlugin implements ArrayAccess
+class sfIsdfPlugin implements ArrayAccess
 {
   protected
     $resource,
     $maintenanceNote;
 
-  public function __construct(QubitActor $resource)
+  public function __construct(QubitFunction $resource)
   {
     $this->resource = $resource;
   }

Modified: 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/actions/editAction.class.php
==============================================================================
--- 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/actions/editAction.class.php    
    Fri Oct 22 17:51:19 2010        (r8392)
+++ 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/actions/editAction.class.php    
    Fri Oct 22 18:01:09 2010        (r8393)
@@ -46,6 +46,8 @@
   {
     parent::earlyExecute();
 
+    $this->isdf = new sfIsdfPlugin($this->resource);
+
     $this->relatedAuthorityRecordComponent = new 
sfIsdfPluginRelatedAuthorityRecordComponent($this->context, 'sfIsdfPlugin', 
'relatedAuthorityRecord');
     $this->relatedAuthorityRecordComponent->resource = $this->resource;
     $this->relatedAuthorityRecordComponent->execute($this->request);
@@ -85,19 +87,7 @@
         break;
 
       case 'maintenanceNotes':
-        $this->maintenanceNote = null;
-
-        // Check for existing maintenance note related to this object
-        $criteria = new Criteria;
-        $criteria = $this->resource->addnotesCriteria($criteria);
-        $criteria->add(QubitNote::TYPE_ID, QubitTerm::MAINTENANCE_NOTE_ID);
-        $note = QubitNote::getOne($criteria);
-
-        if (null !== $note)
-        {
-          $this->form->setDefault('maintenanceNotes', $note->content);
-          $this->maintenanceNote = $note;
-        }
+        $this->form->setDefault('maintenanceNotes', 
$this->isdf->maintenanceNotes);
         $this->form->setValidator('maintenanceNotes', new sfValidatorString);
         $this->form->setWidget('maintenanceNotes', new sfWidgetFormTextarea);
 
@@ -155,22 +145,7 @@
         break;
 
       case 'maintenanceNotes':
-        // Check for existing maintenance note related to this object
-        $criteria = new Criteria;
-        $criteria = $this->resource->addnotesCriteria($criteria);
-        $criteria->add(QubitNote::TYPE_ID, QubitTerm::MAINTENANCE_NOTE_ID);
-        $note = QubitNote::getOne($criteria);
-
-        if (null === $note)
-        {
-          // Create a maintenance note for this object if one doesn't exist
-          $note = new QubitNote;
-          $note->typeId = QubitTerm::MAINTENANCE_NOTE_ID;
-        }
-
-        $note->content = $this->form->getValue('maintenanceNotes');
-
-        $this->resource->notes[] = $note;
+        $this->isdf->maintenanceNotes = 
$this->form->getValue('maintenanceNotes');
 
         break;
 

Modified: 
trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php
==============================================================================
--- trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php   
Fri Oct 22 17:51:19 2010        (r8392)
+++ trunk/plugins/sfIsdfPlugin/modules/sfIsdfPlugin/templates/editSuccess.php   
Fri Oct 22 18:01:09 2010        (r8393)
@@ -114,7 +114,7 @@
       ->help(__('"Record the sources consulted in establishing the function 
description." (ISDF 5.4.8)')), $resource, array('class' => 'resizable')) ?>
 
     <?php echo render_field($form->maintenanceNotes
-      ->help(__('"Record notes pertinent to the creation and maintenance of 
the description." (ISDF 5.4.9)')), $maintenanceNote, array('name' => 'content', 
'class' => 'resizable')) ?>
+      ->help(__('"Record notes pertinent to the creation and maintenance of 
the description." (ISDF 5.4.9)')), $isdf, array('class' => 'resizable')) ?>
 
   </fieldset>
 

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