make dbpatch functional again.
[SMMID.git] / mason / user.mas
blob4924434b7e43face53d52f9b9a94049c29cb6d5e
2 <%args>
3 $dbuser_id
4 $sp_person_id
5 </%args>
7 <script src="/js/node_modules/datatables/media/js/jquery.dataTables.min.js"></script>
8 <script src="/js/source/entries/user_profile.js" ></script>
9 <script src="/js/source/entries/login.js"></script>
11 <link rel="stylesheet" type="text/css" href="/js/node_modules/datatables/media/css/jquery.dataTables.css" />
13 % if($dbuser_id == 0){ #This is a new user. Security will be handled on the Perl side
14   <script>
15     $(document).ready(function(){
16       has_login().then(function(r){
17         if(r.user == null || r.role !== "curator"){
18           alert("You do not have a valid curator login.");
19           window.history.back();
20         }
21       });
22     });
23   </script>
25 <h1> Enter New User Data </h1>
27 <table id="new_user_data_form" width="100%" style="display">
28   <tr>
29     <td>First Name</td>
30     <td><textarea id="edit_first_name" rows="1" cols="60" style="display"></textarea></td>
31     <td>Password (Must be 7 or more characters)</td>
32     <td><input id="new_password" rows="1" cols="60" style="display" type="password"></input></td>
33   </tr>
34   <tr>
35     <td>Last Name</td>
36     <td><textarea id="edit_last_name" rows="1" cols="60" style="display"></textarea></td>
37     <td>Confirm Password</td>
38     <td><input id="new_password_confirm" rows="1" cols="60" style="display" type="password"></input></td>
39   </tr>
40   <tr>
41     <td>Email Address</td>
42     <td><textarea id="edit_email" rows="1" cols="60" style="display"></textarea></td>
43     <td colspan="2">(Keep careful track of the password you choose, you will have to give it to the new user)</td>
44   </tr>
45   <tr>
46     <td>Username</td>
47     <td><textarea id="edit_username" rows="1" cols="60" style="display"></textarea></td>
48   </tr>
49   <tr>
50     <td>Organization/Institution</td>
51     <td><textarea id="edit_organization" rows="1" cols="60" style="display"></textarea></td>
52     <td>User Type</td>
53     <td>
54       <select id="edit_user_type" name="edit_user_type">
55         <option value="">Regular User</option>
56         <option value="curator">Curator</option>
57       </select>
58     </td>
59   </tr>
60 </table>
62 <p>&nbsp;</p>
64 <center><button id="submit_new_user_data_button" type="button" class="btn btn-primary" onclick="submit_new_user_data()">Submit new user data</button></center>
66 % }
68 % if($dbuser_id != 0) {
70 <h1> User Profile </h1>
72 <center>
74 <table width="50%" id="user_profile_table">
75   <tr>
76     <td width="20%" style="border-bottom: 1px solid lightblue">
77       <label for="user_name">Name</label>
78     </td>
79     <td width="20%" style="border-bottom: 1px solid lightblue">
80       <span id="user_name" disabled></span>
81     </td>
82   </tr>
83   <tr>
84     <td width="20%" style="border-bottom: 1px solid lightblue">
85       <label for="user_username">Username</label>
86     </td>
87     <td width="20%" style="border-bottom: 1px solid lightblue">
88       <span id="user_username" disabled></span>
89     </td>
90   </tr>
91   <tr>
92     <td width="20%" style="border-bottom: 1px solid lightblue">
93       <label for="user_email">Email</label>
94     </td>
95     <td width="20%" style="border-bottom: 1px solid lightblue">
96       <span id="user_email" disabled></span>
97     </td>
98   </tr>
99   <tr>
100     <td width="20%" style="border-bottom: 1px solid lightblue">
101       <label for="user_type">User Type</label>
102     </td>
103     <td width="20%" style="border-bottom: 1px solid lightblue">
104       <span id="user_type" disabled></span>
105     </td>
106   </tr>
107   <tr>
108     <td width="20%" style="border-bottom: 1px solid lightblue">
109       <label for="user_organization">Organization/Institution</label>
110     </td>
111     <td width="20%" style="border-bottom: 1px solid lightblue">
112       <span id="user_organization" disabled></span>
113     </td>
114   </tr>
115 </table>
117 </center>
119 % if($sp_person_id == $dbuser_id){
121 <center>
122   <br />
123 <button id="change_user_data_button" class="btn btn-primary" type="button" onclick="edit_profile(<% $dbuser_id %>)">Edit Your Profile</button>
124 &nbsp; &nbsp;
125 <button id="change_password_button" class="btn btn-primary" type="button" onclick="change_password(<% $dbuser_id %>)">Change Password</button>
127 <p><table id="change_user_data_form" width="50%" style="display:none">
128   <tr>
129     <td>First Name</td>
130     <td><textarea id="edit_first_name" rows="1" cols="60" style="display:none"></textarea></td>
131   </tr>
132   <tr>
133     <td>Last Name</td>
134     <td><textarea id="edit_last_name" rows="1" cols="60" style="display:none"></textarea></td>
135   </tr>
136   <tr>
137     <td>Email Address</td>
138     <td><textarea id="edit_email" rows="1" cols="60" style="display:none"></textarea></td>
139   </tr>
140   <tr>
141     <td>Username</td>
142     <td><textarea id="edit_username" rows="1" cols="60" style="display:none"></textarea></td>
143   </tr>
144   <tr>
145     <td>Organization/Institution</td>
146     <td><textarea id="edit_organization" rows="1" cols="60" style="display:none"></textarea></td>
147   </tr>
148 </table>
150 <table id="change_password_form" width="50%" style="display:none">
151   <tr>
152     <td>Old Password</td>
153     <td><input id="old_password" rows="1" cols="60" style="display:none" type="password"></input></td>
154   </tr>
155   <tr>
156     <td>New Password (Must be 7 or more characters)</td>
157     <td><input id="new_password" rows="1" cols="60" style="display:none" type="password"></input></td>
158   </tr>
159   <tr>
160     <td>Confirm New Password</td>
161     <td><input id="new_password_confirm" rows="1" cols="60" style="display:none" type="password"></input></td>
162   </tr>
163 </table></p>
165 </center>
167 % }
169 <h2>Authored SMIDs</h2>
171 <table id="user_authored_smids" class="display" style="width:90%">
172 </table>
174 <h2>Authored Experiments</h2>
176 <table id="user_authored_experiments" class="display" style="width:90%">
177 </table>
179 % if($sp_person_id == $dbuser_id) {
181 <h2>Your Groups</h2>
182 <table id="user_profile_groups" class="display" style="width:90%">
183 </table>
185 % }
187 <script>
188   $(document).ready(function(){
189     var dbuser_id = <% $dbuser_id %>;
190     populate_profile_data(dbuser_id);
191   });
192 </script>
194 % }