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)
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
def view(self,id=0): c.item = Help.get(c.user.site_id,id) return render('/help/help_process.html')
def process(self,id=0): c.item = Help.get(c.site_id,id) return self._view()