allow turning off queued transcripts
This commit is contained in:
parent
eec73ad64d
commit
7a643f4fef
@ -250,6 +250,17 @@ class WhatDidTheySay {
|
||||
|
||||
return $options['languages'];
|
||||
}
|
||||
|
||||
function set_allow_transcripts_for_post($post_id, $allow = true) {
|
||||
$current_transcripts = get_post_meta($post_id, "provided_transcripts", true);
|
||||
$current_transcripts['_allow'] = $allow;
|
||||
update_post_meta($post_id, "provided_transcripts", $current_transcripts);
|
||||
}
|
||||
|
||||
function get_allow_transcripts_for_post($post_id) {
|
||||
$current_transcripts = get_post_meta($post_id, "provided_transcripts", true);
|
||||
return $current_transcripts['_allow'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -137,6 +137,7 @@ class WhatDidTheySayAdmin {
|
||||
function handle_update_queue_transcript($queue_transcript_info) {
|
||||
$updated = false;
|
||||
if (current_user_can('submit_transcriptions')) {
|
||||
if ($what_did_they_say->get_allow_transcripts_for_post($queue_transcript_info['post_id'])) {
|
||||
switch ($queue_transcript_info['action']) {
|
||||
case 'submit_queued_transcript':
|
||||
$result = $this->what_did_they_say->add_queued_transcription_to_post($queue_transcript_info['post_id'], $queue_transcript_info);
|
||||
@ -145,6 +146,7 @@ class WhatDidTheySayAdmin {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $updated;
|
||||
}
|
||||
|
||||
@ -156,8 +158,16 @@ class WhatDidTheySayAdmin {
|
||||
switch ($post_transcript_info['action']) {
|
||||
case "manage_post_transcripts":
|
||||
foreach ($post_transcript_info['transcripts'] as $language => $transcript) {
|
||||
switch ($language) {
|
||||
case "_allow":
|
||||
$allow = true;
|
||||
break;
|
||||
default:
|
||||
$this->what_did_they_say->save_transcript($post_transcript_info['post_id'], $language, $transcript);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->what_did_they_say->set_allow_transcripts_for_post($post_transcript_info['post_id'], isset($post_transcript_info['allow_on_post']));
|
||||
$updated = __('Transcripts updated', 'what-did-they-say');
|
||||
break;
|
||||
}
|
||||
|
@ -3,7 +3,13 @@
|
||||
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
|
||||
<p>
|
||||
<label>
|
||||
Edit transcript for:
|
||||
<input type="checkbox" name="wdts[allow_on_post]" value="yes" <?php echo ($transcripts['_allow']) ? 'checked="checked"' : '' ?> />
|
||||
<?php _e('Allow new transcripts to be submitted for this post', 'what-did-they-say') ?>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<?php _e('Edit transcript for:', 'what-did-they-say') ?>
|
||||
<select name="wdts[language]" id="wdts-language">
|
||||
<?php foreach ($options['languages'] as $code => $info) { ?>
|
||||
<option value="<?php echo $code ?>" <?php echo $info['default'] ? 'selected="selected"' : '' ?>><?php echo $info['name'] ?></option>
|
||||
|
@ -75,11 +75,13 @@ function transcripts_display($dropdown_message = null, $single_language_message
|
||||
$post_transcripts = $what_did_they_say->get_transcripts($post->ID);
|
||||
if (!empty($post_transcripts)) {
|
||||
foreach ($post_transcripts as $code => $transcript) {
|
||||
if (substr($code, 0, 1) != "_") {
|
||||
$transcript = trim($transcript);
|
||||
if (!empty($transcript)) {
|
||||
$transcripts[$code] = $transcript;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($transcripts) > 0) {
|
||||
$default_language = $what_did_they_say->get_default_language();
|
||||
@ -126,6 +128,7 @@ function the_media_transcript_queue_editor() {
|
||||
|
||||
if (current_user_can('submit_transcriptions')) { ?>
|
||||
<?php if (is_array($queued_transcripts_for_user)) { ?>
|
||||
<?php if (count($queued_transcripts_for_user) > 0) { ?>
|
||||
<div class="queued-transcriptions">
|
||||
<h3><?php _e('Your queued transcriptions', 'what-did-they-say') ?></h3>
|
||||
<?php foreach ($queued_transcripts_for_user as $transcript) { ?>
|
||||
@ -136,6 +139,8 @@ function the_media_transcript_queue_editor() {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($what_did_they_say->get_allow_transcripts_for_post($post->ID)) { ?>
|
||||
<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[action]" value="submit_queued_transcript" />
|
||||
@ -155,6 +160,7 @@ function the_media_transcript_queue_editor() {
|
||||
</label>
|
||||
<input type="submit" value="<?php _e('Submit New Transcription', 'what-did-they-say') ?>" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user