Changeset 26ef4e in indico


Ignore:
Timestamp:
03/23/11 18:28:19 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
v0.97-series
Children:
652198
Parents:
cf32f5
Message:

[FIX] Remove account management buttons

  • When there are no local accounts;
Location:
indico/MaKaC/webinterface
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/pages/admins.py

    rcd6fa3 r26ef4e  
    14011401        am = AuthenticatorMgr() 
    14021402        authTagList = [i.getId() for i in am.getList()] 
    1403         for item in self._avatar.getIdentityList(): 
    1404             if not item.getAuthenticatorTag() in authTagList: 
    1405                 continue 
    1406             changePassword = "" 
    1407             if item.getAuthenticatorTag() != "Local" : 
    1408                 changePassword = _("External account") 
    1409             else : 
    1410                 changeURL = urlHandlers.UHUserIdentityChangePassword.getURL() 
    1411                 changeURL.addParam("userId",self._avatar.getId()) 
    1412                 changeURL.addParam("identityId",item.getId()) 
    1413                 changePassword = _("""<a href="%s"><small> _("Change password")</small></a>""")%changeURL 
    1414             il.append(""" 
    1415                         <tr> 
    1416                             <td width="60%%"> 
    1417                                 <input type="checkbox" name="selIdentities" value="%s"> %s 
    1418                             </td> 
    1419                             <td width="20%%"> 
    1420                                 <small>%s</small> 
    1421                             </td> 
    1422                             <td width="20%%"> 
    1423                                 %s 
    1424                             </td> 
    1425                         </tr> 
    1426                         """%(item.getId(), item.getLogin(), item.getAuthenticatorTag(), changePassword) ) 
    1427         vars["items"] = "".join( il ) 
     1403 
     1404        vars["identityItems"] = filter(lambda x: not x.getAuthenticatorTag() in authTagList, self._avatar.getIdentityList()) 
     1405        vars["avatar"] = self._avatar 
    14281406        vars["locator"] = self._avatar.getLocator().getWebForm() 
     1407        vars["accountManagementActive"] = 'Local' in authTagList 
    14291408        return vars 
    14301409 
  • indico/MaKaC/webinterface/tpls/UserIdentitiesTable.tpl

    r5c0074 r26ef4e  
    11 
    2 <form action="%(removeIdentityURL)s" method="POST" style="margin: 0;"> 
     2<form action="<%= removeIdentityURL %>" method="POST" style="margin: 0;"> 
    33<table> 
    4     %(items)s 
     4<% for item in identityItems: %> 
     5<tr> 
     6  <td width="60%%"> 
     7    <% if accountManagementActive: %> 
     8    <input type="checkbox" name="selIdentities" value="<%= item.getId() %>" /> 
     9    <% end %> 
     10    <%= item.getLogin() %> 
     11  </td> 
     12  <td width="20%%"> 
     13    <%= item.getAuthenticatorTag() %> 
     14  </td> 
     15  <td> 
     16    <% if item.getAuthenticatorTag() == "Local": %> 
     17    <a href="<%= urlHandlers.UHUserIdentityChangePassword.getURL(userId=avatar.getId(), identityId=item.getId()) %>"> 
     18      <small> <%= _("Change password") %></small> 
     19    </a> 
     20    <% end %> 
     21    <% else: %> 
     22    External account 
     23    <% end %> 
     24  </td> 
     25</td> 
     26</tr> 
     27<% end %> 
    528    <tr> 
    629        <td> 
    730        <table> 
    831            <tr> 
     32                <% if accountManagementActive: %> 
    933                <td> 
    1034                    <input type="submit" class="btn" value="<%= _("delete selected accounts")%>" name="action"> 
    1135                    </form> 
    1236                </td> 
    13  
    1437                <td> 
    15                 <form style="margin: 0; padding: 0;" action="%(addIdentityURL)s" method="POST"> 
     38                <form style="margin: 0; padding: 0;" action="<%= addIdentityURL %>" method="POST"> 
    1639                    <input type="submit" class="btn" value="<%= _("create a new account")%>" name="action"> 
    1740                </form> 
    18  
    1941                </td> 
     42                <% end %> 
    2043            </tr> 
    2144        </table> 
Note: See TracChangeset for help on using the changeset viewer.