From: Andrey Kutejko Date: Tue, 19 Aug 2014 18:39:43 +0000 (+0300) Subject: isolate admin page rendering X-Git-Tag: 0.6~190 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=b624f0cf368e4d45817a4f256fa637c1c8b4f7da;p=ipf.git isolate admin page rendering --- diff --git a/ipf/admin/app.php b/ipf/admin/app.php index ae4ae7a..ae2e497 100644 --- a/ipf/admin/app.php +++ b/ipf/admin/app.php @@ -37,6 +37,14 @@ class IPF_Admin_App extends IPF_Application ); } + public static function RenderToResponse($tplfile, $params=array(), $request=null) + { + $context = IPF_Project_Template::context($params, $request); + $tmpl = new IPF_Template_File($tplfile, IPF_Project_Template::getDefaultTemplateEnvironment()); + $html = $tmpl->render($context); + return new IPF_HTTP_Response($html); + } + static function checkAdminAuth($request) { $ok = true; diff --git a/ipf/admin/model.php b/ipf/admin/model.php index 60e7a80..bd3b1ed 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -468,7 +468,7 @@ class IPF_Admin_Model protected function renderToResponse($template, $context, $request) { $context = array_merge($this->context($request), $context); - return IPF_Shortcuts::RenderToResponse($template, $context, $request); + return IPF_Admin_App::RenderToResponse($template, $context, $request); } protected function setInlines($model, $data=null) diff --git a/ipf/admin/views.php b/ipf/admin/views.php index eadbb9a..19a2b6b 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -52,7 +52,7 @@ function IPF_Admin_Views_Index($request, $match) 'app_list' => $app_list, 'admin_log' => $admin_log, ); - return IPF_Shortcuts::RenderToResponse('admin/index.html', $context, $request); + return IPF_Admin_App::RenderToResponse('admin/index.html', $context, $request); } function IPF_Admin_Views_ListItems($request, $match) @@ -261,7 +261,7 @@ function IPF_Admin_Views_ChangePassword($request, $match) 'lmodel'=>$lmodel, ); - return IPF_Shortcuts::RenderToResponse('admin/changepassword.html', $context, $request); + return IPF_Admin_App::RenderToResponse('admin/changepassword.html', $context, $request); } } @@ -291,7 +291,7 @@ function IPF_Admin_Views_Login($request, $match) 'form' => $form, 'extra_js' => $form->extra_js(), ); - return IPF_Shortcuts::RenderToResponse('admin/login.html', $context, $request); + return IPF_Admin_App::RenderToResponse('admin/login.html', $context, $request); } function IPF_Admin_Views_Logout($request, $match) @@ -300,7 +300,7 @@ function IPF_Admin_Views_Logout($request, $match) $context = array( 'page_title' => IPF::get('admin_title'), ); - return IPF_Shortcuts::RenderToResponse('admin/logout.html', $context, $request); + return IPF_Admin_App::RenderToResponse('admin/logout.html', $context, $request); } function IPF_Admin_Views_Impersonate($request, $match) @@ -450,7 +450,7 @@ function IPF_Admin_Views_FileBrowser($request, $match) 'upload_url' => $upload_url, 'curr_dir' => $curr_dir, ); - return IPF_Shortcuts::RenderToResponse('admin/filebrowser.html', $context, $request); + return IPF_Admin_App::RenderToResponse('admin/filebrowser.html', $context, $request); } function IPF_Admin_Views_FileBrowserRename($request, $match)