big ui cleanups

This commit is contained in:
John Bintz 2009-09-13 12:35:20 -04:00
parent 334ee3bc4c
commit b97dd56636
10 changed files with 373 additions and 172 deletions

View File

@ -12,7 +12,9 @@ class WDTSLanguageOptions {
$options = get_option($this->key);
foreach ($options['languages'] as $code => $info) {
if (is_null($language)) { $language = $code; }
if ($info['default']) { $language = $code; break; }
if (isset($info['default'])) {
if ($info['default']) { $language = $code; break; }
}
}
return $language;
}

View File

@ -3,6 +3,7 @@
class WDTSTranscriptManager {
var $key = null;
var $post_id = null;
var $allow_multiple = false;
function __construct($post_id = null) {
if (is_numeric($post_id)) { $this->post_id = $post_id; }
@ -36,36 +37,63 @@ class WDTSTranscriptManager {
if (!empty($user)) {
$transcript_info = (array)$transcript_info;
$transcript_info['user_id'] = $user->ID;
unset($transcript_info['key']);
if (($transcripts = $this->_get_transcripts_metadata()) !== false) {
$new_transcripts = array();
$was_added = false;
if (($transcripts = $this->_get_transcripts_metadata()) !== false) {
$max_key = 0;
foreach ($transcripts as $transcript) {
if ($transcript['language'] == $transcript_info['language']) {
$was_added = true;
$new_transcripts[] = $transcript_info;
} else {
$new_transcripts[] = $transcript;
}
$max_key = max($max_key, $transcript['key']) + 1;
}
if (!$was_added) { $new_transcripts[] = $transcript_info; }
$transcript_info['key'] = $max_key;
return update_post_meta($this->post_id, $this->key, $new_transcripts);
if ($this->allow_multiple) {
$transcripts[] = $transcript_info;
} else {
$new_transcripts = array();
$was_added = false;
foreach ($transcripts as $transcript) {
if ($transcript['language'] == $transcript_info['language']) {
$was_added = true;
$transcript_info['key']--;
$new_transcripts[] = $transcript_info;
} else {
$new_transcripts[] = $transcript;
}
}
if (!$was_added) { $new_transcripts[] = $transcript_info; }
$transcripts = $new_transcripts;
}
return update_post_meta($this->post_id, $this->key, $transcripts);
}
}
return false;
}
function delete_transcript($language = null) {
return $this->_delete_transcript_by_field('language', $language);
}
function delete_transcript_by_key($key = null) {
return $this->_delete_transcript_by_field('key', $key);
}
function _delete_transcript_by_field($field, $value) {
if (($transcripts = $this->_get_transcripts_metadata()) !== false) {
$new_transcripts = array();
$deleted_transcript = false;
foreach ($transcripts as $transcript) {
if ($transcript['language'] != $language) { $new_transcripts[] = $transcript; }
if ($transcript[$field] != $value) {
$new_transcripts[] = $transcript;
} else {
$deleted_transcript = $transcript;
}
}
return update_post_meta($this->post_id, $this->key, $new_transcripts);
update_post_meta($this->post_id, $this->key, $new_transcripts);
return $deleted_transcript;
}
return false;
return false;
}
function get_transcripts() {

View File

@ -2,7 +2,13 @@
require_once('WDTSTranscript.php');
class WDTSQueuedTranscript extends WDTSTranscriptManager { var $key = "queued_transcripts"; }
class WDTSApprovedTranscript extends WDTSTranscriptManager { var $key = "approved_transcripts"; }
class WDTSQueuedTranscript extends WDTSTranscriptManager {
var $key = "queued_transcripts";
var $allow_multiple = true;
}
class WDTSApprovedTranscript extends WDTSTranscriptManager {
var $key = "approved_transcripts";
}
?>

View File

@ -26,15 +26,15 @@ class WDTSTranscriptOptions {
}
function _get_transcript_options() {
$current_transcripts = get_post_meta($this->post_id, "transcript_options", true);
if (!is_array($current_transcripts)) { $current_transcripts = array(); }
return $current_transcripts;
$current_options = get_post_meta($this->post_id, "transcript_options", true);
if (!is_array($current_options)) { $current_options = array(); }
return $current_options;
}
function _update_option($option, $value) {
$current_options = $this->_get_transcript_options();
$current_transcripts[$option] = $value;
update_post_meta($this->post_id, "transcript_options", $current_transcripts);
$current_options[$option] = $value;
update_post_meta($this->post_id, "transcript_options", $current_options);
}
}

View File

@ -25,6 +25,8 @@ class WhatDidTheySayAdmin {
var $all_languages = array();
var $notices = array();
var $is_ajax = false;
/**
* Initialize the admin interface.
* @param WhatDidTheySay $what_did_they_say The WhatDidTheySay object to use for all transcript transactions.
@ -45,7 +47,6 @@ class WhatDidTheySayAdmin {
add_action('admin_menu', array(&$this, 'admin_menu'));
add_action('admin_notices', array(&$this, 'admin_notices'));
add_action('admin_init', array(&$this, 'admin_init'));
wp_enqueue_script('prototype');
@ -53,24 +54,27 @@ class WhatDidTheySayAdmin {
add_filter('the_media_transcript', array(&$this, 'the_media_transcript'));
add_filter('the_language_name', array(&$this, 'the_language_name'));
add_filter('wp_footer', array(&$this, 'wp_footer'));
add_filter('template_redirect', array(&$this, 'template_redirect'));
if (isset($_REQUEST['wdts'])) {
if (isset($_REQUEST['wdts']['_nonce'])) {
if (wp_verify_nonce($_REQUEST['wdts']['_nonce'], 'what-did-they-say')) {
$this->handle_update($_REQUEST['wdts']);
if ($this->is_ajax) { exit(0); }
}
}
}
$this->read_language_file();
if (current_user_can('submit_transcriptions')) {
wp_enqueue_script('scriptaculous-effects');
}
}
/**
* Handle admin_init action.
*/
function admin_init() {
wp_enqueue_script('scriptaculous-effects');
function template_redirect() {
wp_enqueue_script('toggle-transcript', plugin_dir_url(dirname(__FILE__)) . 'toggle-transcript.js', array('prototype'), false, true);
}
/**
@ -90,27 +94,6 @@ class WhatDidTheySayAdmin {
function the_language_name($language) {
return '<h3 class="transcript-language">' . $language . '</h3>';
}
/**
* Handle the wp_footer action.
*/
function wp_footer() { ?>
<script type="text/javascript">
$$('.transcript-bundle').each(function(d) {
var select = d.select("select");
if (select.length == 1) {
select = select[0];
var toggle_transcripts = function() {
d.select(".transcript-holder").each(function(div) {
div.hasClassName($F(select)) ? div.show() : div.hide();
});
};
Event.observe(select, 'change', toggle_transcripts);
Event.observe(window, 'load', toggle_transcripts)
}
});
</script>
<?php }
/**
* Handle the user_has_cap filter.
@ -218,19 +201,50 @@ class WhatDidTheySayAdmin {
$transcripts_to_delete = array();
foreach ($queued_transcriptions as $transcription) { $transcripts_to_delete[$transcription->id] = true; }
if (isset($post_transcript_info['queue'])) {
foreach ($post_transcript_info['queue'] as $id => $keep) { unset($transcripts_to_delete[$id]); }
if (isset($info['queue'])) {
foreach ($info['queue'] as $id => $keep) { unset($transcripts_to_delete[$id]); }
}
foreach (array_keys($transcripts_to_delete) as $id) { $queued_transcripts->delete_transcript($id); }
}
$updated = __('Transcripts updated.', 'what-did-they-say');
break;
}
return $updated;
}
function handle_update_approve_transcript($info) {
$this->is_ajax = true;
if (current_user_can('approve_transcriptions')) {
$approved_transcript_manager = new WDTSApprovedTranscript($info['post_id']);
$queued_transcript_manager = new WDTSQueuedTranscript($info['post_id']);
if (($transcript = $queued_transcript_manager->delete_transcript_by_key($info['key'])) !== false) {
$approved_transcript_manager->save_transcript($transcript);
return;
}
header('HTTP/1.1 500 Internal Server Error');
return;
}
header('HTTP/1.1 401 Unauthorized');
}
function handle_update_delete_transcript($info) {
$this->is_ajax = true;
if (current_user_can('approve_transcriptions')) {
$queued_transcript_manager = new WDTSQueuedTranscript($info['post_id']);
if (($transcript = $queued_transcript_manager->delete_transcript_by_key($info['key'])) !== false) {
return;
}
header('HTTP/1.1 500 Internal Server Error');
return;
}
header('HTTP/1.1 401 Unauthorized');
}
/**
* Handle updates to languages.
* @param array $info The part of the $_POST array for What Did They Say?!?
@ -329,7 +343,7 @@ class WhatDidTheySayAdmin {
if (file_exists($this->language_file)) {
foreach (file($this->language_file) as $language) {
$language = trim($language);
list($code, $date_added, $name, $additional) = explode("\t", $language);
list($code, $date_added, $name) = explode("\t", $language);
$this->all_languages[$code] = $name;
}
}
@ -425,6 +439,8 @@ class WhatDidTheySayAdmin {
${"${var_name}_transcripts"} = ${"${var_name}_transcript_manager"}->get_transcripts();
}
$transcript_options = new WDTSTranscriptOptions($post->ID);
$nonce = wp_create_nonce('what-did-they-say');
include(dirname(__FILE__) . '/meta-box.inc');
}

View File

@ -3,28 +3,28 @@
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
<p>
<label>
<input type="checkbox" name="wdts[allow_on_post]" value="yes" <?php echo ($transcripts['_allow']) ? 'checked="checked"' : '' ?> />
<input 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') ?>
</label>
</p>
<?php if (is_array($queued_transcripts) && !empty($queued_transcripts)) { ?>
<p><strong><?php _e('Manage queued transcripts:', 'what-did-they-say') ?></strong></p>
<?php foreach ($queued_transcripts as $transcript) {
$user = get_userdata($transcript->user_id);
$user = get_userdata($transcript['user_id']);
if (!empty($user)) { ?>
<div class="queued-transcription-holder">
<input type="hidden" name="wdts[queue][<?php echo $transcript->id ?>]" value="keep" />
<input type="hidden" name="wdts[language][<?php echo $transcript->id ?>]" value="<?php echo $transcript->language ?>" />
<input type="hidden" name="wdts[language]" value="<?php echo $transcript['language'] ?>" />
<input type="hidden" name="wdts[key]" value="<?php echo $transcript['key'] ?>" />
<p><?php
printf(
__('From <strong>%s</strong> in <strong>%s</strong>:', 'what-did-they-say'),
$user->display_name,
$this->what_did_they_say->get_language_name($transcript->language)
$language_options->get_language_name($transcript['language'])
)
?></p>
<div class="queued-transcription"><?php echo $transcript->transcript ?></div>
<div class="queued-transcription-raw" style="display:none"><?php echo $transcript->transcript ?></div>
<div class="queued-transcription"><?php echo $transcript['transcript'] ?></div>
<div class="queued-transcription-raw" style="display:none"><?php echo $transcript['transcript'] ?></div>
<div style="padding: 10px 0">
<a href="#" class="approve-transcript button">Approve</a>
<a href="#" class="delete-transcript button">Delete</a>
@ -44,54 +44,23 @@
</label>
<?php foreach (array_keys($options['languages']) as $code) { ?>
<textarea class="transcript" id="wdts-transcripts-<?php echo $code ?>" name="wdts[transcripts][<?php echo $code ?>]" style="display: none; width: 100%; height: 200px"><?php echo $approved_transcripts[$code] ?></textarea>
<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_transcripts[$code] ?></textarea>
<?php } ?>
</p>
<script type="text/javascript">
function switch_transcript() {
$$('.transcript').each(function(t) {
(t.id == "wdts-transcripts-" + $F('wdts-language')) ? t.show() : t.hide();
});
}
switch_transcript();
Event.observe($('wdts-language'), 'change', switch_transcript);
$$('.approve-transcript').each(function(b) {
Event.observe(b, 'click', function(e) {
Event.stop(e);
var lang = b.parentNode.parentNode.select("input[name*=[language]]").shift();
if (lang) {
lang = lang.value;
var editor = $('wdts-transcripts-' + lang);
var raw_transcript = b.parentNode.parentNode.select(".queued-transcription-raw").shift();
if (raw_transcript && editor) {
var ok = true;
if (editor.value.match(/[^ ]/)) {
ok = confirm('<?php _e('This will overwrite the current transcript. Are you sure?', 'what-did-they-say') ?>');
}
if (ok) {
editor.value = raw_transcript.innerHTML;
var p = b.parentNode.parentNode;
new Effect.Fade(p, {
'afterFinish': function() { p.parentNode.removeChild(p); }
});
}
}
}
});
});
$$('.delete-transcript').each(function(b) {
Event.observe(b, 'click', function(e) {
Event.stop(e);
if (confirm('<?php _e('This will delete the queued transcript. Are you sure?', 'what-did-they-say') ?>')) {
var p = b.parentNode.parentNode;
new Effect.Fade(p, {
'afterFinish': function() { p.parentNode.removeChild(p); }
});
}
});
});
var language_selector = $('wdts-language');
var ajax_url = '<?php echo $_SERVER['REQUEST_URI'] ?>';
var nonce = '<?php echo $nonce ?>';
var messages = {
'overwrite': '<?php _e('This will overwrite the current transcript. Are you sure?', 'what-did-they-say') ?>',
'delete': '<?php _e('This will delete the queued transcript. Are you sure?', 'what-did-they-say') ?>',
'approved': '<?php _e('Transcript approved and posted. You can further edit it below.', 'what-did-they-say') ?>',
'deleted': '<?php _e('Transcript deleted.', 'what-did-they-say') ?>'
};
var s = document.createElement('script');
s.src = '<?php echo plugin_dir_url(dirname(__FILE__)) . 'edit-transcripts.js' ?>';
document.getElementsByTagName('head')[0].appendChild(s);
</script>

91
edit-transcripts.js Normal file
View File

@ -0,0 +1,91 @@
function switch_transcript() {
$$('.edit-transcript').each(function(t) {
(t.id == "wdts-transcripts-" + $F('wdts-language')) ? t.show() : t.hide();
});
}
switch_transcript();
Event.observe(language_selector, 'change', switch_transcript);
$$('.approve-transcript').each(function(b) {
Event.observe(b, 'click', function(e) {
Event.stop(e);
var lang = b.parentNode.parentNode.select("input[name*=[language]]").shift();
var post_id = b.parentNode.parentNode.parentNode.select("input[name*=[post_id]]").shift();
var key = b.parentNode.parentNode.select("input[name*=[key]]").shift();
if (lang && post_id && key) {
lang = lang.value;
post_id = post_id.value;
key = key.value;
var editor = $('wdts-transcripts-' + lang);
var raw_transcript = b.parentNode.parentNode.select(".queued-transcription-raw").shift();
if (raw_transcript && editor) {
var ok = true;
if (editor.value.match(/[^ ]/)) {
ok = confirm(messages.overwrite);
}
if (ok) {
editor.value = raw_transcript.innerHTML;
var p = b.parentNode.parentNode;
new Ajax.Request(
ajax_url, {
'method': 'post',
'parameters': {
'wdts[_nonce]': nonce,
'wdts[module]': 'approve-transcript',
'wdts[key]': key,
'wdts[post_id]': post_id
},
'onSuccess': function() {
p.update(messages.approved);
new Effect.Highlight(p);
var i,il;
for (i = 0, il = language_selector.options.length; i < il; ++i) {
if (language_selector.options[i].value == lang) {
language_selector.selectedIndex = i;
switch_transcript();
break;
}
}
}
}
);
}
}
}
});
});
$$('.delete-transcript').each(function(b) {
Event.observe(b, 'click', function(e) {
Event.stop(e);
if (confirm(messages.delete)) {
var post_id = b.parentNode.parentNode.parentNode.select("input[name*=[post_id]]").shift();
var key = b.parentNode.parentNode.select("input[name*=[key]]").shift();
if (post_id && key) {
post_id = post_id.value;
key = key.value;
var p = b.parentNode.parentNode;
new Ajax.Request(
ajax_url, {
'method': 'post',
'parameters': {
'wdts[_nonce]': nonce,
'wdts[module]': 'delete-transcript',
'wdts[key]': key,
'wdts[post_id]': post_id
},
'onSuccess': function() {
p.update(messages.deleted);
new Effect.Highlight(p);
}
}
);
}
}
});
});

View File

@ -17,6 +17,8 @@ class WDTSTranscriptTest extends PHPUnit_Framework_TestCase {
}
function testSaveTranscript() {
$this->w->allow_multiple = false;
$this->w->save_transcript(array(
'language' => 'en',
'transcript' => 'this is a transcript'
@ -27,7 +29,8 @@ class WDTSTranscriptTest extends PHPUnit_Framework_TestCase {
array(
'language' => 'en',
'transcript' => 'this is a transcript',
'user_id' => 1
'user_id' => 1,
'key' => 0
)
),
get_post_meta(1, $this->w->key, true)
@ -43,7 +46,8 @@ class WDTSTranscriptTest extends PHPUnit_Framework_TestCase {
array(
'language' => 'en',
'transcript' => 'this is another transcript',
'user_id' => 1
'user_id' => 1,
'key' => 0
)
),
get_post_meta(1, $this->w->key, true)
@ -59,39 +63,101 @@ class WDTSTranscriptTest extends PHPUnit_Framework_TestCase {
array(
'language' => 'en',
'transcript' => 'this is another transcript',
'user_id' => 1
'user_id' => 1,
'key' => 0
),
array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
'user_id' => 1
'user_id' => 1,
'key' => 1
),
),
get_post_meta(1, $this->w->key, true)
);
}
$this->w->allow_multiple = true;
$this->w->save_transcript(array(
'language' => 'en',
'transcript' => 'this is yet another transcript'
));
$this->assertEquals(
array(
array(
'language' => 'en',
'transcript' => 'this is another transcript',
'user_id' => 1,
'key' => 0
),
array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
'user_id' => 1,
'key' => 1
),
array(
'language' => 'en',
'transcript' => 'this is yet another transcript',
'user_id' => 1,
'key' => 2
),
),
get_post_meta(1, $this->w->key, true)
);
}
function testDeleteTranscript() {
update_post_meta(1, $this->w->key, array(
array(
'language' => 'en',
'transcript' => 'this is another transcript',
'user_id' => 1
),
array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
'user_id' => 1
),
$this->w->save_transcript(array(
'language' => 'en',
'transcript' => 'this is another transcript'
));
$this->w->save_transcript(array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
));
$this->w->delete_transcript('en');
$this->assertEquals(array(
array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
'user_id' => 1
'user_id' => 1,
'key' => 1
),
), get_post_meta(1, $this->w->key, true));
}
function testDeleteTranscriptByKey() {
$this->w->save_transcript(array(
'language' => 'en',
'transcript' => 'this is another transcript'
));
$this->w->save_transcript(array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
));
$this->assertEquals(
$this->w->delete_transcript_by_key(0),
array(
'language' => 'en',
'transcript' => "this is another transcript",
'user_id' => 1,
'key' => 0
)
);
$this->assertEquals(array(
array(
'language' => 'fr',
'transcript' => "il s'agit d'une nouvelle transcription",
'user_id' => 1,
'key' => 1
),
), get_post_meta(1, $this->w->key, true));
}

13
toggle-transcript.js Normal file
View File

@ -0,0 +1,13 @@
$$('.transcript-bundle').each(function(d) {
var select = d.select("select");
if (select.length == 1) {
select = select[0];
var toggle_transcripts = function() {
d.select(".transcript-holder").each(function(div) {
div.hasClassName($F(select)) ? div.show() : div.hide();
});
};
Event.observe(select, 'change', toggle_transcripts);
Event.observe(window, 'load', toggle_transcripts)
}
});

View File

@ -26,11 +26,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
foreach (glob(dirname(__FILE__) . '/classes/*.php') as $file) { require_once($file); }
$what_did_they_say_admin =& new WhatDidTheySayAdmin(&$what_did_they_say);
$what_did_they_say_admin = new WhatDidTheySayAdmin(&$what_did_they_say);
add_action('init', array(&$what_did_they_say_admin, 'init'));
register_activation_hook(__FILE__, array(&$what_did_they_say, 'install'));
register_activation_hook(__FILE__, array(&$what_did_they_say_admin, 'install'));
// template tags
// please, if you use any of these, wrap them in function_exists() so your site doesn't
@ -72,10 +70,10 @@ function the_media_transcript($language = null) {
* @return string The name of the requested language.
*/
function get_the_language_name($language = null) {
global $what_did_they_say;
if (is_null($language)) { $language = $what_did_they_say->get_default_language(); }
return $what_did_they_say->get_language_name($language);
$language_options = new WDTSLanguageOptions();
if (is_null($language)) { $language = $language_options->get_default_language(); }
return $language_options->get_language_name($language);
}
/**
@ -106,19 +104,21 @@ function transcripts_display($dropdown_message = null, $single_language_message
$post_transcripts = $approved_transcripts->get_transcripts();
if (!empty($post_transcripts)) {
foreach ($post_transcripts as $code => $transcript) {
if (substr($code, 0, 1) != "_") {
$transcript = trim($transcript);
if (!empty($transcript)) {
$transcripts[$code] = $transcript;
}
foreach ($post_transcripts as $transcript) {
extract($transcript, EXTR_PREFIX_ALL, "transcript");
$transcript_transcript = trim($transcript_transcript);
if (!empty($transcript_transcript)) {
$transcripts[$transcript_language] = $transcript_transcript;
}
}
$language_options = new WDTSLanguageOptions();
if (count($transcripts) > 0) {
$default_language = $what_did_they_say->get_default_language();
$default_language = $language_options->get_default_language();
$output[] = '<div class="transcript-bundle">';
if (count($transcripts) == 1) {
list($code, $transcript) = each($transcripts);
$output[] = apply_filters('the_language_name', get_the_language_name($code));
@ -152,7 +152,7 @@ function transcripts_display($dropdown_message = null, $single_language_message
* If you're allowing users to submit transcripts to the post transcript queue, use this tag in your Loop.
*/
function the_media_transcript_queue_editor() {
global $post, $what_did_they_say;
global $post;
if (current_user_can('submit_transcriptions')) {
$queued_transcripts_for_user = false;
@ -164,40 +164,50 @@ function the_media_transcript_queue_editor() {
$queued_transcripts_for_user = $queued_transcripts->get_transcripts_for_user($user->ID);
}
$transcript_options = new WDTSTranscriptOptions($post->ID);
$language_options = new WDTSLanguageOptions();
if (is_array($queued_transcripts_for_user)) {
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) { ?>
<h4><?php echo $what_did_they_say->get_language_name($transcript->language) ?></h4>
<div>
<?php echo $transcript->transcript ?>
</div>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<?php if ($transcript_options->are_new_transcripts_allowed()) { ?>
$transcript_options = new WDTSTranscriptOptions($post->ID);
$options = get_option('what-did-they-say-options');
foreach (array('Approved', 'Queued') as $name) {
$var_name = strtolower($name);
$class_name = "WDTS${name}Transcript";
${"${var_name}_transcript_manager"} = new $class_name($post->ID);
${"${var_name}_transcripts"} = ${"${var_name}_transcript_manager"}->get_transcripts();
}
$nonce = wp_create_nonce('what-did-they-say');
?>
<?php if (current_user_can('approve_transcriptions')) { ?>
<h3><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
<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" />
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
<h3><?php _e('Submit a new transcription:', 'what-did-they-say') ?></h3>
<label>
<?php _e('Language:', 'what-did-they-say') ?>
<select name="wdts[language]">
<?php foreach ($what_did_they_say->get_languages() as $code => $info) { ?>
<option value="<?php echo $code ?>"><?php echo $info['name'] ?></option>
<?php } ?>
</select>
</label><br />
<label>
<?php _e('Transcription:', 'what-did-they-say') ?><br />
<textarea style="height: 200px; width: 90%" name="wdts[transcript]"></textarea>
</label>
<input type="submit" value="<?php _e('Submit New Transcription', 'what-did-they-say') ?>" />
<?php include(dirname(__FILE__) . '/classes/meta-box.inc') ?>
<input type="submit" value="Submit New" />
</form>
<?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?>
<?php if ($transcript_options->are_new_transcripts_allowed()) { ?>
<h3><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3>
<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[module]" value="queue-transcript" />
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
<label>
<?php _e('Language:', 'what-did-they-say') ?>
<select name="wdts[language]">
<?php foreach ($language_options->get_languages() as $code => $info) { ?>
<option value="<?php echo $code ?>"><?php echo $info['name'] ?></option>
<?php } ?>
</select>
</label><br />
<label>
<?php _e('Transcription:', 'what-did-they-say') ?><br />
<textarea style="height: 200px; width: 90%" name="wdts[transcript]"></textarea>
</label>
<input type="submit" value="<?php _e('Submit For Approval', 'what-did-they-say') ?>" />
<?php } ?>
</form>
<?php } ?>
<?php }