web.py 6.3 KB

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