Author: david
Date: 2008-11-03 15:57:01 -0800 (Mon, 03 Nov 2008)
New Revision: 1515

Modified:
   
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
   
trunk/qubit/apps/qubit/modules/informationobject/templates/editISADSuccess.php
   trunk/qubit/web/js/newCreationEventDialog.js
Log:
Clean up newCreationEvent modal dialog code precedence:
- Move include_partial() call into Context Area of editISAD template make it 
easier to find them both,
- Explictly call code to build YUI dialog from the javascript within the 
_newCreationEventDialog partial to resolve problems with precedence when 
writing/moving DOM objects and rendering the dialog.

Modified: 
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
===================================================================
--- 
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
      2008-11-03 21:35:31 UTC (rev 1514)
+++ 
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
      2008-11-03 23:57:01 UTC (rev 1515)
@@ -5,7 +5,7 @@
 <?php $sf_response->addJavaScript('/vendor/yui/connection/connection-min') ?>
 <?php $sf_response->addJavaScript('/vendor/yui/container/container-min') ?>
 <?php $sf_response->addJavaScript('/js/qubit') ?>
-<?php $sf_response->addJavaScript('/js/newCreationEventDialog') ?>
+<?php $sf_response->addJavaScript('/js/newCreationEventDialog'); ?>
 <?php 
$sf_response->addStylesheet('/vendor/yui/container/assets/skins/sam/container') 
?>
 
 <!-- Use a hidden image so we can grab the path in newCreationEventDialog js 
-->
@@ -18,26 +18,28 @@
    * Dialog object, so we don't see them when Javascript is turned off. Include
    * them here (instead of in .js file) to allow PHP to parse i18n tags. 
    */
- 
-  // Do this right away
-  $('body').prepend(
-    '<div class="yui-skin-sam">' +
-    '<div id="newCreationEventDialog">' +
-    '<div class="hd"><?php echo __('enter creator details') ?></div>' + 
-    '<div class="bd">' +
-    '<form action="" method="POST" style="border: none">' +
-    '</form>' +
-    '</div>' +
-    '</div>' +
-    '</div>'
-  );
   
   // Do this after newCreationEventDialog.js actions
   Drupal.behaviors.writeNewCreationHTML = function(context) 
   {
-    // Write a link to open the form
+    // Create YUI container for form
+    $('body').prepend(
+      '<div class="yui-skin-sam">' +
+        '<div id="newCreationEventDialog">' +
+          '<div class="hd"><?php echo __('enter creator details') ?></div>' + 
+          '<div class="bd">' +
+            '<form action="" method="POST" style="border: none">' +
+            '</form>' +
+          '</div>' +
+        '</div>' +
+      '</div>'
+    );
+    
+    // build the dialog
+    buildCreationEventDialog();
+  
+    // Write a link to show the dialog
     $("table#creationEvents").append('<tr id="addCreationEventLink"><td 
colspan="3"><a href="javascript:Qubit.newCreationEventDialog.show()"><?php echo 
__('add a creation event') ?></a></td></tr>');
-
   }
 //]]>
 </script>
\ No newline at end of file

Modified: 
trunk/qubit/apps/qubit/modules/informationobject/templates/editISADSuccess.php
===================================================================
--- 
trunk/qubit/apps/qubit/modules/informationobject/templates/editISADSuccess.php  
    2008-11-03 21:35:31 UTC (rev 1514)
+++ 
trunk/qubit/apps/qubit/modules/informationobject/templates/editISADSuccess.php  
    2008-11-03 23:57:01 UTC (rev 1515)
@@ -3,9 +3,6 @@
 
 <div class="pageTitle"><?php echo __('edit %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject'))); ?></div>
 
-<!-- add new creation event yui dialog -->
-<?php echo include_partial('newCreationEventDialog') ?>
-
 <?php echo form_tag('informationobject/updateISAD', 'multipart=true') ?>
   <?php echo object_input_hidden_tag($informationObject, 'getId') ?>
   <?php echo input_hidden_tag('collection_type_id', 
QubitTerm::ARCHIVAL_MATERIAL_ID) ?>
@@ -86,6 +83,9 @@
   <fieldset class="collapsible collapsed">
     <legend><?php echo __('context area'); ?></legend>
     
+    <!-- add new creation event yui dialog object -->
+    <?php echo include_partial('newCreationEventDialog') ?>
+    
     <div class="form-item">
       <label for="newCreationEvent"><?php echo __('creation context'); 
?></label>
       

Modified: trunk/qubit/web/js/newCreationEventDialog.js
===================================================================
--- trunk/qubit/web/js/newCreationEventDialog.js        2008-11-03 21:35:31 UTC 
(rev 1514)
+++ trunk/qubit/web/js/newCreationEventDialog.js        2008-11-03 23:57:01 UTC 
(rev 1515)
@@ -1,14 +1,12 @@
 // $Id$
 
-Qubit.noteDialog = Qubit.newCreationEventDialog || {}; // Information object 
treeview
-
 function removeRow(index)
 {
   $('tr#newRow'+index+' div').hide('normal', function() { 
$('tr#newRow'+index).remove() });
   $('input.addedHidden'+index).remove();
 }
 
-Drupal.behaviors.newCreationEventDialog = function (context)
+function buildCreationEventDialog(context)
 {
   var i = 0; // Counter
     
@@ -84,7 +82,7 @@
   // Move newCreationEvent table contents into yui dialog container.
   // Why? So the standard form still works if javascript is disabled
   var nceTable = $('table#newCreationEvent');
-  nceTable.clone().appendTo('#newCreationEventDialog div.bd form');
+  nceTable.clone().appendTo('div#newCreationEventDialog div.bd form');
   nceTable.remove();
   
   // Instantiate the Dialog 


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