From 4812249467ca69942b87582290259a6f68b4e629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beausoleil?= Date: Mon, 7 Jun 2010 09:20:14 -0700 Subject: [PATCH] Hid the pre/middle/post options behind an advanced checkbox. --- adgear-ad-manager.php | 34 +++++++++++++++++++++++++++++--- adgear-ad-manager/adgear-meta.js | 22 +++++++++++++++++++++ adgear-ad-manager/admin.php | 13 +++++++++--- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/adgear-ad-manager.php b/adgear-ad-manager.php index 6ad1d81..e81560c 100644 --- a/adgear-ad-manager.php +++ b/adgear-ad-manager.php @@ -273,6 +273,24 @@ function adgear_path_type_selector_ui($args) { '; +} + +function adgear_example_ui($args) { + if ( $args[ 'selected' ] ) { + $style = ""; + } else { + $style = "display:none"; + } + + echo '
Write manual paths (before, middle, after and manual path) using no quotes and separate segments using commas, like this: advanced, tutorial.
'; +} + function adgear_path_pre_ui($args) { extract($args); ?> @@ -383,12 +401,18 @@ function form($instance) { } else { $path_pre = $path_middle = $path_post = ""; } + + if ( $path_pre == "" && $path_middle == "" && $path_post == "" ) { + $show_advanced = false; + } else { + $show_advanced = true; + } ?>

$this->get_field_id('format_id'), 'name' => $this->get_field_name('format_id'), 'selected' => $format_id, 'include_blank' => true )); ?>

-

+

"> $this->get_field_id('path_pre'), 'name' => $this->get_field_name('path_pre'), 'value' => $path_pre ) ); ?>

@@ -396,7 +420,7 @@ function form($instance) { $this->get_field_id('path_type'), 'name' => $this->get_field_name('path_type'), 'selected' => $path_type, 'path_id' => $this->get_field_id('path'), 'path_name' => $this->get_field_name('path'), 'path_selected' => $path )); ?>

-

+

"> $this->get_field_id('path_middle'), 'name' => $this->get_field_name('path_middle'), 'value' => $path_middle ) ); ?>

@@ -404,10 +428,14 @@ function form($instance) { $this->get_field_id('slugify'), 'name' => $this->get_field_name('slugify'), 'selected' => $slugify )); ?>

-

+

"> $this->get_field_id('path_post'), 'name' => $this->get_field_name('path_post'), 'value' => $path_post ) ); ?>

+

+ + $show_advanced ) ); ?> +

'adgear_format_id', 'name' => 'adgear[format_id]', 'selected' => '', 'include_blank' => true )); ?> - + 'adgear_path_pre', 'name' => 'adgear[path_pre]', 'value' => '' ) ); ?> @@ -208,7 +208,7 @@ function adgear_meta_box_form() { 'adgear_type', 'name' => 'adgear[type]', 'selected' => 'categories', 'path_id' => 'adgear_path', 'path_name' => 'adgear[path]', 'path_selected' => '' ) ); ?> - + 'adgear_path_middle', 'name' => 'adgear[path_middle]', 'value' => '' ) ); ?> @@ -220,12 +220,19 @@ function adgear_meta_box_form() { 'adgear_slugify', 'name' => 'adgear[slugify]', 'selected' => 'yes') ); ?> - + 'adgear_path_post', 'name' => 'adgear[path_post]', 'value' => '' ) ); ?> + + + + false ) ); ?> + false ) ); ?> + +