Author: david
Date: Tue Nov 22 15:22:57 2011
New Revision: 10352

Log:
Merge r10335:10351 from trunk

Modified:
   branches/dcb/   (props changed)
   branches/dcb/COPYRIGHT
   branches/dcb/apps/qubit/modules/menu/actions/deleteAction.class.php
   branches/dcb/apps/qubit/modules/menu/actions/editAction.class.php
   branches/dcb/apps/qubit/modules/menu/actions/listAction.class.php
   branches/dcb/apps/qubit/modules/object/config/import/ead1.yml
   
branches/dcb/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
   branches/dcb/config/rsync_exclude.txt
   branches/dcb/images/logo.png   (props changed)
   branches/dcb/lib/QubitCsvImport.class.php
   branches/dcb/plugins/qbAclPlugin/lib/vendor/Zend/   (props changed)
   branches/dcb/plugins/sfDrupalPlugin/vendor/drupal/   (props changed)
   branches/dcb/vendor/symfony/   (props changed)
   branches/dcb/vendor/symfony/lib/task/i18n/sfI18nExtractPluginTask.class.php  
 (props changed)
   branches/dcb/vendor/yui/   (props changed)
   branches/ica-atom/   (props changed)
   branches/ica-atom/COPYRIGHT
   
branches/ica-atom/apps/qubit/modules/actor/actions/contextMenuComponent.class.php
   (props changed)
   branches/ica-atom/apps/qubit/modules/menu/actions/deleteAction.class.php
   branches/ica-atom/apps/qubit/modules/menu/actions/editAction.class.php
   branches/ica-atom/apps/qubit/modules/menu/actions/listAction.class.php
   branches/ica-atom/apps/qubit/modules/object/config/import/ead1.yml
   
branches/ica-atom/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
   branches/ica-atom/config/rsync_exclude.txt
   branches/ica-atom/favicon.ico   (props changed)
   branches/ica-atom/images/logo.png   (props changed)
   branches/ica-atom/lib/QubitCsvImport.class.php
   branches/ica-atom/plugins/qbAclPlugin/lib/vendor/Zend/   (props changed)
   branches/ica-atom/plugins/sfDrupalPlugin/vendor/drupal/   (props changed)
   branches/ica-atom/vendor/symfony/   (props changed)
   
branches/ica-atom/vendor/symfony/lib/task/i18n/sfI18nExtractPluginTask.class.php
   (props changed)
   branches/ica-atom/vendor/yui/   (props changed)

Modified: branches/dcb/COPYRIGHT
==============================================================================
--- branches/dcb/COPYRIGHT      Tue Nov 22 14:14:17 2011        (r10351)
+++ branches/dcb/COPYRIGHT      Tue Nov 22 15:22:57 2011        (r10352)
@@ -4,9 +4,8 @@
 Qubit Toolkit
 -------------
 Url:       http://qubit-toolkit.org/
-Copyright: 2006-2011, Peter Van Garderen <[email protected]> and other
-           original authors as attributed in each file
-License:   GPL version 2 or any later version - see LICENSE file
+Copyright: 2006-2011, Artefactual Systems Inc. <[email protected]>
+License:   Affero GPL version 3 or any later version - see LICENSE file
 
 Qubit Logo
 ----------
@@ -19,13 +18,6 @@
 Copyright: http://en.wikipedia.org/wiki/User:MuncherOfSpleens
 License:   GNU Free Documentation License
 
-Installer
----------
-Url:       http://www.carl-abrc.ca/
-Author:    Mark Jordan
-Copyright: Canadian Association of Research Libraries
-License:   GPL version 2
-
 symfony
 -------
 Qubit Toolkit is based on the symfony framework
@@ -39,21 +31,6 @@
 
 Qubit Toolkit also uses the following symfony plugins:
 
-sfAuditPlugin
--------------
-Copyright: Jack Bates
-License:   MIT
-
-sfHistoryPlugin
----------------
-Copyright: Jack Bates
-License:   MIT
-
-sfInstallPlugin
----------------
-Copyright: Jack Bates
-License:   GPL version 2
-
 sfLucenePlugin
 --------------
 Copyright: Carl Vondrick
@@ -69,11 +46,6 @@
 Copyright: Fabien Potencer
 License:   MIT
 
-sfTranslatePlugin
------------------
-Copyright: Jack Bates
-License:   MIT
-
 sfWebBrowserPlugin
 --------------
 Copyright: Francois Zaninotto
@@ -149,3 +121,15 @@
 Url: http://www.fatcow.com/free-icons
 Copyright: Fatcow Web Hosting
 License: CC Attribution 3.0
+
+Twitter Bootstrap
+-----------------
+Url: http://twitter.github.com/bootstrap/
+Copyright: Twitter, Inc.
+License: Apache 2.0
+
+Less CSS
+--------
+Url: http://lesscss.org/
+Copyright: 2009-2011 Alexis Sellier
+License: Apache 2.0

Modified: branches/dcb/apps/qubit/modules/menu/actions/deleteAction.class.php
==============================================================================
--- branches/dcb/apps/qubit/modules/menu/actions/deleteAction.class.php Tue Nov 
22 14:14:17 2011        (r10351)
+++ branches/dcb/apps/qubit/modules/menu/actions/deleteAction.class.php Tue Nov 
22 15:22:57 2011        (r10352)
@@ -40,8 +40,8 @@
       // Remove cache
       if ($this->context->getViewCacheManager() !== null)
       {
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*');
       }
 
       $this->redirect(array('module' => 'menu', 'action' => 'list'));

Modified: branches/dcb/apps/qubit/modules/menu/actions/editAction.class.php
==============================================================================
--- branches/dcb/apps/qubit/modules/menu/actions/editAction.class.php   Tue Nov 
22 14:14:17 2011        (r10351)
+++ branches/dcb/apps/qubit/modules/menu/actions/editAction.class.php   Tue Nov 
22 15:22:57 2011        (r10352)
@@ -152,8 +152,8 @@
         // Remove cache
         if ($this->context->getViewCacheManager() !== null)
         {
-          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key='.$this->context->getUser()->getCulture());
-          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key='.$this->context->getUser()->getCulture());
+          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*');
+          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*');
         }
 
         $this->redirect(array('module' => 'menu', 'action' => 'list'));

Modified: branches/dcb/apps/qubit/modules/menu/actions/listAction.class.php
==============================================================================
--- branches/dcb/apps/qubit/modules/menu/actions/listAction.class.php   Tue Nov 
22 14:14:17 2011        (r10351)
+++ branches/dcb/apps/qubit/modules/menu/actions/listAction.class.php   Tue Nov 
22 15:22:57 2011        (r10352)
@@ -44,8 +44,8 @@
       // Remove cache
       if ($this->context->getViewCacheManager() !== null)
       {
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*');
       }
     }
 

Modified: branches/dcb/apps/qubit/modules/object/config/import/ead1.yml
==============================================================================
Binary file (source and/or target). No diff available.

Modified: 
branches/dcb/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
==============================================================================
--- 
branches/dcb/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
   Tue Nov 22 14:14:17 2011        (r10351)
+++ 
branches/dcb/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
   Tue Nov 22 15:22:57 2011        (r10352)
@@ -29,6 +29,7 @@
     $criteria = new Criteria;
     $criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
     $criteria->add(QubitActorI18n::CULTURE, 
$this->context->user->getCulture());
+    $criteria->add(QubitActor::CLASS_NAME, 'QubitRightsHolder');
 
     if (isset($request->query))
     {

Modified: branches/dcb/config/rsync_exclude.txt
==============================================================================
--- branches/dcb/config/rsync_exclude.txt       Tue Nov 22 14:14:17 2011        
(r10351)
+++ branches/dcb/config/rsync_exclude.txt       Tue Nov 22 15:22:57 2011        
(r10352)
@@ -4,6 +4,25 @@
 /web/*_dev.php
 /web/uploads/*
 
+/apps/qubit/config/
+/data/index/
+/config/
+/log/
+/cache/
+/uploads/
+/patches
+/test
+
+/index.php
+/config/ProjectConfiguration.class.php
+/apps/qubit/config/qubitConfiguration.class.php
+
+# security hardening / cleanup
+/COPYRIGHT
+/LICENSE
+/qubit_dev.php
+/README
+
 # SCM files
 .arch-params
 .bzr

Modified: branches/dcb/lib/QubitCsvImport.class.php
==============================================================================
--- branches/dcb/lib/QubitCsvImport.class.php   Tue Nov 22 14:14:17 2011        
(r10351)
+++ branches/dcb/lib/QubitCsvImport.class.php   Tue Nov 22 15:22:57 2011        
(r10352)
@@ -90,7 +90,7 @@
         $action = new sfRadPluginEditAction($this->context, 'sfRadPlugin', 
'edit');
         break;
       case 'isad':
-        $action = new sfIsadPluginEditAction($this->context, 'sfRadPlugin', 
'edit');
+        $action = new sfIsadPluginEditAction($this->context, 'sfIsadPlugin', 
'edit');
         break;
     }
 
@@ -317,6 +317,11 @@
     $n = 0;
     foreach (explode('|', $parameters['subjectAccessPoints']) as 
$new_subjectAccessPoint)
     {
+      if (0 == strlen(trim($new_subjectAccessPoint)))
+      {
+        continue;
+      }
+
       // if the subject does not exist, create it
       if (!in_array($new_subjectAccessPoint, $this->subjects) && 
!empty($new_subjectAccessPoint))
       {
@@ -345,6 +350,11 @@
     $n = 0;
     foreach (explode('|', $parameters['placeAccessPoints']) as 
$new_placeAccessPoint)
     {
+      if (0 == strlen(trim($new_placeAccessPoint)))
+      {
+        continue;
+      }
+
       // if the place does not exist, create it
       if (!in_array($new_placeAccessPoint, $this->places) && 
!empty($new_placeAccessPoint))
       {
@@ -362,28 +372,26 @@
     $parameters['placeAccessPoints'] = $new_placeAccessPoints;
 
     // name access points
-    if (!isset($this->names))
+    $n = 0;
+    $this->getActors();
+    foreach (explode('|', $parameters['nameAccessPoints']) as 
$new_nameAccessPoint)
     {
-      foreach (QubitActor::getOnlyActors() as $name)
+      if (0 == strlen(trim($new_nameAccessPoint)))
       {
-        $this->names[$name->__toString()] = $name;
+        continue;
       }
-    }
 
-    $n = 0;
-    foreach (explode('|', $parameters['nameAccessPoints']) as 
$new_nameAccessPoint)
-    {
       // if the name does not exist, create it
-      if (!in_array($new_nameAccessPoint, $this->names) && 
!empty($new_nameAccessPoint))
+      if (!isset($this->actors[$new_nameAccessPoint]))
       {
         $name = new QubitActor();
         $name->authorizedFormOfName = $new_nameAccessPoint;
         $name->save();
 
-        $this->names[$name->__toString()] = $name;
+        $this->actors[$name->__toString()] = $name;
       }
 
-      $new_nameAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->names[$new_nameAccessPoint], 'module' => 'actor'));
+      $new_nameAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->actors[$new_nameAccessPoint], 'module' => 'actor'));
       $n++;
     }
     $parameters['nameAccessPoints'] = $new_nameAccessPoints;
@@ -393,6 +401,30 @@
 
   protected function mapRad($parameters)
   {
+    $creationTerm = new QubitTerm();
+    $creationTerm->id = QubitTerm::CREATION_ID;
+    $creationUrl = $this->context->routing->generate(null, 
array($creationTerm, 'module' => 'term'));
+
+    // Creation dates
+    foreach (explode('|', $parameters['datesOfCreation']) as $date)
+    {
+      if (0 < strlen($date))
+      {
+        $parameters['editEvents'][] = array(
+          'type' => $creationUrl,
+          'date' => $date
+        );
+      }
+    }
+
+    // Link creators
+    foreach ($this->addCreatorsAndHistory($parameters) as $creator)
+    {
+      $parameters['editEvents'][] = array(
+        'type' => $creationUrl,
+        'actor' => $this->context->routing->generate(null, array($creator, 
'module' => 'actor')));
+    }
+
     if (!isset($this->materialTypes))
     {
       foreach (QubitTerm::getMaterialTypes() as $term)
@@ -471,28 +503,10 @@
     $parameters['datesOfCreation'] = $new_dates;
 
     // name access points
-    if (!isset($this->names))
-    {
-      foreach (QubitActor::getOnlyActors() as $name)
-      {
-        $this->names[$name->__toString()] = $name;
-      }
-    }
-
     $n = 0;
-    foreach (explode('|', $parameters['creators']) as $new_creator)
+    foreach ($this->addCreatorsAndHistory($parameters) as $creator)
     {
-      // if the name does not exist, create it
-      if (!in_array($new_creator, $this->names) && !empty($new_creator))
-      {
-        $name = new QubitActor();
-        $name->authorizedFormOfName = $new_creator;
-        $name->save();
-
-        $this->names[$name->__toString()] = $name;
-      }
-
-      $new_creators['new'.$n] = $this->context->routing->generate(null, 
array($this->names[$new_creator], 'module' => 'actor'));
+      $new_creators['new'.$n] = $this->context->routing->generate(null, 
array($creator, 'module' => 'actor'));
       $n++;
     }
     $parameters['creators'] = $new_creators;
@@ -598,4 +612,69 @@
     return $this->rootObject;
   }
 
-}
\ No newline at end of file
+  public function getActors()
+  {
+    if (!isset($this->actors))
+    {
+      foreach (QubitActor::getOnlyActors() as $item)
+      {
+        $this->actors[$item->__toString()] = $item;
+      }
+    }
+
+    return $this->actors;
+  }
+
+  public function addCreatorsAndHistory($parameters)
+  {
+    $creators = $histories = array();
+    $i = 0;
+    $updated = false;
+
+    // Get array of existing actors
+    $this->getActors();
+
+    if (isset($parameters['creatorHistory']))
+    {
+      $histories = explode('|', $parameters['creatorHistory']);
+    }
+
+    foreach (explode('|', $parameters['creators']) as $creator)
+    {
+      if (0 == strlen(trim($creator)))
+      {
+        continue;
+      }
+
+      if (isset($this->actors[$creator]))
+      {
+        $actor = $this->actors[$creator];
+      }
+      else
+      {
+        $actor = new QubitActor;
+        $actor->authorizedFormOfName = $creator;
+        $updated = true;
+
+        // Add to array of existing actors
+        $this->actors[$creator] = $actor;
+      }
+
+      if (isset($histories[$i]))
+      {
+        $actor->history = $histories[$i];
+        $updated = true;
+      }
+
+      if ($updated)
+      {
+        $actor->save();
+      }
+
+      $creators[] = $actor;
+      $i++;
+    }
+
+    return $creators;
+  }
+}

Modified: branches/ica-atom/COPYRIGHT
==============================================================================
--- branches/ica-atom/COPYRIGHT Tue Nov 22 14:14:17 2011        (r10351)
+++ branches/ica-atom/COPYRIGHT Tue Nov 22 15:22:57 2011        (r10352)
@@ -4,9 +4,8 @@
 Qubit Toolkit
 -------------
 Url:       http://qubit-toolkit.org/
-Copyright: 2006-2011, Peter Van Garderen <[email protected]> and other
-           original authors as attributed in each file
-License:   GPL version 2 or any later version - see LICENSE file
+Copyright: 2006-2011, Artefactual Systems Inc. <[email protected]>
+License:   Affero GPL version 3 or any later version - see LICENSE file
 
 Qubit Logo
 ----------
@@ -19,13 +18,6 @@
 Copyright: http://en.wikipedia.org/wiki/User:MuncherOfSpleens
 License:   GNU Free Documentation License
 
-Installer
----------
-Url:       http://www.carl-abrc.ca/
-Author:    Mark Jordan
-Copyright: Canadian Association of Research Libraries
-License:   GPL version 2
-
 symfony
 -------
 Qubit Toolkit is based on the symfony framework
@@ -39,21 +31,6 @@
 
 Qubit Toolkit also uses the following symfony plugins:
 
-sfAuditPlugin
--------------
-Copyright: Jack Bates
-License:   MIT
-
-sfHistoryPlugin
----------------
-Copyright: Jack Bates
-License:   MIT
-
-sfInstallPlugin
----------------
-Copyright: Jack Bates
-License:   GPL version 2
-
 sfLucenePlugin
 --------------
 Copyright: Carl Vondrick
@@ -69,11 +46,6 @@
 Copyright: Fabien Potencer
 License:   MIT
 
-sfTranslatePlugin
------------------
-Copyright: Jack Bates
-License:   MIT
-
 sfWebBrowserPlugin
 --------------
 Copyright: Francois Zaninotto
@@ -149,3 +121,15 @@
 Url: http://www.fatcow.com/free-icons
 Copyright: Fatcow Web Hosting
 License: CC Attribution 3.0
+
+Twitter Bootstrap
+-----------------
+Url: http://twitter.github.com/bootstrap/
+Copyright: Twitter, Inc.
+License: Apache 2.0
+
+Less CSS
+--------
+Url: http://lesscss.org/
+Copyright: 2009-2011 Alexis Sellier
+License: Apache 2.0

Modified: 
branches/ica-atom/apps/qubit/modules/menu/actions/deleteAction.class.php
==============================================================================
--- branches/ica-atom/apps/qubit/modules/menu/actions/deleteAction.class.php    
Tue Nov 22 14:14:17 2011        (r10351)
+++ branches/ica-atom/apps/qubit/modules/menu/actions/deleteAction.class.php    
Tue Nov 22 15:22:57 2011        (r10352)
@@ -40,8 +40,8 @@
       // Remove cache
       if ($this->context->getViewCacheManager() !== null)
       {
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*');
       }
 
       $this->redirect(array('module' => 'menu', 'action' => 'list'));

Modified: branches/ica-atom/apps/qubit/modules/menu/actions/editAction.class.php
==============================================================================
--- branches/ica-atom/apps/qubit/modules/menu/actions/editAction.class.php      
Tue Nov 22 14:14:17 2011        (r10351)
+++ branches/ica-atom/apps/qubit/modules/menu/actions/editAction.class.php      
Tue Nov 22 15:22:57 2011        (r10352)
@@ -152,8 +152,8 @@
         // Remove cache
         if ($this->context->getViewCacheManager() !== null)
         {
-          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key='.$this->context->getUser()->getCulture());
-          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key='.$this->context->getUser()->getCulture());
+          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*');
+          
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*');
         }
 
         $this->redirect(array('module' => 'menu', 'action' => 'list'));

Modified: branches/ica-atom/apps/qubit/modules/menu/actions/listAction.class.php
==============================================================================
--- branches/ica-atom/apps/qubit/modules/menu/actions/listAction.class.php      
Tue Nov 22 14:14:17 2011        (r10351)
+++ branches/ica-atom/apps/qubit/modules/menu/actions/listAction.class.php      
Tue Nov 22 15:22:57 2011        (r10352)
@@ -44,8 +44,8 @@
       // Remove cache
       if ($this->context->getViewCacheManager() !== null)
       {
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=settings');
-        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=settings');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*');
+        
$this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*');
       }
     }
 

Modified: branches/ica-atom/apps/qubit/modules/object/config/import/ead1.yml
==============================================================================
Binary file (source and/or target). No diff available.

Modified: 
branches/ica-atom/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
==============================================================================
--- 
branches/ica-atom/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
      Tue Nov 22 14:14:17 2011        (r10351)
+++ 
branches/ica-atom/apps/qubit/modules/rightsholder/actions/autocompleteAction.class.php
      Tue Nov 22 15:22:57 2011        (r10352)
@@ -29,6 +29,7 @@
     $criteria = new Criteria;
     $criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
     $criteria->add(QubitActorI18n::CULTURE, 
$this->context->user->getCulture());
+    $criteria->add(QubitActor::CLASS_NAME, 'QubitRightsHolder');
 
     if (isset($request->query))
     {

Modified: branches/ica-atom/config/rsync_exclude.txt
==============================================================================
--- branches/ica-atom/config/rsync_exclude.txt  Tue Nov 22 14:14:17 2011        
(r10351)
+++ branches/ica-atom/config/rsync_exclude.txt  Tue Nov 22 15:22:57 2011        
(r10352)
@@ -4,6 +4,25 @@
 /web/*_dev.php
 /web/uploads/*
 
+/apps/qubit/config/
+/data/index/
+/config/
+/log/
+/cache/
+/uploads/
+/patches
+/test
+
+/index.php
+/config/ProjectConfiguration.class.php
+/apps/qubit/config/qubitConfiguration.class.php
+
+# security hardening / cleanup
+/COPYRIGHT
+/LICENSE
+/qubit_dev.php
+/README
+
 # SCM files
 .arch-params
 .bzr

Modified: branches/ica-atom/lib/QubitCsvImport.class.php
==============================================================================
--- branches/ica-atom/lib/QubitCsvImport.class.php      Tue Nov 22 14:14:17 
2011        (r10351)
+++ branches/ica-atom/lib/QubitCsvImport.class.php      Tue Nov 22 15:22:57 
2011        (r10352)
@@ -90,7 +90,7 @@
         $action = new sfRadPluginEditAction($this->context, 'sfRadPlugin', 
'edit');
         break;
       case 'isad':
-        $action = new sfIsadPluginEditAction($this->context, 'sfRadPlugin', 
'edit');
+        $action = new sfIsadPluginEditAction($this->context, 'sfIsadPlugin', 
'edit');
         break;
     }
 
@@ -317,6 +317,11 @@
     $n = 0;
     foreach (explode('|', $parameters['subjectAccessPoints']) as 
$new_subjectAccessPoint)
     {
+      if (0 == strlen(trim($new_subjectAccessPoint)))
+      {
+        continue;
+      }
+
       // if the subject does not exist, create it
       if (!in_array($new_subjectAccessPoint, $this->subjects) && 
!empty($new_subjectAccessPoint))
       {
@@ -345,6 +350,11 @@
     $n = 0;
     foreach (explode('|', $parameters['placeAccessPoints']) as 
$new_placeAccessPoint)
     {
+      if (0 == strlen(trim($new_placeAccessPoint)))
+      {
+        continue;
+      }
+
       // if the place does not exist, create it
       if (!in_array($new_placeAccessPoint, $this->places) && 
!empty($new_placeAccessPoint))
       {
@@ -362,28 +372,26 @@
     $parameters['placeAccessPoints'] = $new_placeAccessPoints;
 
     // name access points
-    if (!isset($this->names))
+    $n = 0;
+    $this->getActors();
+    foreach (explode('|', $parameters['nameAccessPoints']) as 
$new_nameAccessPoint)
     {
-      foreach (QubitActor::getOnlyActors() as $name)
+      if (0 == strlen(trim($new_nameAccessPoint)))
       {
-        $this->names[$name->__toString()] = $name;
+        continue;
       }
-    }
 
-    $n = 0;
-    foreach (explode('|', $parameters['nameAccessPoints']) as 
$new_nameAccessPoint)
-    {
       // if the name does not exist, create it
-      if (!in_array($new_nameAccessPoint, $this->names) && 
!empty($new_nameAccessPoint))
+      if (!isset($this->actors[$new_nameAccessPoint]))
       {
         $name = new QubitActor();
         $name->authorizedFormOfName = $new_nameAccessPoint;
         $name->save();
 
-        $this->names[$name->__toString()] = $name;
+        $this->actors[$name->__toString()] = $name;
       }
 
-      $new_nameAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->names[$new_nameAccessPoint], 'module' => 'actor'));
+      $new_nameAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->actors[$new_nameAccessPoint], 'module' => 'actor'));
       $n++;
     }
     $parameters['nameAccessPoints'] = $new_nameAccessPoints;
@@ -393,6 +401,30 @@
 
   protected function mapRad($parameters)
   {
+    $creationTerm = new QubitTerm();
+    $creationTerm->id = QubitTerm::CREATION_ID;
+    $creationUrl = $this->context->routing->generate(null, 
array($creationTerm, 'module' => 'term'));
+
+    // Creation dates
+    foreach (explode('|', $parameters['datesOfCreation']) as $date)
+    {
+      if (0 < strlen($date))
+      {
+        $parameters['editEvents'][] = array(
+          'type' => $creationUrl,
+          'date' => $date
+        );
+      }
+    }
+
+    // Link creators
+    foreach ($this->addCreatorsAndHistory($parameters) as $creator)
+    {
+      $parameters['editEvents'][] = array(
+        'type' => $creationUrl,
+        'actor' => $this->context->routing->generate(null, array($creator, 
'module' => 'actor')));
+    }
+
     if (!isset($this->materialTypes))
     {
       foreach (QubitTerm::getMaterialTypes() as $term)
@@ -471,28 +503,10 @@
     $parameters['datesOfCreation'] = $new_dates;
 
     // name access points
-    if (!isset($this->names))
-    {
-      foreach (QubitActor::getOnlyActors() as $name)
-      {
-        $this->names[$name->__toString()] = $name;
-      }
-    }
-
     $n = 0;
-    foreach (explode('|', $parameters['creators']) as $new_creator)
+    foreach ($this->addCreatorsAndHistory($parameters) as $creator)
     {
-      // if the name does not exist, create it
-      if (!in_array($new_creator, $this->names) && !empty($new_creator))
-      {
-        $name = new QubitActor();
-        $name->authorizedFormOfName = $new_creator;
-        $name->save();
-
-        $this->names[$name->__toString()] = $name;
-      }
-
-      $new_creators['new'.$n] = $this->context->routing->generate(null, 
array($this->names[$new_creator], 'module' => 'actor'));
+      $new_creators['new'.$n] = $this->context->routing->generate(null, 
array($creator, 'module' => 'actor'));
       $n++;
     }
     $parameters['creators'] = $new_creators;
@@ -598,4 +612,69 @@
     return $this->rootObject;
   }
 
-}
\ No newline at end of file
+  public function getActors()
+  {
+    if (!isset($this->actors))
+    {
+      foreach (QubitActor::getOnlyActors() as $item)
+      {
+        $this->actors[$item->__toString()] = $item;
+      }
+    }
+
+    return $this->actors;
+  }
+
+  public function addCreatorsAndHistory($parameters)
+  {
+    $creators = $histories = array();
+    $i = 0;
+    $updated = false;
+
+    // Get array of existing actors
+    $this->getActors();
+
+    if (isset($parameters['creatorHistory']))
+    {
+      $histories = explode('|', $parameters['creatorHistory']);
+    }
+
+    foreach (explode('|', $parameters['creators']) as $creator)
+    {
+      if (0 == strlen(trim($creator)))
+      {
+        continue;
+      }
+
+      if (isset($this->actors[$creator]))
+      {
+        $actor = $this->actors[$creator];
+      }
+      else
+      {
+        $actor = new QubitActor;
+        $actor->authorizedFormOfName = $creator;
+        $updated = true;
+
+        // Add to array of existing actors
+        $this->actors[$creator] = $actor;
+      }
+
+      if (isset($histories[$i]))
+      {
+        $actor->history = $histories[$i];
+        $updated = true;
+      }
+
+      if ($updated)
+      {
+        $actor->save();
+      }
+
+      $creators[] = $actor;
+      $i++;
+    }
+
+    return $creators;
+  }
+}

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