예제 #1
0
파일: widget.py 프로젝트: kroman0/products
    def __call__(self):
        kwargs = {'type': self.type,
                  'name': self.name,
                  'id': self.name,
                  'cssClass': self.cssClass,
                  'style': self.style,
                  'size': self.displayWidth,
                  'extra': self.extra}

        site = self.get_site()
        portal_url = getToolByName(site , 'portal_url')()
        key = site.getCaptcha()

        if self._prefix:
            prefix = '%s.' % self._prefix
        else:
            prefix = ''

        return u"""<input type="hidden" value="%s" name="%shashkey" />
                   %s
                   <img src="%s/getCaptchaImage/%s" alt="Enter the word"/>""" % (key,
                                                                                 prefix,
                                                                                 renderElement(self.tag, **kwargs),
                                                                                 portal_url,
                                                                                 key)
예제 #2
0
파일: widget.py 프로젝트: kroman0/products
    def __call__(self):
        captcha = getMultiAdapter((aq_inner(self.context.context), self.request), name='captcha')
        kwargs = {'type': self.type,
                  'name': self.name,
                  'id': self.name,
                  'cssClass': self.cssClass,
                  'style': self.style,
                  'size': self.displayWidth,
                  'extra': self.extra}
        if self.displayMaxWidth:
            kwargs['maxlength'] = self.displayMaxWidth # TODO This is untested.

        return u"""%s%s""" % \
            (renderElement(self.tag, **kwargs), captcha.image_tag())
예제 #3
0
    def __call__(self):
        captcha = getMultiAdapter((aq_inner(self.context.context), self.request), name='captcha')
        kwargs = {'type': self.type,
                  'name': self.name,
                  'id': self.name,
                  'cssClass': self.cssClass,
                  'style': self.style,
                  'size': self.displayWidth,
                  'extra': self.extra}
        if self.displayMaxWidth:
            kwargs['maxlength'] = self.displayMaxWidth # TODO This is untested.

        return u"""<div class="captchaImage">%s</div>
<div class="captchaAudio"><a href="%s" target="_blank">%s</a></div>
%s""" % (captcha.image_tag(),
         captcha.audio_url(),
         _(u"Listen to audio for this captcha"),
         renderElement(self.tag, **kwargs))
예제 #4
0
    def __call__(self):
        humanator = getMultiAdapter((aq_inner(self.context.context), self.request), name='humanator')
        kwargs = {'type': self.type,
                  'name': self.name,
                  'id': self.name,
                  'cssClass': self.cssClass,
                  'style': self.style,
                  'size': self.displayWidth,
                  'extra': self.extra}
        if self.displayMaxWidth:
            kwargs['maxlength'] = self.displayMaxWidth # TODO This is untested.
            
        question = humanator.question()

        text = u"""<div class="humanatorQuestion"><p>%(question)s</p>
        <input type="hidden" name="question_id" value="%(id)s" />
        <input type="hidden" name="id_check" value="%(id_check)s" />
        %(element)s
        """ % {'question':question.Title(), 
                'element':renderElement(self.tag, **kwargs), 
                'id':question.id, 
                'id_check':md5.new(question.Title()).hexdigest()}
        return text