Ignore:
Timestamp:
13 Nov 2014, 14:40:27 (10 years ago)
Author:
Henrik Bettermann
Message:

Change of name.

Location:
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/pages.py

    r11947 r11949  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
    18 """ Viewing components for Kofa objects.
     18""" Viewing components for Ikoba objects.
    1919"""
    2020# XXX: All csv ops should move to a dedicated module soon
     
    4242from zope.session.interfaces import ISession
    4343from zope.password.interfaces import IPasswordManager
    44 from waeup.kofa.browser.layout import (
    45     KofaPage, KofaForm, KofaEditFormPage, KofaAddFormPage,
    46     KofaDisplayFormPage, NullValidator)
    47 from waeup.kofa.browser.interfaces import (
     44from waeup.ikoba.browser.layout import (
     45    IkobaPage, IkobaForm, IkobaEditFormPage, IkobaAddFormPage,
     46    IkobaDisplayFormPage, NullValidator)
     47from waeup.ikoba.browser.interfaces import (
    4848    IUniversity, ICaptchaManager, IChangePassword)
    49 from waeup.kofa.browser.layout import jsaction, action, UtilityView
    50 from waeup.kofa.interfaces import MessageFactory as _
    51 from waeup.kofa.interfaces import(
    52     IKofaObject, IUsersContainer, IUserAccount, IDataCenter,
    53     IKofaXMLImporter, IKofaXMLExporter, IBatchProcessor,
     49from waeup.ikoba.browser.layout import jsaction, action, UtilityView
     50from waeup.ikoba.interfaces import MessageFactory as _
     51from waeup.ikoba.interfaces import(
     52    IIkobaObject, IUsersContainer, IUserAccount, IDataCenter,
     53    IIkobaXMLImporter, IIkobaXMLExporter, IBatchProcessor,
    5454    ILocalRolesAssignable, DuplicationError, IConfigurationContainer,
    5555    ISessionConfiguration, ISessionConfigurationAdd, IJobManager,
    56     IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter,
     56    IPasswordValidator, IContactForm, IIkobaUtils, ICSVExporter,
    5757    application_sessions_vocab)
    58 from waeup.kofa.permissions import (
     58from waeup.ikoba.permissions import (
    5959    get_users_with_local_roles, get_all_roles, get_all_users,
    6060    get_users_with_role)
    6161
    62 from waeup.kofa.authentication import LocalRoleSetEvent
    63 from waeup.kofa.widgets.htmlwidget import HTMLDisplayWidget
    64 from waeup.kofa.utils.helpers import get_user_account, check_csv_charset
    65 from waeup.kofa.mandates.mandate import PasswordMandate
    66 from waeup.kofa.datacenter import DataCenterFile
     62from waeup.ikoba.authentication import LocalRoleSetEvent
     63from waeup.ikoba.widgets.htmlwidget import HTMLDisplayWidget
     64from waeup.ikoba.utils.helpers import get_user_account, check_csv_charset
     65from waeup.ikoba.mandates.mandate import PasswordMandate
     66from waeup.ikoba.datacenter import DataCenterFile
    6767
    6868FORBIDDEN_CHARACTERS = (160,)
    6969
    70 grok.context(IKofaObject)
     70grok.context(IIkobaObject)
    7171grok.templatedir('templates')
    7272
     
    8181    role_manager.assignRoleToPrincipal(localrole, user)
    8282    notify(LocalRoleSetEvent(view.context, localrole, user, granted=True))
    83     ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     83    ob_class = view.__implemented__.__name__.replace('waeup.ikoba.','')
    8484    grok.getSite().logger.info(
    8585        '%s - added: %s|%s' % (ob_class, user, localrole))
     
    113113            _('Local role successfully removed: ${a}',
    114114            mapping = {'a':', '.join(deleted)}))
    115         ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     115        ob_class = view.__implemented__.__name__.replace('waeup.ikoba.','')
    116116        grok.getSite().logger.info(
    117117            '%s - removed: %s' % (ob_class, ', '.join(deleted)))
     
    147147        view.flash(_('Successfully removed: ${a}',
    148148            mapping = {'a': ', '.join(deleted)}))
    149         ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     149        ob_class = view.__implemented__.__name__.replace('waeup.ikoba.','')
    150150        grok.getSite().logger.info(
    151151            '%s - removed: %s' % (ob_class, ', '.join(deleted)))
     
    188188    fields_string = ' + '.join(changed_fields)
    189189    view.flash(_('Form has been saved.'))
    190     ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     190    ob_class = view.__implemented__.__name__.replace('waeup.ikoba.','')
    191191    if fields_string:
    192192        grok.getSite().logger.info('%s - %s - saved: %s' % (ob_class, view.context.__name__, fields_string))
     
    210210        time_delta = None
    211211        if start_time:
    212             tz = getUtility(IKofaUtils).tzinfo
     212            tz = getUtility(IIkobaUtils).tzinfo
    213213            time_delta = datetime.now(tz) - start_time
    214214            start_time = start_time.astimezone(tz).strftime(
     
    252252#
    253253
    254 class LoginPage(KofaPage):
     254class LoginPage(IkobaPage):
    255255    """A login page, available for all objects.
    256256    """
    257257    grok.name('login')
    258     grok.context(IKofaObject)
     258    grok.context(IIkobaObject)
    259259    grok.require('waeup.Public')
    260260    label = _(u'Login')
     
    288288
    289289
    290 class LogoutPage(KofaPage):
     290class LogoutPage(IkobaPage):
    291291    """A logout page. Calling this page will log the current user out.
    292292    """
    293     grok.context(IKofaObject)
     293    grok.context(IIkobaObject)
    294294    grok.require('waeup.Public')
    295295    grok.name('logout')
     
    299299            auth = getUtility(IAuthentication)
    300300            ILogout(auth).logout(self.request)
    301             self.flash(_("You have been logged out. Thanks for using WAeUP Kofa!"))
     301            self.flash(_("You have been logged out. Thanks for using WAeUP Ikoba!"))
    302302        self.redirect(self.application_url() + '/index')
    303303        return
    304304
    305305
    306 class LanguageChangePage(KofaPage):
     306class LanguageChangePage(IkobaPage):
    307307    """ Language switch
    308308    """
    309     grok.context(IKofaObject)
     309    grok.context(IIkobaObject)
    310310    grok.name('change_language')
    311311    grok.require('waeup.Public')
    312312
    313313    def update(self, lang='en', view_name='@@index'):
    314         self.response.setCookie('kofa.language', lang, path='/')
     314        self.response.setCookie('ikoba.language', lang, path='/')
    315315        self.redirect(self.url(self.context, view_name))
    316316        return
     
    323323#
    324324
    325 class ContactAdminForm(KofaForm):
     325class ContactAdminForm(IkobaForm):
    326326    grok.name('contactadmin')
    327327    #grok.context(IUniversity)
     
    357357        usertype = getattr(self.request.principal,
    358358                           'user_type', 'system').title()
    359         kofa_utils = getUtility(IKofaUtils)
    360         success = kofa_utils.sendContactForm(
     359        ikoba_utils = getUtility(IIkobaUtils)
     360        success = ikoba_utils.sendContactForm(
    361361                fullname,email,
    362362                self.config.name_admin,self.config.email_admin,
     
    392392            # No need to flash something.
    393393            return
    394         kofa_utils = getUtility(IKofaUtils)
    395         success = kofa_utils.sendContactForm(
     394        ikoba_utils = getUtility(IIkobaUtils)
     395        success = ikoba_utils.sendContactForm(
    396396                data['fullname'],data['email_from'],
    397397                self.config.name_admin,self.config.email_admin,
     
    408408#
    409409
    410 class UniversityPage(KofaDisplayFormPage):
     410class UniversityPage(IkobaDisplayFormPage):
    411411    """ The main university page.
    412412    """
     
    419419    @property
    420420    def frontpage(self):
    421         lang = self.request.cookies.get('kofa.language')
     421        lang = self.request.cookies.get('ikoba.language')
    422422        html = self.context['configuration'].frontpage_dict.get(lang,'')
    423423        if html =='':
    424             portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     424            portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
    425425            html = self.context[
    426426                'configuration'].frontpage_dict.get(portal_language,'')
    427427        if html =='':
    428             return _(u'<h1>Welcome to WAeUP.Kofa</h1>')
     428            return _(u'<h1>Welcome to WAeUP.Ikoba</h1>')
    429429        else:
    430430            return html
    431431
    432 class AdministrationPage(KofaPage):
     432class AdministrationPage(IkobaPage):
    433433    """ The administration overview page.
    434434    """
     
    448448
    449449    name = 'General news feed'
    450     description = 'waeup.kofa now supports RSS 2.0 feeds :-)'
     450    description = 'waeup.ikoba now supports RSS 2.0 feeds :-)'
    451451    language = None
    452452    date = None
     
    477477#
    478478
    479 class UsersContainerPage(KofaPage):
     479class UsersContainerPage(IkobaPage):
    480480    """Overview page for all local users.
    481481    """
     
    494494            self.flash(_('User account ${a} successfully deleted.',
    495495                mapping = {'a':  userid}))
    496             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     496            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    497497            self.context.__parent__.logger.info(
    498498                '%s - removed: %s' % (ob_class, userid))
     
    521521        return site_roles_string
    522522
    523 class AddUserFormPage(KofaAddFormPage):
     523class AddUserFormPage(IkobaAddFormPage):
    524524    """Add a user account.
    525525    """
     
    555555            self.flash(_('User account ${a} successfully added.',
    556556                mapping = {'a': name}))
    557             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     557            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    558558            self.context.__parent__.logger.info(
    559559                '%s - added: %s' % (ob_class, name))
     
    564564        self.redirect(self.url(self.context))
    565565
    566 class UserManageFormPage(KofaEditFormPage):
     566class UserManageFormPage(IkobaEditFormPage):
    567567    """Manage a user account.
    568568    """
     
    604604        fields_string = ' + '.join(changed_fields)
    605605        if fields_string:
    606             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     606            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    607607            self.context.__parent__.logger.info(
    608608                '%s - %s edited: %s' % (
     
    635635        usertype = getattr(self.request.principal,
    636636                           'user_type', 'system').title()
    637         kofa_utils = getUtility(IKofaUtils)
    638         success = kofa_utils.sendContactForm(
     637        ikoba_utils = getUtility(IIkobaUtils)
     638        success = ikoba_utils.sendContactForm(
    639639                self.request.principal.title,email,
    640640                self.context.title,self.context.email,
     
    660660        self.widgets['title'].displayWidth = 30
    661661
    662 class MyRolesPage(KofaPage):
     662class MyRolesPage(IkobaPage):
    663663    """Display site roles and local roles assigned to officers.
    664664    """
     
    691691#
    692692
    693 class ConfigurationContainerDisplayFormPage(KofaDisplayFormPage):
     693class ConfigurationContainerDisplayFormPage(IkobaDisplayFormPage):
    694694    """View page of the configuration container.
    695695    """
     
    703703
    704704
    705 class ConfigurationContainerManageFormPage(KofaEditFormPage):
     705class ConfigurationContainerManageFormPage(IkobaEditFormPage):
    706706    """Manage page of the configuration container. We always use the
    707707    manage page in the UI not the view page, thus we use the index name here.
     
    763763        return
    764764
    765 class SessionConfigurationAddFormPage(KofaAddFormPage):
     765class SessionConfigurationAddFormPage(IkobaAddFormPage):
    766766    """Add a session configuration object to configuration container.
    767767    """
     
    779779        try:
    780780            self.context.addSessionConfiguration(sessionconfiguration)
    781             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     781            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    782782            self.context.__parent__.logger.info(
    783783                '%s - added: %s' % (
     
    794794        return
    795795
    796 class SessionConfigurationManageFormPage(KofaEditFormPage):
     796class SessionConfigurationManageFormPage(IkobaEditFormPage):
    797797    """Manage session configuration object.
    798798    """
     
    824824#
    825825
    826 class DatacenterPage(KofaEditFormPage):
     826class DatacenterPage(IkobaEditFormPage):
    827827    grok.context(IDataCenter)
    828828    grok.name('index')
     
    854854            self.flash(_('Successfully deleted: ${a}',
    855855                mapping = {'a': ', '.join(deleted)}))
    856             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     856            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    857857            self.context.logger.info(
    858858                '%s - deleted: %s' % (ob_class, ', '.join(deleted)))
    859859        return
    860860
    861 class DatacenterFinishedPage(KofaEditFormPage):
     861class DatacenterFinishedPage(IkobaEditFormPage):
    862862    grok.context(IDataCenter)
    863863    grok.name('processed')
     
    873873        return super(DatacenterFinishedPage, self).update()
    874874
    875 class DatacenterUploadPage(KofaPage):
     875class DatacenterUploadPage(IkobaPage):
    876876    grok.context(IDataCenter)
    877877    grok.name('upload')
     
    904904            mail_table += '%s: %s ...\n' % (line[0], data)
    905905        # Collect all recipient addresses
    906         kofa_utils = getUtility(IKofaUtils)
     906        ikoba_utils = getUtility(IIkobaUtils)
    907907        import_managers = get_users_with_role(
    908908            'waeup.ImportManager', grok.getSite())
     
    924924                      _('${a}: ${b} uploaded',
    925925                      mapping = {'a':config.acronym, 'b':filename}),
    926                       'waeup.kofa',
    927                       target_language=kofa_utils.PORTAL_LANGUAGE)
     926                      'waeup.ikoba',
     927                      target_language=ikoba_utils.PORTAL_LANGUAGE)
    928928            text = _("""File: ${a}
    929929Importer: ${b}
     
    938938                'd':uploadfile.lines - 1,
    939939                'e':mail_table})
    940             success = kofa_utils.sendContactForm(
     940            success = ikoba_utils.sendContactForm(
    941941                    fullname,email,
    942942                    rcpt_name,rcpt_addrs,
     
    983983            target = os.path.join(self.context.storage, normalized_filename)
    984984            filecontent = uploadfile.read()
    985             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     985            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    986986            logger = self.context.logger
    987987
     
    10601060
    10611061    def render(self):
    1062         ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1062        ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    10631063        self.context.logger.info(
    10641064            '%s - downloaded: %s' % (ob_class, self.filename))
     
    10831083
    10841084    def render(self):
    1085         #ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1085        #ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    10861086        #self.context.logger.info(
    10871087        #    '%s - skeleton downloaded: %s' % (ob_class, self.filename))
     
    10941094        return csv_data
    10951095
    1096 class DatacenterImportStep1(KofaPage):
     1096class DatacenterImportStep1(IkobaPage):
    10971097    """Manual import step 1: choose file
    10981098    """
     
    11191119        if select is not None:
    11201120            # A filename was selected
    1121             session = ISession(self.request)['waeup.kofa']
     1121            session = ISession(self.request)['waeup.ikoba']
    11221122            session['import_filename'] = select
    11231123            self.redirect(self.url(self.context, '@@import2'))
    11241124
    1125 class DatacenterImportStep2(KofaPage):
     1125class DatacenterImportStep2(IkobaPage):
    11261126    """Manual import step 2: choose processor
    11271127    """
     
    11911191    def update(self, mode=None, importer=None,
    11921192               back1=None, cancel=None, proceed=None):
    1193         session = ISession(self.request)['waeup.kofa']
     1193        session = ISession(self.request)['waeup.ikoba']
    11941194        self.filename = session.get('import_filename', None)
    11951195
     
    12261226            self.flash(warnings, type='warning')
    12271227
    1228 class DatacenterImportStep3(KofaPage):
     1228class DatacenterImportStep3(IkobaPage):
    12291229    """Manual import step 3: modify header
    12301230    """
     
    13091309
    13101310    def update(self, headerfield=None, back2=None, cancel=None, proceed=None):
    1311         session = ISession(self.request)['waeup.kofa']
     1311        session = ISession(self.request)['waeup.ikoba']
    13121312        self.filename = session.get('import_filename', None)
    13131313        self.mode = session.get('import_mode', None)
     
    13381338            self.flash(warnings, type='warning')
    13391339
    1340 class DatacenterImportStep4(KofaPage):
     1340class DatacenterImportStep4(IkobaPage):
    13411341    """Manual import step 4: do actual import
    13421342    """
     
    13591359            self.redirect(self.url(self.context, '@@import1'))
    13601360            return
    1361         session = ISession(self.request)['waeup.kofa']
     1361        session = ISession(self.request)['waeup.ikoba']
    13621362        self.filename = session.get('import_filename', None)
    13631363        self.mode = session.get('import_mode', None)
     
    14021402            mapping = {'a':linenum - self.warn_num}))
    14031403
    1404 class DatacenterLogsOverview(KofaPage):
     1404class DatacenterLogsOverview(IkobaPage):
    14051405    grok.context(IDataCenter)
    14061406    grok.name('logs')
     
    14181418        self.files = self.context.getLogFiles()
    14191419
    1420 class DatacenterLogsFileview(KofaPage):
     1420class DatacenterLogsFileview(IkobaPage):
    14211421    grok.context(IDataCenter)
    14221422    grok.name('show')
     
    14561456        return
    14571457
    1458 class DatacenterSettings(KofaPage):
     1458class DatacenterSettings(IkobaPage):
    14591459    grok.context(IDataCenter)
    14601460    grok.name('manage')
     
    14891489        if newpath:
    14901490            self.flash(_('New storage path succefully set.'))
    1491             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1491            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    14921492            self.context.logger.info(
    14931493                '%s - storage path set: %s' % (ob_class, newpath))
     
    14951495        return
    14961496
    1497 class ExportCSVPage(KofaPage):
     1497class ExportCSVPage(IkobaPage):
    14981498    grok.context(IDataCenter)
    14991499    grok.name('export')
     
    15191519            job_id = self.context.start_export_job(
    15201520                exporter, self.request.principal.id)
    1521             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1521            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    15221522            self.context.logger.info(
    15231523                '%s - exported: %s, job_id=%s' % (ob_class, exporter, job_id))
     
    15251525            entry = self.context.entry_from_job_id(job_id)
    15261526            self.context.delete_export_entry(entry)
    1527             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1527            ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    15281528            self.context.logger.info(
    15291529                '%s - discarded: job_id=%s' % (ob_class, job_id))
     
    15601560        #self.context.delete_export_entry(
    15611561        #    self.context.entry_from_job_id(job_id))
    1562         ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1562        ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    15631563        self.context.logger.info(
    15641564            '%s - downloaded: %s, job_id=%s' % (ob_class, filename, job_id))
    15651565        return result
    15661566
    1567 class ChangePasswordRequestPage(KofaForm):
     1567class ChangePasswordRequestPage(IkobaForm):
    15681568    """Captcha'd page for all kind of users to request a password change.
    15691569    """
     
    16131613            return
    16141614        # Change password
    1615         kofa_utils = getUtility(IKofaUtils)
    1616         password = kofa_utils.genPassword()
     1615        ikoba_utils = getUtility(IIkobaUtils)
     1616        password = ikoba_utils.genPassword()
    16171617        mandate = PasswordMandate()
    16181618        mandate.params['password'] = password
     
    16251625        url_info = u'Confirmation link: %s' % mandate_url
    16261626        msg = _('You have successfully requested a password for the')
    1627         success = kofa_utils.sendCredentials(
     1627        success = ikoba_utils.sendCredentials(
    16281628            IUserAccount(user),password,url_info,msg)
    16291629        if success:
     
    16321632        else:
    16331633            self.flash(_('An smtp server error occurred.'), type='danger')
    1634         ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1634        ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    16351635        self.context.logger.info(
    16361636            '%s - %s - %s' % (ob_class, data['identifier'], data['email']))
Note: See TracChangeset for help on using the changeset viewer.