Skip to content

Commit 755c519

Browse files
authored
Merge pull request nextcloud#16 from nextcloud/improve-design
Replace tab based design with a scrollable design
2 parents 1abff70 + 96708c6 commit 755c519

File tree

3 files changed

+115
-41
lines changed

3 files changed

+115
-41
lines changed

css/admin.css

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
#user-saml input[type="text"],textarea {
2+
max-width: 600px;
23
width: 100%;
34
}
45

5-
#user-saml input.required {
6-
background-color: lightgoldenrodyellow;
7-
}
8-
96
#user-saml input[type="checkbox"] {
107
vertical-align:middle;
8+
}
9+
10+
#user-saml h4 {
11+
font-size: 14px;
12+
font-weight: 300;
13+
margin: 12px 0;
14+
}
15+
16+
#user-saml-settings > div {
17+
margin-bottom: 10px;
18+
}
19+
20+
.indent {
21+
padding-left: 14px;
22+
}
23+
24+
#user-saml-settings .toggle {
25+
clear: both;
26+
padding: 7px 0;
27+
cursor: pointer;
28+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
29+
opacity: .5;
1130
}

js/admin.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function setSAMLConfigValue(category, setting, value) {
66

77
$(function() {
88
// Enable tabs
9-
$('#user-saml-settings').tabs();
109
$('input:checkbox[value="1"]').attr('checked', true);
1110

1211
$('#user-saml-sp input[type="text"], #user-saml-sp textarea').change(function(e) {
@@ -70,4 +69,36 @@ $(function() {
7069
setSAMLConfigValue('security', key, $(this).val());
7170
});
7271
});
72+
73+
$('#user-saml-settings .toggle').on('click', function() {
74+
var el = $(this),
75+
nextSibling = el.parent().next(),
76+
parentSettingId = el.closest('div').attr('id'),
77+
text = '';
78+
switch(parentSettingId) {
79+
case 'user-saml-security':
80+
if (nextSibling.hasClass('hidden')) {
81+
text = 'Hide security settings ...';
82+
} else {
83+
text = 'Show security settings ...';
84+
}
85+
break;
86+
case 'user-saml-idp':
87+
if (nextSibling.hasClass('hidden')) {
88+
text = 'Hide optional Identity Provider settings ...';
89+
} else {
90+
text = 'Show optional Identity Provider settings ...';
91+
}
92+
break;
93+
case 'user-saml-sp':
94+
if (nextSibling.hasClass('hidden')) {
95+
text = 'Hide Service Provider settings ...';
96+
} else {
97+
text = 'Show Service Provider settings ...';
98+
}
99+
break;
100+
}
101+
el.html(t('user_saml', text));
102+
nextSibling.toggleClass('hidden');
103+
});
73104
});

templates/admin.php

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,75 @@
99
<div id="user-saml-save-indicator" class="msg success inlineblock" style="display: none;">Saved</div>
1010

1111
<div id="user-saml-settings">
12-
<ul>
13-
<li><a href="#user-saml-sp"><?php p($l->t('Service Provider Data')) ?></a></li>
14-
<li><a href="#user-saml-idp"><?php p($l->t('Identity Provider Data')) ?></a></li>
15-
<li><a href="#user-saml-security"><?php p($l->t('Security settings')) ?></a></li>
16-
<li><a href="#user-saml-general"><?php p($l->t('General')) ?></a></li>
17-
</ul>
18-
<div id="user-saml-sp">
19-
<p><?php print_unescaped($l->t('If your Service Provider should use certificates you can optionally specify them here.')) ?></p>
20-
<?php foreach($_['sp'] as $key => $text): ?>
21-
<textarea name="<?php p($key) ?>" placeholder="<?php p($text) ?>"><?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'sp-'.$key, '')) ?></textarea>
22-
<?php endforeach; ?>
23-
</div>
24-
<div id="user-saml-idp">
25-
<p><?php print_unescaped($l->t('Configure your IdP settings here, all yellow input fields are required, others optional.')) ?></p>
26-
<input name="entityId" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-entityId', '')) ?>" type="text" class="required" placeholder="<?php p($l->t('Identifier of the IdP entity (must be a URI)')) ?>"/>
27-
<input name="singleSignOnService.url" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-singleSignOnService.url', '')) ?>" type="text" class="required" placeholder="<?php p($l->t('URL Target of the IdP where the SP will send the Authentication Request Message')) ?>"/>
28-
<input name="singleLogoutService.url" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-singleLogoutService.url', '')) ?>" type="text" placeholder="<?php p($l->t('URL Location of the IdP where the SP will send the SLO Request')) ?>"/>
29-
<textarea name="x509cert" placeholder="<?php p($l->t('Public X.509 certificate of the IdP')) ?>"><?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-x509cert', '')) ?></textarea>
30-
</div>
31-
<div id="user-saml-security">
32-
<p><?php print_unescaped($l->t('For increased security we recommend enabling the following settings if supported by your environment.')) ?></p>
33-
34-
<h3><?php p($l->t('Signatures and encryption offered')) ?></h3>
35-
<?php foreach($_['security-offer'] as $key => $text): ?>
36-
<input type="checkbox" id="user-saml-<?php p($key)?>" name="<?php p($key)?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'security-'.$key, '0')) ?>">
37-
<label for="user-saml-<?php p($key)?>"><?php p($text) ?></label><br/>
38-
<?php endforeach; ?>
39-
<h3><?php p($l->t('Signatures and encryption required')) ?></h3>
40-
<?php foreach($_['security-required'] as $key => $text): ?>
41-
<input type="checkbox" id="user-saml-<?php p($key)?>" name="<?php p($key)?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'security-'.$key, '0')) ?>">
42-
<label for="user-saml-<?php p($key)?>"><?php p($text) ?></label><br/>
43-
<?php endforeach; ?>
44-
</div>
4512
<div id="user-saml-general">
13+
<h3><?php p($l->t('General')) ?></h3>
4614
<?php foreach($_['general'] as $key => $attribute): ?>
4715
<?php if($attribute['type'] === 'checkbox'): ?>
48-
<input type="checkbox" id="user-saml-general-<?php p($key)?>" name="<?php p($key)?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'general-'.$key, '0')) ?>">
49-
<label for="user-saml-general-<?php p($key)?>"><?php p($attribute['text']) ?></label><br/>
16+
<p>
17+
<input type="checkbox" id="user-saml-general-<?php p($key)?>" name="<?php p($key)?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'general-'.$key, '0')) ?>">
18+
<label for="user-saml-general-<?php p($key)?>"><?php p($attribute['text']) ?></label><br/>
19+
</p>
5020
<?php elseif($attribute['type'] === 'line'): ?>
51-
<input name="<?php p($key) ?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'general-'.$key, '')) ?>" type="text" <?php if(isset($attribute['required']) && $attribute['required'] === true): ?>class="required"<?php endif;?> placeholder="<?php p($attribute['text']) ?>"/>
21+
<p>
22+
<input name="<?php p($key) ?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'general-'.$key, '')) ?>" type="text" <?php if(isset($attribute['required']) && $attribute['required'] === true): ?>class="required"<?php endif;?> placeholder="<?php p($attribute['text']) ?>"/>
23+
</p>
5224
<?php endif; ?>
5325
<?php endforeach; ?>
5426

5527
<!-- FIXME: Add "Disable timeout from SAML" switch (checked by default)-->
5628
</div>
29+
<div id="user-saml-sp">
30+
<h3><?php p($l->t('Service Provider Data')) ?></h3>
31+
<p>
32+
<?php print_unescaped($l->t('If your Service Provider should use certificates you can optionally specify them here.')) ?>
33+
<span class="toggle"><?php p($l->t('Show Service Provider settings ...')) ?></span>
34+
</p>
35+
36+
<div class="hidden">
37+
<?php foreach($_['sp'] as $key => $text): ?>
38+
<p>
39+
<textarea name="<?php p($key) ?>" placeholder="<?php p($text) ?>"><?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'sp-'.$key, '')) ?></textarea>
40+
</p>
41+
<?php endforeach; ?>
42+
</div>
43+
</div>
44+
<div id="user-saml-idp">
45+
<h3><?php p($l->t('Identity Provider Data')) ?></h3>
46+
<p>
47+
<?php print_unescaped($l->t('Configure your IdP settings here.')) ?>
48+
</p>
49+
50+
<p><input name="entityId" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-entityId', '')) ?>" type="text" class="required" placeholder="<?php p($l->t('Identifier of the IdP entity (must be a URI)')) ?>"/></p>
51+
<p><input name="singleSignOnService.url" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-singleSignOnService.url', '')) ?>" type="text" class="required" placeholder="<?php p($l->t('URL Target of the IdP where the SP will send the Authentication Request Message')) ?>"/></p>
52+
<p><span class="toggle"><?php p($l->t('Show optional Identity Provider settings ...')) ?></span></p>
53+
<div class="hidden">
54+
<p><input name="singleLogoutService.url" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-singleLogoutService.url', '')) ?>" type="text" placeholder="<?php p($l->t('URL Location of the IdP where the SP will send the SLO Request')) ?>"/></p>
55+
<p><textarea name="x509cert" placeholder="<?php p($l->t('Public X.509 certificate of the IdP')) ?>"><?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'idp-x509cert', '')) ?></textarea></p>
56+
</div>
57+
</div>
58+
<div id="user-saml-security">
59+
<h3><?php p($l->t('Security settings')) ?></h3>
60+
<p>
61+
<?php print_unescaped($l->t('For increased security we recommend enabling the following settings if supported by your environment.')) ?>
62+
<span class="toggle"><?php p($l->t('Show security settings ...')) ?></span>
63+
</p>
64+
<div class="indent hidden">
65+
<h4><?php p($l->t('Signatures and encryption offered')) ?></h4>
66+
<?php foreach($_['security-offer'] as $key => $text): ?>
67+
<p>
68+
<input type="checkbox" id="user-saml-<?php p($key)?>" name="<?php p($key)?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'security-'.$key, '0')) ?>" class="checkbox">
69+
<label for="user-saml-<?php p($key)?>"><?php p($text) ?></label><br/>
70+
</p>
71+
<?php endforeach; ?>
72+
<h4><?php p($l->t('Signatures and encryption required')) ?></h4>
73+
<?php foreach($_['security-required'] as $key => $text): ?>
74+
<p>
75+
<input type="checkbox" id="user-saml-<?php p($key)?>" name="<?php p($key)?>" value="<?php p(\OC::$server->getConfig()->getAppValue('user_saml', 'security-'.$key, '0')) ?>" class="checkbox">
76+
<label for="user-saml-<?php p($key)?>"><?php p($text) ?></label>
77+
</p>
78+
<?php endforeach; ?>
79+
</div>
80+
</div>
5781

5882
<a href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('user_saml.SAML.getMetadata')) ?>" class="button"><?php p($l->t('Download metadata XML')) ?></a>
5983
<!-- FIXME: Add test settings -->

0 commit comments

Comments
 (0)