Skip to content

Commit

Permalink
Merge pull request #5675 from WoltLab/admin-dashboard
Browse files Browse the repository at this point in the history
Admin dashboard
  • Loading branch information
dtdesign authored Jan 10, 2024
2 parents 9a3039a + 205e62c commit 03745a1
Show file tree
Hide file tree
Showing 34 changed files with 1,493 additions and 493 deletions.
6 changes: 1 addition & 5 deletions com.woltlab.wcf/option.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
</option>
<option name="enable_woltlab_news">
<categoryname>module.system</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>1</defaultvalue>
</option>
<option name="module_article">
<categoryname>module.content</categoryname>
<optiontype>boolean</optiontype>
Expand Down Expand Up @@ -1622,5 +1617,6 @@ DESC:wcf.global.sortOrder.descending</selectoptions>
<option name="google_maps_access_user_location"/>
<option name="module_amp"/>
<option name="article_enable_visit_tracking"/>
<option name="enable_woltlab_news"/>
</delete>
</data>
1 change: 0 additions & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
\define('ENABLE_DEBUG_MODE', 1);
\define('ENABLE_BENCHMARK', 0);
\define('LOG_IP_ADDRESS', 1);
\define('ENABLE_WOLTLAB_NEWS', 1);
\define('MODULE_SYSTEM_RECAPTCHA', 1);
\define('MODULE_SMILEY', 1);
\define('MODULE_USERS_ONLINE', 1);
Expand Down
29 changes: 29 additions & 0 deletions ts/WoltLabSuite/Core/Acp/Controller/Dashboard/Configure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Shows the dialog that allows the user to configure the dashboard boxes.
*
* @author Marcel Werk
* @copyright 2001-2023 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.1
*/

import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
import { promiseMutex } from "WoltLabSuite/Core/Helper/PromiseMutex";
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";

async function showDialog(url: string): Promise<void> {
const { ok } = await dialogFactory().usingFormBuilder().fromEndpoint<Response>(url);

if (ok) {
showNotification(undefined, () => {
window.location.reload();
});
}
}

export function setup(button: HTMLElement): void {
button.addEventListener(
"click",
promiseMutex(() => showDialog(button.dataset.url!)),
);
}
12 changes: 4 additions & 8 deletions ts/WoltLabSuite/Core/Form/Builder/Field/Checkboxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ import { FormBuilderData } from "../Data";
import { escapeAttributeSelector } from "WoltLabSuite/Core/Dom/Util";

class Checkboxes extends Field {
protected _fields: HTMLInputElement[];

constructor(fieldId: string) {
super(fieldId);

this._fields = Array.from(document.querySelectorAll(`input[name="${escapeAttributeSelector(this._fieldId)}[]"]`));
}

protected _getData(): FormBuilderData {
const values = this._fields
.map((input) => {
Expand All @@ -39,6 +31,10 @@ class Checkboxes extends Field {
protected _readField(): void {
/* Does nothing. */
}

protected get _fields(): HTMLInputElement[] {
return Array.from(document.querySelectorAll(`input[name="${escapeAttributeSelector(this._fieldId)}[]"]`));
}
}

export = Checkboxes;
38 changes: 38 additions & 0 deletions wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Updates the database layout during the update from 6.0 to 6.1.
*
* @author Marcel Werk
* @copyright 2001-2023 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
*/

use wcf\system\database\table\column\DefaultFalseBooleanDatabaseTableColumn;
use wcf\system\database\table\column\NotNullInt10DatabaseTableColumn;
use wcf\system\database\table\column\NotNullVarchar191DatabaseTableColumn;
use wcf\system\database\table\DatabaseTable;
use wcf\system\database\table\index\DatabaseTableForeignKey;
use wcf\system\database\table\index\DatabaseTableIndex;

return [
DatabaseTable::create('wcf1_acp_dashboard_box_to_user')
->columns([
NotNullVarchar191DatabaseTableColumn::create('boxName'),
NotNullInt10DatabaseTableColumn::create('userID'),
DefaultFalseBooleanDatabaseTableColumn::create('enabled'),
NotNullInt10DatabaseTableColumn::create('showOrder')
->defaultValue(0),
])->indices([
DatabaseTableIndex::create('boxToUser')
->columns(['boxName', 'userID'])
->type(DatabaseTableIndex::UNIQUE_TYPE),
])
->foreignKeys([
DatabaseTableForeignKey::create()
->columns(['userID'])
->referencedTable('wcf1_user')
->referencedColumns(['userID'])
->onDelete('CASCADE'),
]),
];
98 changes: 94 additions & 4 deletions wcfsetup/install/files/acp/style/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,13 @@ html[data-color-scheme="dark"] {
}
}

.acpDashboardBox[data-name="com.woltlab.wcf.news"] .acpDashboardBox__content {
padding: 0;
}

.woltlabNewsfeed {
border: 1px solid var(--wcfContentBorderInner);
border-radius: var(--wcfBorderRadius);
height: 70vh;
border-radius: 0 0 var(--wcfBorderRadius) var(--wcfBorderRadius);
height: 400px;
max-width: 100%;
overflow: hidden;
text-align: center;
Expand All @@ -892,7 +895,7 @@ html[data-color-scheme="dark"] {
}

.woltlabNewsfeed__iframe {
border-radius: var(--wcfBorderRadius);
border-radius: 0 0 var(--wcfBorderRadius) var(--wcfBorderRadius);
height: 100%;
max-width: 100%;
width: 600px;
Expand All @@ -917,3 +920,90 @@ html[data-color-scheme="dark"] {
width: 100%;
}
}

.acpDashboard {
--column-count: 3;

display: grid;
grid-template-columns: repeat(var(--column-count), 1fr);
gap: 20px;
grid-auto-rows: minmax(300px, auto);
margin-top: 40px;
}

@include screen-sm {
.acpDashboard {
--column-count: 2;
}
}

@include screen-xs {
.acpDashboard {
--column-count: 1;
}
}

.acpDashboardBox {
background-color: var(--wcfContentContainerBackground);
border: 1px solid var(--wcfContentContainerBorder);
border-radius: var(--wcfBorderRadius);
box-shadow: var(--wcfBoxShadowCard);
display: flex;
flex-direction: column;
}

.acpDashboardBox__title {
border-bottom: 1px solid var(--wcfContentContainerBorder);
font-weight: 600;
padding: 10px 20px;
}

.acpDashboardBox__content {
padding: 20px;

> :first-child {
margin-top: 0 !important;
}
}

.acpDashboardBox__keyValueGroup {
display: flex;
flex-direction: column;
row-gap: 10px;
}

.acpDashboardBox__keyValueGroup:not(:first-child) {
margin-top: 30px;
}

.acpDashboardBox__keyValue {
align-items: start;
column-gap: 15px;
display: grid;
grid-template-areas: "key spacer value";
grid-template-columns: max-content minmax(15px, auto) minmax(min-content, max-content);

&::before {
border-bottom: 5px dotted currentColor;
content: "";
display: block;
grid-area: spacer;
margin-top: 0.6em;
opacity: 0.12;
}
}

.acpDashboardBox__keyValue__key {
color: var(--wcfInputLabel);
grid-area: key;
}

.acpDashboardBox__keyValue__value {
grid-area: value;
text-align: right;
}

.acpDashboardBox__keyValue__list {
display: flex;
flex-direction: column;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div id="acpDashboardSortableContainer" class="sortableListContainer">
<ul class="sortableList" id="{$field->getPrefixedId()}_list">
{foreach from=$field->getNestedOptions() item=__fieldNestedOption}
<li{if $__fieldNestedOption[depth] > 0} style="padding-left: {$__fieldNestedOption[depth]*20}px"{/if}>
<span class="sortableHandle">
{icon name='arrows-up-down'}
</span>

<label>
<input {*
*}type="checkbox" {*
*}name="{$field->getPrefixedId()}[]" {*
*}value="{$__fieldNestedOption[value]}"{*
*}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
*}{if $field->getValue() !== null && $__fieldNestedOption[value]|in_array:$field->getValue() && $__fieldNestedOption[isSelectable]} checked{/if}{*
*}{if $field->isImmutable() || !$__fieldNestedOption[isSelectable]} disabled{/if}{*
*}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
*}>
{@$__fieldNestedOption[label]}
</label>
</li>
{/foreach}
</ul>
</div>

<script data-relocate="true">
$(() => {
new window.WCF.Sortable.List(
'acpDashboardSortableContainer',
'',
0,
{
handle: '.sortableHandle'
},
true,
{},
);
});
</script>
64 changes: 64 additions & 0 deletions wcfsetup/install/files/acp/templates/creditsAcpDashboardBox.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<div class="acpDashboardBox__keyValueGroup">
<dl class="plain acpDashboardBox__keyValue">
<dt class="acpDashboardBox__keyValue__key">{lang}wcf.acp.dashboard.box.credits.developedBy{/lang}</dt>
<dd class="acpDashboardBox__keyValue__value"><a href="https://www.woltlab.com/{if $__wcf->getLanguage()->getFixedLanguageCode() === 'de'}de/{/if}" class="externalURL"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank" rel="noopener"{/if}>WoltLab&reg; GmbH</a></dd>
</dl>

<dl class="plain acpDashboardBox__keyValue">
<dt class="acpDashboardBox__keyValue__key">{lang}wcf.acp.dashboard.box.credits.productManager{/lang}</dt>
<dd class="acpDashboardBox__keyValue__value">
<ul class="acpDashboardBox__keyValue__list">
<li>Marcel Werk</li>
</ul>
</dd>
</dl>

<dl class="plain acpDashboardBox__keyValue">
<dt class="acpDashboardBox__keyValue__key">{lang}wcf.acp.dashboard.box.credits.developer{/lang}</dt>
<dd class="acpDashboardBox__keyValue__value">
<ul class="acpDashboardBox__keyValue__list">
<li>Olaf Braun</li>
<li>Tim D&uuml;sterhus</li>
<li>Alexander Ebert</li>
<li>Joshua R&uuml;sweg</li>
<li>Matthias Schmidt</li>
<li>Marcel Werk</li>
</ul>
</dd>
</dl>

<dl class="plain acpDashboardBox__keyValue">
<dt class="acpDashboardBox__keyValue__key">{lang}wcf.acp.dashboard.box.credits.designer{/lang}</dt>
<dd class="acpDashboardBox__keyValue__value">
<ul class="acpDashboardBox__keyValue__list">
<li>Alexander Ebert</li>
<li>Marcel Werk</li>
</ul>
</dd>
</dl>

<dl class="plain acpDashboardBox__keyValue">
<dt class="acpDashboardBox__keyValue__key">{lang}wcf.acp.dashboard.box.credits.contributor{/lang}</dt>
<dd class="acpDashboardBox__keyValue__value">
<ul class="acpDashboardBox__keyValue__list">
<li>Andrea Berg</li>
<li>Thorsten Buitkamp</li>
<li>
<a href="https://github.com/WoltLab/WCF/contributors" class="externalURL"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank" rel="noopener"{/if}>{lang}wcf.acp.dashboard.box.credits.contributor.more{/lang}</a>
</li>
</ul>
</dd>
</dl>
</div>

<div class="acpDashboardBox__keyValueGroup">
<p class="acpDashboardBox__keyValue__text">
Copyright &copy; 2001-{TIME_NOW|date:'Y'} WoltLab&reg; GmbH. All rights reserved.
</p>
</div>

<div class="acpDashboardBox__keyValueGroup">
<p class="acpDashboardBox__keyValue__text">
{lang}wcf.acp.dashboard.box.credits.trademarks{/lang}
</p>
</div>
Loading

0 comments on commit 03745a1

Please sign in to comment.