Exemplo n.º 1
0
 def tag_help(self,id=''):
     data = {'success':False}
     if self.site and 'help_id' in request.params:
         h = Help.get(c.site_id,int(request.params['help_id']))
         h.tags.append(Tag(tag=str(request.params['tag']),person=c.user))
         h.save()
         data = {'success':True,'html':h.id}
     json = simplejson.dumps(data)
     response.headers['Content-Type'] = 'text/json'
     return '%s(%s)' % (request.params['jsoncallback'],json)
Exemplo n.º 2
0
 def help_process_submit(self,id=''):
     h = Help.get(c.user.site_id,int(self.form_result['help_id']))
     if h:
         h.status = int(self.form_result['status'])
         if 'response' in self.form_result and 'publish' in self.form_result:
             item = HelpResponse(help_id=h.id,site_id=c.site_id,
                 person_id=c.user.id)
             if not item.id > 0:
                 h.helpresponses.append(item)
             item.url = h.url
             item.status = h.status
             item.response = sanitize(self.form_result['response'])
             item.title = sanitize(self.form_result['title'])
             item.publish = int(self.form_result['publish'])
         
         if 'tags' in self.form_result:
             h.set_tags(self.form_result['tags'],c.user)
         h.save()
         return self._filter(offset=1,limit=1)
     else:
         #TODO panic?
         log.error('help_process_submit h not found: help_id = %s ' % (self.form_result['help_id']))
     return
Exemplo n.º 3
0
 def view(self,id=0):
     c.item = Help.get(c.user.site_id,id)
     return render('/help/help_process.html')
Exemplo n.º 4
0
 def process(self,id=0):
     c.item = Help.get(c.site_id,id)
     return self._view()
Exemplo n.º 5
0
 def feedbackform(self,id=''):
     site = Site.by_slug(str(id))
     if site:
         c.site = site
         help = Help(site_id=site.id,email=sanitize(self.form_result['email']))
         if c.user:
             help.set_user_info(c.user)
         else:
             if 'authorname' in self.form_result:
                 help.authorname = sanitize(self.form_result['authorname'])
             if 'blog' in self.form_result:
                 help.blog = sanitize(self.form_result['blog'])
             if help.blog == "your blog url":
                 help.blog = ''
         if 'category' in self.form_result:
             help.category = sanitize(self.form_result['category'])
         help.url = sanitize(self.form_result['url'])
         help.content = sanitize(self.form_result['content'])
         if 'HTTP_X_FORWARDED_FOR' in request.environ:
             help.ip = request.environ['HTTP_X_FORWARDED_FOR']
         elif 'REMOTE_ADDR' in request.environ:
             help.ip = request.environ['REMOTE_ADDR']
         help.save()
         if 'goto' in request.POST and len(request.POST['goto']) > 5:
             c.goto_url = request.POST['goto']
             return render('/refresh.html')
         else:
             c.result = True
             return render('/help/help_feedback.html')
         
     else:
         log.error('feedback from came in with no site id=%s, params= %s' % (id,request.params))
     return render('/help/help_feedback.html')