My Account Page Migrated. PHP to be replaced
authorYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 29 Jul 2013 15:15:15 +0000 (17:15 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 29 Jul 2013 15:15:15 +0000 (17:15 +0200)
portal/templates/my_account.html [new file with mode: 0644]
portal/urls.py
portal/views.py

diff --git a/portal/templates/my_account.html b/portal/templates/my_account.html
new file mode 100644 (file)
index 0000000..b0dbaf8
--- /dev/null
@@ -0,0 +1,145 @@
+{% extends "layout-unfold1.html" %}
+
+{% block head %}
+<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/my_account.common.css" />
+<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/my_account.profile.css" />
+<script type="text/javascript" src="{{STATIC_URL}}/js/jquery.validate.js"></script> 
+<script type="text/javascript" src="{{STATIC_URL}}/js/my_account.edit_profile.js"></script>
+<script type="text/javascript" src="{{STATIC_URL}}/js/my_account.register.js"></script>
+{% endblock %}
+
+{% block unfold1_main %}
+
+
+
+<div class='ms-dashboard-panel' id='ms-dashboard-slices' style=" display:block; float:none"  >
+    <div class='ms-dashboard-caption'>
+      <h2>MySlice  Account</h2>
+    </div>
+    <div class='ms-dashboard-content' id='tophat__list__user_hrn'>
+            <div id="main">
+                    <div id="middle">
+                       <form id="editForm"  method="POST" action="#" enctype="multipart/form-data">
+                       <table class="profile">          
+                                    <tr class="odd">
+                                            <td colspan="2">
+                                                <div id="info">Personal Details</div>
+                                            </td>
+                                    </tr>
+                                <tr class="even">
+                                            <td class="key">Email</td>
+                                            <td class="value">
+                                                   <span id="emailval" class="value" >{{ person.email }}</span>
+                                                   <img class="logo" src="{{STATIC_URL}}/img/ques_icon.png" onclick="emailAlert()"  title="To change your email please contact the administrator" style="height: 20px; width: 20px; position: absolute; left: 625px; left: 900px; margin-top: -9px;">
+                                            </td>
+                                    </tr>
+                                <tr class="odd">
+                                            <td class="key">Password</td>
+                                            <td class="value"> 
+                                                <button class="edit" type="button" title="Password" name="edit_pass" id="edit_pass">Edit</button>
+                                                    <span id="passval"class="value">******** </span>
+                                                    <span class="hide_this" id="span_pass">
+                                                            <button type="button" class="cancel" title="Cancel" id="cancel_pass_change"> Cancel </button>
+                                                                <div style='display:none;' id="pass_form">
+                                                                    <input type='hidden'  value='' /></div>
+                                                                    <table id="edit_password">
+                                                                            <tr>
+                                                                                    <td>Enter password: </td>
+                                                                                    <td class="field"> 
+                                                                                        <input type="password" name="password" id="password" />
+                                                                                    </td>
+                                                                            </tr>
+                                                                            <tr>
+                                                                                    <td>Confirm password: </td>
+                                                                                    <td class="field"> 
+                                                                                        <input type="password" name="confirmpassword" id="confirmpassword" /> 
+                                                                                        <input type="submit" name="submit_pass" value="Save"/> 
+                                                                                    </td>
+                                                                            </tr>
+                                                                    </table>
+                                                    </span>    
+                                            </td>
+                                </tr>
+                                <tr class="even">
+                                            <td class="key">Full Name</td>
+                                            <td class="value">
+                                                    <span id="nameval" class="value" >Yasin Rahman </span>
+                                                    <span class="hide_this" id="span_name">
+                                                            <button type="button" class="cancel" title="Cancel" id="cancel_name_change"> Cancel </button>
+                                                            
+                                                                <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
+                                                                    <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="" />
+                                                                    <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="" />
+                                                                    <input type="submit" name="submit_name" value="Save"/>
+                                                    </span>
+                                                    <button class="edit" type="button"title="Full Name" id="edit_name">Edit</button>
+                                            </td>
+
+                                </tr>
+                                <tr class="odd">
+                                            <td class="key">Affiliation</td>
+                                            <td class="value">
+                                                    <span id="affval" class="value">UPMC</span>
+                                                    <img class="logo" src="{{STATIC_URL}}/img/ques_icon.png" onclick="affAlert()"  title="To change your affiliation please contact the administrator" style="height: 20px; width: 20px; position: absolute; left: 625px; left: 900px; ">
+                                            </td>
+                                    </tr>
+                            
+                        <tr class="even">
+                                    <td class="key">Generate Keys</td>
+                                    <td> 
+                                        </div>
+                                            <button id="generate_keypair" name="generate" type="submit" onclick="myFunction()" title="Generate a new key pair. After it is generated, you will need to download your public and private keys again.">Generate a new Key Pair </button>
+                                         </div>
+                                    </td> 
+                            </tr>
+                            <tr class="odd">
+                                    <td class="key">Public Key
+                                    </td>
+                                    <td class="value">
+                                            
+                                            <span id="keyval" class="value">******** </span>
+                                            <span class="hide_this" id="span_upload">
+                                                    <button type="button" class="cancel" title="Cancel" id="cancel_upload"> Cancel </button>
+                                                        <div style='display:none;'>
+                                                            <input type='hidden'  name='upload'  /></div>
+                                                            <input type="file" name="pubkey" id="pubkey"/> 
+                                                            
+                                                            <button name="upload_key" id="upload_key"  type="submit" title="Delete your private key">Upload </button>
+                                                            
+                                            </span>
+                                                <div style='display:none;'>
+                                                    <input type='hidden'  name='dload'  />
+                                                </div> 
+                                                    <button type="submit" name="dl_pubkey" class="download" title="Download your public key" id="dl_file"> Download </button>
+                                             <button id="upload_file" type="button" title="Upload a public key"> Upload </button>       
+                                    </td>
+                            </tr>
+                                    <tr class="even" id="pkey_row" display="none">
+                                            <td class="key">Private Key </td>
+                                            <td class="value">********<a href="#">
+                                                 <button type="submit" name="dl_pkey" class="download" title="Download your privaye key" id="dl_pkey"> Download </button>
+                                                 <button id="delete" name="delete" type="submit" title="Delete your private key">Delete </button>
+                                            </td>
+                                    </tr>
+                                    <tr class="odd">
+                                            <td colspan="2">
+
+                                                    <p class="warning" id="pkey_del_msg"> For better
+                                                    security we recommend that you
+                                                    download and delete your 
+                                                    private key from the 
+                                                    server. Always store your 
+                                                    private key in a secure 
+                                                    location. </p>
+                                            </td>
+                                    </tr>
+
+                            </table>
+                          </form>
+                    </div>
+            </div>
+       
+    </div>
+ </div>
+
+{% endblock %}
index 64333b6..9934865 100644 (file)
@@ -22,7 +22,7 @@
 
 from django.conf.urls import patterns, include, url
 from portal           import views
-from portal.views     import UserRegisterView, UserValidateView, DashboardView
+from portal.views     import UserRegisterView, UserValidateView, DashboardView, MyAccountView
 from portal.util      import TemplateView
 
 # DEPRECATED #named_register_forms = (
@@ -42,6 +42,7 @@ urlpatterns = patterns('',
     # User validation
     url(r'^user/validate/?$', UserValidateView.as_view(), name='user_validate'),
     url(r'^dashboard/?$', DashboardView.as_view(), name='dashboard'),
+    url(r'^my_account/?$', MyAccountView.as_view(), name='my_account'),
     url(r'^contact/?$', views.contact),
     # Slice request
     url(r'^slice_request/?$', views.slice_request),
index 74c56ea..afed7e8 100644 (file)
@@ -423,6 +423,60 @@ class UserValidateView(ActivationView):
 # DEPRECATED #
 # DEPRECATED #    return p.render()
 
+class MyAccountView(TemplateView):
+    template_name = "my_account.html"
+
+    def get_context_data(self, **kwargs):
+        #user_hrn = 'ple.upmc.jordan_auge'
+
+        #messages.info(self.request, 'You have logged in')
+        page = Page(self.request)
+
+        # Slow...
+        #slice_query = Query().get('slice').filter_by('user.user_hrn', 'contains', user_hrn).select('slice_hrn')
+        #slice_query = Query().get('user').filter_by('user_hrn', '==', user_hrn).select('slice.slice_hrn')
+        #auth_query  = Query().get('network').select('network_hrn')
+        #page.enqueue_query(slice_query)
+        #page.enqueue_query(auth_query)
+
+        #page.expose_queries()
+
+        #slicelist = SimpleList(
+        #    title = None,
+        #    page  = page,
+        #    key   = 'slice.slice_hrn',
+        #    query = slice_query,
+        #)
+
+        #authlist = SimpleList(
+        #    title = None,
+        #    page  = page,
+        #    key   = 'network_hrn',
+        #    query = auth_query,
+        #)
+
+        context = super(MyAccountView, self).get_context_data(**kwargs)
+        context['person']   = self.request.user
+        #context['networks'] = authlist.render(self.request)
+        #context['slices']   = slicelist.render(self.request)
+
+        # XXX This is repeated in all pages
+        # more general variables expected in the template
+        context['title'] = 'User Profile Page'
+        # the menu items on the top
+        context['topmenu_items'] = topmenu_items('my_account', self.request)
+        # so we can sho who is logged
+        context['username'] = the_user(self.request)
+
+        context.update(page.prelude_env())
+
+        return context
+
+
+
+
+
+
 
 # view for contact form
 def contact(request):