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_label.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 |
---|
23 | function redirect(type) {ldelim} |
---|
24 | url = "{$REDIRECT_TO}"; |
---|
25 | if (typeof type != 'undefined' && type != 'default') {ldelim} |
---|
26 | url = "{$ABS_ROOT_URL}"+ type +".php"; |
---|
27 | } |
---|
28 | window.location.href = url; |
---|
29 | } |
---|
30 | |
---|
31 | // open authentication popup |
---|
32 | function 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=800,height=500" |
---|
37 | ); |
---|
38 | } |
---|
39 | |
---|
40 | // click on a button |
---|
41 | $("a.oauth").click(function() {ldelim} |
---|
42 | var idp = $(this).attr('title'); |
---|
43 | |
---|
44 | switch(idp) {ldelim} |
---|
45 | case 'OpenID': case 'Wordpress': case 'Flickr': |
---|
46 | switch(idp) {ldelim} |
---|
47 | case 'OpenID': |
---|
48 | $("#openid_label").html('{'Please enter your OpenID URL'|@translate|escape:javascript}'); break; |
---|
49 | case 'Wordpress': case 'Flickr': |
---|
50 | $("#openid_label").html('{'Please enter your username'|@translate|escape:javascript}'); break; |
---|
51 | } |
---|
52 | |
---|
53 | $("#openid_form").css('background-color', $("#the_page #content").css('background-color')); |
---|
54 | $("#openid_form img").attr('src', '{$ROOT_URL}{$OAUTH_PATH}template/icons/38px/'+ idp.toLowerCase() +'.png'); |
---|
55 | $("#openid_form h3").html(idp); |
---|
56 | $("#openid_form").data('idp', idp); |
---|
57 | |
---|
58 | $.colorbox({ldelim} |
---|
59 | inline:true, |
---|
60 | href:"#openid_form", |
---|
61 | initialWidth:0, |
---|
62 | initialHeight:0 |
---|
63 | }) |
---|
64 | break; |
---|
65 | |
---|
66 | default: |
---|
67 | open_auth("{$OAUTH_URL}"+ idp); |
---|
68 | } |
---|
69 | |
---|
70 | return false; |
---|
71 | }); |
---|
72 | |
---|
73 | $("#openid_form").submit(function() {ldelim} |
---|
74 | var idp = $(this).data('idp'); |
---|
75 | var oi = $("#openid_form input[name='openid_identifier']").val(); |
---|
76 | |
---|
77 | $("#openid_label").removeClass('error'); |
---|
78 | if (!oi) {ldelim} |
---|
79 | $("#openid_label").addClass('error'); |
---|
80 | return false; |
---|
81 | } |
---|
82 | |
---|
83 | switch(idp) {ldelim} |
---|
84 | case 'Wordpress': oi = "http://" + oi + ".wordpress.com"; break; |
---|
85 | case 'Flickr': oi = "http://www.flickr.com/photos/" + oi + "/"; break; |
---|
86 | } |
---|
87 | |
---|
88 | open_auth("{$OAUTH_URL}OpenID&openid_identifier="+ encode(oi)); |
---|
89 | $.colorbox.close(); |
---|
90 | return false; |
---|
91 | }); |
---|
92 | |
---|
93 | $("#openid_cancel").click(function() {ldelim} |
---|
94 | $("#openid_label").removeClass('error'); |
---|
95 | $.colorbox.close(); |
---|
96 | return false; |
---|
97 | }); |
---|
98 | {/footer_script} |
---|
99 | |
---|
100 | <div style="display:none;"> |
---|
101 | <form id="openid_form" action=""> |
---|
102 | <div> |
---|
103 | <img src="{$ROOT_URL}{$OAUTH_PATH}template/icons/openid_big.png"> |
---|
104 | <h3>OpendID</h3> |
---|
105 | </div> |
---|
106 | <div> |
---|
107 | <br> |
---|
108 | <label id="openid_label" for="openid_identifier">Open ID URL</label> |
---|
109 | <br> |
---|
110 | <input type="text" name="openid_identifier" id="openid_identifier" size="50"> |
---|
111 | </div> |
---|
112 | <div> |
---|
113 | <br> |
---|
114 | <input type="submit" name="{'Submit'|@translate}"> |
---|
115 | <a href="#" id="openid_cancel">{'Cancel'|@translate}</a> |
---|
116 | </div> |
---|
117 | </form> |
---|
118 | </div> |
---|