From e992e296851fd049af045d8851f3b46d0fe73a3f Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 12 Apr 2012 08:38:55 +0200 Subject: [PATCH 1/5] 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 6879da285..94851c20b 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 000000000..45813b876 --- /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 8753474af..ebca4875f 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 28fca5362..84171dc8d 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 43c0346bb..bd3d60f0f 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 fc7a56c8a..70895a1f8 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 da1398ab9..890c4ee6c 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 d29341386..e6f2abdc2 100644 --- a/view/settings_oauth_edit.tpl +++ b/view/settings_oauth_edit.tpl @@ -1,5 +1,3 @@ -$tabs -

$title

From 6c50eba206ee4f3e43580ef4a29f24f04760b248 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 12 Apr 2012 08:40:17 +0200 Subject: [PATCH 2/5] quattro: move center css to style.php. add tpl for generic_links_widget --- view/theme/quattro/generic_links_widget.tpl | 11 +++++++++++ view/theme/quattro/style.php | 16 +++++++++++++++- view/theme/quattro/theme.php | 20 -------------------- 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 view/theme/quattro/generic_links_widget.tpl delete mode 100644 view/theme/quattro/theme.php diff --git a/view/theme/quattro/generic_links_widget.tpl b/view/theme/quattro/generic_links_widget.tpl new file mode 100644 index 000000000..29580bbc7 --- /dev/null +++ b/view/theme/quattro/generic_links_widget.tpl @@ -0,0 +1,11 @@ +
+ {{if $title}}

$title

{{endif}} + {{if $desc}}
$desc
{{endif}} + +
    + {{ for $items as $item }} +
  • $item.label
  • + {{ endfor }} +
+ +
diff --git a/view/theme/quattro/style.php b/view/theme/quattro/style.php index 889ec1530..b6104a170 100644 --- a/view/theme/quattro/style.php +++ b/view/theme/quattro/style.php @@ -1,5 +1,9 @@ page['htmlhead'].=" - - "; - -} From 18ecac4e933e96f4ddc8b53ee1291b70c2a99540 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 12 Apr 2012 08:42:00 +0200 Subject: [PATCH 3/5] settings: remove call to profile_load() --- mod/settings.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mod/settings.php b/mod/settings.php index 94851c20b..2dd9fb9a6 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -15,10 +15,6 @@ function get_theme_config_file($theme){ } function settings_init(&$a) { - if(local_user()) { - profile_load($a,$a->user['nickname']); - } - // These lines provide the javascript needed by the acl selector $a->page['htmlhead'] .= "