Create a new admin login page using hoplite.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 8 Jun 2013 03:41:23 +0000 (23:41 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 8 Jun 2013 05:19:46 +0000 (01:19 -0400)
admin/index.php
admin/login.php [new file with mode: 0644]
admin/templates/admin_header.tpl
admin/templates/admin_login.tpl [new file with mode: 0644]
includes/hoplite

index fc06263516685bbc3ff753bca8f49ab08f9b1e68..897de72e35164a7340c2aff91ecefbbc585eae18 100644 (file)
@@ -35,6 +35,8 @@ require_once HOPLITE_ROOT . '/http/url_map.php';
 require_once HOPLITE_ROOT . '/views/pdo_cache_backend.php';
 require_once HOPLITE_ROOT . '/views/template_loader.php';
 
+require_once BUGDAR_ROOT . '/admin/login.php';
+
 /**
  * @implements \hoplite\http\RootControllerDelegate
  */
@@ -78,7 +80,7 @@ class FrontController
 
        public function LoginPage()
        {
-               $this->controller->StopWithCode(http\ResponseCode::FORBIDDEN);
+               $this->controller->InvokeAction(new LoginAction($this->controller));
        }
 
        public function WillInvokeAction(http\Action $action, http\Request $request, http\Response $response)
diff --git a/admin/login.php b/admin/login.php
new file mode 100644 (file)
index 0000000..79663af
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar
+|| # Copyright (c)2002-2013 Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+namespace bugdar\admin;
+
+use \bugdar;
+use \hoplite\http;
+
+require_once HOPLITE_ROOT . '/http/action.php';
+
+class LoginAction extends http\Action implements TemplatePreCaching
+{
+       public function TemplateSet()
+       {
+               return array('admin_login');
+       }
+
+       public function Invoke(http\Request $request, http\Response $response)
+       {
+               $response->response_code = http\ResponseCode::FORBIDDEN;
+               $response->data['title'] = T('Login');
+
+               $response->context['template'] = 'admin_login';
+
+               $this->controller()->Stop();
+       }
+}
\ No newline at end of file
index 0a6f8c43c6f8f0b26df85b5ed21d82f584527b80..08543dcdf3d54b518283793446b267d7f6b8a2e4 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="{%= $language['langcode'] %}" dir="{%= $language['direction'] %}">
        <head>
                <meta charset="{%= $language['charset'] %}">
-               <title>Bugdar2 Admin Panel - {%= $title %}</title>
+               <title>Bugdar2 {%=T('Administration')%} - {%= $title %}</title>
                <link rel="stylesheet" href="templates/css/reset.css">
                <link rel="stylesheet" href="templates/css/admin.css">
        </head>
diff --git a/admin/templates/admin_login.tpl b/admin/templates/admin_login.tpl
new file mode 100644 (file)
index 0000000..2955d0e
--- /dev/null
@@ -0,0 +1,17 @@
+{%#import 'admin_header'%}
+
+<h1>{%=T('Login to Bugdar')%}</h1>
+
+<form action="../login.php" method="post">
+       <input type="hidden" name="do" value="cplogin">
+
+       <label for="email">{%=T('Email')%}:</label>
+       <input type="text" id="email" name="email" value="{%= Bugdar::$user['email'] %}">
+
+       <label for="password">{%=T('Password')%}</label>
+       <input type="password" id="password" name="password">
+
+       <input type="submit" value="{%=T('Login')%}">
+</form>
+
+{%#import 'admin_footer'%}
\ No newline at end of file
index a7c5ff1323c5b72bedd54bd57c1279e780be7232..c1097e96c8aeaeecf895e9412af52a74b50ef830 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a7c5ff1323c5b72bedd54bd57c1279e780be7232
+Subproject commit c1097e96c8aeaeecf895e9412af52a74b50ef830