Changeset 16529 for main


Ignore:
Timestamp:
7 Jul 2021, 06:51:05 (3 years ago)
Author:
Henrik Bettermann
Message:

Show local roles on faculty, department, course and certificate pages
and provide 'Contact' button so that authenticated users can contact
officers via Kofa.

Location:
main/waeup.kofa/trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r16526 r16529  
    441.7.2.dev0 (unreleased)
    55=======================
     6
     7* Show local roles on faculty, department, course and certificate pages
     8  and provide 'Contact' button so that authenticated users can contact
     9  officers via Kofa.
    610
    711* Extend `IPayer` adapter.
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser_templates/searchpage.pt

    r11254 r16529  
    1818  <p>&nbsp;</p>
    1919  <div tal:condition="view/hitlist">
    20     <h3>Search Results</h3>
     20    <h3 i18n:translate="">Search Results</h3>
    2121    <input type="hidden" name="old_searchterm"
    2222         tal:attributes="value view/searchterm" />
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r16525 r16529  
    21302130    label = _('Academic Section')
    21312131    pnav = 1
    2132     grok.template('facultypage')
     2132
    21332133
    21342134class FacultiesContainerManageFormPage(KofaEditFormPage):
     
    22042204# Faculty pages
    22052205#
    2206 class FacultyPage(KofaPage):
     2206class FacultyPage(KofaPage, LocalRoleAssignmentUtilityView):
    22072207    """Index page of faculties.
    22082208    """
     
    22142214    @property
    22152215    def label(self):
    2216         return _('Departments')
     2216        return self.context.longtitle
    22172217
    22182218class FacultyManageFormPage(KofaEditFormPage,
     
    23552355# Department pages
    23562356#
    2357 class DepartmentPage(KofaPage):
     2357class DepartmentPage(KofaPage, LocalRoleAssignmentUtilityView):
    23582358    """Department index page.
    23592359    """
     
    23622362    grok.name('index')
    23632363    pnav = 1
    2364     label = _('Courses and Certificates')
     2364
     2365    @property
     2366    def label(self):
     2367        return self.context.longtitle
    23652368
    23662369    def update(self):
     
    25492552# Courses pages
    25502553#
    2551 class CoursePage(KofaDisplayFormPage):
     2554class CoursePage(KofaDisplayFormPage, LocalRoleAssignmentUtilityView):
    25522555    """Course index page.
    25532556    """
     
    26322635# Certificate pages
    26332636#
    2634 class CertificatePage(KofaDisplayFormPage):
     2637class CertificatePage(KofaDisplayFormPage, LocalRoleAssignmentUtilityView):
    26352638    """Index page for certificates.
    26362639    """
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/departmentpage.pt

    r11254 r16529  
    55  <li><a href="#tab2" data-toggle="tab">
    66    <span i18n:translate="">Certificates</span></a>
     7  </li>
     8  <li><a href="#tab3" data-toggle="tab">
     9    <span i18n:translate="">Local Roles</span></a>
    710  </li>
    811</ul>
     
    5457    </table>
    5558  </div>
     59  <div id="tab3" class="tab-pane">
     60    <br />
     61    <table class="table table-hover">
     62      <thead>
     63        <tr>
     64          <th i18n:translate="">Officer Name
     65          </th>
     66          <th i18n:translate="">Local Role
     67          </th>
     68          <th></th>
     69        </tr>
     70      </thead>
     71      <tbody>
     72        <tr tal:repeat="entry view/getUsersWithLocalRoles">
     73          <td tal:content="entry/public_name"> PUBLICNAME </td>
     74          <td tal:content="entry/local_role_title"> LOCAL ROLE </td>
     75          <td>
     76            <a href=""
     77               i18n:translate=""
     78               tal:attributes="href python: view.url(entry['user'], 'contactuser')"
     79               class="btn btn-success btn-xs">Contact</a>
     80          </td>
     81        </tr>
     82      </tbody>
     83    </table>
     84  </div>
    5685</div>
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/facultypage.pt

    r11254 r16529  
    1 <div i18n:domain="waeup.kofa" i18n:translate="" tal:condition="python: not len(context.keys())">
    2 There are no subobjects registered yet.
     1<ul i18n:domain="waeup.kofa" class="tabs nav nav-tabs" data-tabs="tabs">
     2  <li class="active"><a href="#tab1" data-toggle="tab">
     3    <span i18n:translate="">Departments</span></a>
     4  </li>
     5  <li><a href="#tab3" data-toggle="tab">
     6    <span i18n:translate="">Local Roles</span></a>
     7  </li>
     8</ul>
     9<div i18n:domain="waeup.kofa" class="tab-content">
     10  <div id="tab1" class="active tab-pane">
     11    <br />
     12    <table class="table table-hover" i18n:domain="waeup.kofa">
     13      <thead>
     14        <tr>
     15          <th i18n:translate="">Code</th>
     16          <th i18n:translate="">Title</th>
     17        </tr>
     18      </thead>
     19      <tbody>
     20        <tr tal:repeat="value context/values">
     21          <td> <a tal:attributes="href python: view.url(value)">
     22              <span tal:content="value/code">Name</span></a></td>
     23          <td tal:content="value/longtitle">Title</td>
     24        </tr>
     25      </tbody>
     26    </table>
     27  </div>
     28  <div id="tab3" class="tab-pane">
     29    <br />
     30    <table class="table table-hover">
     31      <thead>
     32        <tr>
     33          <th i18n:translate="">Officer Name
     34          </th>
     35          <th i18n:translate="">Local Role
     36          </th>
     37          <th></th>
     38        </tr>
     39      </thead>
     40      <tbody>
     41        <tr tal:repeat="entry view/getUsersWithLocalRoles">
     42          <td tal:content="entry/public_name"> PUBLICNAME </td>
     43          <td tal:content="entry/local_role_title"> LOCAL ROLE </td>
     44          <td>
     45            <a href=""
     46               i18n:translate=""
     47               tal:attributes="href python: view.url(entry['user'], 'contactuser')"
     48               class="btn btn-success btn-xs">Contact</a>
     49          </td>
     50        </tr>
     51      </tbody>
     52    </table>
     53  </div>
    354</div>
    455
    5 <table class="table table-hover" i18n:domain="waeup.kofa">
    6   <thead>
    7     <tr>
    8       <th i18n:translate="">Code</th>
    9       <th i18n:translate="">Title</th>
    10     </tr>
    11   </thead>
    12   <tbody>
    13     <tr tal:repeat="value context/values">
    14       <td> <a tal:attributes="href python: view.url(value)">
    15           <span tal:content="value/code">Name</span></a></td>
    16       <td tal:content="value/longtitle">Title</td>
    17     </tr>
    18   </tbody>
    19 </table>
     56
     57
     58
     59
     60
     61
     62
  • main/waeup.kofa/trunk/src/waeup/kofa/doctests/pages.txt

    r15818 r16529  
    470470  >>> print browser.contents
    471471  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    472   ...<h1 class="kofa-content-label">Departments</h1>
     472  ...<h1 class="kofa-content-label">Faculty of My renamed faculty (TF)</h1>
    473473  ...<td> <a href="http://localhost/myuniversity/faculties/TF/TD"> <span>TD</span></a></td>
    474474  ...<td>Department of TestDept (TD)</td>
     
    503503  >>> print browser.contents
    504504  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    505   ...<h1 class="kofa-content-label">Departments</h1>
     505  ...<h1 class="kofa-content-label">Faculty of My renamed faculty (TF)</h1>
    506506  ...<td> <a href="http://localhost/myuniversity/faculties/TF/TD"> <span>TD</span></a></td>
    507507  ...<td>Department of My renamed dept (TD)</td>
  • main/waeup.kofa/trunk/src/waeup/kofa/permissions.py

    r16172 r16529  
    778778        user = grok.getSite()['users'].get(user_name, None)
    779779        user_title = getattr(user, 'title', user_name)
     780        public_name = getattr(user, 'public_name', None)
     781        if not public_name:
     782            public_name = user_title
    780783        local_role_title = getattr(
    781784            dict(get_all_roles()).get(local_role, None), 'title', None)
    782         yield dict(user_name=user_name,
     785        yield dict(user=user,
     786                   user_name=user_name,
    783787                   user_title=user_title,
     788                   public_name=public_name,
    784789                   local_role=local_role,
    785790                   local_role_title=local_role_title,
    786                    setting=setting)
     791                   setting=setting,
     792                   )
    787793
    788794
Note: See TracChangeset for help on using the changeset viewer.