From 9e63f8386eab4187d8ccbd874d6ed864a74074a2 Mon Sep 17 00:00:00 2001 From: yanglu Date: Fri, 3 May 2013 18:24:10 +0800 Subject: [PATCH] =?UTF-8?q?photo=E5=88=B0=E4=B8=80=E5=8D=8A=EF=BC=8Cactivi?= =?UTF-8?q?ty=E5=88=B0=E4=B8=80=E5=8D=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebRoot/WEB-INF/views/activity/show.html | 2 +- WebRoot/WEB-INF/views/admin/photo/index.html | 27 ++++++++++ config/ehcache.xml | 12 +++++ .../controller/ActivityController.java | 2 - .../controller/admin/PhotoController.java | 49 +++++++++++++++++++ src/me/thinkjet/controller/admin/index.html | 27 ++++++++++ syj.sql | 2 - 7 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 WebRoot/WEB-INF/views/admin/photo/index.html create mode 100644 src/me/thinkjet/controller/admin/PhotoController.java create mode 100644 src/me/thinkjet/controller/admin/index.html diff --git a/WebRoot/WEB-INF/views/activity/show.html b/WebRoot/WEB-INF/views/activity/show.html index bca8ab8..af85afd 100644 --- a/WebRoot/WEB-INF/views/activity/show.html +++ b/WebRoot/WEB-INF/views/activity/show.html @@ -15,7 +15,7 @@

${a.title}

-

xxx10

+

评论10

More
diff --git a/WebRoot/WEB-INF/views/admin/photo/index.html b/WebRoot/WEB-INF/views/admin/photo/index.html new file mode 100644 index 0000000..10f7f03 --- /dev/null +++ b/WebRoot/WEB-INF/views/admin/photo/index.html @@ -0,0 +1,27 @@ +<#include "/layout/_layout.html" /> +<@head title="首页|四眼井|互联网人的乐园 "> +<@body> +
+
+
+
+
+

xxx10

+ More +
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/config/ehcache.xml b/config/ehcache.xml index 02b218a..e7b19b0 100644 --- a/config/ehcache.xml +++ b/config/ehcache.xml @@ -81,4 +81,16 @@ diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" /> + + diff --git a/src/me/thinkjet/controller/ActivityController.java b/src/me/thinkjet/controller/ActivityController.java index cf46711..7f3868f 100644 --- a/src/me/thinkjet/controller/ActivityController.java +++ b/src/me/thinkjet/controller/ActivityController.java @@ -1,6 +1,5 @@ package me.thinkjet.controller; -import me.thinkjet.interceptor.ActivityInterceptor; import me.thinkjet.model.Activity; import com.jfinal.aop.Before; @@ -10,7 +9,6 @@ import com.jfinal.plugin.ehcache.CacheName; @ControllerBind(controllerKey = "/activity", viewPath = "activity") -@Before(ActivityInterceptor.class) public class ActivityController extends Controller { @Before(CacheInterceptor.class) diff --git a/src/me/thinkjet/controller/admin/PhotoController.java b/src/me/thinkjet/controller/admin/PhotoController.java new file mode 100644 index 0000000..5996c55 --- /dev/null +++ b/src/me/thinkjet/controller/admin/PhotoController.java @@ -0,0 +1,49 @@ +package me.thinkjet.controller.admin; + +import me.thinkjet.model.Activity; +import me.thinkjet.model.ActivityPhoto; + +import com.jfinal.aop.Before; +import com.jfinal.core.Controller; +import com.jfinal.ext.route.ControllerBind; +import com.jfinal.plugin.ehcache.CacheInterceptor; +import com.jfinal.plugin.ehcache.CacheName; + +@ControllerBind(controllerKey = "/admin/photo", viewPath = "admin/") +public class PhotoController extends Controller { + + @Before(CacheInterceptor.class) + @CacheName("photo") + public void index() { + setAttr("plist", Activity.dao.paginateByCache("photo", + "photo-index" + this.getParaToInt("page", 1), + this.getParaToInt("page", 1), 12, "select *", "from activity_photo order by desc")); + } + + public void add() { + render("add.html"); + } + + public void create() { + Activity a = getModel(Activity.class); + a.set("author", /* this.getSession().getAttribute(SESSION_ID) */1); + a.save(); + render("index.html"); + } + + public void update() { + Activity a = getModel(Activity.class); + a.update(); + render("show.html"); + } + + public void edit() { + setAttr("a", Activity.dao.findById(getPara("id"))); + } + + public void delete(){ + ActivityPhoto.dao.deleteById(this.getAttr("id")); + this.render("index/html"); + } + +} diff --git a/src/me/thinkjet/controller/admin/index.html b/src/me/thinkjet/controller/admin/index.html new file mode 100644 index 0000000..10f7f03 --- /dev/null +++ b/src/me/thinkjet/controller/admin/index.html @@ -0,0 +1,27 @@ +<#include "/layout/_layout.html" /> +<@head title="首页|四眼井|互联网人的乐园 "> +<@body> +
+
+
+
+
+

xxx10

+ More +
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/syj.sql b/syj.sql index e19e902..4d1cd23 100644 --- a/syj.sql +++ b/syj.sql @@ -56,8 +56,6 @@ CREATE TABLE `activity_photo` ( `activity_id` bigint(20) NOT NULL, `path` varchar(200) DEFAULT NULL, `describ` varchar(500) DEFAULT NULL, - `activity_photocol` varchar(45) DEFAULT NULL, - `activity_photocol1` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `fk_idx` (`activity_id`), CONSTRAINT `photo` FOREIGN KEY (`activity_id`) REFERENCES `activity` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION