TemplateController.java
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.thinkgem.jeesite.modules.cms.web;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.cms.entity.Site;
import com.thinkgem.jeesite.modules.cms.service.FileTplService;
import com.thinkgem.jeesite.modules.cms.service.SiteService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 站点Controller
* @author SongLai
* @version 2013-3-23
*/
@Controller
@RequestMapping(value = "${adminPath}/cms/template")
public class TemplateController extends BaseController {
@Autowired
private FileTplService fileTplService;
@Autowired
private SiteService siteService;
@RequiresPermissions("cms:template:edit")
@RequestMapping(value = "")
public String index() {
return "modules/cms/tplIndex";
}
@RequiresPermissions("cms:template:edit")
@RequestMapping(value = "tree")
public String tree(Model model) {
Site site = siteService.get(Site.getCurrentSiteId());
model.addAttribute("templateList", fileTplService.getListForEdit(site.getSolutionPath()));
return "modules/cms/tplTree";
}
@RequiresPermissions("cms:template:edit")
@RequestMapping(value = "form")
public String form(String name, Model model) {
model.addAttribute("template", fileTplService.getFileTpl(name));
return "modules/cms/tplForm";
}
@RequiresPermissions("cms:template:edit")
@RequestMapping(value = "help")
public String help() {
return "modules/cms/tplHelp";
}
}