Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
add plugin source code
Browse files Browse the repository at this point in the history
  • Loading branch information
blackfisch committed Oct 25, 2019
1 parent b4b2822 commit 953ef34
Show file tree
Hide file tree
Showing 43 changed files with 3,397 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/acpMenu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/acpMenu.xsd">
<import>
<acpmenuitem name="wcf.acp.menu.link.oauthclients">
<parent>wcf.acp.menu.link.configuration</parent>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.oauthclients.list">
<controller>wcf\acp\page\OauthclientsListPage</controller>
<parent>wcf.acp.menu.link.oauthclients</parent>
<permissions>admin.configuration.canManageOauthclients</permissions>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.oauthclients.add">
<controller>wcf\acp\form\OauthclientsAddForm</controller>
<parent>wcf.acp.menu.link.oauthclients.list</parent>
<permissions>admin.configuration.canManageOauthclients</permissions>
<icon>fa-plus</icon>
</acpmenuitem>
</import>
</data>
98 changes: 98 additions & 0 deletions src/acptemplates/oauthclientsAdd.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{include file='header' pageTitle='wcf.acp.oauthclients.'|concat:$action}

<header class="contentHeader">
<div class="contentHeaderTitle">
<h1 class="contentTitle">{lang}wcf.acp.oauthclients.{$action}{/lang}</h1>
</div>

<nav class="contentHeaderNavigation">
<ul>
<li><a href="{link controller='OauthclientsList'}{/link}" class="button"><span class="icon icon16 fa-list"></span> <span>{lang}wcf.acp.menu.link.oauthclients.list{/lang}</span></a></li>

{event name='contentHeaderNavigation'}
</ul>
</nav>
</header>

{include file='formError'}

{if $success|isset}
<p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
{/if}

<form method="post" action="{if $action == 'add'}{link controller='OauthclientsAdd'}{/link}{else}{link controller='OauthclientsEdit' object=$oauthclients}{/link}{/if}">
<div class="section">
<dl{if $errorField == 'name'} class="formError"{/if}>
<dt><label for="name">{lang}wcf.oauthclients.name{/lang}</label></dt>
<dd>
<input type="text" id="name" name="name" value="{$name}" required autofocus maxlength="255" class="long">
{if $errorField == 'name'}
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{else}
{lang}wcf.acp.oauthclients.name.error.{$errorType}{/lang}
{/if}
</small>
{/if}
</dd>
</dl>

<dl{if $errorField == 'redirectUrl'} class="formError"{/if}>
<dt><label for="redirectUrl">{lang}wcf.oauthclients.redirectUrl{/lang}</label></dt>
<dd>
<input type="url" id="redirectUrl" name="redirectUrl" value="{$redirectUrl}" required maxlength="255" class="long" placeholder="https://example.com">
{if $errorField == 'redirectUrl'}
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{else}
{lang}wcf.acp.oauthclients.redirectUrl.error.{$errorType}{/lang}
{/if}
</small>
{/if}
</dd>
</dl>
<dl>
<dt><label for="showSignature">{lang}wcf.acp.oauthclients.implicit{/lang}</label></dt>
<dd><ol class="flexibleButtonGroup optionTypeBoolean">
<li>
<input type="radio" id="allowImplicit" name="implicit" value="1" {if $implicit}checked{/if}>
<label for="allowImplicit" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.acp.option.type.boolean.yes{/lang}</label>
</li>
<li>
<input type="radio" id="allowImplicit_no" name="implicit" value="0" {if !$implicit}checked{/if}>
<label for="allowImplicit_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.acp.option.type.boolean.no{/lang}</label>
</li>
</ol>
<small>{lang}wcf.acp.oauthclients.implicit.description{/lang}</small>
</dd>
</dl>
<dl>
<dt><label for="showSignature">{lang}wcf.acp.oauthclients.password{/lang}</label></dt>
<dd><ol class="flexibleButtonGroup optionTypeBoolean">
<li>
<input type="radio" id="allowpassword" name="password" value="1" {if $password}checked{/if}>
<label for="allowpassword" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.acp.option.type.boolean.yes{/lang}</label>
</li>
<li>
<input type="radio" id="allowpassword_no" name="password" value="0" {if !$password}checked{/if}>
<label for="allowpassword_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.acp.option.type.boolean.no{/lang}</label>
</li>
</ol>
<small>{lang}wcf.acp.oauthclients.password.description{/lang}</small>
</dd>
</dl>

{event name='dataFields'}
</div>

{event name='sections'}

<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
{@SECURITY_TOKEN_INPUT_TAG}
</div>
</form>

{include file='footer'}
124 changes: 124 additions & 0 deletions src/acptemplates/oauthclientsEdit.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{include file='header' pageTitle='wcf.acp.oauthclients.'|concat:$action}

<header class="contentHeader">
<div class="contentHeaderTitle">
<h1 class="contentTitle">{lang}wcf.acp.oauthclients.{$action}{/lang}</h1>
</div>

<nav class="contentHeaderNavigation">
<ul>
<li><a href="{link controller='OauthclientsList'}{/link}" class="button"><span class="icon icon16 fa-list"></span> <span>{lang}wcf.acp.menu.link.oauthclients.list{/lang}</span></a></li>

{event name='contentHeaderNavigation'}
</ul>
</nav>
</header>

<p class="info">
<b>Authorization-URL:</b> {link controller="OauthConsent" forceFrontend=true}{/link}
<br /><b>Oauth Token Endpoint:</b> {link controller="OauthToken" forceFrontend=true}{/link}
<br /><b>User API Endpoint:</b> {link controller="OauthUser" forceFrontend=true}{/link}
</p>

{if $oauth_tls_warning}
<p class="warning">{lang}wcf.acp.oauthclients.tls_warning{/lang}</p>
{/if}

{include file='formError'}

{if $success|isset}
<p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
{/if}

<form method="post" action="{if $action == 'add'}{link controller='OauthclientsAdd'}{/link}{else}{link controller='OauthclientsEdit' object=$oauthclients}{/link}{/if}">
<div class="section">
<dl{if $errorField == 'name'} class="formError"{/if}>
<dt><label for="name">{lang}wcf.oauthclients.name{/lang}</label></dt>
<dd>
<input type="text" id="name" name="name" value="{$name}" required autofocus maxlength="255" class="long">
{if $errorField == 'name'}
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{else}
{lang}wcf.acp.oauthclients.name.error.{$errorType}{/lang}
{/if}
</small>
{/if}
</dd>
</dl>

<dl{if $errorField == 'redirectUrl'} class="formError"{/if}>
<dt><label for="redirectUrl">{lang}wcf.oauthclients.redirectUrl{/lang}</label></dt>
<dd>
<input type="url" id="redirectUrl" name="redirectUrl" value="{$redirectUrl}" required maxlength="255" class="long" placeholder="https://example.com">
{if $errorField == 'redirectUrl'}
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{else}
{lang}wcf.acp.oauthclients.redirectUrl.error.{$errorType}{/lang}
{/if}
</small>
{/if}
</dd>
</dl>

<dl>
<dt><label for="showSignature">{lang}wcf.acp.oauthclients.implicit{/lang}</label></dt>
<dd><ol class="flexibleButtonGroup optionTypeBoolean">
<li>
<input type="radio" id="allowImplicit" name="implicit" value="1" {if $implicit}checked{/if}>
<label for="allowImplicit" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.acp.option.type.boolean.yes{/lang}</label>
</li>
<li>
<input type="radio" id="allowImplicit_no" name="implicit" value="0" {if !$implicit}checked{/if}>
<label for="allowImplicit_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.acp.option.type.boolean.no{/lang}</label>
</li>
</ol>
<small>{lang}wcf.acp.oauthclients.implicit.description{/lang}</small>
</dd>
</dl>
<dl>
<dt><label for="showSignature">{lang}wcf.acp.oauthclients.password{/lang}</label></dt>
<dd><ol class="flexibleButtonGroup optionTypeBoolean">
<li>
<input type="radio" id="allowpassword" name="password" value="1" {if $password}checked{/if}>
<label for="allowpassword" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.acp.option.type.boolean.yes{/lang}</label>
</li>
<li>
<input type="radio" id="allowpassword_no" name="password" value="0" {if !$password}checked{/if}>
<label for="allowpassword_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.acp.option.type.boolean.no{/lang}</label>
</li>
</ol>
<small>{lang}wcf.acp.oauthclients.password.description{/lang}</small>
</dd>
</dl>

<dl>
<dt><label for="">{lang}wcf.oauthclients.clientID{/lang}</label></dt>
<dd>
<input type="text" id="" value="{$clientID}" required maxlength="255" class="long" readonly>
</dd>
</dl>

<dl>
<dt><label for="">{lang}wcf.oauthclients.clientSecret{/lang}</label></dt>
<dd>
<input type="text" id="" value="{$clientSecret}" required maxlength="255" class="long" readonly>
</dd>
</dl>

{event name='dataFields'}
</div>

{event name='sections'}

<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
{@SECURITY_TOKEN_INPUT_TAG}
<button class="button buttonSecondary" type="submit" name="refresh"><i class="fa fa-refresh"></i> {lang}wcf.acp.oauthclients.refreshClientSecret{/lang}</button>
</div>
</form>

{include file='footer'}
95 changes: 95 additions & 0 deletions src/acptemplates/oauthclientsList.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{include file='header' pageTitle='wcf.acp.oauthclients.list'}

<header class="contentHeader">
<div class="contentHeaderTitle">
<h1 class="contentTitle">{lang}wcf.acp.oauthclients.list{/lang}</h1>
</div>

<nav class="contentHeaderNavigation">
<ul>
<li><a href="{link controller='OauthclientsAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.oauthclients.add{/lang}</span></a></li>

{event name='contentHeaderNavigation'}
</ul>
</nav>
</header>

{hascontent}
<div class="paginationTop">
{content}{pages print=true assign=pagesLinks controller="OauthclientsList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}{/content}
</div>
{/hascontent}

{if $objects|count}
<div class="section tabularBox" id="oauthclientsTableContainer">
<table class="table">
<thead>
<tr>
<th class="columnID columnOauthclientsID{if $sortField == 'oauthclientID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='OauthclientsList'}pageNo={@$pageNo}&sortField=oauthclientID&sortOrder={if $sortField == 'oauthclientID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.oauthclients.clientID{/lang}</a></th>
<th class="columnTitle columnFirstName{if $sortField == 'name'} active {@$sortOrder}{/if}"><a href="{link controller='OauthclientsList'}pageNo={@$pageNo}&sortField=name&sortOrder={if $sortField == 'name' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.oauthclients.name{/lang}</a></th>
<th class="columnTitle columnLastName{if $sortField == 'redirectUrl'} active {@$sortOrder}{/if}"><a href="{link controller='OauthclientsList'}pageNo={@$pageNo}&sortField=redirectUrl&sortOrder={if $sortField == 'redirectUrl' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.oauthclients.redirectUrl{/lang}</a></th>
<th class="columnTitle columnLastName{if $sortField == 'lastModified'} active {@$sortOrder}{/if}"><a href="{link controller='OauthclientsList'}pageNo={@$pageNo}&sortField=lastModified&sortOrder={if $sortField == 'lastModified' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.oauthclients.lastModified{/lang}</a></th>


{event name='columnHeads'}
</tr>
</thead>

<tbody>
{foreach from=$objects item=oauthclients}
<tr class="jsOauthclientsRow">
<td class="columnIcon">
<a href="{link controller='OauthclientsEdit' object=$oauthclients}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
<span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{$oauthclients->oauthclientID}" data-confirm-message-html="{lang __encode=true}wcf.acp.oauthclients.delete.confirmMessage{/lang}"></span>

{event name='rowButtons'}
</td>
<td class="columnID">{$oauthclients->oauthclientID}</td>
<td class="columnTitle columnFirstName"><a href="{link controller='OauthclientsEdit' object=$oauthclients}{/link}">{$oauthclients->name}</a></td>
<td class="columnTitle columnLastName"><a href="{link controller='OauthclientsEdit' object=$oauthclients}{/link}">{$oauthclients->redirectUrl}</a></td>
<td class="columnTitle columnLastName">{@$oauthclients->lastModified|time}</td>
{event name='columns'}
</tr>
{/foreach}
</tbody>
</table>
</div>

<footer class="contentFooter">
{hascontent}
<div class="paginationBottom">
{content}{@$pagesLinks}{/content}
</div>
{/hascontent}

<nav class="contentFooterNavigation">
<ul>
<li><a href="{link controller='OauthclientsAdd'}{/link}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.acp.menu.link.oauthclients.add{/lang}</span></a></li>

{event name='contentFooterNavigation'}
</ul>
</nav>
</footer>
{else}
<p class="info">{lang}wcf.global.noItems{/lang}</p>
{/if}

<script data-relocate="true">
$(function() {
new WCF.Action.Delete('wcf\\data\\oauthclient\\OauthclientAction', '.jsOauthclientsRow');
var options = { };
{if $pages > 1}
options.refreshPage = true;
{if $pages == $pageNo}
options.updatePageNumber = -1;
{/if}
{else}
options.emptyMessage = '{lang}wcf.global.noItems{/lang}';
{/if}
new WCF.Table.EmptyTableHandler($('#oauthclientsTableContainer'), 'jsOauthclientsRow', options);
});
</script>

{include file='footer'}
22 changes: 22 additions & 0 deletions src/eventListener.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<data xmlns="https://www.woltlab.com" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.woltlab.com https://www.woltlab.com/XSD/vortex/eventListener.xsd">
<import>
<eventlistener name="oauthProviderCleanupCronjob">
<eventclassname>wcf\system\cronjob\DailyCleanUpCronjob</eventclassname>
<eventname>execute</eventname>
<listenerclassname>wcf\system\event\listener\OauthProviderCleanupListener</listenerclassname>
<inherit>1</inherit>
<environment>user</environment>
</eventlistener>

<!-- admin -->
<eventlistener name="oauthProviderCleanupCronjobAdmin">
<eventclassname>wcf\system\cronjob\DailyCleanUpCronjob</eventclassname>
<eventname>execute</eventname>
<listenerclassname>wcf\system\event\listener\OauthProviderCleanupListener</listenerclassname>
<inherit>1</inherit>
<environment>admin</environment>
</eventlistener>
<!-- admin -->
</import>
</data>
Loading

0 comments on commit 953ef34

Please # to comment.