fix edit buttons for ie

This commit is contained in:
John Bintz 2009-09-30 22:33:17 -04:00
parent 12ad221d29
commit c970934553
5 changed files with 20 additions and 19 deletions

View File

@ -1,4 +1,4 @@
<div class="queued-transcript-holder" id="wdts-<?php echo $id = md5(rand()) ?>"> <div class="queued-transcript-holder" id="wdts-<?php echo $id = md5(rand()) ?>">
<?php include(dirname(__FILE__) . '/_queued-transcript-contents.inc') ?> <?php include(dirname(__FILE__) . '/_queued-transcript-contents.inc') ?>
</div> </div>
<script type="text/javascript">WhatDidTheySay.setup_transcript_action_buttons('wdts-<?php echo $id ?>', 'wdts-<?php echo $approved_editor_id ?>')</script> <script type="text/javascript">queued_editors_to_attach.push('wdts-<?php echo $id ?>');</script>

View File

@ -22,7 +22,7 @@
'dialog': '<?php _e('Dialog') ?>', 'dialog': '<?php _e('Dialog') ?>',
'approve': '<?php _e('Approve') ?>', 'approve': '<?php _e('Approve') ?>',
'delete': '<?php _e('Delete') ?>', 'delete': '<?php _e('Delete') ?>',
'edit': '<?php _e('Edit') ?>', 'edit': '<?php _e('Edit') ?>'
}; };
WhatDidTheySay.can_approve = <?php echo current_user_can('approve_transcriptions') ? "true" : "false" ?>; WhatDidTheySay.can_approve = <?php echo current_user_can('approve_transcriptions') ? "true" : "false" ?>;

View File

@ -7,7 +7,7 @@
?> ?>
<?php } ?> <?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?> <?php if (current_user_can('submit_transcriptions')) { ?>
<div id="wdts-<?php echo $new_transcript_id ?>" <?php echo (!$transcript_options->are_new_transcripts_allowed() ? 'style="display:none"' : '') ?>> <div id="wdts-<?php echo $new_transcript_id ?>" style="zoom:1<?php echo (!$transcript_options->are_new_transcripts_allowed() ? ';display:none' : '') ?>">
<h3 class="wdts"><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3> <h3 class="wdts"><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3>
<form method="post"> <form method="post">
<input type="hidden" name="wdts[_nonce]" value="<?php echo wp_create_nonce('what-did-they-say') ?>" /> <input type="hidden" name="wdts[_nonce]" value="<?php echo wp_create_nonce('what-did-they-say') ?>" />

View File

@ -4,13 +4,15 @@
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" /> <input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<?php } ?> <?php } ?>
<label> <input id="wdts-<?php echo $checkbox_id = md5(rand()) ?>" type="checkbox" name="wdts[allow_on_post]" value="yes" <?php echo ($transcript_options->are_new_transcripts_allowed()) ? 'checked="checked"' : '' ?> />
<input id="wdts-<?php echo $checkbox_id = md5(rand()) ?>" type="checkbox" name="wdts[allow_on_post]" value="yes" <?php echo ($transcript_options->are_new_transcripts_allowed()) ? 'checked="checked"' : '' ?> /> <?php _e('Allow new transcripts to be submitted for this post', 'what-did-they-say') ?>
<?php _e('Allow new transcripts to be submitted for this post', 'what-did-they-say') ?>
</label>
<?php $approved_editor_id = md5(rand()) ?> <?php $approved_editor_id = md5(rand()) ?>
<script type="text/javascript">
var queued_editors_to_attach = [];
</script>
<?php if (!is_admin()) { ?> <?php if (!is_admin()) { ?>
<?php include(dirname(__FILE__) . '/_manage-queued-transcripts.inc') ?> <?php include(dirname(__FILE__) . '/_manage-queued-transcripts.inc') ?>
<?php } ?> <?php } ?>
@ -55,6 +57,10 @@
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
queued_editors_to_attach.each(function(q) {
WhatDidTheySay.setup_transcript_action_buttons(q, 'wdts-<?php echo $approved_editor_id ?>')
});
WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $approved_editor_id ?>'); WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $approved_editor_id ?>');
<?php if (!is_admin()) { ?> <?php if (!is_admin()) { ?>
<?php <?php

View File

@ -44,7 +44,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
if (document.selection) { if (document.selection) {
var range = document.selection.createRange(); var range = document.selection.createRange();
var stored_range = range.duplicate(); var stored_range = range.duplicate();
stored_range.moveToElementText(current_transcript); stored_range.moveToElementText(transcript);
stored_range.setEndPoint('EndToEnd', range); stored_range.setEndPoint('EndToEnd', range);
transcript.selectionStart = stored_range.text.length - range.text.length; transcript.selectionStart = stored_range.text.length - range.text.length;
transcript.selectionEnd = current_transcript.selectionStart + range.text.length; transcript.selectionEnd = current_transcript.selectionStart + range.text.length;
@ -140,7 +140,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
'method': 'post', 'method': 'post',
'parameters': parameters, 'parameters': parameters,
'onSuccess': function() { update_update_message(WhatDidTheySay.messages.transcripts_updated); }, 'onSuccess': function() { update_update_message(WhatDidTheySay.messages.transcripts_updated); },
'onFailure': function() { update_update_message(WhatDidTheySay.messages.transcripts_failure); }, 'onFailure': function() { update_update_message(WhatDidTheySay.messages.transcripts_failure); }
} }
); );
}); });
@ -259,8 +259,8 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
var transcript = container.select('.transcript').pop(); var transcript = container.select('.transcript').pop();
var editor = new Element("div", { class: 'wdts-transcript-editor' }); var editor = new Element("div", { className: 'wdts-transcript-editor' });
var button_holder = new Element("div", { class: 'wdts-button-holder' }); var button_holder = new Element("div", { className: 'wdts-button-holder' });
var textnode = new Element('textarea', { style: 'height: 200px; width: 99%' }); var textnode = new Element('textarea', { style: 'height: 200px; width: 99%' });
textnode.value = container.select('.queued-transcript-raw').pop().innerHTML; textnode.value = container.select('.queued-transcript-raw').pop().innerHTML;
@ -293,7 +293,7 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
}, },
'onComplete': function() { 'onComplete': function() {
new Effect.Highlight(container); new Effect.Highlight(container);
WhatDidTheySay.setup_transcript_action_buttons(container); WhatDidTheySay.setup_transcript_action_buttons(container, approved_editor_container);
} }
}); });
} }
@ -317,14 +317,11 @@ WhatDidTheySay.setup_allow_new_transcripts = function(checkbox, editor) {
if (checkbox) { if (checkbox) {
checkbox = $(checkbox); checkbox = $(checkbox);
checkbox.observe('change', function(e) { checkbox.observe('click', function(e) {
Event.stop(e);
if (editor) { editor = $(editor); } if (editor) { editor = $(editor); }
var p = $(checkbox.parentNode.parentNode); var p = $(checkbox.parentNode);
if (p) { if (p) {
top.console.log(p);
var post_id = p.select("input[name*=[post_id]]").pop(); var post_id = p.select("input[name*=[post_id]]").pop();
if (post_id) { if (post_id) {
@ -345,8 +342,6 @@ WhatDidTheySay.setup_allow_new_transcripts = function(checkbox, editor) {
'method': 'post', 'method': 'post',
'parameters': parameters, 'parameters': parameters,
'onSuccess': function() { 'onSuccess': function() {
new Effect.Highlight(checkbox.parentNode);
if (editor) { if (editor) {
if (checkbox.checked) { if (checkbox.checked) {
new Effect.BlindDown(editor, { duration: 0.5 }); new Effect.BlindDown(editor, { duration: 0.5 });