silexlabs / cloud-explorer

*this version is deprecated, see CloudExplorer2* File manager for your users cloud services such as dropbox, google drive and FTP
http://cloud-explorer.org
52 stars 23 forks source link

missing in CE: api to check if the user is logged in #21

Closed lexoyo closed 10 years ago

zabojad commented 10 years ago

I'm currently prioritizing my issues... is this still needed ?

lexoyo commented 10 years ago

My use case:

zabojad commented 10 years ago

I understand, ok I'll see what can be done here...

zabojad commented 10 years ago

I've just pushed in 5f1d1a1b425f4e23ecfcd279c1ee7210b68a99e5 a draft API for what you were looking for.

It is non-Ink API and it is a draft so it might change later if I find it not adequate...

As it's a draft, it's also not document yet but here is a use example of the two new API methods you should use:

<script type="text/javascript">

            $(document).ready(function(){

                    var textarea = $('textarea.console');

                    var currentBlob;

                    window.cloudExplorer = ce.api.CloudExplorer.get();

                    textarea.val("Cloud Explorer ready");

                    $('.isLoggedIntoWww').click(function(){

                            cloudExplorer.isLoggedIn("www", function(ret){

                                    if (ret)
                                        textarea.val(textarea.val() + "\nUser logged into www.");
                                    else
                                        textarea.val(textarea.val() + "\nUser not logged into www.");

                                }, function(e){ 

                                    textarea.val(textarea.val() + "\nError while checking if user not logged into www: "+e);
                                });
                        });

                    $('.authorizeWww').click(function(){

                            cloudExplorer.requestAuthorize("www", function(){

                                    textarea.val(textarea.val() + "\nUser successfully logged into www.");

                                }, function(e) {

                                    textarea.val(textarea.val() + "\nError while user tried to log into www: "+e);
                                });
                        });

                    // (...)

                });

</script>

Look at the app/index.html for the full use example.

I close this ticket for now, please open a new one if you find a bug or anything...