From e992e296851fd049af045d8851f3b46d0fe73a3f Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 12 Apr 2012 08:38:55 +0200 Subject: [PATCH] settings: move tabs to aside. add a new template "generic_links_widget.tpl" --- mod/settings.php | 87 +++++++++++++++++------------------ view/generic_links_widget.tpl | 11 +++++ view/settings.tpl | 2 - view/settings_addons.tpl | 2 - view/settings_connectors.tpl | 2 - view/settings_display.tpl | 2 - view/settings_oauth.tpl | 2 - view/settings_oauth_edit.tpl | 2 - 8 files changed, 53 insertions(+), 57 deletions(-) create mode 100644 view/generic_links_widget.tpl diff --git a/mod/settings.php b/mod/settings.php index 6879da285f..94851c20bb 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -47,6 +47,47 @@ function settings_init(&$a) { EOT; + + $tabs = array( + array( + 'label' => t('Account settings'), + 'url' => $a->get_baseurl(true).'/settings', + 'selected' => (($a->argc == 1)?'active':''), + ), + array( + 'label' => t('Display settings'), + 'url' => $a->get_baseurl(true).'/settings/display', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), + ), + + array( + 'label' => t('Connector settings'), + 'url' => $a->get_baseurl(true).'/settings/connectors', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), + ), + array( + 'label' => t('Plugin settings'), + 'url' => $a->get_baseurl(true).'/settings/addon', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), + ), + array( + 'label' => t('Connected apps'), + 'url' => $a->get_baseurl(true) . '/settings/oauth', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), + ), + array( + 'label' => t('Export personal data'), + 'url' => $a->get_baseurl(true) . '/uexport', + 'selected' => '' + ) + ); + + $tabtpl = get_markup_template("generic_links_widget.tpl"); + $a->page['aside'] = replace_macros($tabtpl, array( + '$title' => t('Settings'), + '$items' => $tabs, + )); + } @@ -479,44 +520,7 @@ function settings_content(&$a) { return; } - $tabs = array( - array( - 'label' => t('Account settings'), - 'url' => $a->get_baseurl(true).'/settings', - 'sel' => (($a->argc == 1)?'active':''), - ), - array( - 'label' => t('Display settings'), - 'url' => $a->get_baseurl(true).'/settings/display', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), - ), - - array( - 'label' => t('Connector settings'), - 'url' => $a->get_baseurl(true).'/settings/connectors', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), - ), - array( - 'label' => t('Plugin settings'), - 'url' => $a->get_baseurl(true).'/settings/addon', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), - ), - array( - 'label' => t('Connections'), - 'url' => $a->get_baseurl(true) . '/settings/oauth', - 'sel' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), - ), - array( - 'label' => t('Export personal data'), - 'url' => $a->get_baseurl(true) . '/uexport', - 'sel' => '' - ) - ); - - $tabtpl = get_markup_template("common_tabs.tpl"); - $tabs = replace_macros($tabtpl, array( - '$tabs' => $tabs, - )); + if(($a->argc > 1) && ($a->argv[1] === 'oauth')) { @@ -524,7 +528,6 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_oauth_edit.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), - '$tabs' => $tabs, '$title' => t('Add application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), @@ -551,7 +554,6 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_oauth_edit.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), - '$tabs' => $tabs, '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), @@ -594,7 +596,6 @@ function settings_content(&$a) { '$consumerkey' => t('Client key starts with'), '$noname' => t('No name'), '$remove' => t('Remove authorization'), - '$tabs' => $tabs, '$apps' => $r, )); return $o; @@ -614,7 +615,6 @@ function settings_content(&$a) { $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_addon"), '$title' => t('Plugin Settings'), - '$tabs' => $tabs, '$settings_addons' => $settings_addons )); return $o; @@ -658,7 +658,6 @@ function settings_content(&$a) { '$form_security_token' => get_form_security_token("settings_connectors"), '$title' => t('Connector Settings'), - '$tabs' => $tabs, '$diasp_enabled' => $diasp_enabled, '$ostat_enabled' => $ostat_enabled, @@ -735,7 +734,6 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_display.tpl"); $o = replace_macros($tpl, array( - '$tabs' => $tabs, '$ptitle' => t('Display Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), @@ -920,7 +918,6 @@ function settings_content(&$a) { ); $o .= replace_macros($stpl,array( - '$tabs' => $tabs, '$ptitle' => t('Account Settings'), '$submit' => t('Submit'), diff --git a/view/generic_links_widget.tpl b/view/generic_links_widget.tpl new file mode 100644 index 0000000000..45813b876a --- /dev/null +++ b/view/generic_links_widget.tpl @@ -0,0 +1,11 @@ +
+ {{if $title}}

$title

{{endif}} + {{if $desc}}
$desc
{{endif}} + + + +
diff --git a/view/settings.tpl b/view/settings.tpl index 8753474afa..ebca4875f0 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -1,5 +1,3 @@ -$tabs -

$ptitle

$nickname_block diff --git a/view/settings_addons.tpl b/view/settings_addons.tpl index 28fca53620..84171dc8db 100644 --- a/view/settings_addons.tpl +++ b/view/settings_addons.tpl @@ -1,5 +1,3 @@ -$tabs -

$title

diff --git a/view/settings_connectors.tpl b/view/settings_connectors.tpl index 43c0346bba..bd3d60f0f4 100644 --- a/view/settings_connectors.tpl +++ b/view/settings_connectors.tpl @@ -1,5 +1,3 @@ -$tabs -

$title

$diasp_enabled
diff --git a/view/settings_display.tpl b/view/settings_display.tpl index fc7a56c8ac..70895a1f89 100644 --- a/view/settings_display.tpl +++ b/view/settings_display.tpl @@ -1,5 +1,3 @@ -$tabs -

$ptitle

diff --git a/view/settings_oauth.tpl b/view/settings_oauth.tpl index da1398ab96..890c4ee6c8 100644 --- a/view/settings_oauth.tpl +++ b/view/settings_oauth.tpl @@ -1,5 +1,3 @@ -$tabs -

$title

diff --git a/view/settings_oauth_edit.tpl b/view/settings_oauth_edit.tpl index d293413867..e6f2abdc24 100644 --- a/view/settings_oauth_edit.tpl +++ b/view/settings_oauth_edit.tpl @@ -1,5 +1,3 @@ -$tabs -

$title

-- 2.39.5