summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/user/helpers/user_block.php33
-rw-r--r--modules/user/views/login.html.php20
-rw-r--r--themes/default/views/header.html.php21
-rw-r--r--themes/default/views/page.html.php3
4 files changed, 54 insertions, 23 deletions
diff --git a/modules/user/helpers/user_block.php b/modules/user/helpers/user_block.php
new file mode 100644
index 00000000..05767253
--- /dev/null
+++ b/modules/user/helpers/user_block.php
@@ -0,0 +1,33 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * 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; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * 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.
+ */
+class user_block_Core {
+ public static function head($theme) {
+ $user = Session::instance()->get('user', null);
+ $url = url::file("lib/jquery.jeditable.js");
+ return empty($user) ? "" : "<script src=\"$url\" type=\"text/javascript\"></script>";
+ }
+
+ public static function top($theme) {
+ $view = new View("login.html");
+ $view->user = Session::instance()->get('user', null);
+ return $view->render();
+ }
+
+}
diff --git a/modules/user/views/login.html.php b/modules/user/views/login.html.php
new file mode 100644
index 00000000..a4005ebf
--- /dev/null
+++ b/modules/user/views/login.html.php
@@ -0,0 +1,20 @@
+<? defined("SYSPATH") or die("No direct script access."); ?>
+<ul id="gLoginMenu">
+ <? if ($user): ?>
+ <a href="<?= url::site("user/{$user->id}?continue=" . url::current(true))?>"><?= _("Modify Profile") ?></a>
+ | <a href="<?= url::site("logout?continue=" . url::current(true)) ?>" id="gLogoutLink">
+ <?= _("Logout") ?>
+ </a>
+ <? else: ?>
+ <span id="gLoginLink">
+ <a href="javascript:show_login('<?= url::site("login") ?>')">
+ <?= _("Login") ?>
+ </a>
+ </span>
+ <span id="gLoginClose" class="gDisplayNone">
+ <?= _("Login") ?> | <a href="javascript:close_login()">X</a>
+ </span>
+ <div id="gLoginFormContainer"></div>
+ <? endif; ?>
+</ul>
+
diff --git a/themes/default/views/header.html.php b/themes/default/views/header.html.php
index edb03640..348111a4 100644
--- a/themes/default/views/header.html.php
+++ b/themes/default/views/header.html.php
@@ -2,26 +2,7 @@
<img id="gLogo" alt="<?= _("Logo") ?>" src="<?= $theme->url("images/logo.png") ?>" />
<h1><?= $item->title_edit ?></h1>
-<? if ($theme->module("user")): ?>
-<ul id="gLoginMenu">
- <? if ($user): ?>
- <a href="<?= url::site("user/{$user->id}?continue=" . url::current(true))?>"><?= _("Modify Profile") ?></a>
- | <a href="<?= url::site("logout?continue=" . url::current(true)) ?>" id="gLogoutLink">
- <?= _("Logout") ?>
- </a>
- <? else: ?>
- <span id="gLoginLink">
- <a href="javascript:show_login('<?= url::site("login") ?>')">
- <?= _("Login") ?>
- </a>
- </span>
- <span id="gLoginClose" class="gDisplayNone">
- <?= _("Login") ?> | <a href="javascript:close_login()">X</a>
- </span>
- <div id="gLoginFormContainer"></div>
- <? endif; ?>
-</ul>
-<? endif; ?>
+<?= View::top($theme) ?>
<div id="gSiteMenu" class="gClearFix">
<ul class="ui-tabs-nav">
diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php
index b2263eff..ca4a5688 100644
--- a/themes/default/views/page.html.php
+++ b/themes/default/views/page.html.php
@@ -21,9 +21,6 @@
<!--script src="<?= $theme->url("jquery/jquery.ui.accordion.js") ?>" type="text/javascript"></script-->
<!--script src="<?= $theme->url("jquery/jquery.ui.init.js") ?>" type="text/javascript"></script-->
<?= View::head($theme) ?>
- <? if ($user): ?>
- <script src="<?= url::file("lib/jquery.jeditable.js") ?>" type="text/javascript"></script>
- <? endif; ?>
</head>
<body>