Committer: ailyin
LJINT-425 (Comments for side projects: add mail and vk authorization)U trunk/cgi-bin/LJ/PartnerSite.pm U trunk/templates/Identity/ExternalLogin.tmpl
Modified: trunk/cgi-bin/LJ/PartnerSite.pm =================================================================== --- trunk/cgi-bin/LJ/PartnerSite.pm 2011-04-22 09:30:42 UTC (rev 10431) +++ trunk/cgi-bin/LJ/PartnerSite.pm 2011-04-22 09:31:15 UTC (rev 10432) @@ -198,7 +198,7 @@ xdreceiver_path rate_limits encoding mapping_locked disabled dochash_salt sync_comments_count_url_pattern - lj_resources partner_resources ); + lj_resources partner_resources identities ); ### CLASS METHODS ### @@ -1000,4 +1000,15 @@ return $resources; } +sub identity_type_enabled { + my ( $self, $idtype ) = @_; + + return 1 unless $self->identities; + + $self->{'identities_enabled'} + ||= { map { $_ => 1 } @{ $self->identities } }; + + return $self->{'identities_enabled'}->{$idtype}; +} + 1; Modified: trunk/templates/Identity/ExternalLogin.tmpl =================================================================== --- trunk/templates/Identity/ExternalLogin.tmpl 2011-04-22 09:30:42 UTC (rev 10431) +++ trunk/templates/Identity/ExternalLogin.tmpl 2011-04-22 09:31:15 UTC (rev 10432) @@ -25,6 +25,14 @@ <li class="m-auth-item m-auth-<TMPL_VAR type>"><a href="?type=<TMPL_VAR type>"><span><TMPL_VAR ml_tab_heading></span></a><i class="m-auth-bl"></i><i class="m-auth-br"></i></li> </TMPL_LOOP> + <TMPL_LOOP type_mailru> + <li class="m-auth-item m-auth-<TMPL_VAR type>"><a href="?type=<TMPL_VAR type>"><span><TMPL_VAR ml_tab_heading></span></a><i class="m-auth-bl"></i><i class="m-auth-br"></i></li> + </TMPL_LOOP> + + <TMPL_LOOP type_vkontakte> + <li class="m-auth-item m-auth-<TMPL_VAR type>"><a href="?type=<TMPL_VAR type>"><span><TMPL_VAR ml_tab_heading></span></a><i class="m-auth-bl"></i><i class="m-auth-br"></i></li> + </TMPL_LOOP> + </ul> <ul class="b-auth"> <TMPL_LOOP type_user> @@ -95,6 +103,31 @@ </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> + </ul> <p class="lj3-close"> <a href="javascript:void(0);" id="close-button"></a>