From b7cb6599de53e687a08ecd7886177362fa91bece Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 9 Oct 2009 10:58:29 -0400 Subject: [PATCH] more tests, more changes --- classes/WhatDidTheySayAdmin.inc | 28 ++-- classes/partials/_change-languages.inc | 2 +- classes/partials/_default-styles.inc | 2 +- classes/partials/_shortcodes-info.inc | 6 +- classes/partials/admin.inc | 12 +- test/selenium/TestCreatePost.html | 20 +++ test/selenium/TestRenameLanguage.html | 5 + test/selenium/TestResetOptions.html | 5 + what-did-they-say.pot | 191 +++++++++++++++++++------ 9 files changed, 215 insertions(+), 56 deletions(-) diff --git a/classes/WhatDidTheySayAdmin.inc b/classes/WhatDidTheySayAdmin.inc index f1fd71c..c9273e3 100644 --- a/classes/WhatDidTheySayAdmin.inc +++ b/classes/WhatDidTheySayAdmin.inc @@ -54,6 +54,8 @@ class WhatDidTheySayAdmin { * Initialize the object. */ function init() { + global $wpdb; + // set up capabilities $this->capabilities = array( 'submit_transcriptions' => __('Submit transcriptions to a post', 'what-did-they-say'), @@ -108,10 +110,6 @@ class WhatDidTheySayAdmin { } } - if ($reset_filter_value) { - // $options['filters_to_use'] = false; - } - foreach (array( array('the_media_transcript', 2), array('the_language_name', 2), @@ -169,13 +167,19 @@ class WhatDidTheySayAdmin { if (isset($_REQUEST['wdts']['_nonce'])) { if (wp_verify_nonce($_REQUEST['wdts']['_nonce'], 'what-did-they-say')) { + if (($_REQUEST['wdts']['post_id'] <= 0) && ($_POST['post_ID'] > 0)) { + $_REQUEST['wdts']['post_id'] = $_POST['post_ID']; + } + $this->handle_update($_REQUEST['wdts']); if ($this->is_ajax) { exit(0); } } } } - } + + $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 **/ @@ -268,6 +272,12 @@ class WhatDidTheySayAdmin { wp_enqueue_style('wdts-defaults', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-defaults.css'); $this->plugin_data = get_plugin_data($this->_parent_file); + + if ($this->transcript_count == 0) { + $this->notices[] = __('Welcome to What Did They Say?!? To get started, read the Introduction, and then How It Works.', 'what-did-they-say'); + } elseif ($this->transcript_count < 10) { + $this->notices[] = __('Is What Did They Say?!? working out for you? Let John know via email (john@coswellproductions.com) or Twitter (@JohnBintz).', 'what-did-they-say'); + } } wp_enqueue_script('scriptaculous-effects'); @@ -294,7 +304,9 @@ class WhatDidTheySayAdmin { wp_enqueue_script('scriptaculous-effects'); wp_enqueue_script('edit-transcripts', plugin_dir_url(dirname(__FILE__)) . 'js/edit-transcripts.js', array('scriptaculous-effects', 'wdts-script')); - } + + add_action('wp_head', array(&$this, 'include_editor_javascript')); + } } } @@ -831,10 +843,8 @@ class WhatDidTheySayAdmin { $nonce = wp_create_nonce('what-did-they-say'); - $transcript_count = (int)$wpdb->get_var($wpdb->prepare("SELECT count($wpdb->postmeta.meta_key) FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key = 'approved_transcripts'")); - $suggested_amount = 20 + ($transcript_count * 0.1); - $available_filters = $this->_get_available_override_filters(); + $suggested_amount = 20 + ($this->transcript_count * 0.1); include('partials/admin.inc'); } diff --git a/classes/partials/_change-languages.inc b/classes/partials/_change-languages.inc index 5bc4607..b029809 100644 --- a/classes/partials/_change-languages.inc +++ b/classes/partials/_change-languages.inc @@ -61,7 +61,7 @@ - + diff --git a/classes/partials/_shortcodes-info.inc b/classes/partials/_shortcodes-info.inc index 1ca3334..48e5bb6 100644 --- a/classes/partials/_shortcodes-info.inc +++ b/classes/partials/_shortcodes-info.inc @@ -1,9 +1,9 @@ diff --git a/classes/partials/admin.inc b/classes/partials/admin.inc index 0eaa1cd..687cd82 100644 --- a/classes/partials/admin.inc +++ b/classes/partials/admin.inc @@ -45,8 +45,16 @@

- Version is © 2009 . - + ' . __('What Did They Say?!?', 'what-did-they-say') . '', + $Version, + $Author + ); + ?> + transcript_count) ?> | +

diff --git a/test/selenium/TestCreatePost.html b/test/selenium/TestCreatePost.html index 253ae15..ae48adc 100644 --- a/test/selenium/TestCreatePost.html +++ b/test/selenium/TestCreatePost.html @@ -21,6 +21,21 @@ title WDTS Test Post + + type + //textarea[@name="wdts[transcripts][en]"] + This is a test transcript inserted on creation. + + + fireEvent + title + blur + + + pause + 2000 + + clickAndWait publish @@ -31,6 +46,11 @@ Post published. + + assertValue + //textarea[@name="wdts[transcripts][en]"] + This is a test transcript inserted on creation. + storeValue post_ID diff --git a/test/selenium/TestRenameLanguage.html b/test/selenium/TestRenameLanguage.html index b7b02bc..5e2f1e6 100644 --- a/test/selenium/TestRenameLanguage.html +++ b/test/selenium/TestRenameLanguage.html @@ -21,6 +21,11 @@ wdts-tab-change-languages + + pause + 250 + + assertVisible //span[contains(text(), "German")] diff --git a/test/selenium/TestResetOptions.html b/test/selenium/TestResetOptions.html index cb14873..0902c30 100644 --- a/test/selenium/TestResetOptions.html +++ b/test/selenium/TestResetOptions.html @@ -21,6 +21,11 @@ wdts-tab-misc-options + + pause + 250 + + assertTextPresent Reset Settings to Default diff --git a/what-did-they-say.pot b/what-did-they-say.pot index d33d7f0..5de5f22 100644 --- a/what-did-they-say.pot +++ b/what-did-they-say.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: what-did-they-say 0.9\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-10-08 11:44-0400\n" +"POT-Creation-Date: 2009-10-08 21:58-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,11 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: what-did-they-say.php:214 +#: what-did-they-say.php:207 msgid "Edit/Add Transcripts" msgstr "" -#: what-did-they-say.php:220 +#: what-did-they-say.php:213 msgid "Manage Transcripts:" msgstr "" @@ -81,7 +81,7 @@ msgid "Edit Approved Transcripts:" msgstr "" #: classes/partials/meta-box.inc:34 -#: classes/partials/_manage-queued-transcripts.inc:19 +#: classes/partials/_manage-queued-transcripts.inc:36 msgid "Language:" msgstr "" @@ -96,7 +96,7 @@ msgid "" "Say?!? Misc. Options page." msgstr "" -#: classes/partials/_queued-transcript-contents.inc:6 +#: classes/partials/_queued-transcript-contents.inc:7 #, php-format msgid "From %s in %s:" msgstr "" @@ -423,7 +423,7 @@ msgid "" "following Template Tag to your search results Loop:" msgstr "" -#: classes/partials/_introduction.inc:84 classes/partials/admin.inc:5 +#: classes/partials/_introduction.inc:84 classes/partials/admin.inc:6 msgid "Styles" msgstr "" @@ -434,7 +434,7 @@ msgid "" "the %s page." msgstr "" -#: classes/partials/_change-languages.inc:3 classes/partials/admin.inc:6 +#: classes/partials/_change-languages.inc:3 classes/partials/admin.inc:7 msgid "Languages" msgstr "" @@ -479,37 +479,140 @@ msgid "" "You are about to delete this language from the available list. Continue?" msgstr "" -#: classes/partials/admin.inc:4 classes/partials/_capabilities.inc:5 +#: classes/partials/admin.inc:4 classes/partials/_how-it-works.inc:2 +msgid "How It Works" +msgstr "" + +#: classes/partials/admin.inc:5 classes/partials/_capabilities.inc:5 msgid "Capabilities" msgstr "" -#: classes/partials/admin.inc:7 +#: classes/partials/admin.inc:8 msgid "Short Codes Info" msgstr "" -#: classes/partials/admin.inc:8 +#: classes/partials/admin.inc:9 msgid "Misc. Options" msgstr "" -#: classes/partials/admin.inc:14 classes/partials/admin.inc:47 -#: classes/WhatDidTheySayAdmin.inc:249 classes/WhatDidTheySayAdmin.inc:250 +#: classes/partials/admin.inc:15 classes/partials/admin.inc:48 +#: classes/WhatDidTheySayAdmin.inc:258 classes/WhatDidTheySayAdmin.inc:259 msgid "What Did They Say?!?" msgstr "" -#: classes/partials/admin.inc:48 +#: classes/partials/admin.inc:49 #, php-format msgid "Might I suggest a $%1$0.2f donation for your %2$d transcripts?" msgstr "" -#: classes/partials/_manage-queued-transcripts.inc:2 -msgid "Your Submitted Transcripts:" +#: classes/partials/_how-it-works.inc:5 +msgid "" +"What Did They Say?!? uses a wspecial workflow to handle the " +"submission and approval of transcripts." msgstr "" -#: classes/partials/_manage-queued-transcripts.inc:11 +#: classes/partials/_how-it-works.inc:6 +msgid "" +"Below are the typical usage patterns of What Did They Say?!?:" +msgstr "" + +#: classes/partials/_how-it-works.inc:11 +msgid "A single user updating their own transcripts" +msgstr "" + +#: classes/partials/_how-it-works.inc:14 +msgid "" +"If you're the only user of the site, you would edit the Approved " +"transcripts of each post. You don't need to enable transcript " +"submissions for any of your posts." +msgstr "" + +#: classes/partials/_how-it-works.inc:15 classes/partials/_how-it-works.inc:24 +msgid "" +"All users need to have enough permissions to Approve Transcripts." +msgstr "" + +#: classes/partials/_how-it-works.inc:20 +msgid "Multiple users who directly update transcripts on posts" +msgstr "" + +#: classes/partials/_how-it-works.inc:23 +msgid "" +"If you trust the other users on your site, you all would edit the " +"Approved transcripts of each post. Again, you don't need to " +"enable transcript submissions for any of your posts." +msgstr "" + +#: classes/partials/_how-it-works.inc:29 +msgid "" +"Multiple users, some of which submit transcripts and some that approve " +"transcripts" +msgstr "" + +#: classes/partials/_how-it-works.inc:32 +msgid "" +"The users who are allowed to submit transcripts get the Submit " +"Transcripts capability." +msgstr "" + +#: classes/partials/_how-it-works.inc:33 +msgid "" +"The users who aprove transcripts get the Approve Transcripts capability." +msgstr "" + +#: classes/partials/_how-it-works.inc:37 +msgid "" +"For posts where users are allowed to submit transcripts, a user with Approve " +"Transcripts needs to enable Allow new transcripts for this post." +msgstr "" + +#: classes/partials/_how-it-works.inc:41 +msgid "" +"Transcript submitters need to submit transcripts from the post directly, not " +"from the Admin interface." +msgstr "" + +#: classes/partials/_how-it-works.inc:42 +msgid "" +"Transcript submitters submit their transcripts to the queue, making them " +"Queued Transcripts." +msgstr "" + +#: classes/partials/_how-it-works.inc:43 +msgid "" +"Submitters can edit and delete their own transcripts while they're in the " +"queue. Once they're approved, they can no longer be edited by the submitter." +msgstr "" + +#: classes/partials/_how-it-works.inc:47 +msgid "" +"Transcript approvers can approve, edit, or delete queued transcripts of any " +"users." +msgstr "" + +#: classes/partials/_how-it-works.inc:48 +msgid "" +"Once a transcript is approved, it's removed from the queue and made live on " +"the site." +msgstr "" + +#: classes/partials/_manage-queued-transcripts.inc:6 +msgid "All Submitted Transcripts" +msgstr "" + +#: classes/partials/_manage-queued-transcripts.inc:12 +msgid "Your Submitted Transcripts" +msgstr "" + +#: classes/partials/_manage-queued-transcripts.inc:28 msgid "Submit a New Transcript:" msgstr "" -#: classes/partials/_manage-queued-transcripts.inc:30 +#: classes/partials/_manage-queued-transcripts.inc:47 msgid "Submit For Approval" msgstr "" @@ -644,75 +747,83 @@ msgstr "" msgid "Change the available languages" msgstr "" -#: classes/WhatDidTheySayAdmin.inc:273 +#: classes/WhatDidTheySayAdmin.inc:159 +msgid "What Did They Say?!? Transcript" +msgstr "" + +#: classes/WhatDidTheySayAdmin.inc:159 +msgid "Show the transcript for the current post." +msgstr "" + +#: classes/WhatDidTheySayAdmin.inc:282 msgid "Manage Transcripts" msgstr "" -#: classes/WhatDidTheySayAdmin.inc:481 +#: classes/WhatDidTheySayAdmin.inc:490 msgid "Transcript added to queue." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:483 +#: classes/WhatDidTheySayAdmin.inc:492 msgid "Transcript not added to queue." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:554 +#: classes/WhatDidTheySayAdmin.inc:563 msgid "Transcripts updated." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:623 +#: classes/WhatDidTheySayAdmin.inc:632 msgid "Default styles option updated." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:639 +#: classes/WhatDidTheySayAdmin.inc:648 msgid "Insertion level updated." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:657 -#, php-format -msgid "%s deleted." -msgstr "" - -#: classes/WhatDidTheySayAdmin.inc:659 -msgid "Language not deleted!" -msgstr "" - #: classes/WhatDidTheySayAdmin.inc:666 #, php-format -msgid "%s added." +msgid "%s deleted." msgstr "" #: classes/WhatDidTheySayAdmin.inc:668 +msgid "Language not deleted!" +msgstr "" + +#: classes/WhatDidTheySayAdmin.inc:675 +#, php-format +msgid "%s added." +msgstr "" + +#: classes/WhatDidTheySayAdmin.inc:677 msgid "Language not added!" msgstr "" -#: classes/WhatDidTheySayAdmin.inc:674 +#: classes/WhatDidTheySayAdmin.inc:683 #, php-format msgid "%s set as default." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:676 +#: classes/WhatDidTheySayAdmin.inc:685 msgid "Language not set as default!" msgstr "" -#: classes/WhatDidTheySayAdmin.inc:682 +#: classes/WhatDidTheySayAdmin.inc:691 #, php-format msgid "%1$s renamed to %2$s." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:684 +#: classes/WhatDidTheySayAdmin.inc:693 msgid "Language not renamed!" msgstr "" -#: classes/WhatDidTheySayAdmin.inc:707 +#: classes/WhatDidTheySayAdmin.inc:716 msgid "User capabilities updated." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:726 +#: classes/WhatDidTheySayAdmin.inc:735 msgid "What Did They Say?!? options reset." msgstr "" -#: classes/WhatDidTheySayAdmin.inc:745 +#: classes/WhatDidTheySayAdmin.inc:754 msgid "What Did They Say?!? core options changed." msgstr ""