mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update admin area
This commit is contained in:
@@ -12,7 +12,7 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
$regexes = new Regexes(['Settings' => null, 'Table_Name' => 'collection_regexes']);
|
||||
@@ -21,17 +21,19 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
|
||||
$group = ($request->has('group') && ! empty($request->input('group')) ? $request->input('group') : '');
|
||||
$regex = $regexes->getRegex($group);
|
||||
$this->smarty->assign(compact('group', 'regex'));
|
||||
|
||||
$content = $this->smarty->fetch('collection_regexes-list.tpl');
|
||||
$this->viewData = array_merge($this->viewData, [
|
||||
'group' => $group,
|
||||
'regex' => $regex,
|
||||
'title' => $title,
|
||||
'meta_title' => $meta_title,
|
||||
]);
|
||||
|
||||
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
||||
|
||||
$this->adminrender();
|
||||
return view('admin.collection-regexes-list', $this->viewData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|void
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
@@ -41,6 +43,7 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
$regexes = new Regexes(['Settings' => null, 'Table_Name' => 'collection_regexes']);
|
||||
$error = '';
|
||||
$regex = ['id' => '', 'regex' => '', 'description' => '', 'group_regex' => '', 'ordinal' => '', 'status' => 1];
|
||||
$meta_title = $title = 'Collections Regex';
|
||||
|
||||
switch ($request->input('action') ?? 'view') {
|
||||
case 'submit':
|
||||
@@ -70,7 +73,6 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
}
|
||||
|
||||
return redirect()->to('admin/collection_regexes-list');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
default:
|
||||
@@ -84,22 +86,22 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
break;
|
||||
}
|
||||
|
||||
$this->smarty->assign('regex', $regex);
|
||||
$this->smarty->assign('error', $error);
|
||||
$this->smarty->assign('status_ids', [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE]);
|
||||
$this->smarty->assign('status_names', ['Yes', 'No']);
|
||||
$this->viewData = array_merge($this->viewData, [
|
||||
'regex' => (object) $regex,
|
||||
'error' => $error,
|
||||
'status_ids' => [Category::STATUS_ACTIVE, Category::STATUS_INACTIVE],
|
||||
'status_names' => ['Yes', 'No'],
|
||||
'title' => $title,
|
||||
'meta_title' => $meta_title,
|
||||
]);
|
||||
|
||||
$content = $this->smarty->fetch('collection_regexes-edit.tpl');
|
||||
|
||||
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
||||
|
||||
$this->adminrender();
|
||||
return view('admin.collection-regexes-edit', $this->viewData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testRegex(Request $request): void
|
||||
public function testRegex(Request $request)
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
$meta_title = $title = 'Collections Regex Test';
|
||||
@@ -107,16 +109,21 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
$group = trim($request->has('group') && ! empty($request->input('group')) ? $request->input('group') : '');
|
||||
$regex = trim($request->has('regex') && ! empty($request->input('regex')) ? $request->input('regex') : '');
|
||||
$limit = ($request->has('limit') && is_numeric($request->input('limit')) ? $request->input('limit') : 50);
|
||||
$this->smarty->assign(['group' => $group, 'regex' => $regex, 'limit' => $limit]);
|
||||
|
||||
$data = null;
|
||||
if ($group && $regex) {
|
||||
$this->smarty->assign('data', (new Regexes(['Settings' => null, 'Table_Name' => 'collection_regexes']))->testCollectionRegex($group, $regex, $limit));
|
||||
$data = (new Regexes(['Settings' => null, 'Table_Name' => 'collection_regexes']))->testCollectionRegex($group, $regex, $limit);
|
||||
}
|
||||
|
||||
$content = $this->smarty->fetch('collection_regexes-test.tpl');
|
||||
$this->viewData = array_merge($this->viewData, [
|
||||
'group' => $group,
|
||||
'regex' => $regex,
|
||||
'limit' => $limit,
|
||||
'data' => $data,
|
||||
'title' => $title,
|
||||
'meta_title' => $meta_title,
|
||||
]);
|
||||
|
||||
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
||||
|
||||
$this->adminrender();
|
||||
return view('admin.collection-regexes-test', $this->viewData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user