diff --git a/modules/oauth/lib/Registry.php b/modules/oauth/lib/Registry.php index b2bc33bb9c8debb74e456bae2683b069839bd95b..ab2a1f09baa321fd00f5f6606dfee0eb2e1cd1ef 100644 --- a/modules/oauth/lib/Registry.php +++ b/modules/oauth/lib/Registry.php @@ -49,7 +49,7 @@ class sspmod_oauth_Registry { protected function header($name) { - return '<tr ><td> </td><td class="header">' . $name . '</td></tr>'; + return '<tr><td> </td><td class="header">' . $name . '</td></tr>'; } @@ -109,10 +109,10 @@ class sspmod_oauth_Registry { public function metaToForm($metadata) { return '<form action="registry.edit.php" method="post">' . '<div id="tabdiv">' . - '<ul>' . - '<li><a href="#basic">Name and descrition</a></li>' . + '<ul class="tabset_tabs">' . + '<li class="tab-link current" data-tab="basic"><a href="#basic">Name and descrition</a></li>' . '</ul>' . - '<div id="basic"><table class="formtable">' . + '<div id="basic" class="tabset_content current"><table class="formtable">' . $this->standardField($metadata, 'name', 'Name of client') . $this->standardField($metadata, 'description', 'Description of client', TRUE) . $this->readonlyField($metadata, 'owner', 'Owner') . @@ -120,10 +120,9 @@ class sspmod_oauth_Registry { $this->readonlyField($metadata, 'secret', 'Consumer Secret<br/>(Used for HMAC_SHA1 signatures)') . $this->standardField($metadata, 'RSAcertificate', 'RSA certificate (PEM)<br/>(Used for RSA_SHA1 signatures)', TRUE) . $this->standardField($metadata, 'callback_url', 'Static/enforcing callback-url') . - $this->hiddenField('field_secret', $metadata['secret']) . - '</table></div>' . '</div>' . + $this->hiddenField('field_secret', $metadata['secret']) . '<input type="submit" name="submit" value="Save" style="margin-top: 5px" />' . '</form>'; } diff --git a/modules/oauth/templates/registry.edit.twig b/modules/oauth/templates/registry.edit.twig new file mode 100644 index 0000000000000000000000000000000000000000..ec7d7594cfb4b642d5e31d9fbc6188c8d9f2f54a --- /dev/null +++ b/modules/oauth/templates/registry.edit.twig @@ -0,0 +1,18 @@ +{% set pagetitle = 'SimpleSAMLphp'|trans %} +{% extends "base.twig" %} + +{% block preload %} + <link href="{{ baseurlpath }}resources/style.css" rel="stylesheet" /> +{% endblock %} + +{% block postload %} + <script src="{{ baseurlpath }}resources/javascript.js"></script> +{% endblock %} + +{% block content %} + <h1>OAuth Client</h1> + {{ form|raw }} + <p style="float: right"> + <a href="registry.php">Return to entity listing <strong>without saving...</strong></a> + </p> +{% endblock %} diff --git a/modules/oauth/templates/registry.list.twig b/modules/oauth/templates/registry.list.twig new file mode 100644 index 0000000000000000000000000000000000000000..e6ec234c6020d7623373ee2dd0de468033250f2a --- /dev/null +++ b/modules/oauth/templates/registry.list.twig @@ -0,0 +1,58 @@ +{% set pagetitle = 'SimpleSAMLphp'|trans %} +{% extends "base.twig" %} + +{% block preload %} + <link href="{{ baseurlpath }}style.css" rel="stylesheet" /> +{% endblock %} + +{% block content %} + <h1>OAuth Client Registry</h1> + <p>Here you can register new OAuth Clients. You are successfully logged in as {{ userid|escape('html') }}</p> + <h2>Your clients</h2> + + <table class="metalist" style="width: 100%;"> + {% for key, entryc in entries.mine %} + {% if loop.index0 % 2 == 0 %} + {% set class = 'even' %} + {% else %} + {% set class = 'odd' %} + {% endif %} + {% set entry = entryc.value %} + <tr class="{{ class }}"> + <td>{{ entry.name|escape('html') }}</td> + <td><kbd>{{ entry.key|escape('html') }}</kbd></td> + <td> + <a href="registry.edit.php?editkey={{ entry.key|escape('url') }}">edit</a> + <a href="registry.php?delete={{ entry.key|escape('url') }}">delete</a> + </td> + </tr> + {% else %} + <tr><td colspan="3">No entries registered</td></tr> + {% endfor %} + </table> + + <p><a href="registry.edit.php">Add new client</a></p> + <h2>Other clients</h2> + + <table class="metalist" style="width: 100%"> + {% for key, entryc in entries.others %} + {% if loop.index0 % 2 == 0 %} + {% set class = 'even' %} + {% else %} + {% set class = 'odd' %} + {% endif %} + {% set entry = entryc.value %} + <tr class="{{ class }}"> + <td>{{ entry.name|escape('html') }}</td> + <td><kbd>{{ entry.key|escape('html') }}</kbd></td> + {% if eentry.owner is defined %}} + <td>{{ entry.owner|escape('html') }}</td> + {% else %} + <td>No owner</td> + {% endif %} + </tr> + {% else %} + <tr><td colspan="3">No entries registered</td></tr> + {% endfor %} + </table> +{% endblock%} diff --git a/modules/oauth/templates/registry.saved.twig b/modules/oauth/templates/registry.saved.twig new file mode 100644 index 0000000000000000000000000000000000000000..6c36465f7162b6b759ba0f41fdb4497b0364a8da --- /dev/null +++ b/modules/oauth/templates/registry.saved.twig @@ -0,0 +1,9 @@ +{% set pagetitle = 'SimpleSAMLphp'|trans %} +{% extends "base.twig" %} + +{% block content %} + <h1>OAith Client saved</h1> + <p> + <a href="registry.php">Go back to OAuth client listing</a> + </p> +{% endblock %} diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index b53a76f9eb6318ab9001f232cb9175aad4be1c5d..4b97e8b1b5b7c2af6e9657232ed8bddac4e624af 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -4,7 +4,6 @@ $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getSessionFromRequest(); $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); - $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); $authsource = "admin"; // force admin to authenticate as registry maintainer diff --git a/modules/oauth/www/resources/javascript.js b/modules/oauth/www/resources/javascript.js new file mode 100644 index 0000000000000000000000000000000000000000..77ef1b1a5e53c34054bdc7593183b7aa7e84f48c --- /dev/null +++ b/modules/oauth/www/resources/javascript.js @@ -0,0 +1,13 @@ +$(document).ready(function() { + $('ul.tabset_tabs li').click( + function() { + var tab_id = $(this).attr('data-tab'); + $('ul.tabset_tabs li').removeClass('current'); + $('.tabset_content').removeClass('current'); + + $(this).addClass('current'); + $("#"+tab_id).addClass('current'); + $("html, body").animate({ scrollTop: 0 }, "slow"); + } + ) +}) diff --git a/modules/oauth/www/resources/style.css b/modules/oauth/www/resources/style.css index 1240db06576e85af71049ead441122ca26354a04..4df7a79504106ad9102dfb88d797561b12f9a55b 100644 --- a/modules/oauth/www/resources/style.css +++ b/modules/oauth/www/resources/style.css @@ -34,4 +34,52 @@ table.metalist tr td { } table.metalist tr.even td { background: #e5e5e5; -} \ No newline at end of file +} + +@media all { + div#content { + margin: .4em ! important; + } + + form { + display: inline; + } + + ul.tabset_tabs { + margin: 0px; + padding: 0px; + list-style: none; + } + + ul.tabset_tabs li { + background: none; + color: #222; + display: inline-block; + padding: 10px 15px; + cursor: pointer; + } + + ul.tabset_tabs li.current { + background: #ededed; + color: #222; + } + + .tabset_content { + display: none; + background: #ededed; + padding: 15px; + } + + .tabset_content.current { + display: inherit; + } + + #graph img { + max-width: 77%; + height: auto; + } + #table img { + max-width: 77%; + height: auto; + } +}