# -*- coding: utf-8 -*- """ demeter web page name:help.py author:rabin """ from .__load__ import * class index_path(Load): @Web.setting def get(self): self.data['url'] = '/help?' self.data['category'] = self.service('common').list('web_help_category') if self.data['category']: for key, value in enumerate(self.data['category']): self.data['category'][key]['link'] = '/help?category=' + str(value['id']) search = {} self.data['category_id'] = self.input('category') if self.data['category_id']: search['category_id'] = self.data['category_id'] self.data['url'] = self.data['url'] + 'category=' + self.data['category_id'] self.data['list'] = self.service('common').list('web_help', search=search, page={'num':10}) if self.data['list']: for key, value in enumerate(self.data['list']): self.data['list'][key]['link'] = '/help/view?id=' + str(value['id']) self.data['list'][key]['index'] = key+1 self.view("list.html") class view_path(Load): @Web.setting def get(self): id = self.input('id') if not id: self.out('error') return self.data['info'] = self.service('common').one('web_help', id=id) self.data['category'] = self.service('common').list('web_help_category') if self.data['category']: for key, value in enumerate(self.data['category']): self.data['category'][key]['link'] = '/help?category=' + str(value['id']) self.view("detail.html")