web.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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'描述',u'icp备案号',u'联系电话',u'视频地址',u'微信图片',u'微信文字',u'微信链接')
  16. ,update = ('name-input-required','subname-input-required','keywords-input-required','description-input-required','icp-input-required','tel-input-required',u'video-input-required',u'wx_pic-pic-required-',u'wx_text-editor-',u'wx_link-input-')
  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. ,width = '800'
  52. ,height = '700'
  53. ,label = (u'文章标题',u'文章分类',u'文章链接',u'文章图片',u'文章内容')
  54. ,update = ('name-input-required','category_id-select-required','link-input-','pic-pic-',u'content-editor--请输入内容')
  55. ,update_category_id = self.service('common').list('web_article_category')
  56. )
  57. self.commonOne('web_article')
  58. self.commonView('update')
  59. @Web.auth
  60. @Web.setting
  61. def post(self):
  62. self.commonUpdate('web_article')
  63. @Web.auth
  64. @Web.setting
  65. def delete(self):
  66. self.commonDelete('web_article')
  67. class category_path(Load):
  68. @Web.auth
  69. @Web.setting
  70. def get(self):
  71. self.common(
  72. name = u'分类'
  73. ,path = '/web/category'
  74. ,width = '600'
  75. ,height = '300'
  76. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称'))
  77. ,thead = (u'分类名称', u'更新时间')
  78. ,tbody = ('name', 'cdate')
  79. ,state = True
  80. )
  81. self.commonList('web_article_category')
  82. self.commonView('list')
  83. class category_update_path(Load):
  84. @Web.auth
  85. @Web.setting
  86. def get(self):
  87. self.common(
  88. path = '/web/category'
  89. ,label = (u'分类名称',)
  90. ,update = ('name-input-required',)
  91. )
  92. self.commonOne('web_article_category')
  93. self.commonView('update')
  94. @Web.auth
  95. @Web.setting
  96. def post(self):
  97. self.commonUpdate('web_article_category')
  98. @Web.auth
  99. @Web.setting
  100. def delete(self):
  101. self.commonDelete('web_article_category')
  102. class menu_path(Load):
  103. @Web.auth
  104. @Web.setting
  105. def get(self):
  106. self.common(
  107. name = u'菜单'
  108. ,path = '/web/menu'
  109. ,width = '600'
  110. ,height = '300'
  111. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'菜单名称'))
  112. ,thead = (u'菜单名称',u'菜单链接', u'更新时间')
  113. ,tbody = ('name', 'link', 'cdate')
  114. ,state = True
  115. )
  116. self.commonList('web_menu')
  117. self.commonView('list')
  118. class menu_update_path(Load):
  119. @Web.auth
  120. @Web.setting
  121. def get(self):
  122. self.common(
  123. path = '/web/menu'
  124. ,label = (u'菜单名称',u'菜单链接')
  125. ,update = ('name-input-required','link-input-required')
  126. )
  127. self.commonOne('web_menu')
  128. self.commonView('update')
  129. @Web.auth
  130. @Web.setting
  131. def post(self):
  132. self.commonUpdate('web_menu')
  133. @Web.auth
  134. @Web.setting
  135. def delete(self):
  136. self.commonDelete('web_menu')