Changeset 11008


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

Set flash types.

Finalize datacenter adjustments.

Location:
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser
Files:
4 edited

Legend:

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

    r11006 r11008  
    8585    user = view.request.form.get('user', None)
    8686    if user is None or localrole is None:
    87         view.flash('No user selected.')
     87        view.flash('No user selected.', type='danger')
    8888        view.redirect(view.url(view.context, '@@manage')+'#tab%s' % tab)
    8989        return
     
    100100    child_ids = view.request.form.get('role_id', None)
    101101    if child_ids is None:
    102         view.flash(_('No local role selected.'))
     102        view.flash(_('No local role selected.'), type='danger')
    103103        view.redirect(view.url(view.context, '@@manage')+'#tab%s' % tab)
    104104        return
     
    117117        except:
    118118            view.flash('Could not remove %s: %s: %s' % (
    119                     child_id, sys.exc_info()[0], sys.exc_info()[1]))
     119                    child_id, sys.exc_info()[0], sys.exc_info()[1]),
     120                    type='danger')
    120121    if len(deleted):
    121122        view.flash(
     
    133134        child_id = form['val_id']
    134135    else:
    135         view.flash(_('No item selected.'))
     136        view.flash(_('No item selected.'), type='danger')
    136137        if tab:
    137138            view.redirect(view.url(view.context, redirect)+'#tab%s' % tab)
     
    152153        except:
    153154            view.flash('Could not delete %s: %s: %s' % (
    154                     id, sys.exc_info()[0], sys.exc_info()[1]))
     155                    id, sys.exc_info()[0], sys.exc_info()[1]), type='danger')
    155156    if len(deleted):
    156157        view.flash(_('Successfully removed: ${a}',
     
    282283                            self.request.principal.id)
    283284                        self.flash(
    284                           _('Your personal data record is outdated. Please update.'))
     285                          _('Your personal data record is outdated. Please update.'),
     286                          type='warning')
    285287                    self.redirect(self.application_url() + rel_link)
    286288                    return
     
    327329                                   type='warning')
    328330                    return
    329             self.flash(_('You entered invalid credentials.'))
     331            self.flash(_('You entered invalid credentials.'), type='danger')
    330332            return
    331333
     
    443445            self.flash(_('Your message has been sent.'))
    444446        else:
    445             self.flash(_('A smtp server error occurred.'))
     447            self.flash(_('A smtp server error occurred.'), type='danger')
    446448        return
    447449
     
    589591            errors = validator.validate_password(password, password_ctl)
    590592            if errors:
    591                 self.flash( ' '.join(errors))
     593                self.flash( ' '.join(errors), type='danger')
    592594                return
    593595        try:
     
    602604        except KeyError:
    603605            self.status = self.flash('The userid chosen already exists '
    604                                   'in the database.')
     606                                  'in the database.', type='danger')
    605607            return
    606608        self.redirect(self.url(self.context))
     
    633635            errors = validator.validate_password(password, password_ctl)
    634636            if errors:
    635                 self.flash( ' '.join(errors))
     637                self.flash( ' '.join(errors), type='danger')
    636638                return
    637639        changed_fields = self.applyData(self.context, **data)
     
    852854                ob_class, sessionconfiguration.academic_session))
    853855        except KeyError:
    854             self.flash(_('The session chosen already exists.'))
     856            self.flash(_('The session chosen already exists.'), type='danger')
    855857            return
    856858        self.redirect(self.url(self.context, '@@index')+'#tab2')
     
    909911            child_id = form['val_id']
    910912        else:
    911             self.flash(_('No item selected.'))
     913            self.flash(_('No item selected.'), type='danger')
    912914            return
    913915        if not isinstance(child_id, list):
     
    920922                deleted.append(id)
    921923            except OSError:
    922                 self.flash(_('OSError: The file could not be deleted.'))
     924                self.flash(_('OSError: The file could not be deleted.'),
     925                           type='danger')
    923926                return
    924927        if len(deleted):
     
    10241027                    _('All import managers have been notified by email.'))
    10251028            else:
    1026                 self.flash(_('An smtp server error occurred.'))
     1029                self.flash(_('An smtp server error occurred.'), type='danger')
    10271030            return
    10281031
     
    10321035        if number_of_pendings > self.max_files:
    10331036            self.flash(
    1034                 _('Maximum number of files in the data center exceeded.'))
     1037                _('Maximum number of files in the data center exceeded.'),
     1038                  type='danger')
    10351039            self.redirect(self.url(self.context))
    10361040            return
     
    10431047            filename = uploadfile.filename
    10441048            #if 'pending' in filename:
    1045             #    self.flash(_("You can't re-upload pending data files."))
     1049            #    self.flash(_("You can't re-upload pending data files."), type='danger')
    10461050            #    return
    10471051            if not filename.endswith('.csv'):
    1048                 self.flash(_("Only csv files are allowed."))
     1052                self.flash(_("Only csv files are allowed."), type='danger')
    10491053                return
    10501054            normalized_filename = self.getNormalizedFileName(filename)
     
    10541058                self.context.storage, 'unfinished', normalized_filename)
    10551059            if os.path.exists(finished_file) or os.path.exists(unfinished_file):
    1056                 self.flash(_("File with same name was uploaded earlier."))
     1060                self.flash(_("File with same name was uploaded earlier."),
     1061                           type='danger')
    10571062                return
    10581063            target = os.path.join(self.context.storage, normalized_filename)
     
    10681073                    "has invalid CSV format. "
    10691074                    "First problematic line detected: line %s. "
    1070                     "Please replace." % invalid_line))
     1075                    "Please replace." % invalid_line), type='danger')
    10711076                logger.info('%s - invalid file uploaded: %s' %
    10721077                            (ob_class, target))
     
    10801085
    10811086        except IOError:
    1082             self.flash('Error while uploading file. Please retry.')
    1083             self.flash('I/O error: %s' % sys.exc_info()[1])
     1087            self.flash('Error while uploading file. Please retry.', type='danger')
     1088            self.flash('I/O error: %s' % sys.exc_info()[1], type='danger')
    10841089            return
    10851090        self.redirect(self.url(self.context))
     
    12731278            return
    12741279        if cancel is not None:
    1275             self.flash(_('Import aborted.'))
     1280            self.flash(_('Import aborted.'), type='warning')
    12761281            self.redirect(self.url(self.context))
    12771282            return
     
    12851290        if self.importer and 'update' in self.importer:
    12861291            if self.mode != 'update':
    1287                 self.flash(_('Update mode only!'))
     1292                self.flash(_('Update mode only!'), type='warning')
    12881293                self.mode_locked = True
    12891294                self.mode = 'update'
     
    12991304        else:
    13001305            self.reader = ()
    1301             self.flash(warnings)
     1306            self.flash(warnings, type='warning')
    13021307
    13031308class DatacenterImportStep3(KofaPage):
     
    13961401            return
    13971402        if cancel is not None:
    1398             self.flash(_('Import aborted.'))
     1403            self.flash(_('Import aborted.'), type='warning')
    13991404            self.redirect(self.url(self.context))
    14001405            return
     
    14111416        warnings = self.getWarnings()
    14121417        if warnings:
    1413             self.flash(warnings)
     1418            self.flash(warnings, type='warning')
    14141419
    14151420class DatacenterImportStep4(KofaPage):
     
    14731478        if self.warn_num:
    14741479            self.flash(_('Processing of ${a} rows failed.',
    1475                 mapping = {'a':self.warn_num}))
     1480                mapping = {'a':self.warn_num}), type='warning')
    14761481        self.flash(_('Successfully processed ${a} rows.',
    14771482            mapping = {'a':linenum - self.warn_num}))
     
    15111516            self.flash(
    15121517                _('Log files can only be searched ' +
    1513                   'on Unix-based operating systems.'))
     1518                  'on Unix-based operating systems.'), type='danger')
    15141519            self.redirect(self.url(self.context, '@@logs'))
    15151520            return
     
    15251530                self.context.queryLogfiles(logname, query))
    15261531        except ValueError:
    1527             self.flash(_('Invalid search expression.'))
     1532            self.flash(_('Invalid search expression.'), type='danger')
    15281533            return
    15291534        if not self.result:
    1530             self.flash(_('No search results found.'))
     1535            self.flash(_('No search results found.'), type='warning')
    15311536        return
    15321537
     
    15571562            for name in not_copied:
    15581563                self.flash(_('File already existed (not copied): ${a}',
    1559                     mapping = {'a':name}))
     1564                    mapping = {'a':name}), type='danger')
    15601565        except:
    15611566            self.flash(_('Given storage path cannot be used. ${a}',
     
    17251730    def delFaculties(self, **data):
    17261731        if not checkPermission('waeup.managePortal', self.context):
    1727             self.flash(_('You are not allowed to remove entire faculties.'))
     1732            self.flash(_('You are not allowed to remove entire faculties.'),
     1733                       type='warning')
    17281734            return
    17291735        delSubobjects(self, redirect='@@manage', tab='1')
     
    17581764            self.context.addFaculty(faculty)
    17591765        except KeyError:
    1760             self.flash(_('The faculty code chosen already exists.'))
     1766            self.flash(_('The faculty code chosen already exists.'),
     1767                       type='danger')
    17611768            return
    17621769        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     
    18131820    def delDepartments(self, **data):
    18141821        if not checkPermission('waeup.managePortal', self.context):
    1815             self.flash(_('You are not allowed to remove entire departments.'))
     1822            self.flash(_('You are not allowed to remove entire departments.'),
     1823                       type='danger')
    18161824            return
    18171825        delSubobjects(self, redirect='@@manage', tab='2')
     
    18811889        else:
    18821890            if 'search' in form:
    1883                 self.flash(_('Empty search string'))
     1891                self.flash(_('Empty search string'), type='warning')
    18841892            return
    18851893        self.hitlist = self._find_students(query=self.searchterm,
    18861894            searchtype=self.searchtype, view=self)
    18871895        if not self.hitlist:
    1888             self.flash(_('No student found.'))
     1896            self.flash(_('No student found.'), type='warning')
    18891897        return
    18901898
     
    19061914            self.context.addDepartment(department)
    19071915        except KeyError:
    1908             self.flash(_('The code chosen already exists in this faculty.'))
     1916            self.flash(_('The code chosen already exists in this faculty.'),
     1917                       type='danger')
    19091918            return
    19101919        self.status = self.flash(
     
    20052014    def delCertificates(self, **data):
    20062015        if not checkPermission('waeup.managePortal', self.context):
    2007             self.flash(_('You are not allowed to remove certificates.'))
     2016            self.flash(_('You are not allowed to remove certificates.'),
     2017                       type='warning')
    20082018            return
    20092019        delSubobjects(
     
    20592069                message += '<a href="%s">%s</a>' % (
    20602070                    self.url(entry), getattr(entry, '__name__', u'Unnamed'))
    2061                 self.flash(message)
     2071                self.flash(message, type='warning')
    20622072            self.redirect(self.url(self.context, u'@@addcourse'))
    20632073            return
     
    21002110                message += '<a href="%s">%s</a>' % (
    21012111                    self.url(entry), getattr(entry, '__name__', u'Unnamed'))
    2102                 self.flash(message)
     2112                self.flash(message, type='warning')
    21032113            self.redirect(self.url(self.context, u'@@addcertificate'))
    21042114            return
     
    22612271        except KeyError:
    22622272            self.status = self.flash(_('The chosen certificate course is already '
    2263                                   'part of this certificate.'))
     2273                                  'part of this certificate.'), type='warning')
    22642274            return
    22652275        self.status = self.flash(
     
    23892399        user = self._searchUser(identifier, email)
    23902400        if user is None:
    2391             self.flash(_('No record found.'))
     2401            self.flash(_('No record found.'), type='warning')
    23922402            return
    23932403        # Change password
     
    24102420                'has been sent to ${a}.', mapping = {'a':email}))
    24112421        else:
    2412             self.flash(_('An smtp server error occurred.'))
     2422            self.flash(_('An smtp server error occurred.'), type='danger')
    24132423        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    24142424        self.context.logger.info(
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/templates/datacenterimport2page.pt

    r8651 r11008  
    99    Please select a file-processor and a processing-mode from the selections below.
    1010  </p>
    11   <div>
    12     <table tal:define="prev_table view/getPreviewTable;">
     11  <div class="table-responsive">
     12    <table tal:define="prev_table view/getPreviewTable;" class="table table-condensed">
    1313      <thead>
    1414        <tr>
     
    5555    </p>
    5656  </div>
    57   <input class="btn" type="submit" name="cancel" tal:attributes="value view/cancel_button" />
    58   <input class="btn danger" type="submit" name="back1" tal:attributes="value view/back_button" />
    59   <input class="btn primary"
     57  <input class="btn btn-default" type="submit" name="cancel" tal:attributes="value view/cancel_button" />
     58  <input class="btn btn-danger" type="submit" name="back1" tal:attributes="value view/back_button" />
     59  <input class="btn btn-primary"
    6060    tal:attributes="disabled python: view.getWarnings() and 'disabled' or ''; value view/proceed_button"
    6161    type="submit" name="proceed" />
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/templates/datacenterimport3page.pt

    r8783 r11008  
    11<div i18n:domain="waeup.kofa" i18n:translate=""
    2   class="alert-message success" tal:condition="not: view/getWarnings">
     2  class="alert alert-success" tal:condition="not: view/getWarnings">
    33  Header fields OK
    44</div>
     
    2929
    3030  <div>
    31 
    32 
    3331    <table tal:define="prev_table view/getPreviewTable;
    34                        headers view/headerfields;">
     32                       headers view/headerfields;"
     33            class="table">
    3534      <thead>
    3635        <tr>
     
    4544          </td>
    4645          <td>
    47             <select class="span4" name="headerfield">
     46            <select name="headerfield">
    4847              <option tal:repeat="opt view/getPossibleHeaders"
    4948                tal:attributes="value opt/value;
     
    6261  </div>
    6362
    64   <input class="btn" type="submit" name="cancel"
     63  <input class="btn btn-default" type="submit" name="cancel"
    6564    tal:attributes="value view/cancel_button" />
    66   <input class="btn" type="reset" name="reset"
     65  <input class="btn btn-default" type="reset" name="reset"
    6766    tal:attributes="value view/reset_button" />
    68   <input class="btn" type="submit" name="update"
     67  <input class="btn btn-default" type="submit" name="update"
    6968    tal:attributes="value view/update_button" />
    7069  <br /><br />
    71   <input class="btn danger" type="submit" name="back2"
     70  <input class="btn btn-danger" type="submit" name="back2"
    7271    tal:attributes="value view/back_button" />
    73   <input class="btn primary"
     72  <input class="btn btn-primary"
    7473    tal:attributes="disabled python: view.getWarnings() and 'disabled' or ''; value view/proceed_button"
    7574    type="submit" name="proceed"/>
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/templates/datacenterimport4page.pt

    r10099 r11008  
    1515</p>
    1616<form method="POST" i18n:domain="waeup.kofa">
    17   <input class="btn primary" type="submit" name="finish"
     17  <input class="btn btn-primary" type="submit" name="finish"
    1818    tal:attributes="value view/back_button" />
    1919</form>
Note: See TracChangeset for help on using the changeset viewer.