web.py 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. def get(self):
  12. self.common(
  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.commonOne('web_set', id=1)
  18. self.commonView('set')
  19. @Web.auth
  20. def post(self):
  21. self.commonUpdate('web_set',id=1)
  22. class article_path(Load):
  23. @Web.auth
  24. def get(self):
  25. self.common(
  26. name = u'文章'
  27. ,path = '/web/article'
  28. ,width = '800'
  29. ,height = '700'
  30. ,search = (('label-1','cdate-time-start','cdate-time-end','category_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'文章分类',u'文章标题'))
  31. ,thead = (u'文章标题', u'文章分类', u'更新时间')
  32. ,tbody = ('name', 'category', 'cdate')
  33. ,state = True
  34. )
  35. self.data['common']['search_category_id-select-'] = self.service('common').list('web_article_category')
  36. self.commonList('web_article')
  37. if self.data['list']:
  38. for key, value in enumerate(self.data['list']):
  39. category = self.service('common').one('web_article_category', id=value['category_id'])
  40. self.data['list'][key]['category'] = category['name']
  41. self.commonView('list')
  42. class article_update_path(Load):
  43. @Web.auth
  44. def get(self):
  45. self.common(
  46. path = '/web/article'
  47. ,label = (u'文章标题',u'文章分类',u'文章链接',u'文章图片',u'文章内容')
  48. ,update = ('name-input-required','category_id-select-required','link-input-','pic-pic-',u'content-editor--请输入内容')
  49. ,update_category_id = self.service('common').list('web_article_category')
  50. )
  51. self.commonOne('web_article')
  52. self.commonView('update')
  53. @Web.auth
  54. def post(self):
  55. self.commonUpdate('web_article')
  56. @Web.auth
  57. def delete(self):
  58. self.commonDelete('web_article')
  59. class category_path(Load):
  60. @Web.auth
  61. def get(self):
  62. self.common(
  63. name = u'分类'
  64. ,path = '/web/category'
  65. ,width = '600'
  66. ,height = '300'
  67. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称'))
  68. ,thead = (u'分类名称', u'更新时间')
  69. ,tbody = ('name', 'cdate')
  70. ,state = True
  71. )
  72. self.commonList('web_article_category')
  73. self.commonView('list')
  74. class category_update_path(Load):
  75. @Web.auth
  76. def get(self):
  77. self.common(
  78. path = '/web/category'
  79. ,label = (u'分类名称',)
  80. ,update = ('name-input-required',)
  81. )
  82. self.commonOne('web_article_category')
  83. self.commonView('update')
  84. @Web.auth
  85. def post(self):
  86. self.commonUpdate('web_article_category')
  87. @Web.auth
  88. def delete(self):
  89. self.commonDelete('web_article_category')
  90. class help_path(Load):
  91. @Web.auth
  92. def get(self):
  93. self.common(
  94. name = u'帮助'
  95. ,path = '/web/help'
  96. ,width = '800'
  97. ,height = '600'
  98. ,search = (('label-1','cdate-time-start','cdate-time-end','category_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'帮助分类',u'帮助标题'))
  99. ,thead = (u'帮助标题', u'帮助分类', u'更新时间')
  100. ,tbody = ('name', 'category', 'cdate')
  101. ,state = True
  102. )
  103. self.data['common']['search_category_id-select-'] = self.service('common').list('web_help_category')
  104. self.commonList('web_help')
  105. if self.data['list']:
  106. for key, value in enumerate(self.data['list']):
  107. category = self.service('common').one('web_help_category', id=value['category_id'])
  108. self.data['list'][key]['category'] = category['name']
  109. self.commonView('list')
  110. class help_update_path(Load):
  111. @Web.auth
  112. def get(self):
  113. self.common(
  114. path = '/web/help'
  115. ,label = (u'帮助标题',u'帮助分类',u'帮助内容')
  116. ,update = ('name-input-required','category_id-select-required',u'content-editor--请输入内容')
  117. ,update_category_id = self.service('common').list('web_help_category')
  118. )
  119. self.commonOne('web_help')
  120. self.commonView('update')
  121. @Web.auth
  122. def post(self):
  123. self.commonUpdate('web_help')
  124. @Web.auth
  125. def delete(self):
  126. self.commonDelete('web_help')
  127. class help_category_path(Load):
  128. @Web.auth
  129. def get(self):
  130. self.common(
  131. name = u'分类'
  132. ,path = '/web/help_category'
  133. ,width = '600'
  134. ,height = '300'
  135. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称'))
  136. ,thead = (u'帮助分类名称', u'更新时间')
  137. ,tbody = ('name', 'cdate')
  138. ,state = True
  139. )
  140. self.commonList('web_help_category')
  141. self.commonView('list')
  142. class help_category_update_path(Load):
  143. @Web.auth
  144. def get(self):
  145. self.common(
  146. path = '/web/help_category'
  147. ,label = (u'帮助分类名称',)
  148. ,update = ('name-input-required',)
  149. )
  150. self.commonOne('web_help_category')
  151. self.commonView('update')
  152. @Web.auth
  153. def post(self):
  154. self.commonUpdate('web_help_category')
  155. @Web.auth
  156. def delete(self):
  157. self.commonDelete('web_help_category')
  158. class menu_path(Load):
  159. @Web.auth
  160. def get(self):
  161. self.common(
  162. name = u'菜单'
  163. ,path = '/web/menu'
  164. ,width = '600'
  165. ,height = '300'
  166. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'菜单名称'))
  167. ,thead = (u'菜单名称',u'菜单链接', u'更新时间')
  168. ,tbody = ('name', 'link', 'cdate')
  169. ,state = True
  170. )
  171. self.commonList('web_menu')
  172. self.commonView('list')
  173. class menu_update_path(Load):
  174. @Web.auth
  175. def get(self):
  176. self.common(
  177. path = '/web/menu'
  178. ,label = (u'菜单名称',u'菜单链接')
  179. ,update = ('name-input-required','link-input-required')
  180. )
  181. self.commonOne('web_menu')
  182. self.commonView('update')
  183. @Web.auth
  184. def post(self):
  185. self.commonUpdate('web_menu')
  186. @Web.auth
  187. def delete(self):
  188. self.commonDelete('web_menu')