implement sidebar fro personal settings - bad kung-fu

This commit is contained in:
Thomas Müller 2014-10-16 18:01:48 +02:00 committed by Lukas Reschke
parent 4611520c7f
commit 04323fbc19
3 changed files with 47 additions and 11 deletions

View File

@ -479,7 +479,7 @@ button.loading {
border-top: 1px solid #ddd; border-top: 1px solid #ddd;
} }
/* no top border for first settings item */ /* no top border for first settings item */
.section:first-child { #app-content > .section:first-child {
border-top: none; border-top: none;
} }
.section h2 { .section h2 {

View File

@ -101,9 +101,38 @@ $tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
$tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser())); $tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser()));
$tmpl->assign('certs', $certificateManager->listCertificates()); $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'); $forms=OC_App::getForms('personal');
$tmpl->assign('forms', array());
foreach($forms as $form) { $formsMap = array_map(function($form){
$tmpl->append('forms', $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(); $tmpl->printPage();

View File

@ -8,10 +8,15 @@
?> ?>
<div id="app-navigation"> <div id="app-navigation">
<!-- <?php foreach($_['forms'] as $form) { <ul>
print_unescaped($form); <?php foreach($_['forms'] as $form) {
};?> if (isset($form['anchor'])) {
--> $anchor = '#' . $form['anchor'];
$sectionName = $form['section-name'];
print_unescaped("<li><a href='$anchor'>$sectionName</a></li>");
}
}?>
</ul>
</div> </div>
<div id="app-content"> <div id="app-content">
@ -159,10 +164,12 @@ if($_['passwordChangeSupported']) {
</form> </form>
<?php foreach($_['forms'] as $form) { <?php foreach($_['forms'] as $form) {
print_unescaped($form); if (isset($form['form'])) {?>
<div id="<?php isset($form['anchor']) ? print_unescaped($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> <h2><?php p($l->t('SSL root certificates')); ?></h2>
<table id="sslCertificate" class="grid"> <table id="sslCertificate" class="grid">
<thead> <thead>
@ -201,7 +208,7 @@ if($_['passwordChangeSupported']) {
</div> </div>
<?php if($_['enableDecryptAll']): ?> <?php if($_['enableDecryptAll']): ?>
<div class="section"> <div id="encryption" class="section">
<h2> <h2>
<?php p( $l->t( 'Encryption' ) ); ?> <?php p( $l->t( 'Encryption' ) ); ?>