From c09cff5056c5693bd3fbcd51df710e0b953a00f2 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 15 Aug 2009 16:45:08 -0400 Subject: [PATCH] working on metabox --- classes/WhatDidTheySay.php | 4 ++++ classes/WhatDidTheySayAdmin.php | 14 ++++++-------- classes/meta-box.inc | 25 +++++++++++++++++++++++++ test/WhatDidTheySayAdminTest.php | 8 ++++---- 4 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 classes/meta-box.inc diff --git a/classes/WhatDidTheySay.php b/classes/WhatDidTheySay.php index 7c7acbb..4fab6dd 100644 --- a/classes/WhatDidTheySay.php +++ b/classes/WhatDidTheySay.php @@ -51,6 +51,10 @@ class WhatDidTheySay { return false; } } + + function get_transcripts($post_id) { + return get_post_meta($post_id, 'provided_transcripts', true); + } /** * Get the languages that the approved transcripts for the post are written in. diff --git a/classes/WhatDidTheySayAdmin.php b/classes/WhatDidTheySayAdmin.php index f817ee2..a7880b8 100644 --- a/classes/WhatDidTheySayAdmin.php +++ b/classes/WhatDidTheySayAdmin.php @@ -24,13 +24,12 @@ class WhatDidTheySayAdmin { var $all_languages = array(); var $notices = array(); - function WhatDidTheySayAdmin() { + function WhatDidTheySayAdmin($what_did_they_say = null) { + $this->what_did_they_say = $what_did_they_say; $this->language_file = dirname(__FILE__) . '/../data/lsr-language.txt'; } - function init($what_did_they_say) { - $this->what_did_they_say = $what_did_they_say; - + function init() { $this->capabilities = array( 'submit_transcriptions' => __('Submit transcriptions to a post', 'what-did-they-say'), 'approve_transcriptions' => __('Approve transcriptions to a post', 'what-did-they-say'), @@ -241,9 +240,7 @@ class WhatDidTheySayAdmin { function manage_admin() { $options = get_option('what-did-they-say-options'); - $nonce = wp_create_nonce('what-did-they-say'); - include(dirname(__FILE__) . '/admin.inc'); } @@ -251,8 +248,9 @@ class WhatDidTheySayAdmin { global $post; $options = get_option('what-did-they-say-options'); - - var_dump($post->ID); + $transcripts = $this->what_did_they_say->get_transcripts($post->ID); + $nonce = wp_create_nonce('what-did-they-say'); + include(dirname(__FILE__) . '/meta-box.inc'); } } diff --git a/classes/meta-box.inc b/classes/meta-box.inc new file mode 100644 index 0000000..ae3d196 --- /dev/null +++ b/classes/meta-box.inc @@ -0,0 +1,25 @@ + + +

+ + + + + +

+ \ No newline at end of file diff --git a/test/WhatDidTheySayAdminTest.php b/test/WhatDidTheySayAdminTest.php index b9d655f..a7ffa5d 100644 --- a/test/WhatDidTheySayAdminTest.php +++ b/test/WhatDidTheySayAdminTest.php @@ -103,16 +103,16 @@ class WhatDidTheySayAdminTest extends PHPUnit_Framework_TestCase { $admin->handle_update_capabilities(array( 'action' => 'capabilities', 'capabilities' => array( - 'submit_transcription' => 'contributor', - 'approve_transcription' => 'subscriber', + 'submit_transcriptions' => 'contributor', + 'approve_transcriptions' => 'subscriber', 'change_languages' => 'reader' ) )); $result = get_option('what-did-they-say-options'); $this->assertEquals(array( - 'submit_transcription' => 'contributor', - 'approve_transcription' => 'subscriber', + 'submit_transcriptions' => 'contributor', + 'approve_transcriptions' => 'subscriber', 'change_languages' => 'reader' ), $result['capabilities']); }