Author: jablko
Date: Thu Oct 14 16:41:04 2010
New Revision: 8142

Log:
Use $isdiah->maintenanceNotes

Modified:
   trunk/apps/qubit/modules/repository/actions/indexAction.class.php
   
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
   trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/editSuccess.php
   
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/indexSuccess.php

Modified: trunk/apps/qubit/modules/repository/actions/indexAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/indexAction.class.php   Thu Oct 
14 16:38:21 2010        (r8141)
+++ trunk/apps/qubit/modules/repository/actions/indexAction.class.php   Thu Oct 
14 16:41:04 2010        (r8142)
@@ -24,12 +24,6 @@
     $this->resource = $this->getRoute()->resource;
 
     $this->otherNames = $this->resource->getOtherNames();
-    $this->maintenanceNote = null;
-    if (0 < count($maintenanceNotes = 
$this->resource->getNotesByType(array('noteTypeId' => 
QubitTerm::MAINTENANCE_NOTE_ID))))
-    {
-      $this->maintenanceNote = $maintenanceNotes->offsetGet(0);
-    }
-
     $this->types = 
$this->resource->getTermRelations(QubitTaxonomy::REPOSITORY_TYPE_ID);
   }
 }

Modified: 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
==============================================================================
--- 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
    Thu Oct 14 16:38:21 2010        (r8141)
+++ 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/actions/editAction.class.php
    Thu Oct 14 16:41:04 2010        (r8142)
@@ -86,27 +86,9 @@
     switch ($name)
     {
       case 'maintenanceNotes':
-        // Check for existing maintenance note related to this object
-        $maintenanceNotes = $this->resource->getNotesByType(array('noteTypeId' 
=> QubitTerm::MAINTENANCE_NOTE_ID));
-
-        if (0 < count($maintenanceNotes))
-        {
-          $note = $maintenanceNotes[0];
-        }
-        else if (null !== $this->form->getValue('maintenanceNotes'))
-        {
-          // Create a maintenance note for this object if one doesn't exist
-          $note = new QubitNote;
-          $note->typeId = QubitTerm::MAINTENANCE_NOTE_ID;
-        }
-        else
-        {
-          break;
-        }
-
-        $note->content = $this->form->getValue('maintenanceNotes');
-
-        $this->resource->notes[] = $note;
+        $this->form->setDefault('maintenanceNotes', 
$this->isdiah->maintenanceNotes);
+        $this->form->setValidator('maintenanceNotes', new sfValidatorString);
+        $this->form->setWidget('maintenanceNotes', new sfWidgetFormTextarea);
 
         break;
 
@@ -121,18 +103,7 @@
     switch ($field->getName())
     {
       case 'maintenanceNotes':
-        $this->maintenanceNote = null;
-
-        // Check for existing maintenance note related to this object
-        $maintenanceNotes = $this->resource->getNotesByType(array('noteTypeId' 
=> QubitTerm::MAINTENANCE_NOTE_ID));
-
-        if (0 < count($maintenanceNotes))
-        {
-          $this->maintenanceNote = $maintenanceNotes[0];
-          $this->form->setDefault('maintenanceNotes', 
$this->maintenanceNote->content);
-        }
-        $this->form->setValidator('maintenanceNotes', new sfValidatorString);
-        $this->form->setWidget('maintenanceNotes', new sfWidgetFormTextarea);
+        $this->isdiah->maintenanceNotes = 
$this->form->getValue('maintenanceNotes');
 
         break;
 

Modified: 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/editSuccess.php
==============================================================================
--- 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/editSuccess.php   
    Thu Oct 14 16:38:21 2010        (r8141)
+++ 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/editSuccess.php   
    Thu Oct 14 16:41:04 2010        (r8142)
@@ -281,7 +281,7 @@
       ->label(__('Sources')), $resource, array('class' => 'resizable')) ?>
 
     <?php echo render_field($form->maintenanceNotes
-      ->help(__('"Record notes pertinent to the creation and maintenance of 
the description." (ISDIAH 5.6.9)')), $maintenanceNote, array('name' => 
'content', 'class' => 'resizable')) ?>
+      ->help(__('"Record notes pertinent to the creation and maintenance of 
the description." (ISDIAH 5.6.9)')), $isdiah, array('class' => 'resizable')) ?>
 
   </fieldset>
 

Modified: 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/indexSuccess.php
==============================================================================
--- 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/indexSuccess.php  
    Thu Oct 14 16:38:21 2010        (r8141)
+++ 
trunk/plugins/sfIsdiahPlugin/modules/sfIsdiahPlugin/templates/indexSuccess.php  
    Thu Oct 14 16:41:04 2010        (r8142)
@@ -126,7 +126,7 @@
 
 <?php echo render_show(__('Sources'), 
render_value($resource->getDescSources(array('cultureFallback' => true)))) ?>
 
-<?php echo render_show(__('Maintenance notes'), 
render_value($maintenanceNote)) ?>
+<?php echo render_show(__('Maintenance notes'), 
render_value($isdiah->maintenanceNotes)) ?>
 
 <?php if (SecurityPriviliges::editCredentials($sf_user, 'repository')): ?>
   <div class="actions section">

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