|
Revision 2650, 1.8 kB
(checked in by bsmith, 17 months ago)
|
|
bugzid:80365 - backporting changes from mtcs templatessets
|
-
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[ */ |
|---|
| 8 | function mtUpdateSignInWidget(u) { |
|---|
| 9 | var el = document.getElementById('signin-widget-content'); |
|---|
| 10 | var content = ''; |
|---|
| 11 | if (!el) return; |
|---|
| 12 | if (u) { |
|---|
| 13 | if (u && u.is_authenticated) { |
|---|
| 14 | user = u; |
|---|
| 15 | mtSaveUser(); |
|---|
| 16 | } else { |
|---|
| 17 | // user really isn't logged in; so let's do this! |
|---|
| 18 | return mtSignIn(); |
|---|
| 19 | } |
|---|
| 20 | } else { |
|---|
| 21 | u = mtGetUser(); |
|---|
| 22 | } |
|---|
| 23 | if (u && u.name) { |
|---|
| 24 | var url; |
|---|
| 25 | if (u.is_authenticated) { |
|---|
| 26 | if (u.is_author) { |
|---|
| 27 | url = '<$mt:CGIPath$><$mt:CommentScript$>?__mode=edit_profile'; |
|---|
| 28 | url += '&return_url=' + encodeURIComponent( location.href ); |
|---|
| 29 | } else { |
|---|
| 30 | url = u.url; |
|---|
| 31 | } |
|---|
| 32 | } else if (u.url) { |
|---|
| 33 | url = u.url; |
|---|
| 34 | } else { |
|---|
| 35 | url = null; |
|---|
| 36 | } |
|---|
| 37 | var content = '<__trans phrase="You are signed in as " escape="js">'; |
|---|
| 38 | if (url) |
|---|
| 39 | content += '<a href="' + url + '">' + u.name + '</a>'; |
|---|
| 40 | else |
|---|
| 41 | content += u.name; |
|---|
| 42 | content += '. (<a href="javascript:void(0)" onclick="return mtSignOutOnClick()"><__trans phrase="sign out" escape="js"></a>)'; |
|---|
| 43 | } else if (u && u.is_banned) { |
|---|
| 44 | content = '<__trans phrase="You do not have permission to sign in to this blog." escape="js">'; |
|---|
| 45 | } else { |
|---|
| 46 | content = '<a href="javascript:void(0)" onclick="return mtSignInOnClick(\'signin-widget-content\')"><__trans phrase="Sign In" escape="js"></a>'; |
|---|
| 47 | } |
|---|
| 48 | el.innerHTML = content; |
|---|
| 49 | } |
|---|
| 50 | mtAttachEvent('usersignin', mtUpdateSignInWidget); |
|---|
| 51 | mtUpdateSignInWidget(); |
|---|
| 52 | /* ]]> */ |
|---|
| 53 | </script> |
|---|
| 54 | </mt:IfRegistrationAllowed> |
|---|