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

Last change on this file since 20293 was 20293, checked in by mistic100, 11 years ago

first commit of oAuth plugin, still in developpement

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