MyAcc: Request to access platform- OK
authorYasin <mohammed-yasin.rahman@lip6.fr>
Thu, 12 Dec 2013 09:57:37 +0000 (10:57 +0100)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Thu, 12 Dec 2013 09:57:37 +0000 (10:57 +0100)
portal/accountview.py
portal/templates/account-view.html

index 53a9445..d4de309 100644 (file)
@@ -9,6 +9,8 @@ from ui.topmenu                         import topmenu_items, the_user
 from django.http                        import HttpResponse, HttpResponseRedirect
 from django.contrib                     import messages
 from django.contrib.auth.decorators     import login_required
+from django.core.mail                   import send_mail
+
 #
 import json, os, re, itertools
 
@@ -317,8 +319,62 @@ def account_process(request):
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')    
             return HttpResponseRedirect("/portal/account/")
-           
-       
+        
+    elif 'fuseco' in request.POST:
+        # The recipients are the PI of the authority
+        #recipients = authority_get_pi_emails(request, authority_hrn)
+        recipients = ["support@myslice.info"] 
+        requester = request.user # current user
+        sender = 'yasin.upmc@gmail.com' # the server email
+        msg = "OneLab user %s requested account in fuseco Platform" % requester
+        send_mail("Onelab user %s requested an account in Fuseco"%requester , msg, sender, recipients)
+        messages.info(request, 'Request to get access on Fuseco platform received. Please wait for PI\'s reply.')
+        return HttpResponseRedirect("/portal/account/")
+
+    elif 'ple' in request.POST:
+        # The recipients are the PI of the authority
+        #recipients = authority_get_pi_emails(request, authority_hrn)
+        recipients = ["support@myslice.info"] 
+        requester = request.user # current user
+        sender = 'yasin.upmc@gmail.com' # the server email
+        msg = "OneLab user %s requested account in fuseco Platform" % requester
+        send_mail("Onelab user %s requested an account in PLE"%requester , msg, sender, recipients)
+        messages.info(request, 'Request to get access on PLE platform received. Please wait for PI\'s reply.')
+        return HttpResponseRedirect("/portal/account/")
+
+    elif 'omf' in request.POST:
+        # The recipients are the PI of the authority
+        #recipients = authority_get_pi_emails(request, authority_hrn)
+        recipients = ["support@myslice.info"]
+        requester = request.user # current user
+        sender = 'yasin.upmc@gmail.com' # the server email
+        msg = "OneLab user %s requested account in omf:nitos Platform" % requester
+        send_mail("Onelab user %s requested an account in OMF:NITOS"%requester , msg, sender, recipients)
+        messages.info(request, 'Request to get access on OMF:NITOS platform received. Please wait for PI\'s reply.')
+        return HttpResponseRedirect("/portal/account/")
+
+    elif 'wilab' in request.POST:
+        # The recipients are the PI of the authority
+        #recipients = authority_get_pi_emails(request, authority_hrn)
+        recipients = ["support@myslice.info"]
+        requester = request.user # current user
+        sender = 'yasin.upmc@gmail.com' # the server email
+        msg = "OneLab user %s requested account in Wilab Platform" % requester
+        send_mail("Onelab user %s requested an account in Wilab"%requester , msg, sender, recipients)
+        messages.info(request, 'Request to get access on Wilab platform received. Please wait for PI\'s reply.')
+        return HttpResponseRedirect("/portal/account/")
+
+    elif 'iotlab' in request.POST:
+        # The recipients are the PI of the authority
+        #recipients = authority_get_pi_emails(request, authority_hrn)
+        recipients = ["support@myslice.info"]
+        requester = request.user # current user
+        sender = 'yasin.upmc@gmail.com' # the server email
+        msg = "OneLab user %s requested account in IOTLab Platform" % requester
+        send_mail("Onelab user %s requested an account in IOTLab"%requester , msg, sender, recipients)
+        messages.info(request, 'Request to get access on IOTLab platform received. Please wait for PI\'s reply.')
+        return HttpResponseRedirect("/portal/account/")
+  
     else:
         messages.info(request, 'Under Construction. Please try again later!')
         return HttpResponseRedirect("/portal/account/")
index 26c21f8..7459a3c 100644 (file)
@@ -21,9 +21,9 @@
 {% endif %}
 
 
+<form id="editForm"  method="POST" action="account_process" enctype="multipart/form-data">
 <div id="middle" align="center">
        <div class="well">
-               <form id="editForm"  method="POST" action="account_process" enctype="multipart/form-data">
                {% csrf_token %}
                        <table class="profile">          
                        <tr class="odd">
                                </td>
                                </tr>
                        </table>
-               </form>
        </div>
 </div>
 
             <tr class="border_bottom">
                 <td class="odd"> {{ platform.platform_no_access }} </td>
                 <td class="even">
-                                       <button id="request_access" name="request_access" type="submit" title="Request Access to this platform">Request</button>
+                                       <button id="request_access" name= {{platform.platform_no_access}} type="submit" title="Request Access to this platform">Request {{platform.platform_no_access}}</button>
                                </td>
             </tr> 
             {%endfor%}               
 </div>
 
 
+</form>