add buttons to submit editor

This commit is contained in:
John Bintz 2009-09-23 21:45:33 -04:00
parent 5ab3047bd2
commit 2eac8f71dc
3 changed files with 78 additions and 66 deletions

View File

@ -23,7 +23,7 @@
$language_options->get_language_name($transcript['language']) $language_options->get_language_name($transcript['language'])
) )
?></p> ?></p>
<div class="queued-transcription"><?php echo $transcript['transcript'] ?></div> <div class="queued-transcription transcript"><?php echo do_shortcode($transcript['transcript']) ?></div>
<div class="queued-transcription-raw" style="display:none"><?php echo $transcript['transcript'] ?></div> <div class="queued-transcription-raw" style="display:none"><?php echo $transcript['transcript'] ?></div>
<div style="padding: 10px 0"> <div style="padding: 10px 0">
<a href="#" class="approve-transcript button">Approve</a> <a href="#" class="approve-transcript button">Approve</a>
@ -54,7 +54,7 @@
foreach ($approved_transcripts as $transcript) { foreach ($approved_transcripts as $transcript) {
if ($transcript['language'] == $code) { $approved_transcript_text = $transcript['transcript']; break; } if ($transcript['language'] == $code) { $approved_transcript_text = $transcript['transcript']; break; }
} ?> } ?>
<textarea class="edit-transcript" id="wdts-transcripts-<?php echo $code ?>" name="wdts[transcripts][<?php echo $code ?>]" style="display: none; width: 100%; height: 200px"><?php echo $approved_transcript_text ?></textarea> <textarea class="edit-transcript" id="wdts-transcripts-<?php echo $code ?>" name="wdts[transcripts][<?php echo $code ?>]" style="display: none; width: 95%; height: 200px"><?php echo $approved_transcript_text ?></textarea>
<?php } ?> <?php } ?>
</p> </p>

View File

@ -27,10 +27,16 @@ var WDTSInjector = Class.create({
} }
}); });
$$('#wdts-shorttags button').each(function(b) { Event.observe(window, 'load', function() {
[
[ '#wdts-shorttags button', $("wdts-transcripts-" + $F('wdts-language')) ],
[ '#wdts-submit-shorttags button', $('wdts-transcript') ]
].each(function(info) {
$$(info[0]).each(function(b) {
top.console.log(b);
b.observe('click', function(e) { b.observe('click', function(e) {
Event.stop(e); Event.stop(e);
var current_transcript = $("wdts-transcripts-" + $F('wdts-language')); var current_transcript = info[1];
if (current_transcript) { if (current_transcript) {
if (document.selection) { if (document.selection) {
var range = document.selection.createRange(); var range = document.selection.createRange();
@ -87,6 +93,8 @@ $$('#wdts-shorttags button').each(function(b) {
} }
}); });
}); });
});
});
$$('.approve-transcript').each(function(b) { $$('.approve-transcript').each(function(b) {
b.observe('click', function(e) { b.observe('click', function(e) {

View File

@ -153,8 +153,8 @@ function transcripts_display($dropdown_message = null, $single_language_message
if (count($transcripts) == 1) { if (count($transcripts) == 1) {
list($code, $transcript) = each($transcripts); list($code, $transcript) = each($transcripts);
$output[] = apply_filters('the_language_name', get_the_language_name($code)); $output[] = end(apply_filters('the_language_name', get_the_language_name($code)));
$output[] = apply_filters('the_media_transcript', $transcript); $output[] = end(apply_filters('the_media_transcript', $transcript));
} else { } else {
$output[] = $dropdown_message; $output[] = $dropdown_message;
$output[] = '<select>'; $output[] = '<select>';
@ -165,8 +165,8 @@ function transcripts_display($dropdown_message = null, $single_language_message
} }
$output[] = '</select>'; $output[] = '</select>';
foreach ($transcripts as $code => $transcript) { foreach ($transcripts as $code => $transcript) {
$language_name = apply_filters('the_language_name', get_the_language_name($code)); $language_name = end(apply_filters('the_language_name', get_the_language_name($code)));
$transcript = apply_filters('the_media_transcript', $transcript); $transcript = end(apply_filters('the_media_transcript', $transcript));
$output[] = '<div ' $output[] = '<div '
. (($code == $default_language) ? 'style="display:none"' : '') . (($code == $default_language) ? 'style="display:none"' : '')
@ -215,13 +215,13 @@ function the_media_transcript_queue_editor() {
<?php if (current_user_can('approve_transcriptions')) { ?> <?php if (current_user_can('approve_transcriptions')) { ?>
<h3><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3> <h3><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
<form method="post" class="transcript-editor"> <form method="post" class="transcript-editor">
<?php include(dirname(__FILE__) . '/classes/meta-box.inc') ?> <?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
<input type="submit" value="Modify Transcript" /> <input type="submit" value="Modify Transcript" />
</form> </form>
<?php } ?> <?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?> <?php if (current_user_can('submit_transcriptions')) { ?>
<?php if ($transcript_options->are_new_transcripts_allowed()) { ?> <?php if ($transcript_options->are_new_transcripts_allowed()) { ?>
<h3><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3> <h3 style="margin-top: 0.5em"><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3>
<form method="post" class="transcript-editor"> <form method="post" class="transcript-editor">
<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') ?>" />
<input type="hidden" name="wdts[module]" value="queue-transcript" /> <input type="hidden" name="wdts[module]" value="queue-transcript" />
@ -234,10 +234,14 @@ function the_media_transcript_queue_editor() {
<?php } ?> <?php } ?>
</select> </select>
</label><br /> </label><br />
<label> <?php _e('Transcript:', 'what-did-they-say') ?><br />
<?php _e('Transcription:', 'what-did-they-say') ?><br /> <div id="wdts-submit-shorttags">
<textarea style="height: 200px; width: 90%" name="wdts[transcript]"></textarea> <button class="wdts-create" id="wdts-scene-heading">Scene Heading</button>
</label> <button class="wdts-create" id="wdts-scene-action">Scene Action</button>
<button class="wdts-create" id="wdts-dialog">Dialog</button>
</div>
<textarea style="height: 200px; width: 90%" id="wdts-transcript" name="wdts[transcript]"></textarea>
<input type="submit" value="<?php _e('Submit For Approval', 'what-did-they-say') ?>" /> <input type="submit" value="<?php _e('Submit For Approval', 'what-did-they-say') ?>" />
<?php } ?> <?php } ?>
</form> </form>