author | Michael Krelin <hacker@klever.net> | 2006-09-28 21:04:48 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-09-28 21:04:48 (UTC) |
commit | 5659bfd13d49fe56aba072b29de0bd0bb332aebd (patch) (unidiff) | |
tree | 832f120283e5cc4f950c001ead3a94175a3ccca2 | |
parent | 84e84c0f62208bba6012e0db7296a9808bbbb148 (diff) | |
download | fireflix-5659bfd13d49fe56aba072b29de0bd0bb332aebd.zip fireflix-5659bfd13d49fe56aba072b29de0bd0bb332aebd.tar.gz fireflix-5659bfd13d49fe56aba072b29de0bd0bb332aebd.tar.bz2 |
automatically start auth process in absence of token
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@166 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/fireflix.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index 82c7b0c..daf4929 100644 --- a/content/fireflix.js +++ b/content/fireflix.js | |||
@@ -17,48 +17,50 @@ var fireflix = { | |||
17 | this.cmd_auth_unauth = document.getElementById('cmd_auth_unauth'); | 17 | this.cmd_auth_unauth = document.getElementById('cmd_auth_unauth'); |
18 | this.menu_auth_done = document.getElementById('menu_auth_done'); | 18 | this.menu_auth_done = document.getElementById('menu_auth_done'); |
19 | this.b_auth = document.getElementById('b_auth'); | 19 | this.b_auth = document.getElementById('b_auth'); |
20 | this.b_auth_done = document.getElementById('b_auth_done'); | 20 | this.b_auth_done = document.getElementById('b_auth_done'); |
21 | this.auth_info = document.getElementById('auth_info'); | 21 | this.auth_info = document.getElementById('auth_info'); |
22 | this.loc_strings = document.getElementById('loc_strings'); | 22 | this.loc_strings = document.getElementById('loc_strings'); |
23 | this.build_menus(); | 23 | this.build_menus(); |
24 | this.cmd_set_props = document.getElementById('cmd_set_props'); | 24 | this.cmd_set_props = document.getElementById('cmd_set_props'); |
25 | this.foundphotos.init(this); | 25 | this.foundphotos.init(this); |
26 | this.photosets.init(this); | 26 | this.photosets.init(this); |
27 | this.photoset.init(this); | 27 | this.photoset.init(this); |
28 | this.uploads.init(this); | 28 | this.uploads.init(this); |
29 | this.uploadObserver.init(this); | 29 | this.uploadObserver.init(this); |
30 | this.flickr.api_key = '9c43cd66947a57e6f29db1a9da3f72e3'; | 30 | this.flickr.api_key = '9c43cd66947a57e6f29db1a9da3f72e3'; |
31 | this.flickr.api_shs = '9c33c9e2f0f0cfd5'; | 31 | this.flickr.api_shs = '9c33c9e2f0f0cfd5'; |
32 | this.flickr.prefs_root = 'net.klever.kin.fireflix'; | 32 | this.flickr.prefs_root = 'net.klever.kin.fireflix'; |
33 | this.flickr.load_token(); | 33 | this.flickr.load_token(); |
34 | document.getElementById('setslist').view = this.photosets; | 34 | document.getElementById('setslist').view = this.photosets; |
35 | document.getElementById('setphotos').view = this.photoset; | 35 | document.getElementById('setphotos').view = this.photoset; |
36 | document.getElementById('uploadlist').view = this.uploads; | 36 | document.getElementById('uploadlist').view = this.uploads; |
37 | this.no_auth_info_label = this.auth_info.value; | 37 | this.no_auth_info_label = this.auth_info.value; |
38 | this.set_auth_state(this.flickr.token,false); | 38 | this.set_auth_state(this.flickr.token,false); |
39 | if(this.flickr.token) { | 39 | if(this.flickr.token) { |
40 | this.refresh_stuff(); | 40 | this.refresh_stuff(); |
41 | }else{ | ||
42 | this.on_cmd_auth(); | ||
41 | } | 43 | } |
42 | }, | 44 | }, |
43 | set_auth_state: function(au,inp) { /* authorized, in progress */ | 45 | set_auth_state: function(au,inp) { /* authorized, in progress */ |
44 | this.cmd_auth_unauth.disabled = !au; | 46 | this.cmd_auth_unauth.disabled = !au; |
45 | this.b_auth.hidden = au || inp; | 47 | this.b_auth.hidden = au || inp; |
46 | this.b_auth_done.hidden = !inp; | 48 | this.b_auth_done.hidden = !inp; |
47 | this.menu_auth_done.hidden = !inp; | 49 | this.menu_auth_done.hidden = !inp; |
48 | this.cmd_auth_done.setAttribute('disabled',!inp); | 50 | this.cmd_auth_done.setAttribute('disabled',!inp); |
49 | this.auth_info.disabled = !au; | 51 | this.auth_info.disabled = !au; |
50 | if(au) { | 52 | if(au) { |
51 | this.auth_info.value = this.flickr.user.fullname+' ['+this.flickr.user.username+']'; /* TODO: move to locale */ | 53 | this.auth_info.value = this.flickr.user.fullname+' ['+this.flickr.user.username+']'; /* TODO: move to locale */ |
52 | }else{ | 54 | }else{ |
53 | this.auth_info.value = this.no_auth_info_label; | 55 | this.auth_info.value = this.no_auth_info_label; |
54 | } | 56 | } |
55 | }, | 57 | }, |
56 | on_cmd_auth: function() { | 58 | on_cmd_auth: function() { |
57 | var _this = this; | 59 | var _this = this; |
58 | this.flickr.authorize_0( | 60 | this.flickr.authorize_0( |
59 | function() { | 61 | function() { |
60 | _this.set_auth_state(_this.flickr.token,true); | 62 | _this.set_auth_state(_this.flickr.token,true); |
61 | }, function(x,s,c,m) { | 63 | }, function(x,s,c,m) { |
62 | _this.flickr_failure(x,s,c,m); | 64 | _this.flickr_failure(x,s,c,m); |
63 | } | 65 | } |
64 | ); | 66 | ); |