source: extensions/oAuth/template/identification_common.tpl @ 26556

Last change on this file since 26556 was 26556, checked in by mistic100, 10 years ago

update for 2.6

File size: 3.6 KB
Line 
1{combine_css path=$OAUTH_PATH|cat:'template/oauth_sprites.css'}
2
3{combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
4{combine_css id='colorbox' path="themes/default/js/plugins/colorbox/style2/colorbox.css"}
5
6{html_style}
7#openid_form { padding:20px; }
8#openid_form h3, #openid_form .oauth_38px { display:inline-block; vertical-align:middle; margin:0; }
9#openid_label.error { color:red; font-weight:bold; }
10{/html_style}
11
12{footer_script}
13// redirect, called from the popup
14function redirect(type) {
15  var url = "{$REDIRECT_TO}";
16  if (typeof type != 'undefined' && type != 'default') {
17    url = "{$ABS_ROOT_URL}"+ type +".php";
18  }
19
20  window.location.href = url;
21}
22
23// open authentication popup
24function open_auth(url) {
25  window.open(
26    url+ "&t=" + (new Date()).getTime(),
27    "hybridauth_social_sing_on",
28    "location=0,status=0,scrollbars=0,width=800,height=500"
29  ); 
30}
31
32// click on a button
33jQuery("a.oauth").click(function() {
34  var idp = jQuery(this).data('idp');
35 
36  switch(idp) {
37    case 'OpenID': case 'Wordpress': case 'Flickr': case 'Steam':
38      switch(idp) {
39        case 'OpenID':
40          jQuery("#openid_label").html('{'Please enter your OpenID URL'|translate|escape:javascript}'); break;
41        case 'Wordpress': case 'Flickr': case 'Steam':
42          jQuery("#openid_label").html('{'Please enter your username'|translate|escape:javascript}'); break;
43      }
44     
45      var bg_color = $('#the_page #content').css('background-color');
46      if (!bg_color || bg_color=='transparent') {
47        bg_color = $('body').css('background-color');
48      }
49      jQuery("#openid_form").css('background-color', bg_color);
50
51      jQuery("#openid_form .oauth_38px").removeClass().addClass("oauth_38px " + idp.toLowerCase());
52      jQuery("#openid_form h3").html(idp);
53      jQuery("#openid_form").data('idp', idp);
54
55      jQuery.colorbox({
56        inline:true,
57        href:"#openid_form",
58        initialWidth:0,
59        initialHeight:0,
60        onComplete: function(){ jQuery.colorbox.resize({ speed:0 }) } // prevent misalignement when icon not loaded
61      })
62      break;
63     
64    default:
65      open_auth("{$OAUTH_URL}"+ idp);
66  }
67 
68  return false;
69});
70
71jQuery("#openid_form").submit(function() {
72  var idp = jQuery(this).data('idp');
73  var oi = jQuery("#openid_form input[name='openid_identifier']").val();
74  jQuery("#openid_form input[name='openid_identifier']").val('');
75 
76  jQuery("#openid_label").removeClass('error');
77  if (!oi) {
78    jQuery("#openid_label").addClass('error');
79    return false;
80  }
81 
82  switch(idp) {
83    case 'Wordpress': oi = "http://" + oi + ".wordpress.com"; break;
84    case 'Flickr': oi = "http://www.flickr.com/photos/" + oi + "/"; break;
85    case 'Steam': oi = "http://steamcommunity.com/openid/" + oi; break;
86  }
87
88  open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encodeURI(oi));
89
90  jQuery.colorbox.close();
91  return false;
92});
93
94jQuery("#openid_cancel").click(function() {
95  jQuery("#openid_label").removeClass('error');
96  jQuery.colorbox.close();
97  return false;
98});
99{/footer_script}
100
101<div style="display:none;">
102  <form id="openid_form" action="">
103    <div>
104      <span class="oauth_38px"></span>
105      <h3>OpendID</h3>
106    </div>
107    <div>
108      <br>
109      <label id="openid_label" for="openid_identifier">Open ID URL</label>
110      <br>
111      <input type="text" name="openid_identifier" id="openid_identifier" size="50">
112    </div>
113    <div>
114      <br>
115      <input type="submit" name="{'Submit'|translate}">
116      <a href="#" id="openid_cancel">{'Cancel'|translate}</a>
117    </div>
118  </form>
119</div>
Note: See TracBrowser for help on using the repository browser.