From: Marcel Werk Date: Thu, 23 Jun 2016 14:36:04 +0000 (+0200) Subject: Added acp search providers for pages, boxes and articles X-Git-Tag: 3.0.0_Beta_1~1372 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=39ceaa620510589c41deea1eb0c73dd5dc279d04;p=GitHub%2FWoltLab%2FWCF.git Added acp search providers for pages, boxes and articles --- diff --git a/com.woltlab.wcf/acpSearchProvider.xml b/com.woltlab.wcf/acpSearchProvider.xml index 1777735c4a..bee7453efe 100644 --- a/com.woltlab.wcf/acpSearchProvider.xml +++ b/com.woltlab.wcf/acpSearchProvider.xml @@ -21,5 +21,17 @@ 5 + + + 6 + + + + 7 + + + + 8 + diff --git a/wcfsetup/install/files/lib/system/search/acp/ArticleACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/ArticleACPSearchResultProvider.class.php new file mode 100644 index 0000000000..7aef52b5bd --- /dev/null +++ b/wcfsetup/install/files/lib/system/search/acp/ArticleACPSearchResultProvider.class.php @@ -0,0 +1,39 @@ + + * @package WoltLabSuite\Core\System\Search\Acp + */ +class ArticleACPSearchResultProvider implements IACPSearchResultProvider { + /** + * @inheritDoc + */ + public function search($query) { + if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) { + return []; + } + + $results = []; + + $contentList = new ArticleContentList(); + $contentList->getConditionBuilder()->add('article_content.title LIKE ?', ['%'.$query.'%']); + $contentList->sqlLimit = 10; + $contentList->sqlOrderBy = 'article_content.title'; + $contentList->readObjects(); + foreach ($contentList as $content) { + $results[] = new ACPSearchResult($content->title, LinkHandler::getInstance()->getLink('ArticleEdit', [ + 'id' => $content->articleID, + ])); + } + + return $results; + } +} diff --git a/wcfsetup/install/files/lib/system/search/acp/BoxACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/BoxACPSearchResultProvider.class.php new file mode 100644 index 0000000000..da525df0fc --- /dev/null +++ b/wcfsetup/install/files/lib/system/search/acp/BoxACPSearchResultProvider.class.php @@ -0,0 +1,39 @@ + + * @package WoltLabSuite\Core\System\Search\Acp + */ +class BoxACPSearchResultProvider implements IACPSearchResultProvider { + /** + * @inheritDoc + */ + public function search($query) { + if (!WCF::getSession()->getPermission('admin.content.cms.canManageBox')) { + return []; + } + + $results = []; + + $boxList = new BoxList(); + $boxList->getConditionBuilder()->add('box.name LIKE ?', ['%'.$query.'%']); + $boxList->sqlLimit = 10; + $boxList->sqlOrderBy = 'box.name'; + $boxList->readObjects(); + foreach ($boxList as $box) { + $results[] = new ACPSearchResult($box->name, LinkHandler::getInstance()->getLink('BoxEdit', [ + 'id' => $box->boxID, + ])); + } + + return $results; + } +} diff --git a/wcfsetup/install/files/lib/system/search/acp/PageACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/PageACPSearchResultProvider.class.php new file mode 100644 index 0000000000..040408f711 --- /dev/null +++ b/wcfsetup/install/files/lib/system/search/acp/PageACPSearchResultProvider.class.php @@ -0,0 +1,39 @@ + + * @package WoltLabSuite\Core\System\Search\Acp + */ +class PageACPSearchResultProvider implements IACPSearchResultProvider { + /** + * @inheritDoc + */ + public function search($query) { + if (!WCF::getSession()->getPermission('admin.content.cms.canManagePage')) { + return []; + } + + $results = []; + + $pageList = new PageList(); + $pageList->getConditionBuilder()->add('page.name LIKE ?', ['%'.$query.'%']); + $pageList->sqlLimit = 10; + $pageList->sqlOrderBy = 'page.name'; + $pageList->readObjects(); + foreach ($pageList as $page) { + $results[] = new ACPSearchResult($page->name, LinkHandler::getInstance()->getLink('PageEdit', [ + 'id' => $page->pageID, + ])); + } + + return $results; + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 177d18e0c5..6351850ccf 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1324,11 +1324,14 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> - + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index c5a5994e57..31756f0704 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1336,6 +1336,9 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> + + +