get metabox working

This commit is contained in:
John Bintz 2009-09-30 21:43:07 -04:00
parent 11d8e126dc
commit e45a2b0e2e
3 changed files with 22 additions and 14 deletions

View File

@ -711,7 +711,7 @@ class WhatDidTheySayAdmin {
wp_enqueue_style('wdts-admin', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-admin.css'); wp_enqueue_style('wdts-admin', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-admin.css');
wp_enqueue_style('wdts-defaults', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-defaults.css'); wp_enqueue_style('wdts-defaults', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-defaults.css');
wp_enqueue_script('scriptaculous-effects'); wp_enqueue_script('scriptaculous-effects');
wp_enqueue_script('edit-transcripts', plugin_dir_url(dirname(__FILE__)) . 'js/edit-transcripts.js', array('scriptaculous-effects'), false, true); wp_enqueue_script('edit-transcripts', plugin_dir_url(dirname(__FILE__)) . 'js/edit-transcripts.js', array('scriptaculous-effects'));
} }
} }
} }
@ -751,8 +751,8 @@ class WhatDidTheySayAdmin {
$language_options = new WDTSLanguageOptions(); $language_options = new WDTSLanguageOptions();
$nonce = wp_create_nonce('what-did-they-say'); $nonce = wp_create_nonce('what-did-they-say');
include('partials/meta-box.inc');
include('partials/_editor-script.inc'); include('partials/_editor-script.inc');
include('partials/meta-box.inc');
} }
} }

View File

@ -1,4 +1,8 @@
<input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" /> <input type="hidden" name="wdts[post_id]" value="<?php echo $post->ID ?>" />
<?php if (is_admin()) { ?>
<input type="hidden" name="wdts[module]" value="manage-post-transcripts" />
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<?php } ?>
<label> <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"' : '' ?> />
@ -12,7 +16,7 @@
<?php } ?> <?php } ?>
<?php if (is_array($queued_transcripts) && !empty($queued_transcripts)) { ?> <?php if (is_array($queued_transcripts) && !empty($queued_transcripts)) { ?>
<p><strong><?php _e('Manage queued transcripts:', 'what-did-they-say') ?></strong></p> <h3 class="wdts"><?php _e('Manage queued transcripts:', 'what-did-they-say') ?></h3>
<?php <?php
foreach ($queued_transcripts as $transcript) { foreach ($queued_transcripts as $transcript) {
$user = get_userdata($transcript['user_id']); $user = get_userdata($transcript['user_id']);
@ -22,7 +26,7 @@
<?php } ?> <?php } ?>
<div id="wdts-<?php echo $approved_editor_id ?>"> <div id="wdts-<?php echo $approved_editor_id ?>">
<?php if (!defined('WP_ADMIN')) { ?> <?php if (!is_admin()) { ?>
<h3 class="wdts"><?php _e('Edit Approved Transcripts:', 'what-did-they-say') ?></h3> <h3 class="wdts"><?php _e('Edit Approved Transcripts:', 'what-did-they-say') ?></h3>
<?php } ?> <?php } ?>
<div class="wdts-transcript-editor"> <div class="wdts-transcript-editor">
@ -43,13 +47,16 @@
} ?> } ?>
<textarea class="edit-transcript" name="wdts[transcripts][<?php echo $code ?>]" style="display: none; width: 99%; height: 200px"><?php echo $approved_transcript_text ?></textarea> <textarea class="edit-transcript" name="wdts[transcripts][<?php echo $code ?>]" style="display: none; width: 99%; height: 200px"><?php echo $approved_transcript_text ?></textarea>
<?php } ?> <?php } ?>
<?php if (!is_admin()) { ?>
<input type="button" class="wdts-modify-transcript" value="<?php _e('Update All Transcripts', 'what-did-they-say') ?>" /> <input type="button" class="wdts-modify-transcript" value="<?php _e('Update All Transcripts', 'what-did-they-say') ?>" />
<span class="wdts-update-message"></span> <span class="wdts-update-message"></span>
<?php } ?>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
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 <?php
$allow_new_transcripts_parameters = array("'wdts-${checkbox_id}'"); $allow_new_transcripts_parameters = array("'wdts-${checkbox_id}'");
if (isset($new_transcript_id)) { if (isset($new_transcript_id)) {
@ -57,4 +64,5 @@
} }
?> ?>
WhatDidTheySay.setup_allow_new_transcripts(<?php echo implode(",", $allow_new_transcripts_parameters) ?>); WhatDidTheySay.setup_allow_new_transcripts(<?php echo implode(",", $allow_new_transcripts_parameters) ?>);
<?php } ?>
</script> </script>

View File

@ -31,7 +31,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
} }
[ 'scene-heading', 'scene-action', 'dialog' ].each(function(tag) { [ 'scene-heading', 'scene-action', 'dialog' ].each(function(tag) {
var b = new Element('button').update(WhatDidTheySay.button_labels[tag]); var b = new Element('button', { className: 'button' }).update(WhatDidTheySay.button_labels[tag]);
var get_t = function() { return tag; }; var get_t = function() { return tag; };