diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-22 17:49:51 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-10-22 17:49:51 +0200 |
commit | 37043508a48b3dccede2217582031019aabe3442 (patch) | |
tree | f9085d559397a3969e80b0a272567da7660e8ddb /settings | |
parent | b7fa644a546a775c5b4b7c4e35da39df11be1c66 (diff) | |
parent | 479424a4590ce99235fe5741828f90926bda4487 (diff) | |
download | nextcloud-server-37043508a48b3dccede2217582031019aabe3442.tar.gz nextcloud-server-37043508a48b3dccede2217582031019aabe3442.zip |
Merge pull request #11620 from owncloud/settings-sidebar
Settings sidebar
Diffstat (limited to 'settings')
-rw-r--r-- | settings/personal.php | 35 | ||||
-rw-r--r-- | settings/templates/personal.php | 26 |
2 files changed, 55 insertions, 6 deletions
diff --git a/settings/personal.php b/settings/personal.php index e6f53d62704..ecbec887da8 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('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) { + $sectionName = str_replace('<h2>', '', $regs[0]); + $sectionName = str_replace('</h2>', '', $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 871a0ec9e39..cc04de5ec38 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -7,6 +7,20 @@ /** @var $_ array */ ?> +<div id="app-navigation"> + <ul> + <?php foreach($_['forms'] as $form) { + if (isset($form['anchor'])) { + $anchor = '#' . $form['anchor']; + $sectionName = $form['section-name']; + print_unescaped(sprintf("<li><a href='%s'>%s</a></li>", OC_Util::sanitizeHTML($anchor), OC_Util::sanitizeHTML($sectionName))); + } + }?> + </ul> +</div> + +<div id="app-content"> + <div class="clientsbox center"> <h2><?php p($l->t('Get the apps to sync your files'));?></h2> <a href="<?php p($_['clients']['desktop']); ?>" target="_blank"> @@ -150,10 +164,12 @@ if($_['passwordChangeSupported']) { </form> <?php foreach($_['forms'] as $form) { - print_unescaped($form); + if (isset($form['form'])) {?> + <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> + <?php } };?> -<div class="section"> +<div id="ssl-root-certificates" class="section"> <h2><?php p($l->t('SSL root certificates')); ?></h2> <table id="sslCertificate" class="grid"> <thead> @@ -192,7 +208,7 @@ if($_['passwordChangeSupported']) { </div> <?php if($_['enableDecryptAll']): ?> -<div class="section"> +<div id="encryption" class="section"> <h2> <?php p( $l->t( 'Encryption' ) ); ?> @@ -254,3 +270,7 @@ if($_['passwordChangeSupported']) { <div class="section credits-footer"> <p><?php print_unescaped($theme->getShortFooter()); ?></p> </div> + + + +</div> |