Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r10129: LJINT-411 (Additional logout link)

Committer: ailyin
LJINT-411 (Additional logout link)
U   trunk/cgi-bin/LJ/PartnerSite.pm
U   trunk/htdocs/gadgets/loginstatus.bml
U   trunk/templates/Identity/LoginStatus.tmpl
Modified: trunk/cgi-bin/LJ/PartnerSite.pm
===================================================================
--- trunk/cgi-bin/LJ/PartnerSite.pm	2011-02-25 08:41:01 UTC (rev 10128)
+++ trunk/cgi-bin/LJ/PartnerSite.pm	2011-02-25 09:01:46 UTC (rev 10129)
@@ -543,7 +543,9 @@
     if ( $opts->{'mode'} eq 'logcom' ) {
         my $uri
             = URI->new( $self->xdreceiver_url( $opts->{'partner_domain'} ) );
-        $uri->query_form( $uri->query_form, 'mode' => 'check_domain' );
+        $uri->query_form( $uri->query_form,
+                          'mode' => 'check_domain',
+                          'logged_in' => LJ::get_remote() ? 1 : 0 );
 
         my $url = $uri->as_string;
 

Modified: trunk/htdocs/gadgets/loginstatus.bml
===================================================================
--- trunk/htdocs/gadgets/loginstatus.bml	2011-02-25 08:41:01 UTC (rev 10128)
+++ trunk/htdocs/gadgets/loginstatus.bml	2011-02-25 09:01:46 UTC (rev 10129)
@@ -30,19 +30,26 @@
 
     my $remote = LJ::get_remote();
 
-    return '' unless $remote;
+    my ( $partner_remote_ljuser, $logout_url );
 
     LJ::need_res(qw( stc/partners/login.css ));
 
-    my $remote_sessid = $remote->session->id;
+    if ( $remote ) {
+        my $remote_sessid = $remote->session->id;
 
-    my $thispage = "$LJ::SITEROOT/gadgets/loginstatus.bml?"
-                 . LJ::Request->args;
+        my $thispage = "$LJ::SITEROOT/gadgets/loginstatus.bml?"
+                     . LJ::Request->args;
 
-    my $logout_url = "$LJ::SITEROOT/gadgets/logout.bml?" .
-                     'returnto=' . LJ::eurl($thispage) . '&' .
-                     'sessid=' . $remote_sessid;
+        $logout_url = "$LJ::SITEROOT/gadgets/logout.bml?" .
+                      'returnto=' . LJ::eurl($thispage) . '&' .
+                      'sessid=' . $remote_sessid;
 
+        $partner_remote_ljuser = $partner->ljuser_html($remote);
+    }
+
+    my $resources_html = $partner->resources_html
+                      || LJ::res_includes();
+
     my $template = LJ::HTML::Template->new(
         { use_expr => 1 },    # force HTML::Template::Pro with Expr support
         filename          => "$ENV{'LJHOME'}/templates/Identity/LoginStatus.tmpl",
@@ -53,10 +60,10 @@
 
     $template->param(
         'js_check_domain'       => $js_check_domain,
-        'partner_remote_ljuser' => $partner->ljuser_html($remote),
+        'partner_remote_ljuser' => $partner_remote_ljuser,
         'logout_url'            => $logout_url,
-        'resources_html'        => $partner->resources_html
-                                || LJ::res_includes(),
+        'resources_html'        => $resources_html,
+        'logged_in'             => $remote ? 1 : 0,
     );
 
     return $template->output;

Modified: trunk/templates/Identity/LoginStatus.tmpl
===================================================================
--- trunk/templates/Identity/LoginStatus.tmpl	2011-02-25 08:41:01 UTC (rev 10128)
+++ trunk/templates/Identity/LoginStatus.tmpl	2011-02-25 09:01:46 UTC (rev 10129)
@@ -8,12 +8,14 @@
 <body>
 	<TMPL_VAR js_check_domain>
 
-	<div class="b-auth">
-		<p class="lj3-identity">
-			<TMPL_VAR partner_remote_ljuser>
-			<span class="lj3-logout">(<a href="<TMPL_VAR logout_url>"><TMPL_VAR expr="ml('/logout.bml.logout.head')"></a>)</span>
-		<p>
-	</div>
+    <TMPL_IF logged_in>
+        <div class="b-auth">
+            <p class="lj3-identity">
+                <TMPL_VAR partner_remote_ljuser>
+                <span class="lj3-logout">(<a href="<TMPL_VAR logout_url>"><TMPL_VAR expr="ml('/logout.bml.logout.head')"></a>)</span>
+            <p>
+        </div>
+    </TMPL_IF>
 </body>
 </html>
 

Tags: andy, bml, ljcom, pm, tmpl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments