Skip to content

Commit

Permalink
Merge pull request #229 from HanashiDev/next
Browse files Browse the repository at this point in the history
WSC 6.1: Version 2.2.0
  • Loading branch information
Hanashi authored Aug 31, 2024
2 parents 4536104 + 9d73ea3 commit 050e404
Show file tree
Hide file tree
Showing 57 changed files with 6,653 additions and 3,568 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.1'
extensions: ctype, dom, exif, gd, gmp, hash, intl, json, libxml, mbstring, opcache, pcre, pdo, pdo_mysql, zlib
tools: cs2pr, phpcs, php-cs-fixer
- name: phpcs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
php:
- '8.1'
- '8.2'
- '8.3'
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
Expand Down
36 changes: 7 additions & 29 deletions acpMenu.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,10 @@
<?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/5.4/acpMenu.xsd">
<import>
<acpmenuitem name="wcf.acp.menu.link.faq">
<parent>wcf.acp.menu.link.content</parent>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.faq.categories.list">
<controller>wcf\acp\page\FaqCategoryListPage</controller>
<parent>wcf.acp.menu.link.faq</parent>
<permissions>admin.faq.canViewCategory</permissions>
<showorder>1</showorder>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.faq.categories.add">
<controller>wcf\acp\form\FaqCategoryAddForm</controller>
<parent>wcf.acp.menu.link.faq.categories.list</parent>
<permissions>admin.faq.canAddCategory</permissions>
<icon>plus</icon>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.faq.questions.list">
<controller>wcf\acp\page\FaqQuestionListPage</controller>
<parent>wcf.acp.menu.link.faq</parent>
<permissions>admin.faq.canViewQuestion</permissions>
<showorder>2</showorder>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.faq.questions.add">
<controller>wcf\acp\form\FaqQuestionAddForm</controller>
<parent>wcf.acp.menu.link.faq.questions.list</parent>
<permissions>admin.faq.canAddQuestion</permissions>
<icon>plus</icon>
</acpmenuitem>
</import>
<delete>
<acpmenuitem name="wcf.acp.menu.link.faq.questions.add"/>
<acpmenuitem name="wcf.acp.menu.link.faq.questions.list"/>
<acpmenuitem name="wcf.acp.menu.link.faq.categories.add"/>
<acpmenuitem name="wcf.acp.menu.link.faq.categories.list"/>
<acpmenuitem name="wcf.acp.menu.link.faq"/>
</delete>
</data>
2 changes: 1 addition & 1 deletion acptemplates/faqQuestionAdd.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
</nav>
</header>

{@$form->getHtml()}
{unsafe:$form->getHtml()}

{include file='footer'}
17 changes: 9 additions & 8 deletions acptemplates/faqQuestionList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
new UiSortableList({
containerId: 'questionList',
className: 'wcf\\data\\faq\\QuestionAction',
offset: {@$startIndex}
offset: {$startIndex}
});
});
</script>
Expand Down Expand Up @@ -36,7 +36,7 @@
<option value="0">{lang}wcf.acp.faq.category{/lang}</option>

{foreach from=$categoryNodeList item=category}
<option value="{@$category->categoryID}"{if $category->categoryID == $categoryID} selected{/if}>{if $category->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($category->getDepth() - 1)}{/if}{$category->getTitle()}</option>
<option value="{$category->categoryID}"{if $category->categoryID == $categoryID} selected{/if}>{if $category->getDepth() > 1}{unsafe:"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($category->getDepth() - 1)}{/if}{$category->getTitle()}</option>
{/foreach}
</select>
</dd>
Expand Down Expand Up @@ -70,9 +70,9 @@
<div class="paginationTop">
{content}
{assign var='linkParameters' value=''}
{if $categoryID}{capture append=linkParameters}&categoryID={@$categoryID}{/capture}{/if}
{if $question}{capture append=linkParameters}&question={@$question|rawurlencode}{/capture}{/if}
{if $answer}{capture append=linkParameters}&answer={@$answer|rawurlencode}{/capture}{/if}
{if $categoryID}{capture append=linkParameters}&categoryID={$categoryID}{/capture}{/if}
{if $question}{capture append=linkParameters}&question={unsafe:$question|rawurlencode}{/capture}{/if}
{if $answer}{capture append=linkParameters}&answer={unsafe:$answer|rawurlencode}{/capture}{/if}

{pages print=true assign=pagesLinks controller="FaqQuestionList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
{/content}
Expand All @@ -81,15 +81,16 @@

{if $objects|count}
<div class="section sortableListContainer" id="questionList">
<ol class="sortableList jsObjectActionContainer jsReloadPageWhenEmpty" data-object-id="0" start="{@($pageNo - 1) * $itemsPerPage + 1}" data-object-action-class-name="wcf\data\faq\QuestionAction">
<ol class="sortableList jsObjectActionContainer jsReloadPageWhenEmpty" data-object-id="0" start="{($pageNo - 1) * $itemsPerPage + 1}" data-object-action-class-name="wcf\data\faq\QuestionAction">
{foreach from=$objects item=question}
<li class="sortableNode sortableNoNesting jsQuestion jsObjectActionObject" data-object-id="{@$question->questionID}">
<li class="sortableNode sortableNoNesting jsQuestion jsObjectActionObject" data-object-id="{$question->questionID}">
<span class="sortableNodeLabel">
({$question->getCategory()->getTitle()})&nbsp;
<a href="{link controller='FaqQuestionEdit' object=$question}{/link}">{$question->getTitle()}</a>

<span class="statusDisplay sortableButtonContainer">
{objectAction action="toggle" isDisabled=$question->isDisabled}
<a href="{link controller='FaqQuestionAdd' duplicateID=$question->questionID isMultilingual=$question->isMultilingual}{/link}" title="{lang}wcf.acp.faqQuestion.copy{/lang}" class="jsTooltip">{icon name='copy' size=16}</a>
<a href="{link controller='FaqQuestionEdit' object=$question}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip">{icon name='pencil' size=16}</a>
{objectAction action="delete" objectTitle=$question->getTitle()}

Expand All @@ -108,7 +109,7 @@
<footer class="contentFooter">
{hascontent}
<div class="paginationBottom">
{content}{@$pagesLinks}{/content}
{content}{unsafe:$pagesLinks}{/content}
</div>
{/hascontent}

Expand Down
24 changes: 24 additions & 0 deletions box.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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/5.4/box.xsd">
<import>
<box identifier="dev.tkirch.wsc.faq.FaqCategories">
<name language="de">Kategorien (FAQ)</name>
<name language="en">Categories (FAQ)</name>
<boxType>system</boxType>
<position>sidebarRight</position>
<objectType>dev.tkirch.wsc.faq.faqCategories</objectType>
<showHeader>1</showHeader>
<visibleEverywhere>0</visibleEverywhere>
<visibilityExceptions>
<page>dev.tkirch.wsc.faq.FaqQuestionList</page>
<page>dev.tkirch.wsc.faq.FaqQuestion</page>
</visibilityExceptions>
<content language="de">
<title>Kategorien</title>
</content>
<content language="en">
<title>Categories</title>
</content>
</box>
</import>
</data>
3 changes: 3 additions & 0 deletions constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

\define('SIMPLE_FAQ_VIEW', 'default');
6 changes: 6 additions & 0 deletions fileDelete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?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/6.0/fileDelete.xsd">
<delete>
<file>lib/action/FaqSearchAction</file>
</delete>
</data>
17 changes: 17 additions & 0 deletions files/js/Hanashi/Api/Questions/GetSearch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions files/js/Hanashi/Api/Questions/RenderSearch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 8 additions & 16 deletions files/js/Hanashi/Faq/BBCode.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions files/js/Hanashi/Faq/Question.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 43 additions & 14 deletions files/lib/acp/form/FaqCategoryAddForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

namespace wcf\acp\form;

use wcf\system\request\LinkHandler;
use wcf\system\WCF;
use Override;
use wcf\data\IStorableObject;
use wcf\system\form\builder\container\FormContainer;
use wcf\system\form\builder\data\processor\CustomFormDataProcessor;
use wcf\system\form\builder\field\IconFormField;
use wcf\system\form\builder\IFormDocument;

class FaqCategoryAddForm extends AbstractCategoryAddForm
class FaqCategoryAddForm extends CategoryAddFormBuilderForm
{
/**
* @inheritDoc
Expand All @@ -15,20 +19,45 @@ class FaqCategoryAddForm extends AbstractCategoryAddForm
/**
* @inheritDoc
*/
public $objectTypeName = 'dev.tkirch.wsc.faq.category';
public string $objectTypeName = 'dev.tkirch.wsc.faq.category';

/**
* @inheritDoc
*/
public function save()
#[Override]
protected function createForm()
{
parent::save();
parent::createForm();

WCF::getTPL()->assign([
'objectEditLink' => LinkHandler::getInstance()->getControllerLink(
FaqCategoryEditForm::class,
['id' => $this->objectAction->getReturnValues()['returnValues']->categoryID]
),
$this->form->appendChildren([
FormContainer::create('properties')
->label('wcf.acp.faq.properties')
->appendChildren([
IconFormField::create('faqIcon')
->label('wcf.acp.faq.faqIcon'),
]),
]);
}

#[Override]
protected function finalizeForm()
{
$this->form->getDataHandler()->addProcessor(
new CustomFormDataProcessor(
'icon',
static function (IFormDocument $document, array $parameters) {
$parameters['additionalData']['faqIcon'] = $parameters['data']['faqIcon'];
unset($parameters['data']['faqIcon']);

return $parameters;
},
function (IFormDocument $document, array $data, IStorableObject $object) {
if (isset($this->formObject->additionalData['faqIcon'])) {
$data['faqIcon'] = $this->formObject->additionalData['faqIcon'];
}

return $data;
}
)
);

parent::finalizeForm();
}
}
Loading

0 comments on commit 050e404

Please sign in to comment.