From 9c0784ba1c27e9b0d4d584d29471f06edbbce33a Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 22 Sep 2009 22:30:16 -0400 Subject: [PATCH] working on admin area --- classes/WhatDidTheySayAdmin.php | 8 +- classes/_capabilities.inc | 31 ++++ classes/_change-languages.inc | 96 ++++++++++++ classes/_default-styles.inc | 45 ++++++ classes/_misc-options.inc | 19 +++ classes/_shortcodes-info.inc | 34 +++++ classes/admin.inc | 259 +++++++------------------------- 7 files changed, 289 insertions(+), 203 deletions(-) create mode 100644 classes/_capabilities.inc create mode 100644 classes/_change-languages.inc create mode 100644 classes/_default-styles.inc create mode 100644 classes/_misc-options.inc create mode 100644 classes/_shortcodes-info.inc diff --git a/classes/WhatDidTheySayAdmin.php b/classes/WhatDidTheySayAdmin.php index cc00b11..f8c7249 100644 --- a/classes/WhatDidTheySayAdmin.php +++ b/classes/WhatDidTheySayAdmin.php @@ -373,12 +373,13 @@ class WhatDidTheySayAdmin { header('HTTP/1.1 401 Unauthorized'); } - function handle_update_default_styles($info) { + function handle_update_styles($info) { $updated = false; if (current_user_can('edit_themes')) { $options = get_option('what-did-they-say-options'); $options['load_default_styles'] = isset($info['default_styles']); + $options['excerpt_distance'] = !empty($info['excerpt_distance']) ? $info['excerpt_distance'] : 30; update_option('what-did-they-say-options', $options); $updated = __('Default styles option updated.', 'what-did-they-say'); @@ -544,7 +545,10 @@ class WhatDidTheySayAdmin { array(&$this, 'manage_admin') ); - if ($plugin_page == "manage-wdts") { $this->read_language_file(); } + if ($plugin_page == "manage-wdts") { + $this->read_language_file(); + wp_enqueue_style('wdts-admin', plugin_dir_url(dirname(__FILE__)) . 'css/wdts-admin.css'); + } wp_enqueue_script('scriptaculous-effects'); } diff --git a/classes/_capabilities.inc b/classes/_capabilities.inc new file mode 100644 index 0000000..1738ac5 --- /dev/null +++ b/classes/_capabilities.inc @@ -0,0 +1,31 @@ + +
+ + +

+ + + + + + + capabilities as $key => $label) { ?> + + + + + + + + + +
+ +
  + +
+
+ + diff --git a/classes/_change-languages.inc b/classes/_change-languages.inc new file mode 100644 index 0000000..5bc4607 --- /dev/null +++ b/classes/_change-languages.inc @@ -0,0 +1,96 @@ + + +

+ + + + + + + + + $info) { + $default = isset($info['default']); + $name = $info['name']; + ?> + + + + + + + + + + + +
+ + +
+ + + + + + +
+
+ + +
+ + + + + + type="submit" + class="button" + value="" /> +
+
+
+ + + + + +
+
+
+ + + + + +
+
+ + + + diff --git a/classes/_default-styles.inc b/classes/_default-styles.inc new file mode 100644 index 0000000..2712065 --- /dev/null +++ b/classes/_default-styles.inc @@ -0,0 +1,45 @@ + + +

+
+ + + + + + +
+
+

What Did They Say?!?:', 'what-did-they-say') ?>

+
+
.transcript
+
+
.dialog
+
+
.name
+
+
.direction
+
+
.scene-heading
+
+
.scene-action
+
+
+ +

+

<php the_matching_transcript_excerpts() ?>

+

emphasized, and there will be %d additional characters on each side of the word.', 'what-did-they-say'), $options['excerpt_distance']) ?>

+ + diff --git a/classes/_misc-options.inc b/classes/_misc-options.inc new file mode 100644 index 0000000..170dddb --- /dev/null +++ b/classes/_misc-options.inc @@ -0,0 +1,19 @@ + +

+

+
+ + + +
+ + + diff --git a/classes/_shortcodes-info.inc b/classes/_shortcodes-info.inc new file mode 100644 index 0000000..759c78d --- /dev/null +++ b/classes/_shortcodes-info.inc @@ -0,0 +1,34 @@ + +

+

+ + + +

+

+ +
+

+

+ [scene-heading]Ext. The Old Man\'s House[/scene-heading] becomes:', 'what-did-they-say') ?> + +

+ +
+

+

+ [scene-action]John is walking down to the car parked in the driveway.[/scene-action] becomes:', 'what-did-they-say') ?> + +

+ +
+

+

+ [dialog name="John" direction="(towards the house)"]Hey, where are the keys?[/dialog] becomes:', 'what-did-they-say') ?> +

+
+
+
+
+
+ diff --git a/classes/admin.inc b/classes/admin.inc index 51fb294..6c19490 100644 --- a/classes/admin.inc +++ b/classes/admin.inc @@ -1,212 +1,69 @@ + __('Capabilities', 'what-did-they-say'), + 'default-styles' => __('Styles', 'what-did-they-say'), + 'change-languages' => __('Languages', 'what-did-they-say'), + 'misc-options' => __('Misc. Options', 'what-did-they-say'), + 'shortcodes-info' => __('Shortcodes Info', 'what-did-they-say') + ); +?>
-

- - -

-

- - - -

-

-
-

-

- [scene-heading]Ext. The Old Man\'s House[/scene-heading] becomes:', 'what-did-they-say') ?> - -

- -
-

-

- [scene-action]John is walking down to the car parked in the driveway.[/scene-action] becomes:', 'what-did-they-say') ?> - -

+

-
-

-

- [dialog name="John" direction="(towards the house)"]Hey, where are the keys?[/dialog] becomes:', 'what-did-they-say') ?> -

-
-
-
-
-
- - - -
- - -

- - - - - - - capabilities as $key => $label) { ?> - - - - - - - - - -
- -
  - -
-
- +
+ $title) { ?> +
- - -

-
- - - - -
-

- +
+ $title) { ?> + - - - - -

- - - - - - - - - $info) { - $default = isset($info['default']); - $name = $info['name']; - ?> - - - - - - - - - - - -
- - -
- - - - - - -
-
- - -
- - - - - - type="submit" - class="button" - value="" /> -
-
-
- - - - - -
-
-
- - - - - -
-
- - - - -

Miscellaneous Options

- -

-

-
- - - -
- +
+ $$('.wdts-tab').each(function(tab) { + tab.observe('click', function(e) { + Event.stop(e); + make_active(tab); + }); + }); + + $$('.wdts-page').each(function(page) { + page.select('form').each(function(form) { + var return_page = new Element("input", { type: 'hidden', name: 'wdts[return_page]', value: page.id }); + form.insert(return_page); + }); + }); + + + make_active($('')); + + make_active($$('.wdts-tab')[0]); + + \ No newline at end of file