Changeset 7335 for main


Ignore:
Timestamp:
13 Dec 2011, 07:30:25 (13 years ago)
Author:
Henrik Bettermann
Message:

Make local roles assignable in certificate containers.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7334 r7335  
    17151715    tabtwoactions = ['Add course referrer',
    17161716                     'Remove selected course referrers','Cancel']
     1717    tabthreeactions1 = ['Remove selected local roles']
     1718    tabthreeactions2 = ['Add local role']
    17171719
    17181720    @property
     
    17511753        self.redirect(self.url(self.context))
    17521754        return
     1755
     1756    def getLocalRoles(self):
     1757        roles = ILocalRolesAssignable(self.context)
     1758        return roles()
     1759
     1760    def getUsers(self):
     1761        """Get a list of all users.
     1762        """
     1763        for key, val in grok.getSite()['users'].items():
     1764            url = self.url(val)
     1765            yield(dict(url=url, name=key, val=val))
     1766
     1767    def getUsersWithLocalRoles(self):
     1768        return get_users_with_local_roles(self.context)
     1769
     1770    @grok.action('Add local role', validator=NullValidator)
     1771    def addLocalRole(self, **data):
     1772        return add_local_role(self, 3, **data)
     1773
     1774    @grok.action('Remove selected local roles')
     1775    def delLocalRoles(self, **data):
     1776        return del_local_roles(self,3,**data)
    17531777
    17541778
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatemanagepage.pt

    r6461 r7335  
    1616
    1717<div id="tabs">
    18 <ul>
    19   <li><a href="#tab-1"><span>Settings</span></a></li>
    20   <li><a href="#tab-2"><span>Course Referrers</span></a></li>
    21 </ul>
     18  <ul>
     19    <li><a href="#tab-1"><span>Settings</span></a></li>
     20    <li><a href="#tab-2"><span>Course Referrers</span></a></li>
     21    <li><a href="#tab-3"><span>Local Roles</span></a></li>
     22  </ul>
    2223   
    23 <div id="tab-1">       
    24       <table class="zebra">
     24  <div id="tab-1">
     25        <table class="zebra">
     26        <tbody>
     27        <tal:block repeat="widget view/widgets">
     28          <tr>
     29            <td class="label">
     30              <label tal:attributes="for widget/name">
     31                <span class="required" tal:condition="widget/required">*</span>
     32                <span i18n:translate="" tal:content="widget/label">label</span>:
     33              </label>
     34            </td>
     35            <td class="field">
     36              <span class="widget" tal:content="structure widget">
     37                <input type="text" />
     38              </span>
     39              <tal:error tal:condition="widget/error">
     40                <span tal:replace="structure widget/error">error</span>
     41              </tal:error>
     42              <tal:hint tal:condition="widget/hint">
     43                <span class="hint" tal:content="structure widget/hint">hint</span>
     44              </tal:hint>
     45            </td>
     46          </tr>
     47        </tal:block>
     48        </tbody>
     49        </table>
     50        <div class="actionButtons" tal:condition="view/availableActions">
     51          <span tal:repeat="action view/actions"
     52                tal:omit-tag="">
     53            <input tal:condition="python:action.label in view.taboneactions"
     54                   tal:replace="structure action/render"/>
     55          </span>
     56        </div>
     57  </div>
     58  <div id="tab-2">
     59    <h3>Course Referrers</h3>
     60    <table class="display dataTableManage">
     61      <thead>
     62        <tr>
     63          <th>&nbsp;</th><th>Level</th><th>Semester</th><th>Referrer</th><th>Course</th><th>Title</th>
     64          <th>Mandatory</th>
     65        </tr>
     66      </thead>
    2567      <tbody>
    26       <tal:block repeat="widget view/widgets">
    27         <tr>
    28           <td class="label">
    29             <label tal:attributes="for widget/name">
    30               <span class="required" tal:condition="widget/required">*</span>
    31               <span i18n:translate="" tal:content="widget/label">label</span>:
    32             </label>
     68        <tr tal:repeat="cc context/values">
     69           <td>
     70            <input type="checkbox"
     71                 name="val_id"
     72                 tal:attributes="value cc/__name__" />
    3373          </td>
    34           <td class="field">
    35             <span class="widget" tal:content="structure widget">
    36               <input type="text" />
     74           <td>
     75            <span tal:content="cc/level">
     76           LEVEL
    3777            </span>
    38             <tal:error tal:condition="widget/error">
    39               <span tal:replace="structure widget/error">error</span>
    40             </tal:error>
    41             <tal:hint tal:condition="widget/hint">
    42               <span class="hint" tal:content="structure widget/hint">hint</span>
    43             </tal:hint>
     78          </td>
     79          <td tal:content="cc/course/semester">SEMESTER</td>
     80          <td>
     81            <a tal:attributes="href python: view.url(cc)"
     82             tal:content="cc/__name__">
     83                REFERRER CODE
     84            </a>
     85          </td>
     86          <td>
     87            <a tal:attributes="href python:view.url(cc.course)"
     88             tal:content="cc/course/code">
     89                COURSE CODE
     90            </a>
     91          </td>
     92          <td>
     93            <span tal:content="cc/course/title">
     94           COURSE TITLE
     95            </span>
     96          </td>
     97          <td>
     98            <span tal:content="cc/core_or_elective">
     99           MANDATORY
     100            </span>
    44101          </td>
    45102        </tr>
    46       </tal:block>
    47103      </tbody>
    48       </table>
    49       <div class="actionButtons" tal:condition="view/availableActions">
    50         <span tal:repeat="action view/actions"
    51               tal:omit-tag="">
    52           <input tal:condition="python:action.label in view.taboneactions"
    53                  tal:replace="structure action/render"/>
    54         </span>
    55       </div>
    56 
    57 </div>   
    58    
    59 <div id="tab-2">
    60   <h3>Course Referrers</h3>
    61   <table class="display dataTableManage">
    62     <thead>
    63       <tr>
    64         <th>&nbsp;</th><th>Level</th><th>Semester</th><th>Referrer</th><th>Course</th><th>Title</th>
    65         <th>Mandatory</th>
     104    </table>
     105    <div class="actionButtons" tal:condition="view/availableActions">
     106      <span tal:repeat="action view/actions"
     107            tal:omit-tag="">
     108        <input tal:condition="python:action.label in view.tabtwoactions"
     109               tal:replace="structure action/render"/>
     110      </span>
     111    </div>
     112  </div>
     113  <div id="tab-3"> <br />
     114    <table class="display dataTableManage">
     115      <thead>
     116        <tr>
     117          <th>&nbsp;
     118          </th>
     119          <th>User Id
     120          </th>
     121          <th>Name
     122          </th>
     123          <th>Local Role
     124          </th>
     125        </tr>
     126      </thead>
     127      <tbody>
     128        <tr tal:repeat="entry view/getUsersWithLocalRoles" class="gradeB"> <td>
     129            <input type="checkbox" name="role_id" tal:attributes="value python: entry['user_name']+'|'+entry['local_role']" /> </td>
     130          <td tal:content="entry/user_name"> USERNAME </td>
     131          <td tal:content="entry/user_title"> USERTITLE </td>
     132          <td tal:content="entry/local_role_title"> LOCAL ROLE </td>
     133        </tr>
     134      </tbody>
     135    </table>
     136    <div class="actionButtons" tal:condition="view/availableActions">
     137      <span tal:repeat="action view/actions" tal:omit-tag="">
     138        <input tal:condition="python:action.label in view.tabthreeactions1" tal:replace="structure action/render"/>
     139      </span>
     140    </div><br /><br />
     141    <table class="zebra">
     142      <tr> <td>
     143          <select id="user" name="user">
     144            <option tal:repeat="user view/getUsers" tal:attributes="value user/name">
     145            <span tal:replace="user/val/title">USERTITLE
     146            </span>
     147            </option>
     148          </select> </td> <td>
     149          <select id="local_role" name="local_role">
     150            <option tal:repeat="localrole view/getLocalRoles" tal:attributes="value localrole/name">
     151            <span tal:replace="localrole/title">LOCALROLETITLE
     152            </span>
     153            </option>
     154          </select> </td> <td>
     155          <div tal:condition="view/availableActions">
     156            <span tal:repeat="action view/actions" tal:omit-tag="">
     157              <input tal:condition="python:action.label in view.tabthreeactions2" tal:replace="structure action/render"/>
     158            </span>
     159          </div> </td>
    66160      </tr>
    67     </thead>
    68     <tbody>
    69       <tr tal:repeat="cc context/values">
    70          <td>
    71           <input type="checkbox"
    72                  name="val_id"
    73                  tal:attributes="value cc/__name__" />
    74         </td>
    75          <td>
    76           <span tal:content="cc/level">
    77            LEVEL
    78           </span>
    79         </td>
    80         <td tal:content="cc/course/semester">SEMESTER</td>
    81         <td>
    82           <a tal:attributes="href python: view.url(cc)"
    83              tal:content="cc/__name__">
    84                 REFERRER CODE
    85           </a>
    86         </td>
    87         <td>
    88           <a tal:attributes="href python:view.url(cc.course)"
    89              tal:content="cc/course/code">
    90                 COURSE CODE
    91           </a>
    92         </td>       
    93         <td>
    94           <span tal:content="cc/course/title">
    95            COURSE TITLE
    96           </span>
    97         </td>
    98         <td>
    99           <span tal:content="cc/core_or_elective">
    100            MANDATORY
    101           </span>
    102         </td>               
    103       </tr>
    104     </tbody>
    105   </table>
    106   <div class="actionButtons" tal:condition="view/availableActions">
    107     <span tal:repeat="action view/actions"
    108           tal:omit-tag="">
    109       <input tal:condition="python:action.label in view.tabtwoactions"
    110              tal:replace="structure action/render"/>
    111     </span>
     161    </table>
    112162  </div>
    113  
    114 </div>
    115163</div>
    116164</form> 
  • main/waeup.sirp/trunk/src/waeup/sirp/permissions.py

    r7334 r7335  
    8383
    8484class CourseAdviser100(grok.Role):
    85     """The course adviser role is meant for the
     85    """The 100 level course adviser role is meant for the
    8686    assignment of dynamic roles only.
    8787    """
     
    9191
    9292class CourseAdviser200(grok.Role):
    93     """The course adviser role is meant for the
     93    """The course 200 level adviser role is meant for the
    9494    assignment of dynamic roles only.
    9595    """
     
    9999
    100100class CourseAdviser300(grok.Role):
    101     """The course adviser role is meant for the
     101    """The 300 level course adviser role is meant for the
    102102    assignment of dynamic roles only.
    103103    """
     
    107107
    108108class CourseAdviser400(grok.Role):
    109     """The course adviser role is meant for the
     109    """The 400 level course adviser role is meant for the
    110110    assignment of dynamic roles only.
    111111    """
     
    115115
    116116class CourseAdviser500(grok.Role):
    117     """The course adviser role is meant for the
     117    """The 500 level course adviser role is meant for the
    118118    assignment of dynamic roles only.
    119119    """
     
    123123
    124124class CourseAdviser600(grok.Role):
    125     """The course adviser role is meant for the
     125    """The 600 level course adviser role is meant for the
    126126    assignment of dynamic roles only.
    127127    """
Note: See TracChangeset for help on using the changeset viewer.