some bug fixes and ui improvements

This commit is contained in:
John Bintz 2009-10-13 18:49:21 -04:00
parent 0ba25fc5af
commit 94aac79b48
8 changed files with 148 additions and 53 deletions

View File

@ -77,6 +77,9 @@ class WhatDidTheySayAdmin {
if ($any_changes) { update_option('what-did-they-say-options', $options); } if ($any_changes) { update_option('what-did-they-say-options', $options); }
} }
// sessions
if (!session_id()) { session_start(); }
// pages // pages
add_action('admin_menu', array(&$this, 'admin_menu')); add_action('admin_menu', array(&$this, 'admin_menu'));
add_action('admin_notices', array(&$this, 'admin_notices')); add_action('admin_notices', array(&$this, 'admin_notices'));
@ -178,7 +181,9 @@ class WhatDidTheySayAdmin {
} }
} }
if (is_admin()) {
$this->transcript_count = (int)$wpdb->get_var($wpdb->prepare("SELECT count($wpdb->postmeta.meta_key) FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'approved_transcripts'")); $this->transcript_count = (int)$wpdb->get_var($wpdb->prepare("SELECT count($wpdb->postmeta.meta_key) FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'approved_transcripts'"));
}
} }
/** Widget **/ /** Widget **/
@ -196,6 +201,15 @@ class WhatDidTheySayAdmin {
echo 'WhatDidTheySay.ajax_url = "' . addslashes($_SERVER['REQUEST_URI']) . '";'; echo 'WhatDidTheySay.ajax_url = "' . addslashes($_SERVER['REQUEST_URI']) . '";';
echo 'WhatDidTheySay.nonce = "' . $nonce . '";'; echo 'WhatDidTheySay.nonce = "' . $nonce . '";';
echo '</script>'; echo '</script>';
if (isset($_SESSION['what-did-they-say'])) {
if (isset($_SESSION['what-did-they-say']['updated'])) {
echo '<div class="wdts-updated"><div>' . $_SESSION['what-did-they-say']['updated'] . '</div></div>';
}
}
// clear out our session variable, we only need it briefly
unset($_SESSION['what-did-they-say']);
} }
/** /**
@ -507,6 +521,11 @@ class WhatDidTheySayAdmin {
} }
if (!is_admin()) { if (!is_admin()) {
$_SESSION['what-did-they-say'] = array(
'action' => 'queue-transcript',
'post_id' => $info['post_id'],
'updated' => $updated
);
header('Location: ' . $_SERVER['HTTP_REFERER']); header('Location: ' . $_SERVER['HTTP_REFERER']);
exit(0); exit(0);
} else { } else {

View File

@ -15,6 +15,7 @@
} }
?> ?>
<?php if (current_user_can('submit_transcriptions')) { ?>
<?php if (!empty($transcripts_to_show)) { ?> <?php if (!empty($transcripts_to_show)) { ?>
<h3 style="margin-top: 0.5em"><?php echo $title ?></h3> <h3 style="margin-top: 0.5em"><?php echo $title ?></h3>
<?php <?php
@ -23,7 +24,7 @@
} }
?> ?>
<?php } ?> <?php } ?>
<?php if (current_user_can('submit_transcriptions')) { ?>
<div id="wdts-<?php echo $new_transcript_id ?>" style="zoom:1<?php echo (!$transcript_options->are_new_transcripts_allowed() ? ';display:none' : '') ?>"> <div id="wdts-<?php echo $new_transcript_id ?>" style="zoom:1<?php echo (!$transcript_options->are_new_transcripts_allowed() ? ';display:none' : '') ?>">
<?php wdts_header_wrapper(__('Submit a New Transcript:', 'what-did-they-say')) ?> <?php wdts_header_wrapper(__('Submit a New Transcript:', 'what-did-they-say')) ?>
<form method="post"> <form method="post">

View File

@ -4,8 +4,10 @@
<input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" /> <input type="hidden" name="wdts[_nonce]" value="<?php echo $nonce ?>" />
<?php } ?> <?php } ?>
<?php if (current_user_can('approve_transcriptions')) { ?>
<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"' : '' ?> />
<?php _e('Allow new transcripts to be submitted for this post', 'what-did-they-say') ?> <?php _e('Allow new transcripts to be submitted for this post', 'what-did-they-say') ?>
<?php } ?>
<?php $approved_editor_id = md5(rand()) ?> <?php $approved_editor_id = md5(rand()) ?>
@ -17,6 +19,7 @@
<?php include(dirname(__FILE__) . '/_manage-queued-transcripts.inc') ?> <?php include(dirname(__FILE__) . '/_manage-queued-transcripts.inc') ?>
<?php } ?> <?php } ?>
<?php if (current_user_can('approve_transcriptions')) { ?>
<?php if (is_array($queued_transcripts) && !empty($queued_transcripts)) { ?> <?php if (is_array($queued_transcripts) && !empty($queued_transcripts)) { ?>
<?php wdts_header_wrapper(__('Manage Queued Transcripts:', 'what-did-they-say')) ?> <?php wdts_header_wrapper(__('Manage Queued Transcripts:', 'what-did-they-say')) ?>
<?php <?php
@ -54,6 +57,7 @@
</div> </div>
<div class="wdts-embed-warning"><?php _e('Uh oh...there\'s a problem with automatic embedding. Enable &quot;Inject transcripts at level 100 instead of level 15&quot; on the What Did They Say?!? Misc. Options page.', 'what-did-they-say') ?></div> <div class="wdts-embed-warning"><?php _e('Uh oh...there\'s a problem with automatic embedding. Enable &quot;Inject transcripts at level 100 instead of level 15&quot; on the What Did They Say?!? Misc. Options page.', 'what-did-they-say') ?></div>
</div> </div>
<?php } ?>
<script type="text/javascript"> <script type="text/javascript">
queued_editors_to_attach.each(function(q) { queued_editors_to_attach.each(function(q) {

View File

@ -91,3 +91,20 @@ h3.wdts {
color: #770000; color: #770000;
font-weight: bold; font-weight: bold;
} }
.wdts-updated {
width: 100%;
position: absolute;
background-color: #E4F2FD;
text-align: center;
font-weight: bold;
border-bottom: solid black 1px;
}
.wdts-updated div {
padding: 0.75em;
}
body {
overflow-x: hidden
}

View File

@ -283,7 +283,6 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
var post_id = container.select("input[name*=[post_id]]").shift(); var post_id = container.select("input[name*=[post_id]]").shift();
var key = container.select("input[name*=[key]]").shift(); var key = container.select("input[name*=[key]]").shift();
top.console.log("made it");
var submitter = new Element('button').update('Update Transcript'); var submitter = new Element('button').update('Update Transcript');
submitter.observe('click', function(e) { submitter.observe('click', function(e) {
Event.stop(e); Event.stop(e);
@ -308,8 +307,6 @@ WhatDidTheySay.setup_transcript_action_buttons = function(container, approved_ed
} }
}); });
top.console.log(actions_holder);
container.appendChild(submitter); container.appendChild(submitter);
actions_holder.parentNode.removeChild(actions_holder); actions_holder.parentNode.removeChild(actions_holder);
@ -392,3 +389,21 @@ var WDTSInjector = Class.create({
} }
} }
}); });
Event.observe(window, 'load', function() {
$$('.wdts-updated').each(function(up) {
up.hide();
up.style.top = document.viewport.getScrollOffsets().top + "px";
new Effect.BlindDown(up, {
duration: 0.25,
afterFinish: function() {
new PeriodicalExecuter(function(pe) {
pe.stop();
new Effect.BlindUp(up, {
duration: 0.25
});
}, 3);
}
});
});
});

View File

@ -25,6 +25,7 @@
<tr><td><a href="TestCreatePost.html">TestCreatePost</a></td></tr> <tr><td><a href="TestCreatePost.html">TestCreatePost</a></td></tr>
<tr><td><a href="TestMetaboxApprovedTranscriptEditing.html">TestMetaboxApprovedTranscriptEditing</a></td></tr> <tr><td><a href="TestMetaboxApprovedTranscriptEditing.html">TestMetaboxApprovedTranscriptEditing</a></td></tr>
<tr><td><a href="TestDeletePost.html">TestDeletePost</a></td></tr> <tr><td><a href="TestDeletePost.html">TestDeletePost</a></td></tr>
<tr><td><a href="TestThemeEditorWorks.html">TestThemeEditorWorks</a></td></tr>
<tr><td><a href="TestDeactivate.html">TestDeactivate</a></td></tr> <tr><td><a href="TestDeactivate.html">TestDeactivate</a></td></tr>
</tbody></table> </tbody></table>
</body> </body>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://comicpress.local/" />
<title>TestThemeEditorWorks</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">TestThemeEditorWorks</td></tr>
</thead><tbody>
<tr>
<td>click</td>
<td>link=Editor</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Edit Themes</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -25,12 +25,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
foreach (glob(dirname(__FILE__) . '/classes/*.inc') as $file) { require_once($file); } foreach (glob(dirname(__FILE__) . '/classes/*.inc') 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);
$what_did_they_say_admin->_parent_file = __FILE__; $__what_did_they_say_admin->_parent_file = __FILE__;
add_action('init', array(&$what_did_they_say_admin, 'init')); add_action('init', array(&$__what_did_they_say_admin, 'init'));
// template tags // template tags
// please, if you use any of these, wrap them in function_exists() so your site doesn't // please, if you use any of these, wrap them in function_exists() so your site doesn't
@ -210,11 +210,11 @@ function the_media_transcript_queue_editor() {
<p>JavaScript is required to edit transcripts.</p> <p>JavaScript is required to edit transcripts.</p>
</noscript> </noscript>
<div id="wdts-<?php echo $id ?>" style="display:none"> <div id="wdts-<?php echo $id ?>" style="display:none">
<h3 class="wdts"><?php _e('Manage Transcripts:', 'what-did-they-say') ?></h3>
<?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?> <?php include(dirname(__FILE__) . '/classes/partials/meta-box.inc') ?>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$($('wdts-opener-<?php echo $id ?>').parentNode).show(); $($('wdts-opener-<?php echo $id ?>').parentNode).show();
$('wdts-opener-<?php echo $id ?>').observe('click', function(e) { $('wdts-opener-<?php echo $id ?>').observe('click', function(e) {
Event.stop(e); Event.stop(e);
@ -225,6 +225,17 @@ function the_media_transcript_queue_editor() {
new Effect.BlindDown(target, { duration: 0.25 }); new Effect.BlindDown(target, { duration: 0.25 });
} }
}); });
<?php
if (isset($_SESSION['what-did-they-say'])) {
if (isset($_SESSION['what-did-they-say']['post_id'])) {
if ($post->ID == $_SESSION['what-did-they-say']['post_id']) { ?>
$('wdts-<?php echo $id ?>').show();
$('wdts-<?php echo $id ?>').scrollIntoView();
<?php }
}
}
?>
</script> </script>
<?php } <?php }
} }