# -*- coding: latin-1 -*-
'''
Created on 26/04/2013

@author: developer
'''

import grok
from controlturnos.interfaces import IContenido
from js.bootstrap import bootstrap
from controlturnos import resource

grok.templatedir('app_templates')


class Empleado(grok.Model):
    pass


class EmpleadoIndex(grok.View):
    grok.template('template')
    grok.require('ct.empleado')
    grok.name('index')

    def update(self):
        bootstrap.need()
        resource.style.need()


class EmpleadoIndexContenido(grok.Viewlet):
    grok.template('contenido_empleado')
Beispiel #2
0
from dolmen.menu import menuentry
from fernlehrgang.models import Lehrheft
from megrok.traject.components import DefaultModel
from fernlehrgang.interfaces.flg import IFernlehrgang
from fernlehrgang.interfaces.lehrheft import ILehrheft
from megrok.z3ctable import LinkColumn, GetAttrColumn
from fernlehrgang.viewlets import AddMenu, NavigationMenu
from dolmen.app.layout import models, IDisplayView
from zeam.form.base import Fields
from fernlehrgang.interfaces import IListing
from grokcore.chameleon.components import ChameleonPageTemplateFile
from fernlehrgang import AddForm
from uvc.layout import TablePage


grok.templatedir('templates')


@menuentry(NavigationMenu)
class LehrheftListing(TablePage):
    grok.implements(IDisplayView, IListing)
    grok.context(IFernlehrgang)
    grok.name('lehrheft_listing')
    grok.title(u'Lehrhefte verwalten')

    template = ChameleonPageTemplateFile('templates/base_listing.cpt')

    label = u"Lehrhefte"

    @property
    def description(self):
Beispiel #3
0
# -*- coding: utf-8 -*-
import grok
import uvcsite
import zope.component

from zope import interface
from ukhtheme.grok.layout import ILayer
from .resources import verbandbuch_js, verbandbuch_css
from dolmen.forms.base.utils import set_fields_data
from uvc.unfallanzeige.uazwizard import Unfallanzeige
from .components import SUnfallanzeigen, ISUnfallanzeige
from uvc.unfallanzeige.verbandsbuch import AddVerbandbuch, IVerbandbuchEintrag
from uvc.unfallanzeige.verbandsbuch import Edit as EditVerbandbuch

grok.templatedir('templates')


class AddVerbandbuch(AddVerbandbuch):
    grok.context(SUnfallanzeigen)
    label = u"Verbandbuch"

    def update(self):
        t1 = u'Solange kein Arztbesuch erforderlich wird, bitte den Unfall zur Dokumentation im Verbandbuch erfassen.'
        t2 = u' Eine Unfallanzeige ist in diesen Fällen nicht erforderlich.'
        t3 = u' Die Daten aus dem Verbandbuch werden später gegebenenfalls in die Unfallmeldung übernommen.'
        self.flash(t1 + t2 + t3)
        verbandbuch_js.need()
        verbandbuch_css.need()

    @property
    def macros(self):
Beispiel #4
0
import grok
from datetime import datetime
grok.templatedir("app_templates")


"""
Este modelo necesita:
de SECCIONES:
            *un metodo que por un metodo llamado:
                    obtener_lista_de_secciones()
                    En forma de lista
"""


class Pedido(grok.Model):
    title = u''

    def actualizarNombresDeSecciones(self):
        self.lista_secciones = self.__parent__['secciones'].\
                                    obtener_lista_secciones()
        self._p_changed = True

    def __init__(self):
        super(Pedido, self).__init__()
        self.lista_secciones = []

    def pedirUnTicket(self, seccion_codigo):
        seccion = self.traerUnaSeccion(seccion_codigo)
        nuevo_ticket = self.__parent__["tickets"].agregarTicket(\
                                                seccion)
        return nuevo_ticket
Beispiel #5
0

import grok
import re
from zope.interface import Interface, invariant, Invalid
from zope import component
from zope.pluggableauth.interfaces import IAuthenticatorPlugin
from zope import schema
from zope.password.interfaces import IPasswordManager
from zope.i18nmessageid.message import MessageFactory as _

from js.bootstrap import bootstrap
import resource
from interfaces import IContenido

grok.templatedir("app_templates")


class Usuarios(grok.Container):

    def __init__(self):
        super(Usuarios, self).__init__()

    def app(self):
        return self.__parent__.app()


class UsuariosIndex(grok.View):
    grok.context(Usuarios)
    grok.require('ct.admin')
    grok.template('template')
Beispiel #6
0
from uvc.tbskin.views import FieldMacros

import uvcsite.plugins
from uvcsite.extranetmembership.enms import ChangePassword
from zope.authentication.interfaces import IUnauthenticatedPrincipal
from zope.dottedname.resolve import resolve
from zope.interface import Interface
from zope.traversing.interfaces import IBeforeTraverseEvent
from ukh.adhoc.interfaces import IUKHAdHocLayer
from grokcore.chameleon.components import ChameleonPageTemplateFile

from ukh.adhoc.browser.register import getAlter
from hurry.workflow.interfaces import IWorkflowState
from hurry.workflow.interfaces import IWorkflowInfo

grok.templatedir("templates")


class FieldMacros(FieldMacros):
    grok.layer(IUKHAdHocLayer)
    template = ChameleonPageTemplateFile('templates/fieldtemplates.cpt')


class Index(uvcsite.Page):
    grok.context(IUKHAdHocApp)

    def render(self):
        self.request.response.redirect(
            "%s/%s" % (self.application_url(), self.request.principal.id))
        return
import grok

from zope.interface import Interface

grok.templatedir('app')

class MainContent(grok.ViewletManager):
    grok.context(Interface)
    grok.name('main')

#header viewlet manager
class Header(grok.ViewletManager):
    grok.context(Interface)
    grok.name('header')

#left side bar viewlet manager
class LeftSidebar(grok.ViewletManager):
    grok.context(Interface)
    grok.name('left')
# -*- coding: utf-8 -*-

import grok
from megrok import resource

from dolmen.app.layout.master import Header
from hurry.jquery import jquery

from zope.interface import Interface
from zope.component import getMultiAdapter

grok.templatedir("templates")


class LiveSearchResources(resource.ResourceLibrary):
    grok.path('resources')
    resource.resource('jquery.dimensions.js', depends=[jquery])
    resource.resource('livesearch.js')
    resource.resource('livesearch.css')


class LiveSearch(grok.Viewlet):
    grok.name("livesearch")
    grok.context(Interface)
    grok.viewletmanager(Header)

    def render(self):
        return u"""
        <script>
        $(document).ready(function(){
          $('#search-widget').liveSearch({
Beispiel #9
0
import grok

grok.templatedir('calc_templates')  # this is actually the default (from module name, calc.py)

class Calculator(grok.Model):
    pass

class Sum(grok.View):
    """Simple view for a model"""
    grok.context(Calculator)  # this is actually the default (from module)
    grok.template('sum')  # this is actually the default (from class name)
    grok.name('sum')  # this is actually the default (from class name)
    grok.require('zope.Public')  # this is actually the default

    def calculateSum(self):
        """you can pull this in the template through view/calculateSum"""

    def update(self):    
        """executed before the template is rendered"""
        self.sum = self.calculateSum()
        self.sendEmail()

    def sendEmail(self):
        """send an email here"""

class PDFSum(grok.View):

    def update(self):
        pass

    def render(self):
Beispiel #10
0
"""
You can explicitly specify the template directory using grok.templatedir on module level:

  >>> grok.grok(__name__)

  >>> manfred = Mammoth()
  >>> from zope.publisher.browser import TestRequest
  >>> request = TestRequest()
  >>> from zope import component
  >>> view = component.getMultiAdapter((manfred, request), name='food')
  >>> print view()
  <html>
  <body>
  ME GROK EAT MAMMOTH!
  </body>
  </html>

"""
import grok

grok.templatedir('templatedirectoryname')


class Mammoth(grok.Model):
    pass


class Food(grok.View):
    pass
Beispiel #11
0
import grok

grok.templatedir('too', 'many', 'arguments')