holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[ljcom] r12325: LJINT-467: Comments for side projects (L...

Committer: akanashin
LJINT-467: Comments for side projects (Lenta.ru olympics)
U   trunk/cgi-bin/LJ/Hooks/PartnerSites.pm
U   trunk/templates/Identity/ExternalLogin/v2.tmpl
Modified: trunk/cgi-bin/LJ/Hooks/PartnerSites.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/PartnerSites.pm	2012-07-20 09:01:04 UTC (rev 12324)
+++ trunk/cgi-bin/LJ/Hooks/PartnerSites.pm	2012-07-20 10:39:27 UTC (rev 12325)
@@ -126,4 +126,15 @@
     $$link_ref = { '_type' => 'Link', '_isnull' => 1 };
 } );
 
+LJ::register_hook( 'override_auth_sequence' => sub {
+    my ( $u, $auth_sequence ) = @_;
+
+    return unless $u;
+
+    my $partner = LJ::PartnerSite->find_by_journal_username( $u->username );
+    return unless $partner && $partner->overrides->{'auth_sequence'};
+
+    @$auth_sequence = split(' ', $partner->overrides->{'auth_sequence'});
+} );
+
 1;

Modified: trunk/templates/Identity/ExternalLogin/v2.tmpl
===================================================================
--- trunk/templates/Identity/ExternalLogin/v2.tmpl	2012-07-20 09:01:04 UTC (rev 12324)
+++ trunk/templates/Identity/ExternalLogin/v2.tmpl	2012-07-20 10:39:27 UTC (rev 12325)
@@ -11,31 +11,34 @@
     <div class="b-identity-header">
         <div class="logo"><i></i>LiveJournal</div>
         <span class="b-auth-wrapper">
-        <TMPL_LOOP type_user>
-            <a class="i-auth" title="Login with <TMPL_VAR ml_tab_heading>" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" src="/img/icons/livejournal-16.png?v=19075"></a>
+        <TMPL_LOOP primary_types>
+            <a class="i-auth" title="Login with <TMPL_VAR ml_tab_heading>" href="?type=<TMPL_VAR type>">
+			<img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" 
+                <TMPL_IF expr="type eq 'user'">
+                    src="/img/icons/livejournal-16.png?v=19075"
+                <TMPL_ELSE>
+                    src="/img/icons/<TMPL_VAR type>-16.gif?v=2"
+                </TMPL_IF>
+            >
+            </a>
         </TMPL_LOOP>
-        <TMPL_LOOP type_facebook>
-            <a class="i-auth" title="Login with <TMPL_VAR ml_tab_heading>" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" src="/img/icons/<TMPL_VAR type>-16.gif?v=1"></a>
-        </TMPL_LOOP>
-        <TMPL_LOOP type_twitter>
-            <a class="i-auth" title="Login with <TMPL_VAR ml_tab_heading>" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" src="/img/icons/<TMPL_VAR type>-16.gif?v=2"></a>
-        </TMPL_LOOP>
-            <a class="i-loginpopup-show" href="#login-more"><img width="16" height="16" alt="More login options" src="/img/icons/showmore.gif?v=11430"></a>
+        <a class="i-loginpopup-show" href="#login-more"><img width="16" height="16" alt="More login options" src="/img/icons/showmore.gif?v=11430"></a>
         </span>
         <div id="login-more" class="b-loginpopup" style="display: none;">
             <ul class="b-loginpopup-items">
-            <TMPL_LOOP type_openid>
-                <li class="b-loginpopup-item"><a title="Login with <TMPL_VAR ml_tab_heading>" class="i-auth" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" src="/img/icons/<TMPL_VAR type>-16.gif?v=1"><TMPL_VAR ml_tab_heading></a></li>
+			<TMPL_LOOP secondary_types>
+                <li class="b-loginpopup-item">
+                    <a title="Login with <TMPL_VAR ml_tab_heading>" class="i-auth" href="?type=<TMPL_VAR type>">
+                    <img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" 
+                        <TMPL_IF expr="type eq 'user'">
+                            src="/img/icons/livejournal-16.png?v=19075"
+                        <TMPL_ELSE>
+                            src="/img/icons/<TMPL_VAR type>-16.gif?v=2"
+                        </TMPL_IF>
+                        ><TMPL_VAR ml_tab_heading>
+                    </a>
+                </li>
             </TMPL_LOOP>
-            <TMPL_LOOP type_mailru>
-                <li class="b-loginpopup-item"><a title="Login with <TMPL_VAR ml_tab_heading>" class="i-auth" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" src="/img/icons/<TMPL_VAR type>-16.gif?v=3"><TMPL_VAR ml_tab_heading></a></li>
-            </TMPL_LOOP>
-            <TMPL_LOOP type_google>
-                <li class="b-loginpopup-item"><a title="Login with <TMPL_VAR ml_tab_heading>" class="i-auth" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Login with <TMPL_VAR ml_tab_heading>" src="/img/icons/<TMPL_VAR type>-16.png?v=1"><TMPL_VAR ml_tab_heading></a></li>
-            </TMPL_LOOP>
-            <TMPL_LOOP type_vkontakte>
-                <li class="b-loginpopup-item"><a title="Log in with <TMPL_VAR ml_tab_heading>" class="i-auth" href="?type=<TMPL_VAR type>"><img width="16" height="16" alt="Log in with <TMPL_VAR ml_tab_heading>" src="/img/icons/<TMPL_VAR type>-16.gif?v=1"><TMPL_VAR ml_tab_heading></a></li>
-            </TMPL_LOOP>
             </ul>
         </div>
 		<script type="text/javascript">
@@ -47,112 +50,50 @@
 			});
 		</script>
     </div>
+
 <ul class="b-auth">
-    <TMPL_LOOP type_user>
-        <li id="tab-<TMPL_VAR type>" class="b-auth-item current">
+    <TMPL_LOOP types>
+        <TMPL_IF expr="type eq 'user'">
+            <li id="tab-<TMPL_VAR type>" class="b-auth-item current">
             <form action="<tmpl_var action>" method="post" target="">
-                <input type="hidden" name="remember_me" value="1">
-                <p class="b-auth-user-form">
-                    <span class="b-auth-input-wrapper">
-                        <label style="display:none;" for="ljusername"><TMPL_VAR expr="ml('/identity/login.bml.user.label.name')"></label>
-                        <input type="text" name="user" id="ljusername" value="" class="b-auth-user-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.user.label.name')">" />
-                    </span>
-                    <span class="b-auth-input-wrapper">
-                        <label style="display:none;" for="ljuserpassword"><TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')"></label>
-                        <input type="password" name="password" id="ljuserpassword" value="" class="b-auth-user-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')">" />
-                        <a target="_blank" href="<TMPL_VAR lj_siteroot>/lostinfo.bml"><TMPL_VAR expr="ml('/identity/login.bml.user.help')"></a>
-                        <a target="_blank" href="<TMPL_VAR lj_siteroot>/create.bml"><TMPL_VAR expr="ml('/identity/login.bml.user.register')"></a>
-                    </span>
-                    <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.user.btn.login')"></button>
-                </p>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.user.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-                <input type="hidden" name="returnto" value="<TMPL_VAR returnto>" />
-            </form>
-        </li>
-    </TMPL_LOOP>
-
-    <TMPL_LOOP type_openid>
-        <li id="tab-<TMPL_VAR type>" class="b-auth-item" style="display:none">
+        <TMPL_ELSE>
+            <li id="tab-<TMPL_VAR type>" class="b-auth-item" style="display:none">
             <form action="<tmpl_var action>" method="post" target="ljidentityauth">
-                <p class="b-auth-openid-form">
-                    <span class="b-auth-input-wrapper">
-                        <label style="display:none;" for="openid_url"><TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')"></label>
-                        <input type="url" name="openid:url" id="openid_url" value="" class="b-auth-openid-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')">" />
-                        <span><TMPL_VAR expr="ml('/identity/login.bml.openid.label.sample')"></span>
-                    </span>
-                    <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.openid.btn.login')"></button>
-                </p>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.openid.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-            </form>
+        </TMPL_IF>
+        <TMPL_IF expr="type eq 'user'">
+            <input type="hidden" name="remember_me" value="1">
+            <p class="b-auth-user-form">
+                <span class="b-auth-input-wrapper">
+                    <label style="display:none;" for="ljusername"><TMPL_VAR expr="ml('/identity/login.bml.user.label.name')"></label>
+                    <input type="text" name="user" id="ljusername" value="" class="b-auth-user-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.user.label.name')">" />
+                </span>
+                <span class="b-auth-input-wrapper">
+                    <label style="display:none;" for="ljuserpassword"><TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')"></label>
+                    <input type="password" name="password" id="ljuserpassword" value="" class="b-auth-user-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.user.label.pass')">" />
+                    <a target="_blank" href="<TMPL_VAR lj_siteroot>/lostinfo.bml"><TMPL_VAR expr="ml('/identity/login.bml.user.help')"></a>
+                    <a target="_blank" href="<TMPL_VAR lj_siteroot>/create.bml"><TMPL_VAR expr="ml('/identity/login.bml.user.register')"></a>
+                </span>
+                <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.user.btn.login')"></button>
+            </p>
+        <TMPL_ELSIF expr="type eq 'openid'">
+            <p class="b-auth-openid-form">
+                <span class="b-auth-input-wrapper">
+                    <label style="display:none;" for="openid_url"><TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')"></label>
+                    <input type="url" name="openid:url" id="openid_url" value="" class="b-auth-openid-input" placeholder="<TMPL_VAR expr="ml('/identity/login.bml.openid.label.url')">" />
+                    <span><TMPL_VAR expr="ml('/identity/login.bml.openid.label.sample')"></span>
+                </span>
+                <button disabled="disabled" type="submit"><TMPL_VAR expr="ml('/identity/login.bml.openid.btn.login')"></button>
+            </p>
+        <TMPL_ELSE> 
+            <button type="submit" class="b-<TMPL_VAR type>btn" title="<TMPL_VAR expr="ml(sprintf('/identity/login.bml.%s.btn.connect',type))">"><span><i></i><TMPL_VAR expr="ml(sprintf('/identity/login.bml.%s.btn.connect',type))"></span></button>
+        </TMPL_IF>
+        <p class="b-auth-desc"><TMPL_VAR expr="ml(sprintf('/identity/login.bml.%s.desc',type))"></p>
+        <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
+        <input type="hidden" name="type" value="<TMPL_VAR type>" />
+        <input type="hidden" name="returnto" value="<TMPL_VAR returnto>" />
+        </form>
         </li>
     </TMPL_LOOP>
-
-    <TMPL_LOOP type_facebook>
-        <li id="tab-<TMPL_VAR type>" class="b-auth-item" style="display:none">
-            <form action="<tmpl_var action>" method="post" target="ljidentityauth">
-                <button type="submit" class="b-facebookbtn" title="<TMPL_VAR expr="ml('/identity/login.bml.facebook.btn.connect')">"><span><i></i><TMPL_VAR expr="ml('/identity/login.bml.facebook.btn.connect')"></span></button>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.facebook.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-            </form>
-        </li>
-    </TMPL_LOOP>
-
-    <TMPL_LOOP type_twitter>
-        <li id="tab-<TMPL_VAR type>" class="b-auth-item" style="display:none">
-            <form action="<tmpl_var action>" method="post" target="ljidentityauth">
-                <button type="submit" class="b-twitterbtn"><span><i></i><TMPL_VAR expr="ml('/identity/login.bml.twitter.btn.connect')"></span></button>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.twitter.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-            </form>
-        </li>
-    </TMPL_LOOP>
-
-    <TMPL_LOOP type_mailru>
-        <li id="tab-<TMPL_VAR type>" class="b-auth-item" style="display:none">
-            <form action="<tmpl_var action>" method="post" target="ljidentityauth">
-                <button type="submit" class="b-mailrubtn"><span><i></i><TMPL_VAR expr="ml('/identity/login.bml.mailru.btn.connect')"></span></button>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.mailru.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-            </form>
-        </li>
-    </TMPL_LOOP>
-
-    <TMPL_LOOP type_vkontakte>
-        <li id="tab-<TMPL_VAR type>" class="b-auth-item" style="display:none">
-            <form action="<tmpl_var action>" method="post" target="ljidentityauth">
-                <button type="submit" class="b-vkontaktebtn"><span><i></i><TMPL_VAR expr="ml('/identity/login.bml.vkontakte.btn.connect')"></span></button>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.vkontakte.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-            </form>
-        </li>
-    </TMPL_LOOP>
-
-    <TMPL_LOOP type_google>
-        <li id="tab-google" class="b-auth-item" style="display:none">
-            <form action="<tmpl_var action>" method="post" target="ljidentityauth">
-                <button type="submit" class="b-googlebtn"><span><i></i><TMPL_VAR expr="ml('/identity/login.bml.google.btn.connect')"></span></button>
-                <p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.google.desc')"></p>
-                <TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span><i class="i-close"></i></p></TMPL_LOOP></TMPL_IF>
-
-                <input type="hidden" name="type" value="<TMPL_VAR type>" />
-            </form>
-        </li>
-    </TMPL_LOOP>
-
 </ul>
 <!--<p class="lj3-close">
     <a href="javascript:void(0);" id="close-button"></a>

Tags: akanashin, holyandrew, 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