Edgewall Software

Ticket #3921: sort-and-perm-display-enhancement.patch

File sort-and-perm-display-enhancement.patch, 2.3 KB (added by awbacker@…, 2 years ago)

patch for perm.py and templates/admin_perm.py

  • webadmin/perm.py

     
    6060                        perm.revoke_permission(subject, action) 
    6161                req.redirect(self.env.href.admin(cat, page)) 
    6262         
    63         perms.sort(lambda a, b: cmp(a[0], b[0])) 
     63        #sort by subject+perm, so we get the perms sorted inside the subject 
     64        perms.sort(lambda a, b: cmp(a[0]+a[1], b[0]+b[1])) 
    6465        req.hdf['admin.actions'] = perm.get_actions() 
    6566        req.hdf['admin.perms'] = [{'subject': p[0], 
    6667                                   'action': p[1], 
  • webadmin/templates/admin_perm.cs

     
    3434</form> 
    3535 
    3636<form method="post"> 
    37  <table class="listing" id="permlist"> 
    38   <thead> 
    39    <tr><th class="sel">&nbsp;</th><th>Subject</th><th>Action</th></tr> 
    40   </thead><tbody><?cs 
    41   each:perm = admin.perms ?> 
    42    <tr> 
    43     <td><input type="checkbox" name="sel" value="<?cs var:perm.key ?>" /></td> 
    44     <td><?cs var:perm.subject ?></td> 
    45     <td><?cs var:perm.action ?></td> 
    46    </tr><?cs 
    47   /each ?></tbody> 
    48  </table> 
    49  <div class="buttons"> 
    50   <input type="submit" name="remove" value="Remove selected items" /> 
    51  </div> 
     37        <table class="listing" id="permlist"> 
     38        <thead> 
     39                <tr><th width="100">Subject</th><th>Action</th></tr></thead> 
     40                <tbody> 
     41 
     42                        <?cs set:firstRun="1" ?> 
     43                        <?cs each:perm = admin.perms ?>                  
     44                                <?cs # draws the start of a row for each new person ?> 
     45                                <?cs if:(perm.subject != lastSubject) ?> 
     46                                        <?cs if:(firstRun=="0")?></td></tr><?cs /if ?> 
     47                                        <tr> 
     48                                                <td><?cs var:perm.subject ?></td> 
     49                                                <td> 
     50                                <?cs /if ?>                      
     51 
     52                                <div style="width:150px;display:block;float:left;"> 
     53                                        <input type="checkbox" name="sel" value="<?cs var:perm.key ?>" /><?cs var:perm.action ?> 
     54                                </div> 
     55                                 
     56                                <?cs set:firstRun="0"?>                  
     57                                <?cs set:lastSubject=perm.subject?> 
     58                        <?cs /each ?> 
     59                        <?cs # this is needed to close-up after the last subject  ?> 
     60                                </td></tr> 
     61                         
     62                </tbody> 
     63                </table> 
     64                <div class="buttons"> 
     65                        <input type="submit" name="remove" value="Remove selected items" /> 
     66                </div> 
    5267</form>