Skip to content

Commit

Permalink
photo到一半,activity到一半
Browse files Browse the repository at this point in the history
  • Loading branch information
ylnb91 committed May 3, 2013
1 parent 10d0242 commit 9e63f83
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 5 deletions.
2 changes: 1 addition & 1 deletion WebRoot/WEB-INF/views/activity/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3>${a.title}</h3>
<div id="comment_display" rel="activity_${a.id}">
<div class="ui-box clearfix">
<div class="ui-box-title">
<h3>xxx<span style=""><span>10</span></span></h3>
<h3>评论<span style=""><span>10</span></span></h3>
<a href="#" class="ui-box-title-more" title="管理我的应用">More</a>
</div>
<div class="ui-box-content">
Expand Down
27 changes: 27 additions & 0 deletions WebRoot/WEB-INF/views/admin/photo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<#include "/layout/_layout.html" />
<@head title="首页|四眼井|互联网人的乐园 "></@head>
<@body>
<div class="clearfix">
<div class="ui-grid-19">
<div class="mgl-20">
<div class="ui-box clearfix">
<div class="ui-box-title">
<h3>xxx<span style=""><span>10</span></span></h3>
<a href="#" class="ui-box-title-more" title="管理我的应用">More</a>
</div>
<div class="ui-box-content">
<ul class="ui-article-list">
<#list activitylist.getList() as a>
<li>
<a href="/activity/show?id=${a.id}">
${a.title}
</a>
</li>
</#list>
</ul>
</div>
</div>
</div>
</div>
</div>
</@body>
12 changes: 12 additions & 0 deletions config/ehcache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>

<cache name="photo"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="1200"
timeToLiveSeconds="1200"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
2 changes: 0 additions & 2 deletions src/me/thinkjet/controller/ActivityController.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.thinkjet.controller;

import me.thinkjet.interceptor.ActivityInterceptor;
import me.thinkjet.model.Activity;

import com.jfinal.aop.Before;
Expand All @@ -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)
Expand Down
49 changes: 49 additions & 0 deletions src/me/thinkjet/controller/admin/PhotoController.java
Original file line number Diff line number Diff line change
@@ -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");
}

}
27 changes: 27 additions & 0 deletions src/me/thinkjet/controller/admin/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<#include "/layout/_layout.html" />
<@head title="首页|四眼井|互联网人的乐园 "></@head>
<@body>
<div class="clearfix">
<div class="ui-grid-19">
<div class="mgl-20">
<div class="ui-box clearfix">
<div class="ui-box-title">
<h3>xxx<span style=""><span>10</span></span></h3>
<a href="#" class="ui-box-title-more" title="管理我的应用">More</a>
</div>
<div class="ui-box-content">
<ul class="ui-article-list">
<#list activitylist.getList() as a>
<li>
<a href="/activity/show?id=${a.id}">
${a.title}
</a>
</li>
</#list>
</ul>
</div>
</div>
</div>
</div>
</div>
</@body>
2 changes: 0 additions & 2 deletions syj.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9e63f83

Please sign in to comment.