Permalink
Browse files

start merging geo write/token checks with flickr.auth.js functions

  • Loading branch information...
1 parent 2cd8281 commit 93dc440dfb5c4d61ec5dff4bef3f6707f53e1f06 straup committed Feb 16, 2012
Showing with 13 additions and 18 deletions.
  1. +5 −0 www/javascript/flickr.auth.js
  2. +3 −3 www/javascript/flickr.auth.min.js
  3. +5 −15 www/templates/page_flickr_photo.txt
@@ -19,6 +19,11 @@ function flickr_auth_dialog_request_write_perms(action, redir){
html += 'again so that you can authorize us to access your account with a <q>write</q> token. ';
}
+ else if (action=='geo'){
+ html += 'In order to be able to edit your photos we need to bounce you back through Flickr ';
+ html += 'again so that you can authorize us to access your account with a <q>write</q> token. ';
+ }
+
html += '</span>';
// other 'actions' go here...
@@ -1,3 +1,3 @@
-function flickr_auth_dialog_request_write_perms(d,b){var c=abs_root_url+"account/flickr/auth?perms=write";if(b)c+="&redir="+encodeURIComponent(b);var a='<div id="modal_flickr_auth">';a+="<h3>Hey look, a modal dialog!</h3>";a+="<p>When you first signed up and authorized this application with Flickr you allowed it access your account with a <q>read</q> only token. ";a+='<span style="font-style:italic;">';if(d=="fave"){a+="In order to fave another users photos we need to bounce you back through Flickr ";
-a+="again so that you can authorize us to access your account with a <q>write</q> token. "}a+="</span>";a+="You'll only have to do this once (or until you revoke the token itself <a href=\"http://www.flickr.com/services/auth/list.gne\">on Flickr</a>). Once you've approved the new token you will be sent back to this webpage.</p>";a+='<div class="buttons"><button onclick="location.href=\''+c+"'; return false;\">Get started</button>&#160;&#160;";a+='<button onclick="$.modal.close(); return false;">Nevermind, maybe another time.</button></div>';
-a+="</div>";$.modal(a)};
+function flickr_auth_dialog_request_write_perms(b,c){var d=abs_root_url+"account/flickr/auth?perms=write";if(c)d+="&redir="+encodeURIComponent(c);var a='<div id="modal_flickr_auth">';a+="<h3>Hey look, a modal dialog!</h3>";a+="<p>When you first signed up and authorized this application with Flickr you allowed it access your account with a <q>read</q> only token. ";a+='<span style="font-style:italic;">';if(b=="fave"){a+="In order to fave another users photos we need to bounce you back through Flickr ";
+a+="again so that you can authorize us to access your account with a <q>write</q> token. "}else if(b=="geo"){a+="In order to be able to edit your photos we need to bounce you back through Flickr ";a+="again so that you can authorize us to access your account with a <q>write</q> token. "}a+="</span>";a+="You'll only have to do this once (or until you revoke the token itself <a href=\"http://www.flickr.com/services/auth/list.gne\">on Flickr</a>). Once you've approved the new token you will be sent back to this webpage.</p>";
+a+='<div class="buttons"><button onclick="location.href=\''+d+"'; return false;\">Get started</button>&#160;&#160;";a+='<button onclick="$.modal.close(); return false;">Nevermind, maybe another time.</button></div>';a+="</div>";$.modal(a)};
@@ -127,21 +127,11 @@ $(document).ready(function(){
{literal}
$("#edit_geo").click(function(e){
- var html = '<div id="photo_geo_perms_warning">';
- html += '<h3>We need to move some of the furniture first.</h3>';
- html += '<p>';
- html += 'In order to edit the geo information we need to update your Flickr auth token, first. ';
- html += 'When you first signed in we asked Flickr for an auth token <q>read</q> only permissions. ';
- html += 'We\'ll need to send you to Flickr to get a new token (one with <q>write</q> permissions) before you edit your photo ';
- html += 'You\'ll only need to do this once and you\'ll be bounced back to this page when you\'re done.';
- html += '</p>';
- html += '<div style="text-align:center; margin-top:30px;"><a class="button" href="';
- html += '/account/flickr/auth?perms=write&redir=' + encodeURIComponent(photo_url) + '#edit-geo">';
- html += 'Okay, let\'s do it</a>';
- html += '&#160;&#160;';
- html += '<a href="#" onclick="$.modal.close(); return false;" class="button">I\'d rather not.</a></div>';
-
- $.modal(html);
+ var redir = photo_url;
+ redir += '#edit-geo';
+
+ flickr_auth_dialog_request_write_perms('geo', redir);
+ return;
});
{/literal}

0 comments on commit 93dc440

Please sign in to comment.