Author: sevein
Date: Thu Aug 18 15:09:57 2011
New Revision: 9534

Log:
Add contact information component to rightsholder

Modified:
   trunk/apps/qubit/modules/rightsholder/actions/editAction.class.php
   trunk/apps/qubit/modules/rightsholder/templates/editSuccess.php
   trunk/apps/qubit/modules/rightsholder/templates/indexSuccess.php

Modified: trunk/apps/qubit/modules/rightsholder/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/rightsholder/actions/editAction.class.php  Wed Aug 
17 17:17:10 2011        (r9533)
+++ trunk/apps/qubit/modules/rightsholder/actions/editAction.class.php  Thu Aug 
18 15:09:57 2011        (r9534)
@@ -72,6 +72,10 @@
     }
 
     $this->response->setTitle("$title - {$this->response->getTitle()}");
+
+    $this->relatedContactInformationComponent = new 
ContactInformationRelatedContactInformationComponent($this->context, 
'contactinformation', 'relatedContactInformation');
+    $this->relatedContactInformationComponent->resource = $this->resource;
+    $this->relatedContactInformationComponent->execute($this->request);
   }
 
   protected function addField($name)
@@ -98,8 +102,20 @@
     if ($request->isMethod('post'))
     {
       $this->form->bind($request->getPostParameters());
+
       if ($this->form->isValid())
       {
+        $this->relatedContactInformationComponent->processForm();
+
+        if (isset($this->request->deleteRelations))
+        {
+          foreach ($this->request->deleteRelations as $item)
+          {
+            $params = $this->context->routing->parse(Qubit::pathInfo($item));
+            $params['_sf_route']->resource->delete();
+          }
+        }
+
         $this->processForm();
 
         $this->resource->save();

Modified: trunk/apps/qubit/modules/rightsholder/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/rightsholder/templates/editSuccess.php     Wed Aug 
17 17:17:10 2011        (r9533)
+++ trunk/apps/qubit/modules/rightsholder/templates/editSuccess.php     Thu Aug 
18 15:09:57 2011        (r9534)
@@ -21,6 +21,14 @@
 
   </fieldset>
 
+  <fieldset class="collapsible" id="contactArea">
+
+    <legend><?php echo __('Contact area') ?></legend>
+
+    <?php echo get_partial('contactinformation/relatedContactInformation', 
$relatedContactInformationComponent->getVarHolder()->getAll()) ?>
+    
+  </fieldset>
+
   <div class="actions section">
 
     <h2 class="element-invisible"><?php echo __('Actions') ?></h2>

Modified: trunk/apps/qubit/modules/rightsholder/templates/indexSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/rightsholder/templates/indexSuccess.php    Wed Aug 
17 17:17:10 2011        (r9533)
+++ trunk/apps/qubit/modules/rightsholder/templates/indexSuccess.php    Thu Aug 
18 15:09:57 2011        (r9534)
@@ -14,6 +14,28 @@
 
 <?php echo render_show(__('Authorized form of name'), 
render_value($resource->getAuthorizedFormOfName(array('cultureFallback' => 
true)))) ?>
 
+<div class="section" id="contactArea">
+
+  <h2><?php echo __('Contact area') ?></h2>
+
+  <?php foreach ($resource->contactInformations as $contactItem): ?>
+    <div class="field">
+      <h3>Contact information</h3>
+      <div class="vcard">
+        <?php if (SecurityPriviliges::editCredentials($sf_user, 
'repository')): ?>
+          <a href="<?php echo url_for(array($contactItem, 'module' => 'actor', 
'action' => 'editContactInformation')) ?>" title="<?php echo __('Edit contact 
information') ?>">
+        <?php endif; ?>
+        <h3><?php echo $contactItem->getContactType(array('cultureFallback' => 
true)) ?><?php if ($contactItem->primaryContact): ?> (<?php echo __('Primary 
contact') ?>)<?php endif; ?></h3>
+        <?php if (SecurityPriviliges::editCredentials($sf_user, 
'repository')): ?>
+          </a>
+        <?php endif; ?>
+        <?php echo get_partial('actor/contactInformation', 
array('contactInformation' => $contactItem)) ?>
+      </div>
+    </div>
+  <?php endforeach; ?>
+
+</div> <!-- /.section#contactArea -->
+
 <div class="actions section">
 
   <h2 class="element-invisible"><?php echo __('Actions') ?></h2>

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