Changeset 6105


Ignore:
Timestamp:
15 May 2011, 16:39:51 (13 years ago)
Author:
Henrik Bettermann
Message:

Align ApplicantsRootManageFormPage? with manage form pages in university package. This includes buttoms for the manual addition and deletion of applicants.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants
Files:
2 edited

Legend:

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

    r6103 r6105  
    159159        title = u'%s %s/%s' % (prefix.title, year, year + 1)
    160160        if code in self.context.keys():
    161             self.status = Invalid(
    162                 'Error: An applicants container for the same application '
    163                 'type and entrance year exists already in the database')
     161            self.flash(
     162                'An applicants container for the same application '
     163                'type and entrance year exists already in the database.')
    164164            return
    165165        # Add new applicants container...
     
    170170        container.title = title
    171171        self.context[code] = container
    172         self.flash('Added "%s".' % code)
     172        self.flash('Added: "%s".' % code)
    173173        self.redirect(self.url(self.context, u'@@manage')+'#tab-1')
    174174        return
     
    213213    pnav = 3
    214214
    215     form_fields = grok.AutoFields(IApplicantsContainer)
    216     # Use friendlier date widget...
     215    form_fields = grok.AutoFields(IApplicantsContainer).omit('title')
    217216    form_fields['startdate'].custom_widget = FriendlyDateDisplayWidget('le')
    218217    form_fields['enddate'].custom_widget = FriendlyDateDisplayWidget('le')
     
    237236    grok.name('manage')
    238237    grok.template('form_manage_applicants_container')
    239     form_fields = grok.AutoFields(IApplicantsContainer)
     238    form_fields = grok.AutoFields(IApplicantsContainer).omit('title')
     239    taboneactions = ['Save','Cancel']
     240    tabtwoactions = ['Add applicant', 'Remove selected','Cancel']
    240241    # Use friendlier date widget...
    241242    form_fields['startdate'].custom_widget = FriendlyDateWidget('le')
     
    264265        return
    265266
    266     @grok.action('Back')
     267    # ToDo: Show warning message before deletion
     268    @grok.action('Remove selected')
     269    def delApplicant(self, **data):
     270        return self.flash('Removal of applicants is not yet implemented!')
     271
     272    @grok.action('Add applicant', validator=NullValidator)
     273    def addApplicant(self, **data):
     274        return self.flash('Manual addition of applicants not yet implemented!')
     275
     276    @grok.action('Cancel', validator=NullValidator)
    267277    def cancel(self, **data):
    268278        self.redirect(self.url(self.context))
    269279        return
     280
    270281
    271282class LoginApplicant(WAeUPPage):
     
    290301
    291302        if self.request.principal.id == 'zope.anybody':
    292             self.flash('Entered credentials are invalid')
     303            self.flash('Entered credentials are invalid.')
    293304            return
    294305
     
    336347
    337348    def emitLockMessage(self):
    338         self.flash('The requested form is locked (read-only)')
     349        self.flash('The requested form is locked (read-only).')
    339350        self.redirect(self.url(self.context))
    340351        return
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/form_manage_applicants_container.pt

    r6087 r6105  
    2121  </div>
    2222
    23 
    2423  <div id="tabs">
    2524    <ul>
    2625      <li><a href="#tab-1"><span>Settings</span></a></li>
    27       <li><a href="#tab-2"><span>Contents</span></a></li>
     26      <li><a href="#tab-2"><span>Applicants</span></a></li>
    2827    </ul>
    2928    <div id="tab-1">
    30       <table class="form-fields">
    31         <tbody>
    32           <tal:block repeat="widget view/widgets">
    33             <tal:condition condition="python:widget.name not in ['form.title']">
    34             <tr>
    35               <td class="label" tal:define="hint widget/hint">
    36                 <label tal:condition="python:hint"
    37                        tal:attributes="for widget/name">
    38                   <span class="required" tal:condition="widget/required"
    39                         >*</span><span i18n:translate=""
    40                         tal:content="widget/label">label</span>
    41                 </label>
    42                 <label tal:condition="python:not hint"
    43                        tal:attributes="for widget/name">
    44                   <span class="required" tal:condition="widget/required"
    45                         >*</span><span i18n:translate=""
    46                         tal:content="widget/label">label</span>
    47                 </label>
    48               </td>
    49               <td class="field">
    50                 <div class="widget" tal:content="structure widget">
    51                   <input type="text" />
    52                 </div>
    53                 <div class="error" tal:condition="widget/error">
    54                   <span tal:replace="structure widget/error">error</span>
    55                 </div>
    56               </td>
    57             </tr>
    58             </tal:condition>
    59           </tal:block>
    60         </tbody>
    61       </table>
     29        <table class="zebra">
     30                <tbody>
     31                  <tal:block repeat="widget view/widgets">
     32                    <tr>
     33                      <td class="label" tal:define="hint widget/hint">
     34                        <label tal:condition="python:hint"
     35                               tal:attributes="for widget/name">
     36                          <span class="required" tal:condition="widget/required"
     37                                >*</span><span i18n:translate=""
     38                                tal:content="widget/label">label</span>
     39                        </label>
     40                        <label tal:condition="python:not hint"
     41                               tal:attributes="for widget/name">
     42                          <span class="required" tal:condition="widget/required"
     43                                >*</span><span i18n:translate=""
     44                                tal:content="widget/label">label</span>
     45                        </label>
     46                      </td>
     47                      <td class="field">
     48                        <div class="widget" tal:content="structure widget">
     49                          <input type="text" />
     50                        </div>
     51                        <div class="error" tal:condition="widget/error">
     52                          <span tal:replace="structure widget/error">error</span>
     53                        </div>
     54                      </td>
     55                    </tr>
     56                  </tal:block>
     57                </tbody>
     58        </table>
     59        <div id="actionsView">
     60            <span class="actionButtons" tal:condition="view/availableActions">
     61                <span tal:repeat="action view/actions"
     62                      tal:omit-tag="">
     63                  <input tal:condition="python:action.label in view.taboneactions"
     64                         tal:replace="structure action/render"/>
     65                </span>
     66            </span>
     67        </div>
    6268    </div>
    6369    <div id="tab-2">
    64       <h3>Applications</h3>
     70      <h3>Applicants</h3>
    6571      <table id="datatable" class="display">
    66         <thead>
    67           <tr>
    68             <th>ID</th><th>status</th>
    69           </tr>
    70         </thead>
    71         <tbody>
    72           <tr tal:repeat="appl context/values">
    73             <td>
    74               <a tal:attributes="href python: view.url(appl)"
    75                  tal:content="appl/__name__">
    76                 ID
    77               </a>
    78             </td>
    79             <td>
    80               <span tal:condition="not: appl/locked">in progress</span>
    81               <span tal:condition="appl/locked">submitted</span>
    82             </td>
    83           </tr>
    84         </tbody>
    85       </table>
     72        <thead>
     73          <tr>
     74            <th>ID</th><th>status</th>
     75          </tr>
     76        </thead>
     77        <tbody>
     78          <tr tal:repeat="appl context/values">
     79            <td>
     80              <input type="checkbox"
     81                         name="val_id"
     82                         tal:attributes="value appl/_name_" />
     83            </td>
     84            <td>
     85              <a tal:attributes="href python: view.url(appl)"
     86                      tal:content="appl/__name__">
     87                      ID
     88              </a>
     89            </td>
     90            <td>
     91              <span tal:condition="not: appl/locked">in progress</span>
     92              <span tal:condition="appl/locked">submitted</span>
     93            </td>
     94          </tr>
     95        </tbody>
     96    </table>
     97    <div id="actionsView">
     98        <span class="actionButtons" tal:condition="view/availableActions">
     99            <span tal:repeat="action view/actions"
     100                  tal:omit-tag="">
     101              <input tal:condition="python:action.label in view.tabtwoactions"
     102                     tal:replace="structure action/render"/>
     103            </span>
     104        </span>
     105    </div>
    86106    </div>
    87107  </div>
    88 
    89   <div id="actionsView">
    90     <span class="actionButtons" tal:condition="view/availableActions">
    91       <input tal:repeat="action view/actions"
    92              tal:replace="structure action/render"
    93              />
    94     </span>
    95   </div>
    96108</form>
Note: See TracChangeset for help on using the changeset viewer.