really clean stuff up

This commit is contained in:
John Bintz 2009-09-30 21:28:03 -04:00
parent bb9f29a1fd
commit 11d8e126dc
4 changed files with 32 additions and 20 deletions

View File

@ -7,9 +7,9 @@
?>
<?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?>
<?php if ($transcript_options->are_new_transcripts_allowed()) { ?>
<div id="wdts-<?php echo $new_transcript_id ?>" <?php echo (!$transcript_options->are_new_transcripts_allowed() ? 'style="display:none"' : '') ?>>
<h3 class="wdts"><?php _e('Submit a new transcript:', 'what-did-they-say') ?></h3>
<form method="post" id="<?php echo $id = "wdts-" . md5(rand()) ?>">
<form method="post">
<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 ?>" />
@ -30,6 +30,6 @@
<input type="submit" value="<?php _e('Submit For Approval', 'what-did-they-say') ?>" />
</div>
</form>
<script type="text/javascript">WhatDidTheySay.setup_transcript_editor('<?php echo $id ?>')</script>
<?php } ?>
<script type="text/javascript">WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $new_transcript_id ?>')</script>
</div>
<?php } ?>

View File

@ -7,6 +7,10 @@
<?php $approved_editor_id = md5(rand()) ?>
<?php if (!is_admin()) { ?>
<?php include(dirname(__FILE__) . '/_manage-queued-transcripts.inc') ?>
<?php } ?>
<?php if (is_array($queued_transcripts) && !empty($queued_transcripts)) { ?>
<p><strong><?php _e('Manage queued transcripts:', 'what-did-they-say') ?></strong></p>
<?php
@ -43,7 +47,14 @@
<span class="wdts-update-message"></span>
</div>
</div>
<script type="text/javascript">
WhatDidTheySay.setup_transcript_editor('wdts-<?php echo $approved_editor_id ?>');
WhatDidTheySay.setup_allow_new_transcripts('wdts-<?php echo $checkbox_id ?>');
<?php
$allow_new_transcripts_parameters = array("'wdts-${checkbox_id}'");
if (isset($new_transcript_id)) {
$allow_new_transcripts_parameters[] = "'wdts-${new_transcript_id}'";
}
?>
WhatDidTheySay.setup_allow_new_transcripts(<?php echo implode(",", $allow_new_transcripts_parameters) ?>);
</script>

View File

@ -313,26 +313,26 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
}
};
WhatDidTheySay.setup_allow_new_transcripts = function(checkbox) {
WhatDidTheySay.setup_allow_new_transcripts = function(checkbox, editor) {
if (checkbox) {
checkbox = $(checkbox);
checkbox.observe('change', function(e) {
Event.stop(e);
if (editor) { editor = $(editor); }
var p = $(checkbox.parentNode.parentNode);
if (p) {
top.console.log(p);
var post_id = p.select("input[name*=[post_id]]").pop();
var key = p.select("input[name*=[key]]").pop();
if (post_id && key) {
if (post_id) {
post_id = post_id.value;
key = key.value;
var parameters = {
'wdts[_nonce]': WhatDidTheySay.nonce,
'wdts[module]': 'manage-post-transcripts',
'wdts[key]': key,
'wdts[post_id]': post_id
};
@ -346,6 +346,14 @@ WhatDidTheySay.setup_allow_new_transcripts = function(checkbox) {
'parameters': parameters,
'onSuccess': function() {
new Effect.Highlight(checkbox.parentNode);
if (editor) {
if (checkbox.checked) {
new Effect.BlindDown(editor, { duration: 0.5 });
} else {
new Effect.BlindUp(editor, { duration: 0.5 });
}
}
}
}
);

View File

@ -210,18 +210,11 @@ function the_media_transcript_queue_editor() {
}
$nonce = wp_create_nonce('what-did-they-say');
$new_transcript_id = md5(rand());
?>
<?php if (current_user_can('approve_transcriptions')) { ?>
<h3 class="wdts"><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
<form method="post" id="wdts-<?php echo $id = md5(rand()) ?>">
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
</form>
<script type="text/javascript">
$('wdts-<?php echo $id ?>').observe('submit', function(e) { Event.stop(e); });
</script>
<?php } ?>
<?php include(dirname(__FILE__) . '/classes/partials/_manage-queued-transcripts.inc') ?>
<h3 class="wdts"><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
<?php }
}