From 04323fbc19524926973550cc2aa0ab0331a4ca0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 16 Oct 2014 18:01:48 +0200 Subject: [PATCH] implement sidebar fro personal settings - bad kung-fu --- core/css/apps.css | 2 +- settings/personal.php | 35 ++++++++++++++++++++++++++++++--- settings/templates/personal.php | 21 +++++++++++++------- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/core/css/apps.css b/core/css/apps.css index 35487bee59..898259ed9d 100644 --- a/core/css/apps.css +++ b/core/css/apps.css @@ -479,7 +479,7 @@ button.loading { border-top: 1px solid #ddd; } /* no top border for first settings item */ -.section:first-child { +#app-content > .section:first-child { border-top: none; } .section h2 { diff --git a/settings/personal.php b/settings/personal.php index e6f53d6270..ecbec887da 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -101,9 +101,38 @@ $tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true)); $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser())); $tmpl->assign('certs', $certificateManager->listCertificates()); +// add hardcoded forms from the template +$l = OC_L10N::get('settings'); +$formsAndMore = array(); +$formsAndMore[]= array( 'anchor' => 'passwordform', 'section-name' => $l->t('Personal Info') ); + $forms=OC_App::getForms('personal'); -$tmpl->assign('forms', array()); -foreach($forms as $form) { - $tmpl->append('forms', $form); + +$formsMap = array_map(function($form){ + if (preg_match('%(]*>.*?)%i', $form, $regs)) { + $sectionName = str_replace('

', '', $regs[0]); + $sectionName = str_replace('

', '', $sectionName); + $anchor = strtolower($sectionName); + $anchor = str_replace(' ', '-', $anchor); + + return array( + 'anchor' => $anchor, + 'section-name' => $sectionName, + 'form' => $form + ); + } + return array( + 'form' => $form + ); +}, $forms); + +$formsAndMore = array_merge($formsAndMore, $formsMap); + +// add bottom hardcoded forms from the template +$formsAndMore[]= array( 'anchor' => 'ssl-root-certificates', 'section-name' => $l->t('SSL root certificates') ); +if($enableDecryptAll) { + $formsAndMore[]= array( 'anchor' => 'encryption', 'section-name' => $l->t('Encryption') ); } + +$tmpl->assign('forms', $formsAndMore); $tmpl->printPage(); diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 86f2c28319..b3a26acdb6 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -8,10 +8,15 @@ ?>
- +
@@ -159,10 +164,12 @@ if($_['passwordChangeSupported']) { + + -
+

t('SSL root certificates')); ?>

@@ -201,7 +208,7 @@ if($_['passwordChangeSupported']) { -
+

t( 'Encryption' ) ); ?>