diff --git a/README.md b/README.md index 0da0678..2549cd3 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ $ php artisan plugin:install claim - `claim` 디렉토리 이동 후 `composer dump` 명령 실행 # Usage -XE3에서 제공하는 게시판, 댓글에서 특별한 설정 없이 신고 기능을 제공합니다. +XE3에서 제공하는 유저, 게시판, 댓글에서 특별한 설정 없이 신고 기능을 제공합니다. -> 게시물 내용, 댓글의 토글 버튼을 클릭 > `신고`버튼을 통해서 신고합니다. +> 유저 프로필, 게시물 내용, 댓글의 토글 버튼을 클릭 > `신고`버튼을 통해서 신고합니다. > > `관리자 > 컨텐츠 > 신고` 메뉴를 통해서 신고 내역을 확인할 수 있습니다. diff --git a/assets/menu.js b/assets/menu.js index 1407809..18d03a6 100644 --- a/assets/menu.js +++ b/assets/menu.js @@ -1,20 +1,22 @@ var ClaimToggleMenu = { - storeBoard: function(e, url, from, targetId, shortCut) { + storeClaim: function(e, url, from, targetId, shortCut) { e.preventDefault(); var _o = $(e.target)[0]; - - XE.ajax({ - url: url, - type: 'post', - dataType: 'json', - data: {from: from, targetId:targetId, shortCut:shortCut}, - success: function (json) { - $('body').trigger('click'); - XE.toast('success', XE.Lang.trans('claim::msgClaimReceived')); - } - }); + let reason = prompt(XE.Lang.trans('claim::enterClaimReason'), ''); + if (reason != null) { + XE.ajax({ + url: url, + type: 'post', + dataType: 'json', + data: {from: from, targetId: targetId, shortCut: shortCut, message: reason}, + success: function (json) { + $('body').trigger('click'); + XE.toast('success', XE.Lang.trans('claim::msgClaimReceived')); + } + }); + } }, - destroyBoard: function(e, url, from, targetId) { + destroyClaim: function(e, url, from, targetId) { e.preventDefault(); var _o = $(e.target)[0]; diff --git a/composer.json b/composer.json index 909c160..e2548bd 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,6 @@ "title": "신고", "icon": "icon.png", "component": { - "claim/settingsSkin/claim@default": { - "class": "Xpressengine\\Plugins\\Claim\\Skin\\SettingsSkin", - "name": "신고하기 관리자 기본 스킨", - "description": "기본스킨." - }, "module/board@board/toggleMenu/claim@boardClaimItem": { "class": "Xpressengine\\Plugins\\Claim\\ToggleMenus\\BoardClaimItem", "name": "게시판 신고 토글 메뉴", @@ -35,6 +30,11 @@ "class": "Xpressengine\\Plugins\\Claim\\ToggleMenus\\CommentClaimItem", "name": "댓글 신고 토글 메뉴", "description": "" + }, + "user/toggleMenu/claim@userClaimItem": { + "class": "Xpressengine\\Plugins\\Claim\\ToggleMenus\\UserClaimItem", + "name": "유저 신고 토글 메뉴", + "description": "" } } } diff --git a/langs/lang.php b/langs/lang.php index 8b0519c..5e154b7 100644 --- a/langs/lang.php +++ b/langs/lang.php @@ -7,18 +7,74 @@ ], 'AlreadyClaimed' => [ 'ko' => '이미 신고되었습니다.', - 'en' => 'Already Claimed.', + 'en' => "It's already been reported", ], 'msgClaimReceived' => [ 'ko' => '신고가 접수 되었습니다.', - 'en' => 'The report has been received.', + 'en' => 'The report has been received', ], 'msgClaimCanceled' => [ 'ko' => '신고가 취소 되었습니다.', - 'en' => 'The report has been canceled.', + 'en' => 'The report has been canceled', ], 'unknownUser' => [ 'ko' => '알 수 없는 회원', 'en' => 'Unknown user' - ] + ], + 'enterClaimReason' => [ + 'ko' => '신고 사유를 입력해주세요.', + 'en' => 'Please enter reason for report' + ], + 'claimException' => [ + 'ko' => '신고에 실패하였습니다.
계속 실패하는 경우 관리자에게 문의해주세요.', + 'en' => 'Failed to report.
If you continue to receive this error please contact Administrator.' + ], + 'cantReportAdminException' => [ + 'ko' => '관리자는 신고할 수 없습니다.', + 'en' => "You can't report admin" + ], + 'cantReportMyselfException' => [ + 'ko' => '자기 자신을 신고할 수 없습니다', + 'en' => "You can't report yourself" + ], + 'cantReportWithdrawnUserException' => [ + 'ko' => '탈퇴한 사용자입니다.', + 'en' => "You can't report withdrawn user" + ], + 'guestCannotReportException' => [ + 'ko' => '비회원은 신고할 수 없습니다.', + 'en' => 'Guest cannot report' + ], + 'notSupportClaimTypeException' => [ + 'ko' => '지원하지 않는 신고 유형 입니다.', + 'en' => 'Not supported report type' + ], + 'notFoundTargetException' => [ + 'ko' => '잘못된 신고 대상 입니다.', + 'en' => 'Invalid report target' + ], + 'statusNew' => [ + 'ko' => '접수중', + 'en' => 'New' + ], + 'statusProcessing' => [ + 'ko' => '처리중', + 'en' => 'Processing' + ], + 'statusClosed' => [ + 'ko' => '처리됨', + 'en' => 'Closed' + ], + 'claimTypeBoard' => [ + 'ko' => '게시물', + 'en' => 'Board' + ], + 'claimTypeComment' => [ + 'ko' => '댓글', + 'en' => 'Comment' + ], + 'claimTypeUser' => [ + 'ko' => '유저', + 'en' => 'User' + ], ]; diff --git a/plugin.php b/plugin.php index ca4521a..c08ff25 100644 --- a/plugin.php +++ b/plugin.php @@ -1,71 +1,66 @@ - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ - namespace Xpressengine\Plugins\Claim; -use Illuminate\Database\Schema\Blueprint; -use Route; -use Schema; -use XeToggleMenu; +use Illuminate\Support\Facades\Route; +use App\Facades\XeToggleMenu; use Xpressengine\Plugin\AbstractPlugin; +use Xpressengine\Plugins\Claim\Models\ClaimLog; +use Xpressengine\Plugins\Claim\Factory\ClaimFactory; +use Xpressengine\Plugins\Claim\Repositories\ClaimRepository; /** - * Plugin - * - * @category Claim - * @package Xpressengine\Plugins\Claim - * @author XE Developers - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io + * Class Plugin + * @package Xpressengine\Plugins\Claim */ class Plugin extends AbstractPlugin { /** - * boot - * + * @var Migrations\MigrationResource + */ + protected $migrationResource; + + /** * @return void */ - public function boot() + public function __construct() { - $this->registerToggleMenu(); - $this->registerManageRoute(); - $this->registerFixedRoute(); - $this->registerSettingsMenu(); + $this->migrationResource = app(Migrations\MigrationResource::class); - app()->singleton(Handler::class, function () { - $proxyClass = app('xe.interception')->proxy(Handler::class); - return new $proxyClass(app('xe.config')); - }); - app()->alias(Handler::class, 'xe.claim.handler'); + parent::__construct(); } /** - * activate - * - * @param null $installedVersion installed version + * boot * @return void */ - public function activate($installedVersion = null) + public function boot() { + $this->registerRoute(); + $this->registerSettingsMenu(); + + ClaimRepository::setModel(ClaimLog::class); + + app()->singleton(ClaimHandler::class, function () { + $proxyClass = app('xe.interception')->proxy(ClaimHandler::class); + return new $proxyClass(app(ClaimRepository::class), app('xe.config')); + }); + app()->alias(ClaimHandler::class, 'xe.claim.handler'); + + app()->singleton(ClaimFactory::class, function () { + return new ClaimFactory(app(ClaimHandler::class)); + }); } /** + * check for updates * @return boolean */ - public function checkUpdated($installedVersion = NULL) + public function checkUpdated($installedVersion = null) { + if ($this->migrationResource->checkInstalled() === false) { + return false; + } + if (version_compare($installedVersion, '0.9.1', '<=')) { $toggleMenuId = 'module/board@board'; $activated = XeToggleMenu::getActivated($toggleMenuId); @@ -87,36 +82,38 @@ public function checkUpdated($installedVersion = NULL) public function update($installedVersion = null) { + if ($this->migrationResource->checkInstalled() === false) { + $this->migrationResource->install(); + } + $this->putLang(); - $this->setToggleMenuConfig(); + $this->setToggleMenuConfigs(); } public function install() { - $this->createClaimLogTable(); + if ($this->migrationResource->checkInstalled() === false) { + $this->migrationResource->install(); + } + $this->putLang(); - $this->setToggleMenuConfig(); + $this->setToggleMenuConfigs(); } /** - * set toggle menu item to board, comment - * + * set toggle menu item to board, comment, user * @return void */ - protected function setToggleMenuConfig() + protected function setToggleMenuConfigs() { - $toggleMenuId = 'module/board@board'; - $activated = XeToggleMenu::getActivated($toggleMenuId); - $itemId = 'module/board@board/toggleMenu/claim@boardClaimItem'; - if (isset($activated[$itemId]) === false) { - $setActivate = array_keys($activated); - $setActivate[] = $itemId; - XeToggleMenu::setActivates($toggleMenuId, null, $setActivate); - } + $this->setToggleMenuConfig('user', 'user/toggleMenu/claim@userClaimItem'); + $this->setToggleMenuConfig('comment', 'comment/toggleMenu/claim@commentClaimItem'); + $this->setToggleMenuConfig('module/board@board', 'module/board@board/toggleMenu/claim@boardClaimItem'); + } - $toggleMenuId = 'comment'; + protected function setToggleMenuConfig(string $toggleMenuId, string $itemId) + { $activated = XeToggleMenu::getActivated($toggleMenuId); - $itemId = 'comment/toggleMenu/claim@commentClaimItem'; if (isset($activated[$itemId]) === false) { $setActivate = array_keys($activated); $setActivate[] = $itemId; @@ -124,98 +121,38 @@ protected function setToggleMenuConfig() } } - public function createClaimLogTable() - { - if (Schema::hasTable('claim_logs') === false) { - Schema::create('claim_logs', function (Blueprint $table) { - $table->bigIncrements('id'); - $table->string('claim_type', 36); - $table->string('short_cut', 255); - $table->string('target_id', 36); - $table->string('user_id', 36); - $table->string('ipaddress', 16); - $table->string('message', 255); - $table->timestamp('created_at'); - $table->timestamp('updated_at'); - - $table->index(['target_id', 'user_id']); - $table->index(['target_id', 'claim_type']); - }); - } - } - - protected function putLang() - { - app('xe.translator')->putFromLangDataSource('claim', base_path('plugins/claim/langs/lang.php')); - } - /** - * register toggle menu - * + * put lang * @return void */ - protected function registerToggleMenu() - { - app('xe.pluginRegister')->add(ToggleMenus\BoardClaimItem::class); - app('xe.pluginRegister')->add(ToggleMenus\CommentClaimItem::class); - } - - /** - * Register Plugin Settings Route - * - * @return void - */ - protected function registerManageRoute() + protected function putLang() { - Route::settings(self::getId(), function () { - Route::get( - '/', - [ - 'as' => 'manage.claim.claim.index', - 'uses' => 'ManagerController@index', - 'settings_menu' => 'contents.claim' - ] - ); - Route::post('delete', ['as' => 'manage.claim.claim.delete', 'uses' => 'ManagerController@delete']); - Route::get('config', ['as' => 'manage.claim.claim.config', 'uses' => 'ManagerController@config']); - Route::get( - 'config/edit', - ['as' => 'manage.claim.claim.config.edit', 'uses' => 'ManagerController@configEdit'] - ); - Route::post( - 'config/update', - ['as' => 'manage.claim.claim.config.update', 'uses' => 'ManagerController@configUpdate'] - ); - }, ['namespace' => 'Xpressengine\Plugins\Claim\Controllers']); + app('xe.translator')->putFromLangDataSource( + static::getId(), + static::path('langs/lang.php') + ); } /** - * register fixed route - * + * register route * @return void */ - protected function registerFixedRoute() + protected function registerRoute() { - Route::fixed('claim', function () { - Route::get('', ['as' => 'fixed.claim.index', 'uses' => 'UserController@index']); - Route::post('store', ['as' => 'fixed.claim.store', 'uses' => 'UserController@store']); - Route::post('destroy', ['as' => 'fixed.claim.destroy', 'uses' => 'UserController@destroy']); - }, ['namespace' => 'Xpressengine\Plugins\Claim\Controllers']); + Route::middleware('web')->group(static::path('routes.php')); } /** * register interception - * * @return void */ - public static function registerSettingsMenu() + protected function registerSettingsMenu() { - // settings menu 등록 $menus = [ 'contents.claim' => [ 'title' => 'xe::claim', 'display' => true, - 'description' => 'blur blur~', + 'description' => 'xe::claim', 'ordering' => 5000 ], ]; diff --git a/routes.php b/routes.php new file mode 100644 index 0000000..1ba9a79 --- /dev/null +++ b/routes.php @@ -0,0 +1,51 @@ + 'settings.claim.index', + 'uses' => 'ClaimSettingsController@index', + 'settings_menu' => 'contents.claim' + ]); + + Route::get('/{id}', [ + 'as' => 'settings.claim.edit', + 'uses' => 'ClaimSettingsController@edit' + ]); + + Route::put('/{id}', [ + 'as' => 'settings.claim.update', + 'uses' => 'ClaimSettingsController@update' + ]); + + Route::post('/{id}/delete', [ + 'as' => 'settings.claim.delete', + 'uses' => 'ClaimSettingsController@delete' + ]); + + Route::get('config', [ + 'as' => 'settings.claim.config', + 'uses' => 'ManagerController@config' + ]); + + Route::get('config/edit', [ + 'as' => 'settings.claim.config.edit', + 'uses' => 'ManagerController@configEdit' + ]); + + Route::post('config/update', [ + 'as' => 'settings.claim.config.update', + 'uses' => 'ManagerController@configUpdate' + ]); + +}, ['namespace' => 'Xpressengine\Plugins\Claim\Controllers']); + + +// fixed routes +Route::fixed('claim', function () { + Route::get('', ['as' => 'fixed.claim.index', 'uses' => 'ClaimController@index']); + Route::post('store', ['as' => 'fixed.claim.store', 'uses' => 'ClaimController@store']); + Route::post('destroy', ['as' => 'fixed.claim.destroy', 'uses' => 'ClaimController@destroy']); +}, ['namespace' => 'Xpressengine\Plugins\Claim\Controllers']); diff --git a/src/ClaimHandler.php b/src/ClaimHandler.php new file mode 100644 index 0000000..7c973d3 --- /dev/null +++ b/src/ClaimHandler.php @@ -0,0 +1,231 @@ +repository = $repository; + $this->configManager = $configManager; + } + + /** + * 해당 ID의 신고 로그를 반환 + * @param string $id + * @return ClaimLog + */ + public function findOrFail(string $id) + { + return $this->repository->findOrFail($id); + } + + /** + * 해당 컨텐츠가 신고된 횟수를 반환 + * @param string $claimType + * @param string $targetId + * @return int + */ + public function count(string $claimType, string $targetId) + { + return $this->repository->where('target_id', $targetId) + ->where('claim_type', $claimType) + ->count(); + } + + /** + * 신고 로그 삭제 + * @param string $id + * @return bool|null + * @throws \Exception + */ + public function delete(string $id) + { + return $this->repository->findOrFail($id)->delete(); + } + + /** + * 신고 로그 삭제 + * @param string $claimType + * @param string $targetId + * @param UserInterface $author + * @return mixed + */ + public function deleteByTargetId(string $claimType, string $targetId, UserInterface $author) + { + return $this->repository->where('user_id', $author->getKey()) + ->where('target_id', $targetId) + ->where('claim_type', $claimType) + ->delete(); + } + + /** + * 대상을 신고 + * @param string $claimType + * @param string $targetId + * @param string $targetUserId + * @param UserInterface $author + * @param string $shortCut + * @param string $message + * @return void + */ + public function report( + string $claimType, + string $targetId, + string $targetUserId, + UserInterface $author, + string $shortCut, + string $message = '' + ) { + if ($this->exists($claimType, $author, $targetId) === true) { + throw new Exceptions\AlreadyClaimedException; + } + + return $this->repository->create([ + 'claim_type' => $claimType, + 'short_cut' => $shortCut, + 'target_id' => $targetId, + 'target_user_id' => $targetUserId, + 'user_id' => $author->getKey(), + 'message' => $message, + 'status' => ClaimLog::STATUS_NEW, + 'ipaddress' => $_SERVER['REMOTE_ADDR'], + ]); + } + + /** + * 신고 여부 + * @param string $claimType + * @param UserInterface $author + * @param string $targetId + * @return bool + */ + public function exists(string $claimType, UserInterface $author, string $targetId) + { + return $this->repository->where('user_id', $author->getKey()) + ->where('target_id', $targetId) + ->where('claim_type', $claimType) + ->exists(); + } + + /** + * 신고 로그 수정 + * @param string $id + * @param string $status + * @param string $adminMessage + * @return ClaimLog + */ + public function updateLog(string $id, string $status, string $adminMessage = '') + { + $log = $this->findOrFail($id); + + if (!array_key_exists($status, ClaimLog::STATUSES)) { + throw new \UnexpectedValueException('Invalid Claim status'); + } + + $log->status = $status; + $log->admin_message = $adminMessage; + $log->save(); + + return $log; + } + + /** + * 신고 로그 페이지네이션 반환 + * @param array $inputs + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginateClaimLogs(array $inputs = []) + { + $query = $this->repository->query(); + $this->applyFiltersToClaimLogs($query, $inputs); + $logs = $query->paginate(); + + /** @var ClaimFactory $claimFactory */ + $claimFactory = app(ClaimFactory::class); + $logs->setCollection($logs->getCollection()->map(function ($log) use ($claimFactory) { + $log->claim_type_text = xe_trans($claimFactory->make($log->claim_type)->getText()); + return $log; + })); + + return $logs; + } + + /** + * 신고 로그 검색 필터 적용 + * @param Builder $query + * @param array $inputs + * @return Builder + */ + protected function applyFiltersToClaimLogs(Builder $query, array $inputs = []) + { + $claimType = array_get($inputs, 'claim_type'); + if ($claimType !== null) { + $query->where('claim_type', $claimType); + } + + $claimStatus = array_get($inputs, 'claim_status'); + if ($claimStatus !== null) { + $query->where('status', $claimStatus); + } + + $keyField = array_get($inputs, 'keyfield'); + $keyword = array_get($inputs, 'keyword'); + if ($keyField !== null && $keyword !== null) { + if ($keyField === 'author_name') { + $query->whereHas('user', function ($query) use ($keyword) { + $query->where('display_name', 'like', "%{$keyword}%"); + }); + } + + else if ($keyField === 'target_name') { + $query->whereHas('targetUser', function ($query) use ($keyword) { + $query->where('display_name', 'like', "%{$keyword}%"); + }); + } + + else if ($keyField === 'message') { + $query->where('message', 'like', "%{$keyword}%"); + } + } + + $startDate = array_get($inputs, 'start_date'); + $endDate = array_get($inputs, 'end_date'); + if ($startDate !== null || $endDate !== null) { + $query->whereBetween('created_at', [ + $startDate ? $startDate . ' 00:00:00' : Carbon::minValue(), + $endDate ? $endDate . ' 23:59:59' : Carbon::maxValue() + ]); + } + + $query->orderByDesc('created_at'); + + return $query; + } +} diff --git a/src/Controllers/UserController.php b/src/Controllers/ClaimController.php similarity index 52% rename from src/Controllers/UserController.php rename to src/Controllers/ClaimController.php index f6e3890..21a2a4a 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/ClaimController.php @@ -1,6 +1,6 @@ get('targetId'); + $claimType = $request->get('from'); - $this->handler->set($from); - - $invoked = $this->handler->has($targetId, Auth::user()); - $count = $this->handler->count($targetId); + $invoked = $this->handler->exists($claimType, auth()->user(), $targetId); + $count = $this->handler->count($claimType, $targetId); return XePresenter::makeApi([ 'invoked' => $invoked, @@ -71,44 +66,36 @@ public function index() } /** - * store - * * @return \Xpressengine\Presenter\Presentable */ - public function store() + public function store(ClaimFactory $factory, Request $request) { - if (Auth::check() === false) { + if (auth()->check() === false) { throw new LoginRequiredHttpException; } - $targetId = Request::get('targetId'); - $shortCut = Request::get('shortCut'); - $from = Request::get('from'); + $author = auth()->user(); + $targetId = $request->get('targetId'); + $shortCut = $request->get('shortCut'); + $claimType = $request->get('from'); + $message = $request->get('message') ?: ''; - $this->handler->set($from); + $targetClaimType = $factory->make($claimType); + $targetClaimType->report($author, $targetId, $shortCut, $message); - try { - $this->handler->add($targetId, Auth::user(), $shortCut); - } catch (\Exception $e) { - throw new AlreadyClaimedHttpException; - } - return $this->index(); + return $this->index($request); } /** - * destroy - * * @return \Xpressengine\Presenter\Presentable */ - public function destroy() + public function destroy(Request $request) { - $targetId = Request::get('targetId'); - $from = Request::get('from'); - - $this->handler->set($from); + $targetId = $request->get('targetId'); + $claimType = $request->get('from'); - $this->handler->removeByTargetId($targetId, Auth::user()); + $this->handler->deleteByTargetId($claimType, $targetId, auth()->user()); - return $this->index(); + return $this->index($request); } } diff --git a/src/Controllers/ClaimSettingsController.php b/src/Controllers/ClaimSettingsController.php new file mode 100644 index 0000000..6e23cb9 --- /dev/null +++ b/src/Controllers/ClaimSettingsController.php @@ -0,0 +1,128 @@ + + * @copyright 2019 Copyright XEHub Corp. + * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL + * @link https://xpressengine.io + */ + +namespace Xpressengine\Plugins\Claim\Controllers; + +use Illuminate\Http\Request; +use App\Http\Controllers\Controller; +use App\Facades\XeDB; +use App\Facades\XePresenter; +use Xpressengine\Plugins\Claim\ClaimHandler; +use Xpressengine\Plugins\Claim\Factory\ClaimFactory; +use Xpressengine\Plugins\Claim\Models\ClaimLog; + +/** + * ClaimSettingsController + * + * @category Claim + * @package Xpressengine\Plugins\Claim + * @author XE Developers + * @copyright 2019 Copyright XEHub Corp. + * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL + * @link https://xpressengine.io + */ +class ClaimSettingsController extends Controller +{ + /** + * @var ClaimHandler + */ + protected $handler; + + /** + * @var ClaimFactory + */ + protected $factory; + + /** + * @return void + */ + public function __construct(ClaimHandler $handler, ClaimFactory $factory) + { + $this->handler = $handler; + $this->factory = $factory; + } + + /** + * @return \Xpressengine\Presenter\Presentable + */ + public function index(Request $request) + { + $paginate = $this->handler->paginateClaimLogs($request->all()); + $claimTypes = $this->factory->getActivateTypes(); + $claimStatuses = ClaimLog::STATUSES; + + return XePresenter::make('claim::views.settings.index', [ + 'paginate' => $paginate, + 'claimTypes' => $claimTypes, + 'claimStatuses' => $claimStatuses + ]); + } + + /** + * @param string $id + * @return mixed + */ + public function edit(string $id) + { + $log = $this->handler->findOrFail($id); + $claimStatuses = ClaimLog::STATUSES; + $targetClaimTypeText = xe_trans($this->handler->getClaimTypeByKey($log->claim_type)->getText()); + + session()->flash('settings_intended_url', url()->previous()); + + return XePresenter::make('claim::views.settings.edit', [ + 'log' => $log, + 'claimStatuses' => $claimStatuses, + 'targetClaimTypeText' => $targetClaimTypeText + ]); + } + + /** + * @param Request $request + * @param string $id + * @return \Illuminate\Http\RedirectResponse + * @throws \Exception + */ + public function update(Request $request, string $id) + { + $status = $request->get('status'); + $adminMessage = $request->get('admin_message') ?: ''; + + XeDB::beginTransaction(); + try { + $this->handler->updateLog($id, $status, $adminMessage); + XeDB::commit(); + } catch (\Exception $e) { + XeDB::rollback(); + throw $e; + } + + return redirect()->intended(session()->get('settings_intended_url')) + ->with('alert', ['type' => 'success', 'message' => xe_trans('xe::saved')]); + } + + /** + * @param string $id + * @return \Illuminate\Http\RedirectResponse + * @throws \Exception + */ + public function delete(string $id) + { + $this->handler->delete($id); + + return redirect()->back()->with('alert', ['type' => 'success', 'message' => xe_trans('xe::deleted')]); + } +} diff --git a/src/Controllers/ManagerController.php b/src/Controllers/ManagerController.php deleted file mode 100644 index 38aa809..0000000 --- a/src/Controllers/ManagerController.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ - -namespace Xpressengine\Plugins\Claim\Controllers; - -use Request; -use View; -use Redirect; -use XePresenter; -use App; -use XeDB; -use Cfg; -use DynamicField; -use Validator; -use App\Http\Controllers\Controller; -use Xpressengine\Plugins\Claim\Handler; -use Xpressengine\Plugins\Claim\Models\ClaimLog; - -/** - * ManagerController - * - * @category Claim - * @package Xpressengine\Plugins\Claim - * @author XE Developers - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ -class ManagerController extends Controller -{ - /** - * @var Handler - */ - protected $handler; - - /** - * ManagerController constructor. - */ - public function __construct() - { - XePresenter::setSettingsSkinTargetId('claim'); - } - - /** - * index - * - * @return \Xpressengine\Presenter\Presentable - */ - public function index() - { - $wheres = []; - $orders = []; - - $paginate = ClaimLog::orderBy('created_at', 'desc')->paginate(20)->appends(Request::except('page')); - - return XePresenter::make('index', [ - 'action' => 'index', - 'paginate' => $paginate, - ]); - } - - /** - * delete - * - * @return \Xpressengine\Presenter\Presentable - */ - public function delete() - { - $id = Request::get('id'); - - $this->handler->remove($id); - - return XePresenter::makeApi([]); - } -} diff --git a/src/Exceptions/AlreadyClaimedException.php b/src/Exceptions/AlreadyClaimedException.php index cd1d14f..3085385 100644 --- a/src/Exceptions/AlreadyClaimedException.php +++ b/src/Exceptions/AlreadyClaimedException.php @@ -16,7 +16,7 @@ namespace Xpressengine\Plugins\Claim\Exceptions; -use Xpressengine\Plugins\Claim\ClaimException; +use Symfony\Component\HttpFoundation\Response; /** * AlreadyClaimedException @@ -30,5 +30,7 @@ */ class AlreadyClaimedException extends ClaimException { + protected $message = 'claim::AlreadyClaimed'; + protected $statusCode = Response::HTTP_INTERNAL_SERVER_ERROR; } diff --git a/src/Exceptions/AlreadyClaimedHttpException.php b/src/Exceptions/AlreadyClaimedHttpException.php deleted file mode 100644 index 80daaa0..0000000 --- a/src/Exceptions/AlreadyClaimedHttpException.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ - -namespace Xpressengine\Plugins\Claim\Exceptions; - -use Xpressengine\Plugins\Board\HttpBoardException; -use Symfony\Component\HttpFoundation\Response; - -/** - * AlreadyClaimedHttpException - * - * @category Claim - * @package Xpressengine\Plugins\Claim - * @author XE Developers - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ -class AlreadyClaimedHttpException extends HttpBoardException -{ - protected $message = 'claim::AlreadyClaimed'; - - protected $statusCode = Response::HTTP_INTERNAL_SERVER_ERROR; -} diff --git a/src/Exceptions/CantReportAdminException.php b/src/Exceptions/CantReportAdminException.php new file mode 100644 index 0000000..2031443 --- /dev/null +++ b/src/Exceptions/CantReportAdminException.php @@ -0,0 +1,7 @@ + + */ + private $activateClaimTypes = []; + + /** + * default claim types + * @var string[] + */ + protected $defaultClaimTypes = [ + Types\UserClaim::class, + Types\BoardClaim::class, + Types\CommentClaim::class + ]; + + public function __construct(ClaimHandler $handler) + { + foreach ($this->defaultClaimTypes as $class) { + $targetClaimType = app($class, ['handler' => $handler]); + assert($targetClaimType instanceof Types\AbstractClaimType); + $this->register($targetClaimType); + } + } + + /** + * @param AbstractClaimType $type + * @return void + */ + public function register(AbstractClaimType $type) + { + if (!array_key_exists($type->getName(), $this->activateClaimTypes) && class_exists($type->getClass())) { + $this->activateClaimTypes[$type->getName()] = $type; + } + } + + /** + * @param string $name + * @return void + */ + public function remove(string $name) + { + if (array_key_exists($name, $this->activateClaimTypes)) { + unset($this->activateClaimTypes[$name]); + } + } + + /** + * @param string $name + * @return AbstractClaimType + */ + public function make(string $name) + { + $targetType = array_get($this->activateClaimTypes, $name); + if ($targetType === null) { + throw new NotSupportClaimTypeException(); + } + + return $targetType; + } + + /** + * @return array + */ + public function getActivateTypes() + { + return $this->activateClaimTypes; + } +} diff --git a/src/Factory/Types/AbstractClaimType.php b/src/Factory/Types/AbstractClaimType.php new file mode 100644 index 0000000..a5d7fca --- /dev/null +++ b/src/Factory/Types/AbstractClaimType.php @@ -0,0 +1,105 @@ +handler = $handler; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + /** + * @param UserInterface $author + * @param string $targetId + * @return bool + */ + public function exists(UserInterface $author, string $targetId) + { + return $this->handler->exists($this->name, $author, $targetId); + } + + /** + * report target + * @return void + */ + public function report( + UserInterface $author, + string $targetId, + string $shortCut, + string $message = '', + string $targetUserId = '' + ) { + $this->handler->report( + $this->name, + $targetId, + $targetUserId, + $author, + $shortCut, + $message + ); + } + + /** + * check report conditions + * @param UserInterface $author + * @param T $target + * @return void + */ + public function checkReportConditions(UserInterface $author, $target) { } +} diff --git a/src/Factory/Types/BoardClaim.php b/src/Factory/Types/BoardClaim.php new file mode 100644 index 0000000..0632732 --- /dev/null +++ b/src/Factory/Types/BoardClaim.php @@ -0,0 +1,73 @@ +checkReportConditions($author, $target); + + parent::report($author, $targetId, $shortCut, $message, $target->user_id); + } + + /** + * check report conditions + * @param UserInterface $author + * @param $target + * @return void + */ + public function checkReportConditions( + UserInterface $author, + $target + ) { + assert($target instanceof \Xpressengine\Plugins\Board\Models\Board); + + if (($targetUser = $target->getAuthor()) && $targetUser instanceof User) { + if ($targetUser->getKey() === $author->getKey()) { + throw new CantReportMyselfException(); + } + + if ($targetUser->isAdmin()) { + throw new CantReportAdminException(); + } + } + + parent::checkReportConditions($author, $target->getKey()); + } +} diff --git a/src/Factory/Types/CommentClaim.php b/src/Factory/Types/CommentClaim.php new file mode 100644 index 0000000..5dec7f4 --- /dev/null +++ b/src/Factory/Types/CommentClaim.php @@ -0,0 +1,73 @@ +checkReportConditions($author, $target); + + parent::report($author, $targetId, $shortCut, $message, $target->user_id); + } + + /** + * check report conditions + * @param UserInterface $author + * @param $target + * @return void + */ + public function checkReportConditions( + UserInterface $author, + $target + ) { + assert($target instanceof \Xpressengine\Plugins\Comment\Models\Comment); + + if (($targetUser = $target->getAuthor()) && $targetUser instanceof User) { + if ($targetUser->getKey() === $author->getKey()) { + throw new CantReportMyselfException(); + } + + if ($targetUser->isAdmin()) { + throw new CantReportAdminException(); + } + } + + parent::checkReportConditions($author, $target->id); + } +} diff --git a/src/Factory/Types/UserClaim.php b/src/Factory/Types/UserClaim.php new file mode 100644 index 0000000..9b874f6 --- /dev/null +++ b/src/Factory/Types/UserClaim.php @@ -0,0 +1,77 @@ +checkReportConditions($author, $target); + + parent::report($author, $targetId, $shortCut, $message, $target->getKey()); + } + + /** + * check report conditions + * @param UserInterface $author + * @param $target + * @return void + */ + public function checkReportConditions(UserInterface $author, $target) + { + if (($author instanceof User) === false) { + throw new GuestCannotReportException(); + } + + if ($target->getKey() === $author->getKey()) { + throw new CantReportMyselfException(); + } + + if ($target->isAdmin()) { + throw new CantReportAdminException(); + } + + if ($target->getStatus() !== User::STATUS_ACTIVATED) { + throw new CantReportWithdrawnUserException(); + } + + parent::checkReportConditions($author, $target->getKey()); + } +} diff --git a/src/Handler.php b/src/Handler.php deleted file mode 100644 index 7c75587..0000000 --- a/src/Handler.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ - -namespace Xpressengine\Plugins\Claim; - -use Xpressengine\Counter\Counter; -use Xpressengine\Config\ConfigManager; -use Xpressengine\Plugins\Claim\Models\ClaimLog; -use Xpressengine\User\Models\User; -use Xpressengine\User\UserInterface; - -/** - * Handler - * - * @category Claim - * @package Xpressengine\Plugins\Claim - * @author XE Developers - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ -class Handler -{ - /** - * @var ConfigManager - */ - protected $configManager; - - /** - * @var string - */ - protected $claimType; - - /** - * @var string - */ - const CONFIG_NAME = 'Claim'; - - /** - * create instance - * - * @param ConfigManager $configManager config manager - */ - public function __construct(ConfigManager $configManager) - { - $this->configManager = $configManager; - } - - /** - * claim 에서 사용 할 type name 설정 - * - * @param string $claimType claim type - * - * @return void - */ - public function set($claimType) - { - $this->claimType = $claimType; - } - - /** - * 신고 수 - * - * @param string $targetId targetId - * - * @return int - */ - public function count($targetId) - { - return ClaimLog::where('target_id', $targetId)->where('claim_type', $this->claimType)->count(); - } - - /** - * 신고 삭제 - * - * @param int $id id - * - * @return void - */ - public function remove($id) - { - ClaimLog::find($id)->delete(); - } - - /** - * 신고 삭제 - * - * @param string $targetId targetId - * @param UserInterface $author user instance - * - * @return void - */ - public function removeByTargetId($targetId, UserInterface $author) - { - ClaimLog::where('user_id', $author->getId())->where('target_id', $targetId) - ->where('claim_type', $this->claimType)->delete(); - } - - /** - * 신고 추가 - * - * @param string $targetId targetId - * @param UserInterface $author user instance - * @param string $shortCut 바로가기 - * - * @return ClaimLog - */ - public function add($targetId, UserInterface $author, $shortCut) - { - if ($this->has($targetId, $author) === true) { - throw new Exceptions\AlreadyClaimedException; - } - - $item = ClaimLog::create([ - 'claim_type' => $this->claimType, - 'short_cut' => $shortCut, - 'target_id' => $targetId, - 'user_id' => $author->getId(), - 'ipaddress' => $_SERVER['REMOTE_ADDR'], - ]); - - return $item; - } - - /** - * 신고 여부 - * - * @param string $targetId targetId - * @param UserInterface $author user instance - * - * @return bool - */ - public function has($targetId, UserInterface $author) - { - return ClaimLog::where('user_id', $author->getId())->where('target_id', $targetId) - ->where('claim_type', $this->claimType)->first() !== null; - } -} diff --git a/src/Migrations/MigrationResource.php b/src/Migrations/MigrationResource.php new file mode 100644 index 0000000..9a360fa --- /dev/null +++ b/src/Migrations/MigrationResource.php @@ -0,0 +1,94 @@ +getSupportMigrations()->each( + function ($migration) { + $migration->install(); + } + ); + } + + /** + * check installed + * @return bool + */ + public function checkInstalled() + { + $isInstalled = true; + + $this->getSupportMigrations()->each( + function ($migration) use (&$isInstalled) { + if ($migration->checkInstalled() === false) { + $isInstalled = false; + return false; + } + + return true; + } + ); + + return $isInstalled; + } + + /** + * update migrations + * @param string|null $installedVersion + * @return void + */ + public function update(string $installedVersion = null) + { + $this->getSupportMigrations()->each( + function ($migration) use ($installedVersion) { + $migration->update($installedVersion); + } + ); + } + + /** + * check updated + * @param string|null $installedVersion + * @return bool + */ + public function checkUpdated(string $installedVersion = null) + { + $isUpdated = true; + + $this->getSupportMigrations()->each( + function ($migration) use (&$isUpdated, $installedVersion) { + if ($migration->checkUpdated() === false) { + $isUpdated = false; + return false; + } + + return true; + } + ); + + return $isUpdated; + } + + /** + * @return Collection + */ + protected function getSupportMigrations() + { + return collect([ + app(Table\ClaimLogTable::class) + ]); + } +} diff --git a/src/Migrations/Table/ClaimLogTable.php b/src/Migrations/Table/ClaimLogTable.php new file mode 100644 index 0000000..7a21ebd --- /dev/null +++ b/src/Migrations/Table/ClaimLogTable.php @@ -0,0 +1,74 @@ +checkInstalled() === false) { + $this->createTable(); + } + } + + /** + * @return bool + */ + public function checkInstalled() + { + return Schema::hasTable(ClaimLog::TABLE_NAME); + } + + /** + * @return void + */ + protected function createTable() + { + Schema::create(ClaimLog::TABLE_NAME, function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('claim_type', 36); + $table->string('short_cut', 255); + $table->string('target_id', 36); + $table->string('target_user_id', 36); + $table->string('user_id', 36); + $table->string('ipaddress', 16); + $table->string('message', 255); + $table->string('admin_message', 255)->nullable(); + $table->string('status', 255); + $table->nullableTimestamps(); + + $table->index(['target_id', 'user_id']); + $table->index(['target_id', 'claim_type']); + }); + } + + /** + * @param $installedVersion + * @return bool + */ + public function checkUpdated($installedVersion = null) + { + return true; + } + + /** + * @param $installedVersion + * @return void + */ + public function update($installedVersion = null) + { + + } +} diff --git a/src/Models/ClaimLog.php b/src/Models/ClaimLog.php index d5948e4..2f42233 100644 --- a/src/Models/ClaimLog.php +++ b/src/Models/ClaimLog.php @@ -16,27 +16,21 @@ namespace Xpressengine\Plugins\Claim\Models; -use Xpressengine\Config\ConfigEntity; -use Xpressengine\Database\Eloquent\DynamicModel; -use Xpressengine\Document\Exceptions\NotAllowedTypeException; -use Xpressengine\Document\Exceptions\DocumentNotFoundException; -use Xpressengine\Document\Exceptions\ReplyLimitationException; -use Xpressengine\Document\Exceptions\ValueRequiredException; -use Illuminate\Database\Eloquent\Builder as OriginBuilder; use Xpressengine\User\Models\User; +use Xpressengine\Database\Eloquent\DynamicModel; /** * ClaimLog * * @property int id - * @property string claimType - * @property string shortCut - * @property string targetId - * @property string uiserId + * @property string claim_type + * @property string short_cut + * @property string target_id + * @property string user_id * @property string ipaddress * @property string message - * @property string createdAt - * @property string updatedAt + * @property string created_at + * @property string updated_at * * @category Claim * @package Xpressengine\Plugins\Claim @@ -47,6 +41,27 @@ */ class ClaimLog extends DynamicModel { + const TABLE_NAME = 'claim_logs'; + + /** @var string claim status : new */ + const STATUS_NEW = 'new'; + /** @var string claim status : processing */ + const STATUS_PROCESSING = 'processing'; + /** @var string claim status : closed */ + const STATUS_CLOSED = 'closed'; + + /** @var string[] claim statuses */ + const STATUSES = [ + self::STATUS_NEW => 'claim::statusNew', + self::STATUS_PROCESSING => 'claim::statusProcessing', + self::STATUS_CLOSED => 'claim::statusClosed' + ]; + + /** + * @var bool + */ + public $timestamps = true; + /** * @var string[] */ @@ -54,7 +69,6 @@ class ClaimLog extends DynamicModel /** * user - * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() @@ -62,6 +76,15 @@ public function user() return $this->belongsTo(User::class, 'user_id'); } + /** + * target user + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function targetUser() + { + return $this->belongsTo(User::class, 'target_user_id'); + } + /** * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ diff --git a/src/Repositories/ClaimRepository.php b/src/Repositories/ClaimRepository.php new file mode 100644 index 0000000..118497b --- /dev/null +++ b/src/Repositories/ClaimRepository.php @@ -0,0 +1,15 @@ + - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ - -namespace Xpressengine\Plugins\Claim\Skin; - -use Xpressengine\Skin\AbstractSkin; -use View; - -/** - * SettingsSkin - * - * @category Claim - * @package Xpressengine\Plugins\Claim - * @author XE Developers - * @copyright 2019 Copyright XEHub Corp. - * @license http://www.gnu.org/licenses/lgpl-3.0-standalone.html LGPL - * @link https://xpressengine.io - */ -class SettingsSkin extends AbstractSkin -{ - /** - * @var string - */ - public static $id = 'claim/settingsSkin/claim@default'; - - /** - * render - * - * @return \Illuminate\View\View - */ - public function render() - { - $view = View::make('claim::views.settingsSkin._frame', $this->data); - $content = View::make(sprintf('claim::views.settingsSkin.%s', $this->view), $this->data); - $view->content = $content->render(); - - return $view; - } -} diff --git a/src/ToggleMenus/AbstractClaimItem.php b/src/ToggleMenus/AbstractClaimItem.php index c59d184..95b84c2 100644 --- a/src/ToggleMenus/AbstractClaimItem.php +++ b/src/ToggleMenus/AbstractClaimItem.php @@ -4,7 +4,7 @@ use Auth; use XeFrontend; -use Xpressengine\Plugins\Claim\Handler; +use Xpressengine\Plugins\Claim\ClaimHandler; use Xpressengine\ToggleMenu\AbstractToggleMenu; /** @@ -14,6 +14,17 @@ */ abstract class AbstractClaimItem extends AbstractToggleMenu { + /** @var ClaimHandler */ + protected $claimHandler; + + /** + * @return void + */ + public function __construct() + { + $this->claimHandler = app(ClaimHandler::class); + } + /** * get text * @@ -21,20 +32,11 @@ abstract class AbstractClaimItem extends AbstractToggleMenu */ public function getText() { - $handler = $this->claimHandler(); - - $count = $handler->count($this->identifier); - $invoked = $handler->has($this->identifier, Auth::user()); - $text = 'xe::claim'; - if ($invoked === true) { + if ($this->claimHandler->exists($this->componentType, Auth::user(), $this->identifier)) { $text = 'xe::cancelClaim'; } - if ($count > 0) { - return sprintf('%s (%s)', xe_trans($text), $count); - } - return xe_trans($text); } @@ -48,6 +50,15 @@ public function getType() return static::MENUTYPE_EXEC; } + /** + * get target class + * @return string + */ + public function getClass() + { + return $this->class; + } + /** * get toggle menu action * @@ -55,17 +66,15 @@ public function getType() */ public function getAction() { - $handler = $this->claimHandler(); - XeFrontend::translation([ 'claim::msgClaimReceived', 'claim::msgClaimCanceled', + 'claim::enterClaimReason' ]); - - if ($handler->has($this->identifier, Auth::user()) === true) { + if ($this->claimHandler->exists($this->componentType, Auth::user(), $this->identifier)) { return sprintf( - 'ClaimToggleMenu.destroyBoard(event, "%s", "%s", "%s")', + 'ClaimToggleMenu.destroyClaim(event, "%s", "%s", "%s")', route('fixed.claim.destroy'), $this->componentType, $this->identifier @@ -73,7 +82,7 @@ public function getAction() } return sprintf( - 'ClaimToggleMenu.storeBoard(event, "%s", "%s", "%s", "%s")', + 'ClaimToggleMenu.storeClaim(event, "%s", "%s", "%s", "%s")', route('fixed.claim.store'), $this->componentType, $this->identifier, @@ -91,15 +100,4 @@ public function getScript() $path = '/plugins/claim/assets/menu.js'; return asset(str_replace(base_path(), '', $path)); } - - /** - * @return Handler - */ - private function claimHandler() - { - $handler = app('xe.claim.handler'); - $handler->set($this->componentType); - - return $handler; - } } diff --git a/src/ToggleMenus/UserClaimItem.php b/src/ToggleMenus/UserClaimItem.php new file mode 100644 index 0000000..b678b10 --- /dev/null +++ b/src/ToggleMenus/UserClaimItem.php @@ -0,0 +1,6 @@ +{{ xe_trans('xe::claim') }} +@endsection + +
+
+
+ {{ method_field('put') }} + +
+
+
+
+
+

신고 관리 - No. {{ $log->id }}

+
+
+
+
+
+
+ + @if ($author = $log->user) + + + + @else + + @endif +
+ +
+ + +
+ +
+ + +
+ +
+ + + 바로가기 +
+ +
+ + @if ($targetUser = $log->targetUser) + + + + @else + + @endif +
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+
+
+
+ +
+
+
+
+
+
diff --git a/views/settings/index.blade.php b/views/settings/index.blade.php new file mode 100644 index 0000000..0ef5480 --- /dev/null +++ b/views/settings/index.blade.php @@ -0,0 +1,221 @@ + +{{ app('xe.frontend')->js('assets/core/xe-ui-component/js/xe-page.js')->load() }} +{{ app('xe.frontend')->js('assets/vendor/jqueryui/jquery-ui.min.js')->load() }} +{{ app('xe.frontend')->css('assets/vendor/jqueryui/jquery-ui.min.css')->load() }} + +@section('page_title') +

{{ xe_trans('xe::claim') }}

+@endsection + +
+
+
+
+
+
+

{{ xe_trans('xe::claim') }} {{ xe_trans('xe::management') }}

+
+
+
+
+
+
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ +
+
+ +
+
+ 접수일 + + +
+
+ + +
+ 리셋 +
+ +
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + @foreach($paginate as $item) + + + + + + + + + + + {{----}} + + @endforeach + +
No.신고한 사람접수일유형신고 대상신고 사유상태관리삭제
{{ $item->id }} + @if($author = $item->user) + {{ $author->display_name }}
{{ $author->email }}
+ @else + {{ xe_trans('claim::unknownUser') }} + @endif +
{{ $item->created_at->format('Y-m-d') }}{{ $item->claim_type_text }} + @if($targetUser = $item->targetUser) + {{ $targetUser->display_name }}
{{ $targetUser->email }}
+ @else + {{ xe_trans('claim::unknownUser') }} + @endif +
{{ $item->message }}{{ xe_trans(array_get($claimStatuses, $item->status, $item->status)) }} + +
+
+
+ + +
+
+
+
+ +
+ {{ csrf_field() }} +
+ + diff --git a/views/settingsSkin/_frame.blade.php b/views/settingsSkin/_frame.blade.php deleted file mode 100644 index 1cea95a..0000000 --- a/views/settingsSkin/_frame.blade.php +++ /dev/null @@ -1,10 +0,0 @@ -@section('page_title') -

{{xe_trans('claim::claimManage')}}

-@stop - -{{-- include contents blade file --}} -@section('content') -
- {!! isset($content) ? $content : '' !!} -
-@show diff --git a/views/settingsSkin/index.blade.php b/views/settingsSkin/index.blade.php deleted file mode 100644 index 751ebb9..0000000 --- a/views/settingsSkin/index.blade.php +++ /dev/null @@ -1,116 +0,0 @@ -
-
-
-
-
-
-

{{ xe_trans('xe::claim') }} {{ xe_trans('xe::management') }}

-
-
-
-
-
-
- -
-
-
-
- - - - - - - - - - - - @foreach($paginate as $item) - - @if ($item->user != null) - - @else - - @endif - - - - {{----}} - {{----}} - - @endforeach - -
{{ xe_trans('xe::claim') }} {{ xe_trans('xe::user') }}{{ xe_trans('xe::shortcut') }}{{ xe_trans('xe::date') }}{{ xe_trans('xe::ipAddress') }}
[{{ $item->user->getDisplayName() }}][{{xe_trans('claim::unknownUser')}}]{{ $item['claim_type'] }} {{ $item['created_at'] }}{{ $item['ipaddress'] }}
-
-
- - -
-
-
-
- -{{----}}