Author: david
Date: 2008-11-10 10:56:53 -0800 (Mon, 10 Nov 2008)
New Revision: 1541
Added:
trunk/qubit/apps/qubit/modules/informationobject/templates/_newActorEventDialog.php
trunk/qubit/web/js/newActorEventDialog.js
Removed:
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
trunk/qubit/web/js/newCreationEventDialog.js
Log:
Rename "newCreationEvent" form elements, scripts and files to "newActorEvent"
in preparation for making actor events more generic.
Copied:
trunk/qubit/apps/qubit/modules/informationobject/templates/_newActorEventDialog.php
(from rev 1540,
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php)
===================================================================
---
trunk/qubit/apps/qubit/modules/informationobject/templates/_newActorEventDialog.php
(rev 0)
+++
trunk/qubit/apps/qubit/modules/informationobject/templates/_newActorEventDialog.php
2008-11-10 18:56:53 UTC (rev 1541)
@@ -0,0 +1,45 @@
+<?php use_helper('Javascript') ?>
+<?php
$sf_response->addJavaScript('/vendor/yui/yahoo-dom-event/yahoo-dom-event') ?>
+<?php $sf_response->addJavaScript('/vendor/yui/animation/animation-min') ?>
+<?php $sf_response->addJavaScript('/vendor/yui/dragdrop/dragdrop-min') ?>
+<?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/newActorEventDialog'); ?>
+<?php
$sf_response->addStylesheet('/vendor/yui/container/assets/skins/sam/container')
?>
+
+<!-- Use a hidden image so we can grab the path in newActorEventDialog js -->
+<?php echo image_tag('delete', array('id' => 'imagesDeletePng', 'style' =>
'display: none')) ?>
+
+<script language="javascript">
+//<!CDATA[
+ /*
+ * Dynamically write form elements specific to the newActorEventDialog YUI
+ * 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 after newActorEventDialog.js actions
+ Drupal.behaviors.writeNewActorEventHTML = function(context)
+ {
+ // Create YUI container for form
+ $('body').prepend(
+ '<div class="yui-skin-sam">' +
+ '<div id="newActorEventDialog">' +
+ '<div class="hd"><?php echo __('new event') ?></div>' +
+ '<div class="bd">' +
+ '<form action="" method="POST" style="border: none">' +
+ '</form>' +
+ '</div>' +
+ '</div>' +
+ '</div>'
+ );
+
+ // build the dialog
+ renderEventDialog();
+
+ // Write a link to show the dialog
+ $("table#actorEvents").append('<tr id="addActorEventLink"><td colspan="4"
style="text-align: right"><a
href="javascript:Qubit.newActorEventDialog.show()"><?php echo __('add new')
?></a></td></tr>');
+ }
+//]]>
+</script>
\ No newline at end of file
Property changes on:
trunk/qubit/apps/qubit/modules/informationobject/templates/_newActorEventDialog.php
___________________________________________________________________
Added: svn:keywords
+ Author Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted:
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
===================================================================
---
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
2008-11-08 00:24:05 UTC (rev 1540)
+++
trunk/qubit/apps/qubit/modules/informationobject/templates/_newCreationEventDialog.php
2008-11-10 18:56:53 UTC (rev 1541)
@@ -1,45 +0,0 @@
-<?php use_helper('Javascript') ?>
-<?php
$sf_response->addJavaScript('/vendor/yui/yahoo-dom-event/yahoo-dom-event') ?>
-<?php $sf_response->addJavaScript('/vendor/yui/animation/animation-min') ?>
-<?php $sf_response->addJavaScript('/vendor/yui/dragdrop/dragdrop-min') ?>
-<?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->addStylesheet('/vendor/yui/container/assets/skins/sam/container')
?>
-
-<!-- Use a hidden image so we can grab the path in newCreationEventDialog js
-->
-<?php echo image_tag('delete', array('id' => 'imagesDeletePng', 'style' =>
'display: none')) ?>
-
-<script language="javascript">
-//<!CDATA[
- /*
- * Dynamically write form elements specific to the newCreationEventDialog YUI
- * 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 after newCreationEventDialog.js actions
- Drupal.behaviors.writeNewCreationHTML = function(context)
- {
- // 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
Copied: trunk/qubit/web/js/newActorEventDialog.js (from rev 1540,
trunk/qubit/web/js/newCreationEventDialog.js)
===================================================================
--- trunk/qubit/web/js/newActorEventDialog.js (rev 0)
+++ trunk/qubit/web/js/newActorEventDialog.js 2008-11-10 18:56:53 UTC (rev
1541)
@@ -0,0 +1,104 @@
+// $Id$
+
+function removeRow(index)
+{
+ $('tr#newRow'+index+' div').hide('normal', function() {
$('tr#newRow'+index).remove() });
+ $('input.addedHidden'+index).remove();
+}
+
+function renderEventDialog(context)
+{
+ var i = 0; // Counter
+
+ // Write data from dialog to informationobject/edit form for submission.
+ var handleSubmit = function() {
+ var thisData = this.getData();
+ var actorSelector = $('table#newActorEvent
select[name="newActorEvent[actorId]"]');
+
+ // Hide dialog
+ this.hide();
+
+ // Build hidden form input fields
+ var newHiddens = '';
+ newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newActorEvents['+i+'][actorId]"
value="'+thisData['newActorEvent[actorId]']+'" />\n';
+ newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newActorEvents['+i+'][newActorAuthorizedName]"
value="'+thisData['newActorEvent[newActorAuthorizedName]']+'" />\n';
+ newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newActorEvents['+i+'][creationYear]"
value="'+thisData['newActorEvent[creationYear]']+'" />\n';
+ newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newActorEvents['+i+'][endYear]"
value="'+thisData['newActorEvent[endYear]']+'" />\n';
+ newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newActorEvents['+i+'][creationDateNote]"
value="'+thisData['newActorEvent[creationDateNote]']+'" />\n';
+
+ // Append hidden input fields
+ $('table#actorEvents').append(newHiddens);
+
+ // Determine the actor name to show in the creation events table
+ var actorId = thisData['newActorEvent[actorId]'];
+ if (actorId > 0)
+ {
+ var nameDisplay = actorSelector.find('option:selected').text();
+ }
+ else if (thisData['newActorEvent[newActorAuthorizedName]'].length > 0)
+ {
+ var nameDisplay = thisData['newActorEvent[newActorAuthorizedName]'];
+ }
+
+ // Determine the date(s) to show in the creation events table
+ var dateDisplay = thisData['newActorEvent[dateDisplay]'];
+ if (dateDisplay.length == 0 && thisData['newActorEvent[year]'].length > 0)
+ {
+ dateDisplay = thisData['newActorEvent[year]'];
+ if (thisData['newActorEvent[endYear]'].length > 0)
+ {
+ dateDisplay += ' - '+thisData['newActorEvent[endYear]'];
+ }
+ }
+
+ // Build visible row to append to the creationEvents Table
+ var newRow = $('<tr id="newRow'+i+'">'+
+ '<td><div>'+nameDisplay+'</div></td>'+
+ '<td><div>TODO: Get Role<div></td>'+
+ '<td><div>'+dateDisplay+'<div></td>'+
+ '<td><div><a href="javascript:removeRow('+i+')"><img
src="'+$('img#imagesDeletePng').attr('src')+'" /></a></div></td>'+
+ '</tr>'
+ );
+
+ // Append visible row showing actor name and event note
+ $('div', newRow).hide();
+ newRow.insertBefore('table#actorEvents tr#addActorEventLink');
+ $('div', newRow).show('normal');
+
+ // Clear data out of yui dialog
+ $('table#newActorEvent
input[name="newActorEvent[newActorAuthorizedName]"]').val('');
+ $('table#newActorEvent input[name="newActorEvent[year]"]').val('');
+ $('table#newActorEvent input[name="newActorEvent[endYear]"]').val('');
+ $('table#newActorEvent input[name="newActorEvent[dateDisplay]"]').val('');
+ actorSelector.get(0).options[0].selected = true;
+
+ i++; // increment counter
+ };
+
+ var handleCancel = function() {
+ this.cancel();
+ };
+
+ // Move newActorEvent table contents into yui dialog container.
+ // Why? So the standard form still works if javascript is disabled
+ var newActorEventTable = $('table#newActorEvent');
+ newActorEventTable.clone().appendTo('div#newActorEventDialog div.bd form');
+ newActorEventTable.remove();
+
+ // Instantiate the Dialog
+ Qubit.newActorEventDialog = new YAHOO.widget.Dialog("newActorEventDialog",
+ {
+ width : "480px",
+ zIndex : "100",
+ fixedcenter : true,
+ visible : false,
+ modal : true,
+ constraintoviewport : true,
+ postmethod : 'none',
+ buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
+ { text:"Cancel", handler:handleCancel } ],
+ effect : { effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25 }
+ } );
+
+ Qubit.newActorEventDialog.render();
+}
\ No newline at end of file
Property changes on: trunk/qubit/web/js/newActorEventDialog.js
___________________________________________________________________
Added: svn:keywords
+ Author Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: trunk/qubit/web/js/newCreationEventDialog.js
===================================================================
--- trunk/qubit/web/js/newCreationEventDialog.js 2008-11-08 00:24:05 UTC
(rev 1540)
+++ trunk/qubit/web/js/newCreationEventDialog.js 2008-11-10 18:56:53 UTC
(rev 1541)
@@ -1,104 +0,0 @@
-// $Id$
-
-function removeRow(index)
-{
- $('tr#newRow'+index+' div').hide('normal', function() {
$('tr#newRow'+index).remove() });
- $('input.addedHidden'+index).remove();
-}
-
-function buildCreationEventDialog(context)
-{
- var i = 0; // Counter
-
- // Write data from dialog to informationobject/edit form for submission.
- var handleSubmit = function() {
- var thisData = this.getData();
- var actorSelector = $('table#newCreationEvent
select[name="newCreationEvent[actorId]"]');
-
- // Hide dialog
- this.hide();
-
- // Build hidden form input fields
- var newHiddens = '';
- newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newCreationEvents['+i+'][actorId]"
value="'+thisData['newCreationEvent[actorId]']+'" />\n';
- newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newCreationEvents['+i+'][newActorAuthorizedName]"
value="'+thisData['newCreationEvent[newActorAuthorizedName]']+'" />\n';
- newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newCreationEvents['+i+'][creationYear]"
value="'+thisData['newCreationEvent[creationYear]']+'" />\n';
- newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newCreationEvents['+i+'][endYear]"
value="'+thisData['newCreationEvent[endYear]']+'" />\n';
- newHiddens += '<input class="addedHidden'+i+'" type="hidden"
name="newCreationEvents['+i+'][creationDateNote]"
value="'+thisData['newCreationEvent[creationDateNote]']+'" />\n';
-
- // Append hidden input fields
- $('table#creationEvents').append(newHiddens);
-
- // Determine the actor name to show in the creation events table
- var actorId = thisData['newCreationEvent[actorId]'];
- if (actorId > 0)
- {
- var nameDisplay = actorSelector.find('option:selected').text();
- }
- else if (thisData['newCreationEvent[newActorAuthorizedName]'].length > 0)
- {
-
- var nameDisplay = thisData['newCreationEvent[newActorAuthorizedName]'];
- }
-
- // Determine the date(s) to show in the creation events table
- var dateDisplay = thisData['newCreationEvent[creationDateNote]'];
- if (dateDisplay.length == 0 &&
thisData['newCreationEvent[creationYear]'].length > 0)
- {
- dateDisplay = thisData['newCreationEvent[creationYear]'];
- if (thisData['newCreationEvent[endYear]'].length > 0)
- {
- dateDisplay += ' - '+thisData['newCreationEvent[endYear]'];
- }
- }
-
- // Build visible row to append to the creationEvents Table
- var newRow = $('<tr id="newRow'+i+'">'+
- '<td><div>'+nameDisplay+'</div></td>'+
- '<td><div>'+dateDisplay+'<div></td>'+
- '<td><div><a href="javascript:removeRow('+i+')"><img
src="'+$('img#imagesDeletePng').attr('src')+'" /></a></div></td>'+
- '</tr>'
- );
-
- // Append visible row showing actor name and event note
- $('div', newRow).hide();
- newRow.insertBefore('table#creationEvents tr#addCreationEventLink');
- $('div', newRow).show('normal');
-
- // Clear data out of yui dialog
- $('table#newCreationEvent
input[name="newCreationEvent[newActorAuthorizedName]"]').val('');
- $('table#newCreationEvent
input[name="newCreationEvent[creationYear]"]').val('');
- $('table#newCreationEvent
input[name="newCreationEvent[endYear]"]').val('');
- $('table#newCreationEvent
input[name="newCreationEvent[creationDateNote]"]').val('');
- actorSelector.get(0).options[0].selected = true;
-
- i++; // increment counter
- };
-
- var handleCancel = function() {
- this.cancel();
- };
-
- // 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('div#newCreationEventDialog div.bd form');
- nceTable.remove();
-
- // Instantiate the Dialog
- Qubit.newCreationEventDialog = new
YAHOO.widget.Dialog("newCreationEventDialog",
- {
- width : "480px",
- zIndex : "100",
- fixedcenter : true,
- visible : false,
- modal : true,
- constraintoviewport : true,
- postmethod : 'none',
- buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
- { text:"Cancel", handler:handleCancel } ],
- effect : { effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25 }
- } );
-
- Qubit.newCreationEventDialog.render();
-}
\ No newline at end of file
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---