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

Revision 2394, 1.8 kB (checked in by bsmith, 19 months ago)

bugzid:79831 - Small code fixes to sync with UTS template set

  • 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 id="signin-widget-content" class="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            if (u.is_author) {
26                url = '<$mt:CGIPath$><$mt:CommentScript$>?__mode=edit_profile&blog_id=<$mt:BlogID$>';
27                url += '&static=' + escape( location.href );
28            } else {
29                url = u.url;
30            }
31        } else if (u.url) {
32            url = u.url;
33        } else {
34            url = null;
35        }
36        var content = '<__trans phrase="You are signed in as " escape="js">';
37        if (url)
38            content += '<a href="' + url + '">' + u.name + '</a>';
39        else
40            content += u.name;
41        content += '.  (<a href="javascript:void(0)" onclick="return mtSignOutOnClick()"><__trans phrase="sign out" escape="js"></a>)';
42    } else if (u && u.is_banned) {
43        content = '<__trans phrase="You do not have permission to sign in to this blog." escape="js">';
44    } else {
45        content = '<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'signin-widget-content\')"><__trans phrase="Sign In" escape="js"></a>';
46    }
47    el.innerHTML = content;
48}
49mtAttachEvent('usersignin', mtUpdateSignInWidget);
50mtUpdateSignInWidget();
51/* ]]> */
52</script>
53</mt:IfRegistrationAllowed>
Note: See TracBrowser for help on using the browser.