예제 #1
0
 def update(self):
     FormWrapper.update(self)
     if 'redmine_task_form.buttons.create' not in self.request.form:
         # Shows zimbra form only if redmine was not chosen
         self.zimbra.update()
     if 'zimbra_task_form.buttons.create' not in self.request.form:
         # Shows redmine form only if zimbra was not chosen
         self.redmine.update()
예제 #2
0
    def __init__(self, context, request):
        typename = request.get('dossier_type')

        ttool = getToolByName(context, 'portal_types')
        self.ti = ttool.getTypeInfo(typename)

        FormWrapper.__init__(self, context, request)
        grok.View.__init__(self, context, request)

        # Set portal_type name on newly created form instance
        if self.form_instance is not None and \
                not getattr(self.form_instance, 'portal_type', None):
            self.form_instance.portal_type = self.ti.getId()
예제 #3
0
    def __init__(self, context, request):
        typename = request.get('dossier_type')

        ttool = getToolByName(context, 'portal_types')
        self.ti = ttool.getTypeInfo(typename)

        FormWrapper.__init__(self, context, request)
        grok.View.__init__(self, context, request)

        # Set portal_type name on newly created form instance
        if self.form_instance is not None and \
                not getattr(self.form_instance, 'portal_type', None):
            self.form_instance.portal_type = self.ti.getId()
예제 #4
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        ttool = api.portal.get_tool('portal_types')
        self.fti = ttool.getTypeInfo(self.typename)

        FormWrapper.__init__(self, context, request)

        # Set portal_type name on newly created form instance
        if self.form_instance is not None and \
                not getattr(self.form_instance, 'portal_type', None):
            self.form_instance.portal_type = self.fti.getId()
예제 #5
0
    def update(self):
        super(EtherpadEditView, self).update()
        if self.field is None:
            self.field = self.getEtherpadField()

        if self.form_instance is None:
            self.form_instance = self.form_instance_class(
                aq_inner(self.context), self.request
            )
            self.form_instance.__name__ = self.__name__
            self.form_instance.etherpad = self.etherpad
            self.form_instance.padID = self.padID
            self.form_instance.field = self.field
            FormWrapper.update(self)
예제 #6
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        ttool = api.portal.get_tool('portal_types')
        self.fti = ttool.getTypeInfo(self.typename)

        FormWrapper.__init__(self, context, request)
        grok.View.__init__(self, context, request)

        # Set portal_type name on newly created form instance
        if self.form_instance is not None and \
                not getattr(self.form_instance, 'portal_type', None):
            self.form_instance.portal_type = self.fti.getId()
예제 #7
0
    def __call__(self):
        oguid = self.request.get('oguid')

        # The default value for the title of the new dossier should be the
        # title of the remote dossier, which contains the task which is
        # accepted with this wizard.
        query = getUtility(ITaskQuery)
        task = query.get_task_by_oguid(oguid)

        title_key = 'form.widgets.IOpenGeverBase.title'

        if self.request.form.get(title_key, None) is None:
            title = task.containing_dossier
            if isinstance(title, str):
                title = title.decode('utf-8')
            self.request.set(title_key, title)

        return FormWrapper.__call__(self)
예제 #8
0
    def __call__(self):
        oguid = self.request.get('oguid')

        # The default value for the title of the new dossier should be the
        # title of the remote dossier, which contains the task which is
        # accepted with this wizard.
        query = getUtility(ITaskQuery)
        task = query.get_task_by_oguid(oguid)

        title_key = 'form.widgets.IOpenGeverBase.title'

        if self.request.form.get(title_key, None) is None:
            title = task.containing_dossier
            if isinstance(title, str):
                title = title.decode('utf-8')
            self.request.set(title_key, title)

        return FormWrapper.__call__(self)
예제 #9
0
 def update(self):
     BaseView.update(self)
     FormWrapper.update(self)
예제 #10
0
 def __init__(self, context, request):
     cart_view = getMultiAdapter((context, request), name='cart_view')
     request['cart_view'] = cart_view
     FormWrapper.__init__(self, context, request)
예제 #11
0
 def __init__(self, context, request):
     BaseView.__init__(self, context, request)
     FormWrapper.__init__(self, context, request)
예제 #12
0
 def __init__(self, context, request):
     FormWrapper.__init__(self, context, request)
     request.set('disable_border', 1)
예제 #13
0
 def __init__(self, context, request):
     FormWrapper.__init__(self, context, request)
     threadlocals.session_name = self.form.session_name
예제 #14
0
 def update(self):
     BaseView.update(self)
     FormWrapper.update(self)
예제 #15
0
    def update(self):
        if self.portal_state is None:
            self.portal_state = component.getMultiAdapter(
                (self.context, self.request), name=u'plone_portal_state')

        if self.portal_registry is None:
            self.portal_registry = component.getUtility(IRegistry)

        if self.embed_settings is None:
            self.embed_settings = {}
            registry = self.portal_registry
            self.embed_settings = registry.forInterface(EtherpadEmbedSettings)

        if self.etherpad_settings is None:
            registry = self.portal_registry
            self.etherpad_settings = registry.forInterface(EtherpadSettings)

        if self.etherpad is None:
            self.etherpad = HTTPAPI(self.context, self.request)
            self.etherpad.checkToken()
        if self.field is None:
            self.field = self.getEtherpadField()
        if self.padName is None:
            self.padName = IUUID(self.context)
            logger.debug('set padName to %s' % self.padName)

        #Portal maps the internal userid to an etherpad author.
        if self.authorMapper is None:
            mt = getToolByName(self.context, 'portal_membership')
            member = mt.getAuthenticatedMember()
            if member is not None:
                self.authorMapper = member.getId()
                if self.authorName is None:
                    self.authorName = member.getProperty("fullname")
        if self.authorID is None:
            author = self.etherpad.createAuthorIfNotExistsFor(
                authorMapper=self.authorMapper, name=self.authorName)
            if author:
                self.authorID = author['authorID']

        #Portal maps the internal userid to an etherpad group:
        if self.groupMapper is None:
            self.groupMapper = self.padName
        if self.groupID is None:
            group = self.etherpad.createGroupIfNotExistsFor(
                groupMapper=self.groupMapper)
            if group:
                self.groupID = group['groupID']

        #Portal creates a pad in the userGroup
        if self.padID is None:
            self.padID = '%s$%s' % (self.groupID, self.padName)
            self.etherpad.createGroupPad(
                groupID=self.groupID,
                padName=self.padName,
                text=self.context.Description(),
            )

        #Portal starts the session for the user on the group:
        if not self.validUntil:
            #24 hours in unix timestamp in seconds
            self.validUntil = str(int(time.time() + 24 * 60 * 60))
        if not self.sessionID:
            session = self.etherpad.createSession(groupID=self.groupID,
                                                  authorID=self.authorID,
                                                  validUntil=self.validUntil)
            if session:
                self.sessionID = session['sessionID']
            self._addSessionCookie()

        if self.etherpad_iframe_url is None:
            #TODO: made this configuration with language and stuff
            url = self.portal_state.portal_url()
            basepath = self.etherpad_settings.basepath
            query = {}  # self.embed_settings  # TODO: as dict
            for field in schema.getFields(EtherpadEmbedSettings):
                value = getattr(self.embed_settings, field)
                if value is not None:
                    query[field] = value
            query['lang'] = self.portal_state.language()
            equery = urlencode(query)
            equery = equery.replace('True', 'true').replace('False', 'false')
            url = "%s%sp/%s?%s" % (url, basepath, self.padID, equery)
            self.etherpad_iframe_url = url

        if self.form_instance is None:
            self.form_instance = self.form_instance_class(
                aq_inner(self.context), self.request)
            self.form_instance.__name__ = self.__name__
            self.form_instance.etherpad = self.etherpad
            self.form_instance.padID = self.padID
            self.form_instance.field = self.field
            FormWrapper.update(self)
예제 #16
0
 def __init__(self, *args, **kwargs):
     FormWrapper.__init__(self, *args, **kwargs)
     grok.View.__init__(self, *args, **kwargs)
예제 #17
0
 def __init__(self, context, request):
     FormWrapper.__init__(self, context, request)
     request.set('disable_border', 1)
예제 #18
0
 def __init__(self, *args, **kwargs):
     FormWrapper.__init__(self, *args, **kwargs)
     grok.View.__init__(self, *args, **kwargs)
예제 #19
0
 def __call__(self):
     return FormWrapper.__call__(self)
예제 #20
0
 def __init__(self, context, request):
     FormWrapper.__init__(self, context, request)
     self.context = context
     self.request = request
     self.zimbra = ZimbraTaskFormWrapper(context, request)
     self.redmine = FileTicketFormWrapper(context, request)
예제 #21
0
 def __call__(self):
     return FormWrapper.__call__(self)
예제 #22
0
 def __init__(self, context, request):
     FormWrapper.__init__(self, context, request)
     EventListing.__init__(self, context, request)
예제 #23
0
 def __init__(self, context, request):
     # We can optionally set some variables in the constructor
     FormWrapper.__init__(self, context, request)
     self.isbn = self.request.get('isbn')
     logger.info( "REQUEST=%s" % self.isbn )
예제 #24
0
 def __init__(self, context, request):
     cart_view = getMultiAdapter((context, request), name='cart_view')
     request['cart_view'] = cart_view
     FormWrapper.__init__(self, context, request)
예제 #25
0
    def update(self):
        if self.portal_state is None:
            self.portal_state = component.getMultiAdapter(
                (self.context, self.request), name=u'plone_portal_state'
            )

        if self.portal_registry is None:
            self.portal_registry = component.getUtility(IRegistry)

        if self.embed_settings is None:
            self.embed_settings = {}
            registry = self.portal_registry
            self.embed_settings = registry.forInterface(EtherpadEmbedSettings)

        if self.etherpad_settings is None:
            registry = self.portal_registry
            self.etherpad_settings = registry.forInterface(EtherpadSettings)

        if self.etherpad is None:
            self.etherpad = HTTPAPI(self.context, self.request)
            self.etherpad.checkToken()
        if self.field is None:
            self.field = self.getEtherpadField()
        if self.padName is None:
            self.padName = IUUID(self.context)
            logger.debug('set padName to %s' % self.padName)

        #Portal maps the internal userid to an etherpad author.
        if self.authorMapper is None:
            mt = getToolByName(self.context, 'portal_membership')
            member = mt.getAuthenticatedMember()
            if member is not None:
                self.authorMapper = member.getId()
                if self.authorName is None:
                    self.authorName = member.getProperty("fullname")
        if self.authorID is None:
            author = self.etherpad.createAuthorIfNotExistsFor(
                authorMapper=self.authorMapper,
                name=self.authorName
            )
            if author:
                self.authorID = author['authorID']

        #Portal maps the internal userid to an etherpad group:
        if self.groupMapper is None:
            self.groupMapper = self.padName
        if self.groupID is None:
            group = self.etherpad.createGroupIfNotExistsFor(
                groupMapper=self.groupMapper
            )
            if group:
                self.groupID = group['groupID']

        #Portal creates a pad in the userGroup
        if self.padID is None:
            self.padID = '%s$%s' % (self.groupID, self.padName)
            self.etherpad.createGroupPad(
                groupID=self.groupID,
                padName=self.padName,
                text=self.context.Description(),
            )

        #Portal starts the session for the user on the group:
        if not self.validUntil:
            #24 hours in unix timestamp in seconds
            self.validUntil = str(int(time.time() + 24 * 60 * 60))
        if not self.sessionID:
            session = self.etherpad.createSession(
                groupID=self.groupID,
                authorID=self.authorID,
                validUntil=self.validUntil
            )
            if session:
                self.sessionID = session['sessionID']
            self._addSessionCookie()

        if self.etherpad_iframe_url is None:
            #TODO: made this configuration with language and stuff
            url = self.portal_state.portal_url()
            basepath = self.etherpad_settings.basepath
            query = {}  # self.embed_settings  # TODO: as dict
            for field in schema.getFields(EtherpadEmbedSettings):
                value = getattr(self.embed_settings, field)
                if value is not None:
                    query[field] = value
            query['lang'] = self.portal_state.language()
            equery = urlencode(query)
            equery = equery.replace('True', 'true').replace('False', 'false')
            url = "%s%sp/%s?%s" % (url, basepath, self.padID, equery)
            self.etherpad_iframe_url = url

        if self.form_instance is None:
            self.form_instance = self.form_instance_class(
                aq_inner(self.context), self.request
            )
            self.form_instance.__name__ = self.__name__
            self.form_instance.etherpad = self.etherpad
            self.form_instance.padID = self.padID
            self.form_instance.field = self.field
            FormWrapper.update(self)
예제 #26
0
 def __init__(self, context, request):
     BaseView.__init__(self, context, request)
     FormWrapper.__init__(self, context, request)
예제 #27
0
 def __init__(self, context, request):
     BrowserView.__init__(self, context, request)
     FormWrapper.__init__(self, context, request)
예제 #28
0
 def __init__(self, context, request):
     FormWrapper.__init__(self, context, request)
     self.REQUEST = request