From 762bb8de795f8bb455da969d287397b2fa6a2f82 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 30 Jun 2011 17:00:26 +0200 Subject: [PATCH] update oembed and widgets plugins settings form --- addon/oembed/oembed.php | 28 +++++++++--------------- addon/oembed/settings.tpl | 7 ++++++ addon/widgets/settings.tpl | 19 ++++++++++++++++ addon/widgets/widgets.php | 36 +++++++++++++++---------------- view/theme/duepuntozero/style.css | 14 ++++++++++-- 5 files changed, 65 insertions(+), 39 deletions(-) create mode 100644 addon/oembed/settings.tpl create mode 100644 addon/widgets/settings.tpl diff --git a/addon/oembed/oembed.php b/addon/oembed/oembed.php index 7e677fd6f..880e4992f 100644 --- a/addon/oembed/oembed.php +++ b/addon/oembed/oembed.php @@ -25,9 +25,9 @@ function oembed_uninstall() { function oembed_settings_post($a,$b){ if(! local_user()) return; - if (isset($_POST['oembed-submit'])){ - set_pconfig(local_user(), 'oembed', 'use_for_youtube', (isset($_POST['oembed_use_for_youtube'])? intval($_POST['oembed_use_for_youtube']):0)); - notice( t('OEmbed settings updated') . EOL); + if (x($_POST,'oembed-submit')){ + set_pconfig(local_user(), 'oembed', 'use_for_youtube', (x($_POST,'oembed_use_for_youtube')? intval($_POST['oembed_use_for_youtube']):0)); + info( t('OEmbed settings updated') . EOL); } } @@ -36,21 +36,13 @@ function oembed_settings(&$a,&$o) { return; $uofy = intval(get_pconfig(local_user(), 'oembed', 'use_for_youtube' )); - $o.=' -
-

OEmbed

-
- -
-
-
- -
-
'; + $t = file_get_contents( dirname(__file__). "/settings.tpl" ); + $o .= replace_macros($t, array( + '$submit' => t('Submit'), + '$title' => "OEmbed", + '$useoembed' => array('oembed_use_for_youtube', t('Use OEmbed for YouTube videos'), $uofy, ""), + )); + } diff --git a/addon/oembed/settings.tpl b/addon/oembed/settings.tpl new file mode 100644 index 000000000..5a65ef8e5 --- /dev/null +++ b/addon/oembed/settings.tpl @@ -0,0 +1,7 @@ +
+

$title

+ {{ inc field_checkbox.tpl with $field=$useoembed }}{{ endinc }} +
+ +
+
diff --git a/addon/widgets/settings.tpl b/addon/widgets/settings.tpl new file mode 100644 index 000000000..9d0f21d29 --- /dev/null +++ b/addon/widgets/settings.tpl @@ -0,0 +1,19 @@ +
+

$title

+
+ + $key +
+ +
+ +
+ +

$widgets_h

+ + +
diff --git a/addon/widgets/widgets.php b/addon/widgets/widgets.php index f5f868222..13c4f93bb 100644 --- a/addon/widgets/widgets.php +++ b/addon/widgets/widgets.php @@ -33,34 +33,32 @@ function widgets_settings(&$a,&$o) { $key = get_pconfig(local_user(), 'widgets', 'key' ); if ($key=='') { $key = mt_rand(); set_pconfig(local_user(), 'widgets', 'key', $key); } - - $o .='

Widgets

'; - - - $o.=' -
- '. t('Widgets key: ') .''.$key.' -
-
-
- -
'; - - - $o.='

Widgets:

'; - $o .= ''; - + + + $t = file_get_contents( dirname(__file__). "/settings.tpl" ); + $o .= replace_macros($t, array( + '$submit' => t('Generate new key'), + '$baseurl' => $a->get_baseurl(), + '$title' => "Widgets", + '$label' => t('Widgets key'), + '$key' => $key, + '$widgets_h' => t('Widgets available'), + '$widgets' => $widgets, + )); + } function widgets_module() { diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index dc54398dc..67a1546ee 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2541,6 +2541,15 @@ a.mail-list-link { filter:alpha(opacity=100); } +/** + * Plugins settings + */ + +.settings-block > h3, +.settings-heading { + border-bottom: 1px solid #babdb6 +} + /** * Form fields @@ -2554,7 +2563,6 @@ a.mail-list-link { .field label { float: left; width: 200px; - font-weight: bold; } .field input, @@ -2599,7 +2607,9 @@ a.mail-list-link { #adminpage h3 { border-bottom: 1px solid #cccccc; } - +#adminpage .field label { + font-weight: bold; +} #adminpage .submit { clear:left; text-align: right;