web.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. # -*- coding: utf-8 -*-
  2. """
  3. demeter web page
  4. name:content.py 内容相关页面
  5. author:rabin
  6. """
  7. from .__load__ import *
  8. class set_path(Load):
  9. @Web.auth
  10. @Web.setting
  11. def get(self):
  12. self.set(
  13. path = '/web/set'
  14. ,label = (u'标题',u'关键词',u'描述',u'icp备案号',u'联系电话',u'忘记密码联系电话',u'手机端管理',u'购买方式')
  15. ,update = ('name-input-required','keywords-input-required','description-input-required','icp-input-required','tel-input-required','passtel-input-required',u'mobile-pic--',u'buy-pic--')
  16. )
  17. self.one('web_set', id=1)
  18. self.show('set')
  19. @Web.auth
  20. @Web.setting
  21. def post(self):
  22. self.update('web_set',id=1)
  23. class article_path(Load):
  24. @Web.auth
  25. @Web.setting
  26. def get(self):
  27. self.set(
  28. name = u'文章'
  29. ,path = '/web/article'
  30. ,width = '800'
  31. ,height = '700'
  32. ,search = (('label-1','cdate-time-start','cdate-time-end','category_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'文章分类',u'文章标题'))
  33. ,thead = (u'文章标题', u'文章分类', u'更新时间')
  34. ,tbody = ('name', 'category', 'cdate')
  35. ,state = True
  36. )
  37. self.data['common']['search_category_id-select-'] = self.service('common').list('web_article_category')
  38. self.list('web_article')
  39. if self.data['list']:
  40. for key, value in enumerate(self.data['list']):
  41. category = self.service('common').one('web_article_category', id=value['category_id'])
  42. self.data['list'][key]['category'] = category['name']
  43. self.show('list')
  44. class article_update_path(Load):
  45. @Web.auth
  46. @Web.setting
  47. def get(self):
  48. self.set(
  49. path = '/web/article'
  50. ,label = (u'文章标题',u'文章分类',u'文章链接',u'文章图片',u'文章内容')
  51. ,update = ('name-input-required','category_id-select-required','link-input-','pic-pic-',u'content-editor--请输入内容')
  52. ,update_category_id = self.service('common').list('web_article_category')
  53. )
  54. self.one('web_article')
  55. self.show('update')
  56. @Web.auth
  57. @Web.setting
  58. def post(self):
  59. self.update('web_article')
  60. @Web.auth
  61. @Web.setting
  62. def delete(self):
  63. self.drop('web_article')
  64. class category_path(Load):
  65. @Web.auth
  66. @Web.setting
  67. def get(self):
  68. self.set(
  69. name = u'分类'
  70. ,path = '/web/category'
  71. ,width = '600'
  72. ,height = '300'
  73. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称'))
  74. ,thead = (u'分类名称', u'更新时间')
  75. ,tbody = ('name', 'cdate')
  76. ,state = True
  77. )
  78. self.list('web_article_category')
  79. self.show('list')
  80. class category_update_path(Load):
  81. @Web.auth
  82. @Web.setting
  83. def get(self):
  84. self.set(
  85. path = '/web/category'
  86. ,label = (u'分类名称',)
  87. ,update = ('name-input-required',)
  88. )
  89. self.one('web_article_category')
  90. self.show('update')
  91. @Web.auth
  92. @Web.setting
  93. def post(self):
  94. self.update('web_article_category')
  95. @Web.auth
  96. @Web.setting
  97. def delete(self):
  98. self.drop('web_article_category')
  99. class help_path(Load):
  100. @Web.auth
  101. @Web.setting
  102. def get(self):
  103. self.set(
  104. name = u'帮助'
  105. ,path = '/web/help'
  106. ,width = '800'
  107. ,height = '600'
  108. ,search = (('label-1','cdate-time-start','cdate-time-end','category_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'帮助分类',u'帮助标题'))
  109. ,thead = (u'帮助标题', u'帮助分类', u'更新时间')
  110. ,tbody = ('name', 'category', 'cdate')
  111. ,state = True
  112. )
  113. self.data['common']['search_category_id-select-'] = self.service('common').list('web_help_category')
  114. self.list('web_help')
  115. if self.data['list']:
  116. for key, value in enumerate(self.data['list']):
  117. category = self.service('common').one('web_help_category', id=value['category_id'])
  118. self.data['list'][key]['category'] = category['name']
  119. self.show('list')
  120. class help_update_path(Load):
  121. @Web.auth
  122. @Web.setting
  123. def get(self):
  124. self.set(
  125. path = '/web/help'
  126. ,label = (u'帮助标题',u'帮助分类',u'帮助内容')
  127. ,update = ('name-input-required','category_id-select-required',u'content-editor--请输入内容')
  128. ,update_category_id = self.service('common').list('web_help_category')
  129. )
  130. self.one('web_help')
  131. self.show('update')
  132. @Web.auth
  133. @Web.setting
  134. def post(self):
  135. self.update('web_help')
  136. @Web.auth
  137. @Web.setting
  138. def delete(self):
  139. self.drop('web_help')
  140. class help_category_path(Load):
  141. @Web.auth
  142. @Web.setting
  143. def get(self):
  144. self.set(
  145. name = u'分类'
  146. ,path = '/web/help_category'
  147. ,width = '600'
  148. ,height = '300'
  149. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称'))
  150. ,thead = (u'帮助分类名称', u'更新时间')
  151. ,tbody = ('name', 'cdate')
  152. ,state = True
  153. )
  154. self.list('web_help_category')
  155. self.show('list')
  156. class help_category_update_path(Load):
  157. @Web.auth
  158. @Web.setting
  159. def get(self):
  160. self.set(
  161. path = '/web/help_category'
  162. ,label = (u'帮助分类名称',)
  163. ,update = ('name-input-required',)
  164. )
  165. self.one('web_help_category')
  166. self.show('update')
  167. @Web.auth
  168. @Web.setting
  169. def post(self):
  170. self.update('web_help_category')
  171. @Web.auth
  172. @Web.setting
  173. def delete(self):
  174. self.drop('web_help_category')
  175. class menu_path(Load):
  176. @Web.auth
  177. @Web.setting
  178. def get(self):
  179. self.set(
  180. name = u'菜单'
  181. ,path = '/web/menu'
  182. ,width = '600'
  183. ,height = '300'
  184. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'菜单名称'))
  185. ,thead = (u'菜单名称',u'菜单链接', u'更新时间')
  186. ,tbody = ('name', 'link', 'cdate')
  187. ,state = True
  188. )
  189. self.list('web_menu')
  190. self.show('list')
  191. class menu_update_path(Load):
  192. @Web.auth
  193. @Web.setting
  194. def get(self):
  195. self.set(
  196. path = '/web/menu'
  197. ,label = (u'菜单名称',u'菜单链接')
  198. ,update = ('name-input-required','link-input-required')
  199. )
  200. self.one('web_menu')
  201. self.show('update')
  202. @Web.auth
  203. @Web.setting
  204. def post(self):
  205. self.update('web_menu')
  206. @Web.auth
  207. @Web.setting
  208. def delete(self):
  209. self.drop('web_menu')