Author: david
Date: Tue Nov 17 17:05:44 2009
New Revision: 3907

Log:
Skeleton of ISDF edit form.

Added:
   trunk/apps/qubit/modules/function/
   trunk/apps/qubit/modules/function/actions/
   trunk/apps/qubit/modules/function/actions/editAction.class.php   (contents, 
props changed)
      - copied, changed from r3904, 
trunk/apps/qubit/modules/actor/actions/editAction.class.php
   trunk/apps/qubit/modules/function/config/
   trunk/apps/qubit/modules/function/config/view.yml   (contents, props changed)
      - copied, changed from r3904, 
trunk/apps/qubit/modules/actor/config/view.yml
   trunk/apps/qubit/modules/function/templates/
   trunk/apps/qubit/modules/function/templates/editSuccess.php   (contents, 
props changed)
      - copied, changed from r3904, 
trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php
Modified:
   trunk/lib/model/QubitFunction.php

Copied and modified: 
trunk/apps/qubit/modules/function/actions/editAction.class.php (from r3904, 
trunk/apps/qubit/modules/actor/actions/editAction.class.php)
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/editAction.class.php Tue Nov 17 
09:35:57 2009        (r3904, copy source)
+++ trunk/apps/qubit/modules/function/actions/editAction.class.php      Tue Nov 
17 17:05:44 2009        (r3907)
@@ -18,129 +18,216 @@
  */
 
 /**
- * Controller for editing actor information.
+ * Controller for editing func information.
  *
  * @package    qubit
- * @subpackage actor
+ * @subpackage function
  * @version    svn: $Id$
- * @author     Peter Van Garderen <[email protected]>
- * @author     Jack Bates <[email protected]>
  * @author     David Juhasz <[email protected]>
  */
-class ActorEditAction extends sfAction
+class FunctionEditAction extends sfAction
 {
+  public static $NAMES = array(
+    'type',
+    'authorizedFormOfName',
+    //'parallel_name',
+    //'other_name',
+    'classification',
+    'dates',
+    'description',
+    'history',
+    'legislation',
+    'descriptionIdentifier',
+    'institutionIdentifier',
+    'rules',
+    'descriptionStatus',
+    'descriptionDetail',
+    'revisionHistory',
+    'sources'
+    //'maintainance_note'
+  );
+
+  protected function addField($name)
+  {
+    switch ($name)
+    {
+      case 'authorizedFormOfName':
+      case 'classification':
+      case 'dates':
+      case 'description':
+      case 'history':
+      case 'legislation':
+      case 'descriptionIdentifier':
+      case 'institutionIdentifier':
+      case 'rules':
+      case 'revisionHistory':
+      case 'sources':
+        $this->form->setDefault($name, $this->user[$name]);
+        $this->form->setValidator($name, new sfValidatorString);
+        $this->form->setWidget($name, new sfWidgetFormInput);
+
+        break;
+
+      case 'type':
+        if (null !== $this->func->type)
+        {
+          $this->form->setDefault('type', 
$this->context->routing->generate(null, array('module' => 'term', 'action' => 
'show', 'id' => $this->func->type->id)));
+        }
+        $this->form->setValidator('type', new sfValidatorString);
+
+        $choices = array();
+        $choices[null] = null;
+
+        /*
+        foreach 
(QubitTaxonomy::getTermsById(QubitTaxonomy::DESCRIPTION_STATUS_ID) as $term)
+        {
+          $choices[$this->context->routing->generate(null, array('module' => 
'term', 'action' => 'show', 'id' => $term->id))] = $term;
+        }
+        */
+
+        // TODO add "Function types" qubit term constants
+        $choices = array(
+          'Subfunction' => 'Subfunction',
+          'Business process' => 'Business process',
+          'Activity' => 'Activity',
+          'Task' => 'Task',
+          'Transaction' => 'Transaction'
+        );
+
+        $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' 
=> $choices)));
+
+        break;
+
+      case 'descriptionStatus':
+        if (null !== $this->func->descriptionStatus)
+        {
+          $this->form->setDefault('descriptionStatus', 
$this->context->routing->generate(null, array('module' => 'term', 'action' => 
'show', 'id' => $this->func->descriptionStatus->id)));
+        }
+        $this->form->setValidator('descriptionStatus', new sfValidatorString);
+
+        $choices = array();
+        $choices[null] = null;
+        foreach 
(QubitTaxonomy::getTermsById(QubitTaxonomy::DESCRIPTION_STATUS_ID) as $term)
+        {
+          $choices[$this->context->routing->generate(null, array('module' => 
'term', 'action' => 'show', 'id' => $term->id))] = $term;
+        }
+
+        $this->form->setWidget('descriptionStatus', new 
sfWidgetFormSelect(array('choices' => $choices)));
+
+        break;
+
+      case 'descriptionDetail':
+        if (null !== $this->func->descriptionDetail)
+        {
+          $this->form->setDefault('descriptionDetail', 
$this->context->routing->generate(null, array('module' => 'term', 'action' => 
'show', 'id' => $this->func->descriptionDetail->id)));
+        }
+        $this->form->setValidator('descriptionDetail', new sfValidatorString);
+
+        $choices = array();
+        $choices[null] = null;
+        foreach 
(QubitTaxonomy::getTermsById(QubitTaxonomy::DESCRIPTION_DETAIL_LEVEL_ID) as 
$term)
+        {
+          $choices[$this->context->routing->generate(null, array('module' => 
'term', 'action' => 'show', 'id' => $term->id))] = $term;
+        }
+
+        $this->form->setWidget('descriptionDetail', new 
sfWidgetFormSelect(array('choices' => $choices)));
+
+        break;
+    }
+  }
+
   public function execute($request)
   {
     $this->form = new sfForm;
 
-    $this->actor = new QubitActor;
+    $this->func = new QubitFunction;
 
     if (isset($request->id))
     {
-      $this->actor = QubitActor::getById($request->id);
+      $this->func = QubitFunction::getById($request->id);
 
-      if (!isset($this->actor))
+      if (!isset($this->func))
       {
         $this->forward404();
       }
 
       // Add optimistic lock
-      $this->form->setDefault('serialNumber', $this->actor->serialNumber);
+      $this->form->setDefault('serialNumber', $this->func->serialNumber);
       $this->form->setValidator('serialNumber', new sfValidatorInteger);
       $this->form->setWidget('serialNumber', new sfWidgetFormInputHidden);
     }
 
+    // HACK: Use static::$NAMES in PHP 5.3,
+    // http://php.net/oop5.late-static-bindings
+    $class = new ReflectionClass($this);
+    foreach ($class->getStaticPropertyValue('NAMES') as $name)
+    {
+      $this->addField($name);
+    }
+
     //Other Forms of Name
-    $this->otherNames = $this->actor->getOtherNames();
-    $this->newName = new QubitActorName;
+    // TODO
+    //$this->otherNames = $this->func->getOtherNames();
+    //$this->newName = new QubitActorName;
 
     //Properties
-    $this->languageCodes = $this->actor->getProperties($name = 
'language_of_actor_description');
-    $this->scriptCodes = $this->actor->getProperties($name = 
'script_of_actor_description');
+    // TODO
+    //$this->languageCodes = $this->func->getProperties($name = 
'language_of_func_description');
+    //$this->scriptCodes = $this->func->getProperties($name = 
'script_of_func_description');
 
     //Notes
-    $this->maintenanceNotes = $this->actor->getNotesByType(array('noteTypeId' 
=> QubitTerm::MAINTENANCE_NOTE_ID));
+    //TODO
+    //$this->maintenanceNotes = $this->func->getNotesByType(array('noteTypeId' 
=> QubitTerm::MAINTENANCE_NOTE_ID));
 
     //Actor Relations
-    $this->actorRelations = $this->actor->getActorRelations();
-    $this->actorRelationCategories = 
QubitTaxonomy::getTermsById(QubitTaxonomy::ACTOR_RELATION_TYPE_ID);
+    //TODO
+    //$this->funcRelations = $this->func->getActorRelations();
+    //$this->funcRelationCategories = 
QubitTaxonomy::getTermsById(QubitTaxonomy::ACTOR_RELATION_TYPE_ID);
 
     //Related resources (events)
-    $this->events = $this->actor->getEvents();
-    $this->eventTypes = 
QubitTerm::getOptionsForSelectList(QubitTaxonomy::EVENT_TYPE_ID);
-    $this->resourceTypeTerms = 
array(QubitTerm::getById(QubitTerm::ARCHIVAL_MATERIAL_ID));
-
-    if ($this->getRequestParameter('repositoryReroute'))
-    {
-      $this->repositoryReroute = 
$this->getRequestParameter('repositoryReroute');
-    }
-    else
-    {
-      $this->repositoryReroute = null;
-    }
-
-    if ($this->getRequestParameter('informationObjectReroute'))
-    {
-      $this->informationObjectReroute = 
$this->getRequestParameter('informationObjectReroute');
-    }
-    else
-    {
-      $this->informationObjectReroute = null;
-    }
-
-    // Add javascript libraries to allow multiple instance select boxes
-    $this->getResponse()->addJavaScript('/vendor/jquery');
-    
$this->getResponse()->addJavaScript('/sfDrupalPlugin/vendor/drupal/misc/drupal');
-    $this->getResponse()->addJavaScript('multiInstanceSelect');
+    //TODO
+    //$this->events = $this->func->getEvents();
+    //$this->eventTypes = 
QubitTerm::getOptionsForSelectList(QubitTaxonomy::EVENT_TYPE_ID);
+    //$this->resourceTypeTerms = 
array(QubitTerm::getById(QubitTerm::ARCHIVAL_MATERIAL_ID));
 
     if ($request->isMethod('post'))
     {
-      $this->updateActorAttributes();
-      $this->updateTermOneToManyRelations();
-      $this->updateProperties();
-      $this->updateActorRelations();
-      $this->deleteActorRelations();
-      $this->updateEvents();
-      $this->deleteEvents();
-      $this->updateNotes();
-      $this->deleteNotes();
-
-      $this->actor->save();
-
-      $this->updateOtherNames();
-
-      //set redirect if actor edit was called from another module
-      if ($this->getRequestParameter('repositoryReroute'))
-      {
-        
$this->redirect('repository/edit?id='.$this->getRequestParameter('repositoryReroute'));
-      }
-
-      if ($this->getRequestParameter('informationObjectReroute'))
-      {
-        
$this->redirect('informationobject/edit?id='.$this->getRequestParameter('informationObjectReroute'));
-      }
-
-      $this->redirect(array('module' => 'actor', 'action' => 'show', 'id' => 
$this->actor->getId()));
+      // TODO
+      //$this->updateFunctionAttributes();
+      //$this->updateTermOneToManyRelations();
+      //$this->updateProperties();
+      //$this->updateActorRelations();
+      //$this->deleteActorRelations();
+      //$this->updateEvents();
+      //$this->deleteEvents();
+      //$this->updateNotes();
+      //$this->deleteNotes();
+
+      $this->func->save();
+
+      //$this->updateOtherNames();
+
+      $this->redirect(array('module' => 'function', 'action' => 'edit', 'id' 
=> $this->func->getId()));
     }
   }
 
-  public function updateActorAttributes()
-  {
-    
$this->actor->setAuthorizedFormOfName($this->getRequestParameter('authorized_form_of_name'));
-    
$this->actor->setDatesOfExistence($this->getRequestParameter('dates_of_existence'));
-    
$this->actor->setCorporateBodyIdentifiers($this->getRequestParameter('corporate_body_identifiers'));
-    $this->actor->setHistory($this->getRequestParameter('history'));
-    $this->actor->setPlaces($this->getRequestParameter('places'));
-    $this->actor->setLegalStatus($this->getRequestParameter('legal_status'));
-    $this->actor->setFunctions($this->getRequestParameter('functions'));
-    $this->actor->setMandates($this->getRequestParameter('mandates'));
-    
$this->actor->setInternalStructures($this->getRequestParameter('internal_structures'));
-    
$this->actor->setGeneralContext($this->getRequestParameter('general_context'));
-    
$this->actor->setDescriptionIdentifier($this->getRequestParameter('description_identifier'));
-    
$this->actor->setInstitutionResponsibleIdentifier($this->getRequestParameter('institution_responsible_identifier'));
-    $this->actor->setRules($this->getRequestParameter('rules'));
-    $this->actor->setSources($this->getRequestParameter('sources'));
-    
$this->actor->setRevisionHistory($this->getRequestParameter('revision_history'));
+  public function updateFunctionAttributes()
+  {
+    
$this->func->setAuthorizedFormOfName($this->getRequestParameter('authorized_form_of_name'));
+    
$this->func->setDatesOfExistence($this->getRequestParameter('dates_of_existence'));
+    
$this->func->setCorporateBodyIdentifiers($this->getRequestParameter('corporate_body_identifiers'));
+    $this->func->setHistory($this->getRequestParameter('history'));
+    $this->func->setPlaces($this->getRequestParameter('places'));
+    $this->func->setLegalStatus($this->getRequestParameter('legal_status'));
+    $this->func->setFunctions($this->getRequestParameter('functions'));
+    $this->func->setMandates($this->getRequestParameter('mandates'));
+    
$this->func->setInternalStructures($this->getRequestParameter('internal_structures'));
+    
$this->func->setGeneralContext($this->getRequestParameter('general_context'));
+    
$this->func->setDescriptionIdentifier($this->getRequestParameter('description_identifier'));
+    
$this->func->setInstitutionResponsibleIdentifier($this->getRequestParameter('institution_responsible_identifier'));
+    $this->func->setRules($this->getRequestParameter('rules'));
+    $this->func->setSources($this->getRequestParameter('sources'));
+    
$this->func->setRevisionHistory($this->getRequestParameter('revision_history'));
 
   }
 
@@ -148,7 +235,7 @@
   {
     if ($this->getRequestParameter('new_name'))
     {
-      $this->actor->setOtherNames($this->getRequestParameter('new_name'), 
$this->getRequestParameter('new_name_type_id'), 
$this->getRequestParameter('new_name_note'));
+      $this->func->setOtherNames($this->getRequestParameter('new_name'), 
$this->getRequestParameter('new_name_type_id'), 
$this->getRequestParameter('new_name_note'));
     }
   }
 
@@ -156,37 +243,37 @@
   {
     if ($this->getRequestParameter('entity_type_id'))
     {
-      
$this->actor->setEntityTypeId($this->getRequestParameter('entity_type_id'));
+      
$this->func->setEntityTypeId($this->getRequestParameter('entity_type_id'));
     }
     else
     {
-      $this->actor->setEntityTypeId(null);
+      $this->func->setEntityTypeId(null);
     }
 
     if ($this->getRequestParameter('description_status_id'))
     {
-      
$this->actor->setDescriptionStatusId($this->getRequestParameter('description_status_id'));
+      
$this->func->setDescriptionStatusId($this->getRequestParameter('description_status_id'));
     }
     else
     {
-      $this->actor->setDescriptionStatusId(null);
+      $this->func->setDescriptionStatusId(null);
     }
 
     if ($this->getRequestParameter('description_detail_id'))
     {
-      
$this->actor->setDescriptionDetailId($this->getRequestParameter('description_detail_id'));
+      
$this->func->setDescriptionDetailId($this->getRequestParameter('description_detail_id'));
     }
     else
     {
-      $this->actor->setDescriptionDetailId(null);
+      $this->func->setDescriptionDetailId(null);
     }
 
-    $this->actor->save();
+    $this->func->save();
   }
 
   public function updateProperties()
   {
-    // Add multiple languages of actor description
+    // Add multiple languages of func description
     if ($language_codes = $this->getRequestParameter('language_code'))
     {
       // If string, turn into single element array
@@ -196,13 +283,13 @@
       {
         if (strlen($language_code))
         {
-          $this->actor->addProperty('language_of_actor_description', 
$language_code, array('source_culture'=>true, 'scope' => 'languages'));
+          $this->func->addProperty('language_of_func_description', 
$language_code, array('source_culture'=>true, 'scope' => 'languages'));
           $this->foreignKeyUpdate = true;
         }
       }
     }
 
-    // Add multiple scripts of actor description
+    // Add multiple scripts of func description
     if ($script_codes = $this->getRequestParameter('script_code'))
     {
       // If string, turn into single element array
@@ -212,7 +299,7 @@
       {
         if (strlen($script_code))
         {
-          $this->actor->addProperty($name = 'script_of_actor_description', 
$script_code, array('source_culture'=>true, 'scope' => 'scripts'));
+          $this->func->addProperty($name = 'script_of_func_description', 
$script_code, array('source_culture'=>true, 'scope' => 'scripts'));
           $this->foreignKeyUpdate = true;
         }
       }
@@ -229,22 +316,22 @@
 
     if ($this->getRequestParameter('informationObjectId'))
     {
-      if ($this->getRequestParameter('actor_role_id'))
+      if ($this->getRequestParameter('func_role_id'))
       {
-        $actorRoleId = $this->getRequestParameter('actor_role_id');
+        $funcRoleId = $this->getRequestParameter('func_role_id');
       }
       else
       {
         //default role is Creator
-        $actorRoleId = QubitTerm::EXISTENCE_ID;
+        $funcRoleId = QubitTerm::EXISTENCE_ID;
       }
 
-      
$this->actor->addInformationObjectRelation($this->getRequestParameter('informationObjectId'),
 $actorRoleId, $this->getRequestParameter('relation_dates'));
+      
$this->func->addInformationObjectRelation($this->getRequestParameter('informationObjectId'),
 $funcRoleId, $this->getRequestParameter('relation_dates'));
     }
   }
 
   /**
-   * Update actor relationships
+   * Update func relationships
    *
    * @return ActorEditAction $this object
    */
@@ -253,23 +340,23 @@
     if ($this->hasRequestParameter('updateActorRelations'))
     {
       // Data from YUI dialog
-      $actorRelationData = $this->getRequestParameter('updateActorRelations');
+      $funcRelationData = $this->getRequestParameter('updateActorRelations');
     }
     else
     {
       // Data from plain html folm
-      $actorRelationData = 
array($this->getRequestParameter('editActorRelation'));
+      $funcRelationData = 
array($this->getRequestParameter('editActorRelation'));
     }
 
-    foreach ($actorRelationData as $actorRelationRow)
+    foreach ($funcRelationData as $funcRelationRow)
     {
-      // If no actor name specified then don't update this actor relation
-      if (0 == strlen($relatedActorName = $actorRelationRow['actorName']))
+      // If no func name specified then don't update this func relation
+      if (0 == strlen($relatedActorName = $funcRelationRow['funcName']))
       {
         continue;
       }
 
-      // If related actor doesn't exist, create a new actor
+      // If related func doesn't exist, create a new func
       if (null === ($relatedActor = 
QubitActor::getByAuthorizedFormOfName($relatedActorName)))
       {
         $relatedActor = new QubitActor;
@@ -278,20 +365,20 @@
       }
 
       // Create/edit relation
-      if (isset($actorRelationRow['id']))
+      if (isset($funcRelationRow['id']))
       {
-        if (null === ($relation = 
QubitRelation::getById($actorRelationRow['id'])))
+        if (null === ($relation = 
QubitRelation::getById($funcRelationRow['id'])))
         {
-          throw new sfException('Relation id '.$actorRelationRow['id'].' does 
not exist.');
+          throw new sfException('Relation id '.$funcRelationRow['id'].' does 
not exist.');
         }
         else
         {
-          // Update related actor based on current direction of relationship
-          if ($this->actor->getId() == $relation->getSubjectId())
+          // Update related func based on current direction of relationship
+          if ($this->func->getId() == $relation->getSubjectId())
           {
             $relation->setObjectId($relatedActor->getId());
           }
-          else if ($this->actor->getId() == $relation->getObjectId())
+          else if ($this->func->getId() == $relation->getObjectId())
           {
             $relation->setSubjectId($relatedActor->getId());
           }
@@ -304,21 +391,21 @@
       else
       {
         $relation = new QubitRelation;
-        $relation->setSubjectId($this->actor->getId());
+        $relation->setSubjectId($this->func->getId());
         $relation->setObjectId($relatedActor->getId());
       }
 
-      $relation->setTypeId($actorRelationRow['categoryId']);
-      
$relation->setStartDate(QubitDate::standardize($actorRelationRow['startDate']));
-      
$relation->setEndDate(QubitDate::standardize($actorRelationRow['endDate']));
+      $relation->setTypeId($funcRelationRow['categoryId']);
+      
$relation->setStartDate(QubitDate::standardize($funcRelationRow['startDate']));
+      
$relation->setEndDate(QubitDate::standardize($funcRelationRow['endDate']));
 
-      // Save new relation and related actor
+      // Save new relation and related func
       $relatedActor->save();
       $relation->save();
 
       // Add notes (after save of $relation so we have an object_id)
-      $relation->updateNote($actorRelationRow['description'], 
QubitTerm::RELATION_NOTE_DESCRIPTION_ID);
-      $relation->updateNote($actorRelationRow['dateDisplay'], 
QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID);
+      $relation->updateNote($funcRelationRow['description'], 
QubitTerm::RELATION_NOTE_DESCRIPTION_ID);
+      $relation->updateNote($funcRelationRow['dateDisplay'], 
QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID);
     }
 
     return $this;
@@ -336,7 +423,7 @@
     }
   }
   /**
-   * Add or update events related to this actor
+   * Add or update events related to this func
    *
    * @return ActorEditAction this object
    */
@@ -344,7 +431,7 @@
   {
     if ($this->hasRequestParameter('updateEvents'))
     {
-      // The 'updateEvents' array is created by the actorEventDialog.js
+      // The 'updateEvents' array is created by the funcEventDialog.js
       $updateEvents = $this->getRequestParameter('updateEvents');
     }
     else if ($this->hasRequestParameter('newEvent'))
@@ -357,7 +444,7 @@
       return;
     }
 
-    // Loop through actor events
+    // Loop through func events
     foreach ($updateEvents as $eventFormData)
     {
       // Create new event or update an existing one
@@ -406,7 +493,7 @@
       }
 
       // Update other event properties
-      $event->setActorId($this->actor->getId());
+      $event->setActorId($this->func->getId());
       $event->setTypeId($eventFormData['typeId']);
       $event->setDateDisplay($eventFormData['dateDisplay']);
       
$event->setStartDate(QubitDate::standardize($eventFormData['startDate']));
@@ -446,7 +533,7 @@
     {
       if (0 < strlen($newNote))
       {
-        $this->actor->setNote(array('userId' => $userId, 'note' => $newNote, 
'noteTypeId' => QubitTerm::MAINTENANCE_NOTE_ID));
+        $this->func->setNote(array('userId' => $userId, 'note' => $newNote, 
'noteTypeId' => QubitTerm::MAINTENANCE_NOTE_ID));
       }
     }
 

Copied and modified: trunk/apps/qubit/modules/function/config/view.yml (from 
r3904, trunk/apps/qubit/modules/actor/config/view.yml)
==============================================================================
--- trunk/apps/qubit/modules/actor/config/view.yml      Tue Nov 17 09:35:57 
2009        (r3904, copy source)
+++ trunk/apps/qubit/modules/function/config/view.yml   Tue Nov 17 17:05:44 
2009        (r3907)
@@ -5,25 +5,21 @@
     MainMenu: []
     SearchBox: []
 
-editContactInformationSuccess:
-  components:
-    sidebar: []
-  javascripts: [/sfDrupalPlugin/vendor/drupal/misc/collapse, 
/sfDrupalPlugin/vendor/drupal/misc/textarea]
-
-editIsaarSuccess:
-  javascripts: [/sfDrupalPlugin/vendor/drupal/misc/collapse, 
/sfDrupalPlugin/vendor/drupal/misc/textarea, multiDelete, multiInstanceSelect, 
multiInstanceInput]
+editSuccess:
+  javascripts:
+    - /vendor/jquery
+    - /sfDrupalPlugin/vendor/drupal/misc/drupal
+    - /sfDrupalPlugin/vendor/drupal/misc/collapse
+    - /sfDrupalPlugin/vendor/drupal/misc/textarea
+    - multiDelete
+    - multiInstanceSelect
+    - multiInstanceInput
 
 listSuccess:
   javascripts:
   components:
     sidebar: []
 
-autocompleteSuccess:
-  javascripts: [-*]
-  components:
-    sidebar: []
-  stylesheets: [-*]
-
 all:
   components:
-    sidebar: [actor, contextMenu]
+    sidebar: []

Copied and modified: 
trunk/apps/qubit/modules/function/templates/editSuccess.php (from r3904, 
trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php)
==============================================================================
--- trunk/apps/qubit/modules/actor/templates/editIsaarSuccess.php       Tue Nov 
17 09:35:57 2009        (r3904, copy source)
+++ trunk/apps/qubit/modules/function/templates/editSuccess.php Tue Nov 17 
17:05:44 2009        (r3907)
@@ -1,43 +1,34 @@
 <?php use_helper('Javascript') ?>
 
-<?php // write actorRelationDialog yui dialog object to DOM via javascript
-  echo include_partial('actorRelationDialog'); ?>
+<?php // write functionRelationDialog yui dialog object to DOM via javascript
+//  echo include_partial('functionRelationDialog'); ?>
 
-<?php // write eventDialog yui dialog object to DOM via javascript
-  echo include_partial('eventDialog'); ?>
-
-<div class="pageTitle"><?php echo __('edit %1% - ISAAR', array('%1%' => 
sfConfig::get('app_ui_label_actor'))) ?></div>
+<div class="pageTitle"><?php echo __('edit %1% - ISAAR', array('%1%' => 
sfConfig::get('app_ui_label_function'))) ?></div>
 
 <?php if (isset($sf_request->id)): ?>
-  <?php echo $form->renderFormTag(url_for(array('module' => 'actor', 'action' 
=> 'edit', 'id' => $sf_request->id)), array('id' => 'editForm')) ?>
+  <?php echo $form->renderFormTag(url_for(array('module' => 'function', 
'action' => 'edit', 'id' => $sf_request->id)), array('id' => 'editForm')) ?>
 <?php else: ?>
-  <?php echo $form->renderFormTag(url_for(array('module' => 'actor', 'action' 
=> 'create')), array('id' => 'editForm')) ?>
+  <?php echo $form->renderFormTag(url_for(array('module' => 'function', 
'action' => 'create')), array('id' => 'editForm')) ?>
 <?php endif; ?>
 
   <?php echo $form->renderHiddenFields() ?>
 
-  <?php echo input_hidden_tag('repositoryReroute', $repositoryReroute) ?>
-  <?php echo input_hidden_tag('informationObjectReroute', 
$informationObjectReroute) ?>
-
-    <div class="formHeader">
-      <?php echo render_title($actor) ?>
-    </div>
+  <div class="formHeader">
+    <?php echo render_title($func) ?>
+  </div>
 
   <fieldset class="collapsible collapsed" id="identityArea">
 
   <legend><?php echo __('identity area'); ?></legend>
 
-  <div class="form-item">
-    <label for="type_of_entity"><?php echo __('type of entity'); ?></label>
-    <?php echo object_select_tag($actor, 'getEntityTypeId', 
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' => 
'getActorEntityTypes')) ?>
-  </div>
+  <?php echo $form->type->renderRow() ?>
 
   <div class="form-item">
     <label for="authorized_form_of_name"><?php echo __('authorized form of 
name'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getAuthorizedFormOfName(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <?php if (strlen($sourceCultureValue = 
$func->getAuthorizedFormOfName(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-    <?php echo object_input_tag($actor, 'getAuthorizedFormOfName', 
array('size' => 20)) ?>
+    <?php echo object_input_tag($func, 'getAuthorizedFormOfName', array('size' 
=> 20)) ?>
   </div>
 
   <div class="form-item">
@@ -52,7 +43,7 @@
         <?php foreach ($otherNames as $otherName): ?>
           <tr><td><?php echo $otherName->getName() ?></td><td><?php echo 
$otherName->getType() ?></td>
           <td><?php echo $otherName->getNote() ?></td>
-          <td style="text-align: center;"><?php echo 
link_to(image_tag('delete', 'align=top'), array('module' => 'actor', 'action' 
=> 'deleteOtherName', 'otherNameId' => $otherName->getId(), 'returnTemplate' => 
'isaar')) ?></td></tr>
+          <td style="text-align: center;"><?php echo 
link_to(image_tag('delete', 'align=top'), array('module' => 'function', 
'action' => 'deleteOtherName', 'otherNameId' => $otherName->getId(), 
'returnTemplate' => 'isaar')) ?></td></tr>
         <?php endforeach; ?>
       <?php endif; ?>
       <tr>
@@ -70,81 +61,26 @@
     </table>
   </div>
 
-  <div class="form-item">
-    <label for="identifiers"><?php echo __('identifiers for corporate 
bodies'); ?></label>
-    <?php echo object_input_tag($actor, 'getCorporateBodyIdentifiers', 
array('size' => 20)) ?>
-  </div>
-
   </fieldset>
 
   <fieldset class="collapsible collapsed" id="descriptionArea">
-    <legend><?php echo __('description area'); ?></legend>
+    <legend><?php echo __('context area'); ?></legend>
 
     <div class="form-item">
-      <label for="dates_of_existence"><?php echo __('dates of existence'); 
?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getDatesOfExistence(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <label for="dates"><?php echo __('dates'); ?></label>
+      <?php if (strlen($sourceCultureValue = 
$func->getDates(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-      <?php echo object_input_tag($actor, 'getDatesOfExistence', array('size' 
=> 20)) ?>
+      <?php echo object_input_tag($func, 'getDates', array('size' => 20)) ?>
     </div>
 
     <div class="form-item">
       <label for="history"><?php echo __('history'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getHistory(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
-      <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
-      <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getHistory', array('class' => 
'resizable', 'size' => '30x10')) ?>
-    </div>
-
-    <div class="form-item">
-      <label for="places"><?php echo __('places'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getPlaces(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
-      <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
-      <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getPlaces', array('class' => 
'resizable', 'size' => '30x3')) ?>
-    </div>
-
-    <div class="form-item">
-      <label for="legal_status"><?php echo __('legal status'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getLegalStatus(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
-      <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
-      <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getLegalStatus', array('class' 
=> 'resizable', 'size' => '30x3')) ?>
-    </div>
-
-    <div class="form-item">
-      <label for="functions"><?php echo __('functions, occupations and 
activities'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getFunctions(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
-      <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
-      <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getFunctions', array('class' => 
'resizable', 'size' => '30x3')) ?>
-    </div>
-
-    <div class="form-item">
-      <label for="mandates"><?php echo __('Mandates/Sources of authority'); 
?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getMandates(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
-      <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
-      <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getMandates', array('class' => 
'resizable', 'size' => '30x3')) ?>
-    </div>
-
-    <div class="form-item">
-      <label for="internal_structures"><?php echo __('Internal 
structures/Genealogy'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getInternalStructures(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
-      <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
-      <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getInternalStructures', 
array('class' => 'resizable', 'size' => '30x3')) ?>
-    </div>
-
-    <div class="form-item">
-      <label for="general_context"><?php echo __('general context'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getGeneralContext(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <?php if (strlen($sourceCultureValue = 
$func->getHistory(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getGeneralContext', 
array('class' => 'resizable', 'size' => '30x3')) ?>
+      <?php echo object_textarea_tag($func, 'getHistory', array('class' => 
'resizable', 'size' => '30x10')) ?>
     </div>
-
-
   </fieldset>
 
   <fieldset class="collapsible collapsed" id="relationshipsArea">
@@ -152,7 +88,7 @@
 
     <div class="form-item">
       <table class="inline" id="relatedEntities">
-        <caption><?php echo __('Related corporate bodies, persons or 
families'); ?></caption>
+        <caption><?php echo __('Related corporate bodies, archival materials 
and other resources'); ?></caption>
         <tr>
           <th style="width: 25%"><?php echo __('name'); ?></th>
           <th style="width: 15%"><?php echo __('type'); ?></th>
@@ -160,17 +96,17 @@
           <th style="width: 30%"><?php echo __('description'); ?></th>
           <th style="width: 10%; text-align: center"><?php echo 
image_tag('delete', array('align' => 'top', 'class' => 'deleteIcon')) ?></th>
         </tr>
-      <?php if (0 < count($actorRelations)): ?>
-        <?php foreach ($actorRelations as $actorRelation): ?>
-        <tr id="<?php echo 'actorRelation_'.$actorRelation->getId() ?>" 
class="<?php echo 'related_obj_'.$actorRelation->getId() ?>">
-          <?php if ($actorRelation->getObjectId() == $actor->getId()): ?>
-          <td><?php echo 
$actorRelation->getSubject()->getAuthorizedFormOfName() ?></td>
+      <?php if (0 < count($funcRelations)): ?>
+        <?php foreach ($funcRelations as $funcRelation): ?>
+        <tr id="<?php echo 'functionRelation_'.$funcRelation->getId() ?>" 
class="<?php echo 'related_obj_'.$funcRelation->getId() ?>">
+          <?php if ($funcRelation->getObjectId() == $func->getId()): ?>
+          <td><?php echo 
$funcRelation->getSubject()->getAuthorizedFormOfName() ?></td>
           <?php else: ?>
-          <td><?php echo 
$actorRelation->getObject()->getAuthorizedFormOfName() ?></td>
+          <td><?php echo $funcRelation->getObject()->getAuthorizedFormOfName() 
?></td>
           <?php endif; ?>
-          <td><?php echo $actorRelation->getType() ?></td>
+          <td><?php echo $funcRelation->getType() ?></td>
           <td>
-          <?php if (0 < strlen($dateDisplay = 
$actorRelation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 
< count($dateArray = $actorRelation->getDates())): ?>
+          <?php if (0 < strlen($dateDisplay = 
$funcRelation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DATE_DISPLAY_ID)) || 0 
< count($dateArray = $funcRelation->getDates())): ?>
             <?php if (0 < strlen($dateDisplay)): ?>
               <?php echo $dateDisplay ?>
             <?php elseif (2 == count($dateArray)): ?>
@@ -180,9 +116,9 @@
             <?php endif; ?>
           <?php endif; ?>
           </td>
-          <td><?php echo 
$actorRelation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?></td>
+          <td><?php echo 
$funcRelation->getNoteByTypeId(QubitTerm::RELATION_NOTE_DESCRIPTION_ID) ?></td>
           <td style="text-align: center;">
-            <input type="checkbox" name="deleteRelations[<?php echo 
$actorRelation->getId() ?>]" value="delete" class="multiDelete" />
+            <input type="checkbox" name="deleteRelations[<?php echo 
$funcRelation->getId() ?>]" value="delete" class="multiDelete" />
           </td>
         </tr>
         <?php endforeach; ?>
@@ -191,15 +127,15 @@
     </div>
 
     <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
-    <!-- NOTE: The actorRelationDialog.js script cuts this *entire*       -->
-    <!-- "actorRelation" table and pastes it in a YUI dialog object.      -->
+    <!-- NOTE: The functionRelationDialog.js script cuts this *entire*       
-->
+    <!-- "functionRelation" table and pastes it in a YUI dialog object.      
-->
     <!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
-    <table class="inline" id="actorRelation">
+    <table class="inline" id="functionRelation">
       <caption><?php echo __('new relationship') ?></caption>
       <tbody>
       <tr>
         <th style="width: 66%" colspan="3">
-          <label for="editActorRelation_actorName" 
class="required_field"><?php echo __('Name of related entity') ?></label>
+          <label for="editActorRelation_functionName" 
class="required_field"><?php echo __('Name of related entity') ?></label>
         </th>
         <th style="width: 34%">
           <label for="editActorRelation_categoryId"><?php echo __('Category of 
relationship') ?></label>
@@ -207,10 +143,10 @@
       </tr>
       <tr>
         <td colspan="3" style="width: 66%">
-          <?php include_partial('actorNameAutoComplete', array('actor' => 
$actor))?>
+          <?php // include_partial('functionNameAutoComplete', 
array('function' => $func))?>
         </td>
         <td style="width: 34%">
-          <?php echo select_tag('editActorRelation[categoryId]', 
objects_for_select($actorRelationCategories, 'getId', 'getName')) ?>
+          <?php echo select_tag('editActorRelation[categoryId]', 
objects_for_select($funcRelationCategories, 'getId', 'getName')) ?>
         </td>
       </tr>
       <tr>
@@ -253,82 +189,6 @@
       </tr>
       </tbody>
     </table>
-
-    <!-- Related resources -->
-    <div class="form-item">
-      <table class="inline" id="relatedEvents">
-        <caption><?php echo __('Related resources'); ?></caption>
-        <tr>
-          <th style="width: 35%"><?php echo __('title'); ?></th>
-          <th style="width: 20%"><?php echo __('relationship'); ?></th>
-          <th style="width: 25%"><?php echo __('dates'); ?></th>
-          <th style="width: 10%; text-align: center"><?php echo 
image_tag('delete', array('align' => 'top', 'class' => 'deleteIcon')) ?></th>
-        </tr>
-      <?php if (0 < count($events)): ?>
-        <?php foreach ($events as $event): ?>
-        <tr id="<?php echo 'event_'.$event->getId() ?>" class="<?php echo 
'related_obj_'.$event->getId() ?>">
-          <td><?php echo $event->getInformationObject()->getTitle() ?></td>
-          <td><?php echo $event->getType() ?></td>
-          <td>
-            <?php if (0 < strlen($dateDisplay = $event->getDateDisplay())): ?>
-              <?php echo $dateDisplay ?>
-            <?php elseif (0 < strlen($event->getStartDate()) && 0 < 
strlen($event->getEndDate())): ?>
-              <?php echo __('%1% - %2%', array('%1%' => 
collapse_date($event->getStartDate()), '%2%' => 
collapse_date($event->getEndDate()))) ?>
-            <?php elseif (0 < strlen($date = $event->getStartDate()) || 0 < 
strlen($date = $event->getEndDate())): ?>
-              <?php echo collapse_date($date) ?>
-            <?php endif; ?>
-          </td>
-          <td style="text-align: right">
-            <input type="checkbox" name="deleteEvents[<?php echo 
$event->getId() ?>]" value="delete" class="multiDelete" />
-          </td>
-        </tr>
-        <?php endforeach; ?>
-      <?php endif; ?>
-      </table>
-    </div>
-
-    <?php 
-      /**
-       * NOTE: The eventDialog script cuts this entire table and pastes
-       * it in a YUI dialog object.
-       *
-       * @see apps/qubit/modules/actor/_eventDialog.php
-       * @see web/js/eventDialog.js
-       */
-    ?>
-    <table id="newEvent" class="inline">
-      <tr>
-        <td colspan="3" class="headerCell" style="width: 55%;"><?php echo 
__('title of related resource'); ?></td>
-      </tr>
-      <tr>
-        <td colspan="3" class="noline">
-          <?php echo input_tag('newEvent[resourceTitle]', null, array('class' 
=> 'titleAutoComplete')) ?>
-          <?php include_partial('informationobject/titleAutoComplete') ?>
-        </td>
-      </tr>
-      <tr>
-        <td colspan="2" class="headerCell" style="width: 60%;"><?php echo 
__('nature of relationship') ?></td>
-        <td class="headerCell" style="width: 40%;"><?php echo __('type of 
related resource') ?></td>
-      </tr>
-      <tr>
-        <td colspan="2" class="noline">
-          <?php echo select_tag('newEvent[typeId]', 
options_for_select($eventTypes))?>
-        </td>
-        <td class="noline">
-          <?php echo select_tag('newEvent[resourceTypeId]', 
-            objects_for_select($resourceTypeTerms, 'getId', 'getName'))?>
-        </td>
-      </tr>
-      <tr>
-        <td class="headerCell" style="width: 30%"><?php echo __('date'); 
?></td>
-        <td class="headerCell" style="width: 30%"><?php echo __('end date'); 
?></td>
-        <td class="headerCell" style="width: 40%"><?php echo __('date 
display'); ?></td></tr>
-      <tr>
-        <td class="noline"><?php echo input_tag('newEvent[startDate]') ?></td>
-        <td class="noline"><?php echo input_tag('newEvent[endDate]') ?></td>
-        <td class="noline"><?php echo input_tag('newEvent[dateDisplay]') 
?></td>
-      </tr>
-    </table>
   </fieldset>
 
   <fieldset class="collapsible collapsed" id="controlArea">
@@ -336,41 +196,41 @@
 
     <div class="form-item">
       <label for="description_identifier"><?php echo __('authority record 
identifier'); ?></label>
-      <?php echo object_input_tag($actor, 'getDescriptionIdentifier', 
array('size' => 20)) ?>
+      <?php echo object_input_tag($func, 'getDescriptionIdentifier', 
array('size' => 20)) ?>
     </div>
 
     <div class="form-item">
       <label for="institution_identifier"><?php echo __('institution 
identifier'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getInstitutionResponsibleIdentifier(array('sourceCulture' => 'true'))) 
> 0 && $sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <?php if (strlen($sourceCultureValue = 
$func->getInstitutionIdentifier(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-      <?php echo object_input_tag($actor, 
'getInstitutionResponsibleIdentifier', array('size' => 20)) ?>
+      <?php echo object_input_tag($func, 'getInstitutionIdentifier', 
array('size' => 20)) ?>
     </div>
 
     <div class="form-item">
       <label for="rules"><?php echo __('rules and/or conventions'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getRules(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <?php if (strlen($sourceCultureValue = 
$func->getRules(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getRules', array('class' => 
'resizable', 'size' => '30x3')) ?>
+      <?php echo object_textarea_tag($func, 'getRules', array('class' => 
'resizable', 'size' => '30x3')) ?>
     </div>
 
     <div class="form-item">
       <label for="status_id"><?php echo __('status'); ?></label>
-      <?php echo object_select_tag($actor, 'getDescriptionStatusId', 
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' => 
'getDescriptionStatuses')) ?>
+      <?php echo object_select_tag($func, 'getDescriptionStatusId', 
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' => 
'getDescriptionStatuses')) ?>
     </div>
 
     <div class="form-item">
       <label for="level_of_detail_id"><?php echo __('level of detail'); 
?></label>
-      <?php echo object_select_tag($actor, 'getDescriptionDetailId', 
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' => 
'getDescriptionDetailLevels')) ?>
+      <?php echo object_select_tag($func, 'getDescriptionDetailId', 
array('related_class' => 'QubitTerm', 'include_blank' => true, 'peer_method' => 
'getDescriptionDetailLevels')) ?>
     </div>
 
     <div class="form-item">
       <label for="dates"><?php echo __('dates of creation, revision and 
deletion'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getRevisionHistory(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <?php if (strlen($sourceCultureValue = 
$func->getRevisionHistory(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getRevisionHistory', 
array('class' => 'resizable', 'size' => '30x3')) ?>
+      <?php echo object_textarea_tag($func, 'getRevisionHistory', 
array('class' => 'resizable', 'size' => '30x3')) ?>
     </div>
 
     <div class="form-item">
@@ -379,7 +239,7 @@
       <?php if (count($languageCodes) > 0): ?>
       <?php foreach ($languageCodes as $languageCode): ?>
         <div style="margin-top: 5px; margin-bottom: 5px;">
-        <?php echo 
format_language($languageCode->getValue(array('sourceCulture' => true))) 
?>&nbsp;<?php echo link_to(image_tag('delete', 'align=top'), array('module' => 
'actor', 'action' => 'deleteProperty', 'Id' => $languageCode->getId(), 
'returnTemplate' => 'isaar')) ?><br/>
+        <?php echo 
format_language($languageCode->getValue(array('sourceCulture' => true))) 
?>&nbsp;<?php echo link_to(image_tag('delete', 'align=top'), array('module' => 
'function', 'action' => 'deleteProperty', 'Id' => $languageCode->getId(), 
'returnTemplate' => 'isaar')) ?><br/>
         </div>
       <?php endforeach; ?>
       <?php endif; ?>
@@ -393,7 +253,7 @@
       <?php if (count($scriptCodes) > 0): ?>
       <?php foreach ($scriptCodes as $scriptCode): ?>
         <div style="margin-top: 5px; margin-bottom: 5px;">
-        <?php echo format_script($scriptCode->getValue(array('sourceCulture' 
=> true))) ?>&nbsp;<?php echo link_to(image_tag('delete', 'align=top'), 
array('module' => 'actor', 'action' => 'deleteProperty', 'Id' => 
$scriptCode->getId(), 'returnTemplate' => 'isaar')) ?><br/>
+        <?php echo format_script($scriptCode->getValue(array('sourceCulture' 
=> true))) ?>&nbsp;<?php echo link_to(image_tag('delete', 'align=top'), 
array('module' => 'function', 'action' => 'deleteProperty', 'Id' => 
$scriptCode->getId(), 'returnTemplate' => 'isaar')) ?><br/>
         </div>
       <?php endforeach; ?>
       <?php endif; ?>
@@ -403,10 +263,10 @@
 
     <div class="form-id">
       <label for="sources"><?php echo __('sources'); ?></label>
-      <?php if (strlen($sourceCultureValue = 
$actor->getSources(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $actor->getSourceCulture()): ?>
+      <?php if (strlen($sourceCultureValue = 
$func->getSources(array('sourceCulture' => 'true'))) > 0 && 
$sf_user->getCulture() != $func->getSourceCulture()): ?>
       <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
       <?php endif; ?>
-      <?php echo object_textarea_tag($actor, 'getSources', array('class' => 
'resizable', 'size' => '30x3')) ?>
+      <?php echo object_textarea_tag($func, 'getSources', array('class' => 
'resizable', 'size' => '30x3')) ?>
     </div>
 
     <div class="form-item">
@@ -441,11 +301,11 @@
       <?php if($repositoryReroute): ?>
         <li><?php echo link_to(__('Cancel'), array('module' => 'repository', 
'action' => 'show', 'id' => $repositoryReroute)) ?>
       <?php else: ?>
-        <li><?php echo link_to(__('Cancel'), array('module' => 'actor', 
'action' => 'show', 'id' => $actor->id)) ?></li>
+        <li><?php echo link_to(__('Cancel'), array('module' => 'function', 
'action' => 'show', 'id' => $func->id)) ?></li>
       <?php endif; ?>
       <li><?php echo submit_tag(__('Save')) ?></li>
     <?php else: ?>
-      <li><?php echo link_to(__('Cancel'), array('module' => 'actor', 'action' 
=> 'list')) ?></li>
+      <li><?php echo link_to(__('Cancel'), array('module' => 'function', 
'action' => 'list')) ?></li>
       <li><?php echo submit_tag(__('Create')) ?></li>
     <?php endif; ?>
   </ul>

Modified: trunk/lib/model/QubitFunction.php
==============================================================================
--- trunk/lib/model/QubitFunction.php   Tue Nov 17 13:23:42 2009        (r3906)
+++ trunk/lib/model/QubitFunction.php   Tue Nov 17 17:05:44 2009        (r3907)
@@ -19,4 +19,8 @@
 
 class QubitFunction extends BaseFunction
 {
+  public function __toString()
+  {
+    return $this->getAuthorizedFormOfName(array('cultureFallback' => true));
+  }
 }

--

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


Reply via email to