settings: move tabs to aside. add a new template "generic_links_widget.tpl"

This commit is contained in:
Fabio Comuni 2012-04-12 08:38:55 +02:00
parent 815a727076
commit e992e29685
8 changed files with 53 additions and 57 deletions

View file

@ -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'),

View file

@ -0,0 +1,11 @@
<div class="widget">
{{if $title}}<h3>$title</h3>{{endif}}
{{if $desc}}<div class="desc">$desc</div>{{endif}}
<ul>
{{ for $items as $item }}
<li class="tool"><a href="$item.url" class="{{ if $item.selected }}selected{{ endif }}">$item.label</a></li>
{{ endfor }}
</ul>
</div>

View file

@ -1,5 +1,3 @@
$tabs
<h1>$ptitle</h1>
$nickname_block

View file

@ -1,5 +1,3 @@
$tabs
<h1>$title</h1>

View file

@ -1,5 +1,3 @@
$tabs
<h1>$title</h1>
<div class="connector_statusmsg">$diasp_enabled</div>

View file

@ -1,5 +1,3 @@
$tabs
<h1>$ptitle</h1>
<form action="settings/display" id="settings-form" method="post" autocomplete="off" >

View file

@ -1,5 +1,3 @@
$tabs
<h1>$title</h1>

View file

@ -1,5 +1,3 @@
$tabs
<h1>$title</h1>
<form method="POST">