Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Tue, 29 Jul 2014 12:52:59 +0000 (14:52 +0200)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Tue, 29 Jul 2014 12:52:59 +0000 (14:52 +0200)
portal/actions.py
portal/contactview.py
portal/templates/onelab/onelab_supportview.html
portal/templates/slice-tab-users-view.html

index 75e5d06..3f83013 100644 (file)
@@ -416,7 +416,12 @@ def create_slice(wsgi_request, request):
     user_hrn = request.get('user_hrn', None)
     user_hrns = list([user_hrn]) if user_hrn else list()
     
-    user_email = request.get
+    user_query  = Query().get('user').select('user_hrn','user_email').filter_by('user_hrn','==',user_hrn)
+    user_details_sfa = execute_admin_query(wsgi_request, user_query)
+    if not user_details_sfa:
+        raise Exception, "User %s doesn't exist, validate user before validating slice" % user_hrn
+    for user in user_details_sfa:
+        user_email = user['user_email']
 
     # XXX We should create a slice with Manifold terminology
     slice_params = {
@@ -432,12 +437,11 @@ def create_slice(wsgi_request, request):
     results = execute_query(wsgi_request, query)
     if not results:
         raise Exception, "Could not create %s. Already exists ?" % slice_params['hrn']
-    ## We do not store the email in pendingslice table. As a result receiver's email is unknown ##
-    ## Need modification in pendingslice table ###
-    #else:
-    #    subject = 'Slice created'
-    #    msg = 'A manager of your institution has validated your slice request. You can now add resources to the slice and start experimenting.'
-    #    send_mail(subject, msg, 'support@onelab.eu',['yasin.upmc@gmail.com'], fail_silently=False)
+    else:
+        clear_user_creds(wsgi_request,user_email)
+        subject = 'Slice created'
+        msg = 'A manager of your institution has validated your slice request. You can now add resources to the slice and start experimenting.'
+        send_mail(subject, msg, 'support@onelab.eu',[user_email], fail_silently=False)
        
     return results
 
index c41ee74..482594e 100644 (file)
@@ -35,7 +35,7 @@ class ContactView (FreeAccessView, ThemeView):
             #theme.template_name = 'email_support.txt'
             #recipients = render_to_string(theme.template, form.cleaned_data)
             #recipients = subject.replace('\n', '')
-            recipients = ['support@myslice.info']
+            recipients = ['support@onelab.eu']
             if cc_myself:
                 recipients.append(email)
             #recipients = ['support@myslice.info']
index e33127c..eb2a8de 100644 (file)
                        <h2>Contact Us</h2>
                
                        <h3>Mailing List</h3>
-                       <p>You can subscribe to our mailing list by sending a request to: <b>support</b> AT <b>myslice</b> DOT <b>info</b></p>
+                       <p>You can subscribe to our mailing list by sending a request to: <b>support</b> (AT) <b>onelab</b> (DOT) <b>eu</b></p>
                        <p>Also you can adress any issues in the same email address.</p>
                        
                        <h3>Mailing Address</h3>
index 18007ab..82acd01 100644 (file)
@@ -6,7 +6,10 @@
     function get_users_in_slice(authority_hrn){
         console.log(authority_hrn);
         $("table#user-tab").html("<tr><th>+/-</th><th>Email</th><th>User hrn</th></tr>");
-       var slice_users = [];
+       var slice_users = [];
+       var slice_users_removed = [];
+               var slice_users_emails = [];
+       var slice_users_emails_removed = [];
        $.post("/rest/user/",{'filters':{'parent_authority': authority_hrn}}, function( data ) {
                var list_users = [];
                var table_users = [];
                $("div#user-tab-loading").css("display","none");
             $("input:checkbox.user").click(function() {
                 user_hrn = $(this).closest('tr').find('td:eq(2)').html();
+                user_email = $(this).closest('tr').find('td:eq(1)').html();
                 if(this.checked){
                     var record_id = this.id;
                     slice_users.push (user_hrn);
+                                       slice_users_removed.splice($.inArray(user_hrn, slice_users_removed),1);
+                    slice_users_emails.push (user_email);
+                                       slice_users_emails_removed.splice($.inArray(user_email, slice_users_emails_removed),1); 
+       
                 }else{
-                    console.log(slice_users);
+                    slice_users_removed.push (user_hrn);
+                                       slice_users.splice($.inArray(user_hrn, slice_users),1);
+                    slice_users_emails_removed.push (user_email);
+                                       // this one is removing from the list wrong user when u uncheck
+                                       //slice_users_emails.splice($.inArray(user_email, slice_users_emails),1);
+                                       //this one is still buggy cz it still keeps users in both arrays
+                                       // but it's ok for the moment
+                                       slice_users_emails;
+       
                 }
             });
        }); // post rest/use
                        mysliceAlert('Rest Error for: '+data.error,'warning', true);
                        }
                }); // post update slice
-               // TODO: refresh table
-               //window.location="/portal/institution#slices";
+                       emails = slice_users_emails.concat(slice_users_emails_removed);
+               $.post("/credentials/clear/",{'emails':emails}, function(data) {
+               }); // post credentials clear
+
                }); // button#addusers click
 
     } // get_users_in_slice