Ignore:
Timestamp:
30 Jan 2014, 11:09:15 (11 years ago)
Author:
Henrik Bettermann
Message:

Adjust accesscodes module.

Location:
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/accesscodes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/accesscodes/browser.py

    r9637 r11009  
    2222from zope.component import getUtility
    2323from hurry.workflow.interfaces import InvalidTransitionError
    24 from waeup.kofa.browser.resources import datatable
    2524from waeup.kofa.browser.layout import KofaPage, KofaAddFormPage, NullValidator
    2625from waeup.kofa.browser.breadcrumbs import Breadcrumb
     
    5251            return
    5352        if not batches:
    54             self.flash(_('No batch selected.'))
     53            self.flash(_('No batch selected.'), type='warning')
    5554            return
    5655        if isinstance(batches, basestring):
     
    102101    @action(_('Cancel'), validator=NullValidator)
    103102    def cancel(self, *args, **kw):
    104         self.flash(_('Batch creation cancelled.'))
     103        self.flash(_('Batch creation cancelled.'), type='warning')
    105104        self.redirect(self.url(self.context))
    106105
     
    120119    def update(self, filenames=None, reimport=None, cancel=None):
    121120        if cancel is not None:
    122             self.flash(_('Reimport cancelled.'))
     121            self.flash(_('Reimport cancelled.'), type='warning')
    123122            self.redirect(self.url(self.context))
    124123            return
     
    126125            return
    127126        if not filenames:
    128             self.flash(_('No file chosen. Action cancelled.'))
     127            self.flash(_('No file chosen. Action cancelled.'), type='warning')
    129128            self.redirect(self.url(self.context))
    130129            return
     
    137136            except KeyError:
    138137                self.flash(_('This batch already exists: ${a}',
    139                     mapping = {'a':filename}))
     138                    mapping = {'a':filename}), type='warning')
    140139                continue
    141140            self.flash(_('Successfully reimported: ${a}',
     
    156155    disable_button = _('Disable ACs')
    157156    enable_button = _('Enable ACs')
     157    cancel_button = _('Cancel Search')
    158158
    159159    def update(self, *args, **kw):
    160         datatable.need()
    161160        form = self.request.form
     161        if 'cancel' in form:
     162            self.redirect(self.url(self.context))
     163            return
    162164        self.hitlist = []
    163165        if 'searchterm' in form and form['searchterm']:
     
    187189                except InvalidTransitionError:
    188190                    self.flash(_('${a}: Disable transition not allowed.',
    189                         mapping = {'a':entry}))
     191                        mapping = {'a':entry}), type='danger')
    190192            elif 'enable' in form:
    191193                try:
     
    196198                    self.context.logger_info(ob_class, message)
    197199                except InvalidTransitionError:
    198                     self.flash(_('${a}: Re-enable transition not allowed.', mapping = {'a':entry}))
     200                    self.flash(_('${a}: Re-enable transition not allowed.',
     201                               mapping = {'a':entry}), type='danger')
    199202        self.hitlist = search(query=self.searchterm,
    200203            searchtype=self.searchtype, view=self)
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/accesscodes/browser.txt

    r10207 r11009  
    273273    >>> ctrl.getControl(value='code').selected = True
    274274    >>> browser.getControl(name='searchterm').value = app_1_codes.keys()[0]
    275     >>> browser.getControl('Search').click()
     275    >>> browser.getControl(name='search').click()
    276276
    277277The first access code in the ``APP-1`` batch is displayed:
     
    295295    >>> ctrl.getControl(value='batch_serial').selected = True
    296296    >>> browser.getControl(name='searchterm').value = '1'
    297     >>> browser.getControl('Search').click()
     297    >>> browser.getControl(name='search').click()
    298298    >>> print browser.contents
    299299    <!DOCTYPE html ...
     
    311311    >>> ctrl.getControl(value='batch_serial').selected = True
    312312    >>> browser.getControl(name='searchterm').value = 'xyz'
    313     >>> browser.getControl('Search').click()
     313    >>> browser.getControl(name='search').click()
    314314    >>> print browser.contents
    315315    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     
    324324    >>> ctrl.getControl(value='history').selected = True
    325325    >>> browser.getControl(name='searchterm').value = 'initialized'
    326     >>> browser.getControl('Search').click()
     326    >>> browser.getControl(name='search').click()
    327327    >>> print browser.contents
    328328    <!DOCTYPE html ...
     
    345345    >>> ctrl.getControl(value='history').selected = True
    346346    >>> browser.getControl(name='searchterm').value = 'initialized'
    347     >>> browser.getControl('Search').click()
     347    >>> browser.getControl(name='search').click()
    348348
    349349This lists all access codes. We now tick one to disable it and click
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/accesscodes/browser_templates/batchcontainer.pt

    r9267 r11009  
    33    The following batches are available:
    44  </p>
    5   <table>
    6     <thead>
    7       <tr>
    8         <th>&nbsp;</th>
    9         <th i18n:translate="">Prefix</th>
    10         <th i18n:translate="">Entries</th>
    11         <th i18n:translate="">Used</th>
    12         <th i18n:translate="">Disabled</th>
    13         <th i18n:translate="">Cost</th>
    14         <th i18n:translate="">Date of Creation</th>
    15         <th i18n:translate="">Creator</th>
    16       </tr>
    17     </thead>
    18     <tbody>
    19   <tr tal:repeat="batch context/values">
    20   <td>
    21     <input type="checkbox" name="batches" value="batch/prefix"
    22      tal:attributes="value batch/__name__"
    23      tal:condition="batch/num" />
    24   </td>
    25   <td>
    26     <span tal:replace="batch/prefix">APP</span>
    27     -
    28     <span tal:replace="batch/num">10</span>
    29   </td>
    30   <td>
    31     <span tal:replace="batch/entry_num">1012</span>
    32   </td>
    33   <td>
    34     <span tal:replace="batch/used_num">512</span>
    35   </td>
    36   <td>
    37     <span tal:replace="batch/disabled_num">112</span>
    38   </td>
    39   <td tal:content="batch/cost">12.12</td>
    40   <td tal:content="python: batch.creation_date.strftime('%Y-%m-%d %H:%M:%S')">
    41       2011-11-22 18:04:55
    42   </td>
    43   <td tal:content="batch/creator">SOMEUSER</td>
    44       </tr>
    45       <tr tal:condition="not: context/values">
    46       <td colspan="5"><b i18n:translate="">No batches yet</b></td>
    47       </tr>
    48     </tbody>
    49   </table>
    50   <input type="submit" class="btn" name="archive"
     5  <div class="table-responsive">
     6    <table class="table">
     7      <thead>
     8        <tr>
     9          <th>&nbsp;</th>
     10          <th i18n:translate="">Prefix</th>
     11          <th i18n:translate="">Entries</th>
     12          <th i18n:translate="">Used</th>
     13          <th i18n:translate="">Disabled</th>
     14          <th i18n:translate="">Cost</th>
     15          <th i18n:translate="">Date of Creation</th>
     16          <th i18n:translate="">Creator</th>
     17        </tr>
     18      </thead>
     19      <tbody>
     20    <tr tal:repeat="batch context/values">
     21    <td>
     22      <input type="checkbox" name="batches" value="batch/prefix"
     23       tal:attributes="value batch/__name__"
     24       tal:condition="batch/num" />
     25    </td>
     26    <td>
     27      <span tal:replace="batch/prefix">APP</span>
     28      -
     29      <span tal:replace="batch/num">10</span>
     30    </td>
     31    <td>
     32      <span tal:replace="batch/entry_num">1012</span>
     33    </td>
     34    <td>
     35      <span tal:replace="batch/used_num">512</span>
     36    </td>
     37    <td>
     38      <span tal:replace="batch/disabled_num">112</span>
     39    </td>
     40    <td tal:content="batch/cost">12.12</td>
     41    <td tal:content="python: batch.creation_date.strftime('%Y-%m-%d %H:%M:%S')">
     42        2011-11-22 18:04:55
     43    </td>
     44    <td tal:content="batch/creator">SOMEUSER</td>
     45        </tr>
     46        <tr tal:condition="not: context/values">
     47        <td colspan="5"><b i18n:translate="">No batches yet</b></td>
     48        </tr>
     49      </tbody>
     50    </table>
     51  </div>
     52  <input type="submit" class="btn btn-default" name="archive"
    5153      tal:attributes="value view/archive_button" />
    52   <input type="submit" class="btn" name="delete"
     54  <input type="submit" class="btn btn-default" name="delete"
    5355       tal:attributes="value view/delete_button" />
    5456</form>
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/accesscodes/browser_templates/reimportbatchpage.pt

    r7811 r11009  
    44</p>
    55<form method="POST" i18n:domain="waeup.kofa">
    6   <table>
     6  <table class="table">
    77    <thead>
    88      <tr>
     
    2525    </tbody>
    2626  </table>
    27   <input type="submit" class="btn primary" name="reimport"
     27  <input type="submit" class="btn btn-primary" name="reimport"
    2828      tal:attributes="value view/reimport_button" />
    29   <input type="submit" class="btn" name="cancel"
     29  <input type="submit" class="btn btn-default" name="cancel"
    3030      tal:attributes="value view/cancel_button" />
    3131</form>
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/accesscodes/browser_templates/searchpage.pt

    r7811 r11009  
    1 <form method="POST" i18n:domain="waeup.kofa">
     1<form method="POST" i18n:domain="waeup.kofa" class="form-inline">
    22<br />
    3   <input type="submit" class="btn primary" name="search"
    4       tal:attributes="value view/search_button" />
     3  <div class="form-group">
     4    <input type="submit" class="btn btn-primary" name="search"
     5        tal:attributes="value view/search_button" />
    56  <span i18n:translate="">for access codes</span>
    6   <select name="searchtype">
    7     <option i18n:translate="" value="code">with PIN</option>
    8     <option i18n:translate="" value="batch_serial">with serial</option>
    9     <option i18n:translate="" value="history">with message term</option>
    10   </select>
    11   <input type="text" name="searchterm" />
     7  </div>
     8  <div class="form-group">
     9    <select name="searchtype">
     10      <option i18n:translate="" value="code">with PIN</option>
     11      <option i18n:translate="" value="batch_serial">with serial</option>
     12      <option i18n:translate="" value="history">with message term</option>
     13    </select>
     14  </div>
     15  <div class="form-group">
     16    <input type="text" class="form-control" name="searchterm" />
     17  </div>
    1218  <p>&nbsp;</p>
    1319  <div tal:condition="view/hitlist">
     
    1723    <input type="hidden" name="old_searchtype"
    1824         tal:attributes="value view/searchtype" />
    19     <table class="display dataTableManage">
     25    <table class="dataTableManage">
    2026      <thead>
    2127      <tr>
     
    4349    </table>
    4450    <div>
    45       <input type="submit" class="btn" name="disable"
     51      <input type="submit" class="btn btn-default" name="disable"
    4652          tal:attributes="value view/disable_button" />
    47       <input type="submit" class="btn" name="enable"
     53      <input type="submit" class="btn btn-default" name="enable"
    4854          tal:attributes="value view/enable_button" />
     55      <input type="submit" class="btn btn-default" name="cancel"
     56          tal:attributes="value view/cancel_button" />
    4957    </div>
    50 
     58  </div>
     59  <div tal:condition="not: view/hitlist">
     60    <input type="submit" class="btn btn-default" name="cancel"
     61        tal:attributes="value view/cancel_button" />
    5162  </div>
    5263</form>
Note: See TracChangeset for help on using the changeset viewer.