1 package net.sourceforge.blogentis.modules.fragments;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import net.sourceforge.blogentis.om.Blog;
26 import net.sourceforge.blogentis.om.SectionPeer;
27 import net.sourceforge.blogentis.storage.VelocityFragment;
28 import net.sourceforge.blogentis.turbine.BlogParameterParser;
29
30 import org.apache.torque.TorqueException;
31 import org.apache.torque.util.Criteria;
32 import org.apache.turbine.util.RunData;
33 import org.apache.velocity.context.Context;
34
35 public class SectionList extends VelocityFragment {
36 public VelocityFragment invoke(Context context)
37 throws TorqueException {
38 RunData data = (RunData)context.get("data");
39 BlogParameterParser pp = (BlogParameterParser)data.getParameters();
40 Blog blog = pp.getBlog();
41 if (blog != null) {
42 Criteria c = new Criteria();
43 c.add(SectionPeer.BLOG_ID, blog.getBlogId());
44 c.addAscendingOrderByColumn(SectionPeer.TITLE);
45 context.put("sections", SectionPeer.doSelect(c));
46 }
47 return this;
48 }
49 }