boketemplateimpl.java
来自「cwbbs 云网论坛源码」· Java 代码 · 共 1,112 行 · 第 1/4 页
JAVA
1,112 行
} str += "]"; str += " "; str += "<a href=\"showblog.jsp?rootid=" + leftMsgDb.getRootid() + "&op=allcomm#" + leftMsgDb.getId() + "\">" + DefaultRender.RenderFullTitle(request, leftMsgDb) + "</a>"; str += "</li>"; } } } str += "</ul>"; return str; } public String renderSubListdayblog(HttpServletRequest request, UserConfigDb ucd, TemplateDb td) { int year, month, day = 1; try { year = ParamUtil.getInt(request, "y"); month = ParamUtil.getInt(request, "m"); day = ParamUtil.getInt(request, "d"); } catch (Exception e) { Calendar cal = Calendar.getInstance(); year = cal.get(cal.YEAR); month = cal.get(cal.MONTH) + 1; } UserBlog ub = new UserBlog(ucd.getId()); Vector v = ub.getBlogDayList(year, month, day); Iterator ir = v.iterator(); MsgDb msgdb; String str = ""; TemplateLoader tl = null; try { tl = new TemplateLoader(request, getTemplateCacheKey(ucd, TemplateDb.TEMPL_TYPE_SUB), getTemplateContent(ucd, "sub_content")); } catch (Exception e) { LogUtil.getLog(getClass()).error("renderSubListdayblog:" + e.getMessage()); } while (ir.hasNext()) { msgdb = (MsgDb) ir.next(); request.setAttribute("MsgDb", msgdb); str += tl.toString(); } return str; } public String renderSubMyBlog(HttpServletRequest request, UserConfigDb ucd, TemplateDb td) { String blogUserDir = ParamUtil.get(request, "blogUserDir"); String sql = SQLBuilder.getMyblogSql(blogUserDir, ucd.getId()); MsgDb msgdb = new MsgDb(); int total = msgdb.getThreadsCount(sql, msgdb. getVirtualBoardcodeOfBlog(ucd. getId(), blogUserDir)); int pagesize = 20; int curpage = StrUtil.toInt(ParamUtil.get(request, "CPages"), 1); Paginator paginator = new Paginator(request, total, pagesize); long start = (curpage - 1) * pagesize; long end = curpage * pagesize; ThreadBlockIterator irmsg = msgdb.getThreads(sql, msgdb.getVirtualBoardcodeOfBlog(ucd.getId(), blogUserDir), start, end); StringBuffer sb = new StringBuffer();; TemplateLoader tl = null; try { tl = new TemplateLoader(request, getTemplateCacheKey(ucd, TemplateDb.TEMPL_TYPE_SUB), getTemplateContent(ucd, "sub_content")); } catch (Exception e) { LogUtil.getLog(getClass()).error("renderSubMyBlog:" + e.getMessage()); } while (irmsg.hasNext()) { msgdb = (MsgDb) irmsg.next(); request.setAttribute("MsgDb", msgdb); sb.append(tl.toString()); } sb.append("<div class='pageBlock'>"); sb.append(paginator.getPageStatics(request)); sb.append(" "); sb.append(paginator.getPageBlock(request, "myblog.jsp?blogId=" + ucd.getId())); sb.append("</div>"); return sb.toString(); } public String renderListphotoStyle1(HttpServletRequest request, UserConfigDb ucd, TemplateDb td) { String common = getTemplateContent(ucd, "common_content"); String str = common.replaceFirst("\\{title\\}", "[<a href='listphoto.jsp?blogId=" + ucd.getId() + "'>相册</a>] [列表]"); str = str.replaceFirst("\\{remark\\}", ""); PhotoDb pd = new PhotoDb(); int curpage = ParamUtil.getInt(request, "CPages", 1); String sql; sql = "select id from " + pd.getTableName() + " where blog_id=" + ucd.getId() + " ORDER BY addDate desc"; int total = 0; int pagesize = 20; ListResult lr = null; try { lr = pd.listResult(sql, curpage, pagesize); } catch (ErrMsgException e) { LogUtil.getLog(getClass()).error("renderSubListPhoto:" + e.getMessage()); return "error"; } if (lr != null) total = lr.getTotal(); String block = ""; Paginator paginator = new Paginator(request, total, pagesize); Iterator irphoto = null; if (lr != null) irphoto = lr.getResult().iterator(); if (irphoto != null) { while (irphoto.hasNext()) { pd = (PhotoDb) irphoto.next(); block += "<li><span style='float:right'>" + ForumSkin.formatDateTime(request, pd.getAddDate()) + "</span>"; block += "<a href='showphoto.jsp?id=" + pd.getId() + "'>" + pd.getTitle() + "</a></li>"; } } block += "<div class='pageBlock'>"; block += paginator.getPageBlock(request, "listphoto.jsp"); block += "</div>"; return str.replaceFirst("\\{list\\}", block); } public String renderListphoto(HttpServletRequest request, UserConfigDb ucd, TemplateDb td) { String common = getTemplateContent(ucd, "common_content"); String str = common.replaceFirst("\\{title\\}", "[相册] [<a href='listphoto_style1.jsp?blogId=" + ucd.getId() + "'>列表</a>]"); str = str.replaceFirst("\\{remark\\}", ""); PhotoDb pd = new PhotoDb(); int curpage = ParamUtil.getInt(request, "CPages", 1); String sql; sql = "select id from " + pd.getTableName() + " where blog_id=" + ucd.getId() + " ORDER BY addDate desc"; int pagesize = 4; ListResult lr = null; try { lr = pd.listResult(sql, curpage, pagesize); } catch (ErrMsgException e) { LogUtil.getLog(getClass()).error("renderSubListPhoto:" + e.getMessage()); return "error"; } String block = ""; Iterator irphoto = null; Vector v = lr.getResult(); if (lr != null) irphoto = v.iterator(); if (irphoto != null) { int k = 0; com.redmoon.forum.Config cfg = com.redmoon.forum.Config.getInstance(); String attachmentBasePath = request.getContextPath() + "/upfile/" + pd.photoBasePath + "/"; while (irphoto.hasNext()) { pd = (PhotoDb) irphoto.next(); if (pd.isRemote()) { boolean isFtpUsed = cfg.getBooleanProperty("forum.ftpUsed"); if (isFtpUsed) { attachmentBasePath = cfg.getProperty("forum.ftpUrl"); if (attachmentBasePath.lastIndexOf("/") != attachmentBasePath.length() - 1) attachmentBasePath += "/"; attachmentBasePath += pd.photoBasePath + "/"; } } k++; } } if (v.size()>0) { block = "<div id=\"photoDiv\"></div>"; block += "<script>ajaxpage('" + Global.getRootPath() + "/blog/listphoto_render.jsp?blogId=" + ucd.getId() + "', 'photoDiv');</script>"; } return str.replaceFirst("\\{list\\}", block); } public String renderListmusic(HttpServletRequest request, UserConfigDb ucd, TemplateDb td) { String common = getTemplateContent(ucd, "common_content"); String str = common.replaceFirst("\\{title\\}", "音乐"); str = str.replaceFirst("\\{remark\\}", ""); MusicDb mud = new MusicDb(); String strcurpage = StrUtil.getNullString(request.getParameter("CPages")); if (strcurpage.equals("")) strcurpage = "1"; if (!StrUtil.isNumeric(strcurpage)) { return StrUtil.makeErrMsg(SkinUtil.LoadString(request, "err_id")); } String sql; sql = "select id from " + mud.getTable().getName() + " where blog_id=" + ucd.getId() + " ORDER BY sort asc, add_date desc"; long total = mud.getQObjectCount(sql, "" + ucd.getId()); int pagesize = 20; int curpage = StrUtil.toInt(strcurpage, 1); QObjectBlockIterator obi = mud.getQObjects(sql, "" + ucd.getId(), (curpage - 1) * pagesize, curpage * pagesize); Paginator paginator = new Paginator(request, total, pagesize); String block = ""; while (obi.hasNext()) { mud = (MusicDb) obi.next(); block += "<li><span style='float:right'>" + ForumSkin.formatDateTime(request, mud.getDate("add_date")) + "</span><a href='showmusic.jsp?blogId=" + ucd.getId() + "&id=" + mud.getLong("id") + "'>" + mud.getString("title") + "</a></li>"; } block += "<div class='pageBlock'>"; block += paginator.getPageBlock(request, "listmusic.jsp"); block += "</div>"; return str.replaceFirst("\\{list\\}", block); } public String renderListvideo(HttpServletRequest request, UserConfigDb ucd, TemplateDb td) { String common = getTemplateContent(ucd, "common_content");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?