root/branches/release-38/default_templates/signin.mtml @ 2364

Revision 2364, 1.7 kB (checked in by bchoate, 19 months ago)

Removing redundant call to mtUpdateSignInWidget.

  • Property svn:keywords set to Id Date Author Revision
Line 
1<mt:IfRegistrationAllowed>
2<div class="widget-sign-in widget">
3    <h3 class="widget-header"><__trans phrase="Sign In"></h3>
4    <div class="widget-content" id="signin-widget-content"></div>
5</div>
6<script type="text/javascript">
7/* <![CDATA[ */
8function mtUpdateSignInWidget(u) {
9    var el = document.getElementById('signin-widget-content');
10    if (!el) return;
11    if (u) {
12        if (u && u.is_authenticated) {
13            user = u;
14            mtSaveUser();
15        } else {
16            // user really isn't logged in; so let's do this!
17            return mtSignIn();
18        }
19    } else {
20        u = mtGetUser();
21    }
22    if (u) {
23        var url;
24        if (u.is_authenticated) {
25            url = '<$mt:CGIPath$><$mt:CommentScript$>?__mode=edit_profile&blog_id=<$mt:BlogID$>';
26            url += '&static=' + escape( location.href );
27        } else if (u.url) {
28            url = u.url;
29        } else {
30            url = null;
31        }
32        var content = '<__trans phrase="You are signed in as " escape="js">';
33        if (url)
34            content += '<a href="' + url + '">' + u.name + '</a>';
35        else
36            content += u.name;
37        content += '.  (<a href="javascript:void(0)" onclick="return mtSignOutOnClick()"><__trans phrase="sign out" escape="js"></a>)';
38    } else if (u && u.is_banned) {
39        content = '<__trans phrase="You do not have permission to sign in to this blog." escape="js">';
40    } else {
41        content = '<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'signin-widget-content\')"><__trans phrase="Sign In" escape="js"></a>';
42    }
43    el.innerHTML = content;
44}
45mtAttachEvent('usersignin', mtUpdateSignInWidget);
46/* ]]> */
47</script>
48</mt:IfRegistrationAllowed>
Note: See TracBrowser for help on using the browser.