Author: david
Date: 2008-12-01 16:38:07 -0800 (Mon, 01 Dec 2008)
New Revision: 1649

Modified:
   
trunk/qubit/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
   trunk/qubit/apps/qubit/modules/physicalobject/templates/_edit.php
   trunk/qubit/web/js/multiDelete.js
Log:
Use "related_obj_<object_id>" class attribute for deletable object relations to 
make multiDelete() functionality (a) less brittle (i.e. the jQuery pattern 
matching is less prone to breaking due to nesting issues) and (b) automatically 
hide multiple instances of the same relation when marked for deletion (e.g. 
"publication notes")

Modified: 
trunk/qubit/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
===================================================================
--- 
trunk/qubit/apps/qubit/modules/informationobject/templates/editIsadSuccess.php  
    2008-12-01 22:09:38 UTC (rev 1648)
+++ 
trunk/qubit/apps/qubit/modules/informationobject/templates/editIsadSuccess.php  
    2008-12-02 00:38:07 UTC (rev 1649)
@@ -51,7 +51,7 @@
         </tr>
         <?php if ($titleNotes): ?>
         <?php foreach ($titleNotes as $titleNote): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$titleNote->getId() ?>">
           <td><div class="animateNicely">
             <?php echo $titleNote->getContent(array('cultureFallback' => 
'true')) ?>
           </div></td>
@@ -103,7 +103,7 @@
         </tr>
         <?php if(count($actorEvents)): ?>
         <?php foreach ($actorEvents as $actorEvent): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$actorEvent->getId() ?>">
           <td><div class="animateNicely">
             <?php echo ($actorEvent->getActor()) ? $actorEvent->getActor() : 
'&nbsp;' ?>
           </div></td>
@@ -281,7 +281,7 @@
         </tr>
       <?php if ($languageCodes): ?>
         <?php foreach ($languageCodes as $languageCode): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$languageCode->getId() ?>">
           <td><div class="animateNicely">
             <?php echo 
format_language($languageCode->getValue(array('sourceCulture'=>true))) ?>
           </div></td>
@@ -307,7 +307,7 @@
         </tr>
       <?php if ($scriptCodes): ?>
         <?php foreach ($scriptCodes as $scriptCode): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$scriptCode->getId() ?>">
           <td><div class="animateNicely">
               <?php echo 
format_script($scriptCode->getValue(array('sourceCulture'=>true))) ?>
           </div></td>
@@ -376,7 +376,7 @@
         </tr>
       <?php if ($publicationNotes): ?>
         <?php foreach ($publicationNotes as $publicationNote): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$publicationNote->getId() ?>">
           <td><div class="animateNicely">
             <?php echo 
nl2br($publicationNote->getContent(array('cultureFallback' => 'true'))) ?>
           </div></td>
@@ -407,7 +407,7 @@
         </tr>
         <?php if ($notes): ?>
         <?php foreach ($notes as $note): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$note->getId() ?>">
           <td><div class="animateNicely">
           <?php echo nl2br($note->getContent(array('cultureFallback' => 
'true'))) ?><br/>
           <span class="note"><?php echo $note->getUser() ?>, <?php echo 
$note->getUpdatedAt() ?></span>
@@ -440,7 +440,7 @@
         </tr>
       <?php if ($subjectAccessPoints): ?>
         <?php foreach ($subjectAccessPoints as $subject): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$subject->getId() ?>">
           <td><div class="animateNicely">
             <?php echo $subject->getTerm() ?>
           </div></td>
@@ -467,7 +467,7 @@
         </tr>
       <?php if ($placeAccessPoints): ?>
         <?php foreach ($placeAccessPoints as $place): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$place->getId() ?>">
           <td><div class="animateNicely">
             <?php echo $place->getTerm() ?>
           </div></td>
@@ -495,7 +495,7 @@
         </tr>
       <?php if ($nameAccessPoints): ?>
         <?php foreach ($nameAccessPoints as $name): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$name->getId() ?>">
           <td><div class="animateNicely"><?php echo $name->getActor() 
?></div></td>
           <td><div class="animateNicely"><?php echo 
$name->getType()->getRole() ?></div></td>
           <td style="text-align: right"><div class="animateNicely">
@@ -567,7 +567,7 @@
         </tr>
       <?php if ($descriptionLanguageCodes): ?>
         <?php foreach ($descriptionLanguageCodes as $languageCode): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$languageCode->getId() ?>">
           <td><div class="animateNicely">
             <?php echo 
format_language($languageCode->getValue(array('sourceCulture'=>true))) ?>
           </div></td>
@@ -593,7 +593,7 @@
         </tr>
       <?php if ($descriptionScriptCodes): ?>
         <?php foreach ($descriptionScriptCodes as $scriptCode): ?>
-        <tr>
+        <tr class="<?php echo 'related_obj_'.$scriptCode->getId() ?>">
           <td><div class="animateNicely">
             <?php echo 
format_script($scriptCode->getValue(array('sourceCulture'=>true))) ?>
           </div></td>

Modified: trunk/qubit/apps/qubit/modules/physicalobject/templates/_edit.php
===================================================================
--- trunk/qubit/apps/qubit/modules/physicalobject/templates/_edit.php   
2008-12-01 22:09:38 UTC (rev 1648)
+++ trunk/qubit/apps/qubit/modules/physicalobject/templates/_edit.php   
2008-12-02 00:38:07 UTC (rev 1649)
@@ -8,7 +8,7 @@
   </tr>
 <?php foreach($relations as $relation): ?>
   <?php $physicalObject = 
QubitPhysicalObject::getById($relation->getSubjectId()); ?>
-  <tr>
+  <tr class="<?php echo 'related_obj_'.$physicalObject->getId() ?>">
     <td style="width: 90%"><div class="animateNicely">
       <?php if (strlen($type = $physicalObject->getType())) echo $type.': '; ?>
       <b><?php echo $physicalObject->getName(array('cultureFallback' => 
'true')); ?></b>

Modified: trunk/qubit/web/js/multiDelete.js
===================================================================
--- trunk/qubit/web/js/multiDelete.js   2008-12-01 22:09:38 UTC (rev 1648)
+++ trunk/qubit/web/js/multiDelete.js   2008-12-02 00:38:07 UTC (rev 1649)
@@ -9,9 +9,10 @@
 {
   // Hide element
   var thisElement = $(obj);
-  var parentRow = thisElement.parent('div').parent('td').parent('tr');
-  parentRow.find('td div').hide('normal', function() {
-    parentRow.remove();
+  var relatedObjName = thisName.replace(/\w+\[(\d+)\]/, 'related_obj_$1');
+  var parentRows = $('tr.'+relatedObjName);
+  parentRows.find('div').hide('normal', function() {
+    parentRows.remove();
   });
 
   // Append hidden field to delete element on form submit


--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to