From f3d301cf61cd09ad9089efb5d016e05ce6318bee Mon Sep 17 00:00:00 2001 From: arno Date: Sat, 7 Aug 2010 22:27:46 +0200 Subject: [PATCH] my account link appears when logging from main page --- application/forms/Geom.php | 2 +- application/layouts/scripts/footer.phtml | 20 +++++++++++++------- application/views/helpers/FooterLink.php | 8 ++++++-- public/js/syj.js | 6 ++++-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/application/forms/Geom.php b/application/forms/Geom.php index cad18a7..2ae949b 100644 --- a/application/forms/Geom.php +++ b/application/forms/Geom.php @@ -29,7 +29,7 @@ class Syj_Form_Geom extends Zend_Form 'decorators' => array( 'ViewHelper', 'label', - array('HtmlTag', array('tag' => 'div', 'id' => 'geom_accept_container'))))); + array('HtmlTag', array('tag' => 'div', 'id' => 'geom_accept_container', 'class' => 'logged-hide'))))); $submit = array('Submit', 'geom_submit', array('label' => __("save"))); diff --git a/application/layouts/scripts/footer.phtml b/application/layouts/scripts/footer.phtml index 5767857..08b2ff9 100644 --- a/application/layouts/scripts/footer.phtml +++ b/application/layouts/scripts/footer.phtml @@ -29,24 +29,30 @@ echo $this->footerLink(array( isset($this->redirectLinks) ? $this->redirectLinks : true); /* - * login, logout, account links + * account link */ -if ($this->loggedUser) { +if ($mainpage or $this->loggedUser) { echo $this->footerLink(array( 'route' => 'account', 'action' => 'index', 'controller' => 'account'), - $this->translate("my account")); - if (!$mainpage) { + $this->translate("my account"), true, + 'logged-show'); +} + +/* + * login or logout links + */ +if (!$mainpage) { + if ($this->loggedUser) { + echo $this->footerLink(array( 'route' => 'logout', 'action' => 'logout', 'controller' => 'login'), $this->translate("logout"), false); - } -} else { - if (!$mainpage) { + } else { echo $this->footerLink(array( 'route' => 'login', 'action' => 'login', diff --git a/application/views/helpers/FooterLink.php b/application/views/helpers/FooterLink.php index 529221d..46788c6 100644 --- a/application/views/helpers/FooterLink.php +++ b/application/views/helpers/FooterLink.php @@ -4,7 +4,7 @@ class Syj_View_Helper_FooterLink extends Zend_View_Helper_Abstract { - public function FooterLink($routeoptions, $text, $redirect=true) { + public function FooterLink($routeoptions, $text, $redirect=true, $extraclass=null) { $page = new Zend_Navigation_Page_Mvc($routeoptions); if ($page->isActive()) { $link = $this->view->escape($text); @@ -19,7 +19,11 @@ class Syj_View_Helper_FooterLink extends Zend_View_Helper_Abstract } $link = $this->view->anchor($href, $text, array('class' => 'footer-anchor')); } - return '' . PHP_EOL; + $class = "footer-link"; + if (isset($extraclass)) { + $class = "$class $extraclass"; + } + return '
' . $link . '
' . PHP_EOL; } } diff --git a/public/js/syj.js b/public/js/syj.js index 65f6897..b5121d4 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -780,10 +780,12 @@ var loginMgr = Object.extend(gLoggedInfo, { } if (this.logged) { this.controlsdeck.setIndex(1); - $("geom_accept_container").hide(); + $$(".logged-hide").invoke('hide'); + $$(".logged-show").invoke('show'); } else { this.controlsdeck.setIndex(0); - $("geom_accept_container").show(); + $$(".logged-hide").invoke('show'); + $$(".logged-show").invoke('hide'); } if (this.iscreator) { -- 2.39.2