⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 directory.java

📁 cwbbs 云网论坛源码
💻 JAVA
字号:
package com.redmoon.forum.plugin.info;import java.sql.*;import javax.servlet.http.*;import cn.js.fan.db.*;import cn.js.fan.security.*;import cn.js.fan.util.*;import cn.js.fan.web.*;import org.apache.log4j.*;import java.util.Vector;import java.util.Iterator;public class Directory {    String connname = "";    Logger logger = Logger.getLogger(Directory.class.getName());    public Directory() {        connname = Global.defaultDB;        if (connname.equals(""))            logger.info("Directory:conname is empty");    }    public boolean AddChild(HttpServletRequest request) throws            ErrMsgException {                int child_count = 0, orders = 1, parent_orders = 1,                islocked = 0;        String root_code = "", name = "", code = "", parent_code = "";        name = ParamUtil.get(request, "name").trim();        if (name == null || name.equals(""))            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_name_empty"));        code = ParamUtil.get(request, "code").trim();        if (code.equals(""))            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_code_empty"));        if (code.equals("not"))            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_code_not"));        if (!StrUtil.isSimpleCode(code))            throw new ErrMsgException(SkinUtil.LoadString(request, "err_simple_code"));                     parent_code = ParamUtil.get(request, "parent_code").trim();        if (parent_code.equals(""))            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_parent_code_empty"));        String description = ParamUtil.get(request, "description");        int type = ParamUtil.getInt(request, "type");        String pluginCode = ParamUtil.get(request, "pluginCode");        Leaf lf = new Leaf();        lf = lf.getLeaf(code);        if (lf!=null && lf.isLoaded())            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_same_code") + lf.getName());         lf = new Leaf();        lf.setName(name);        lf.setCode(code);        lf.setParentCode(parent_code);        lf.setDescription(description);        lf.setType(type);        lf.setPluginCode(pluginCode);        Leaf leaf = getLeaf(parent_code);        return leaf.AddChild(lf);    }    public void del(String delcode) throws ErrMsgException {        Leaf lf = getLeaf(delcode);        lf.del(lf);    }    public synchronized boolean update(HttpServletRequest request) throws            ErrMsgException {        String code = ParamUtil.get(request, "code", false);        String name = ParamUtil.get(request, "name", false);        String description = ParamUtil.get(request, "description");        boolean isHome = ParamUtil.get(request, "isHome").equals("true") ? true : false;        int type = ParamUtil.getInt(request, "type");        if (code == null) {            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_need_code"));        }        if (name==null) {            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_need_name"));        }        int templateId = ParamUtil.getInt(request, "templateId");        String parentCode = ParamUtil.get(request, "parentCode");        String pluginCode = ParamUtil.get(request, "pluginCode");        Leaf leaf = getLeaf(code);        if (!parentCode.equals(leaf.getParentCode())) {                        Leaf lf = getLeaf(parentCode);             while (lf!=null && !lf.getCode().equals(lf.CODE_ROOT)) {                                String pCode = lf.getParentCode();                if (pCode.equals(leaf.getCode()))                    throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_parent_code"));                                    lf = getLeaf(pCode);            }        }        leaf.setName(name);        leaf.setDescription(description);        leaf.setIsHome(isHome);        leaf.setType(type);        leaf.setTemplateId(templateId);        leaf.setPluginCode(pluginCode);        boolean re = false;        if (parentCode.equals(leaf.getParentCode()))            re = leaf.update();        else            re = leaf.update(parentCode);        return re;    }    public synchronized boolean move(HttpServletRequest request) throws            ErrMsgException {        String code = ParamUtil.get(request, "code", false);        String direction = ParamUtil.get(request, "direction", false);        if (code == null) {            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_need_code"));        }        if ( direction == null ) {            throw new ErrMsgException(SkinUtil.LoadString(request, "res.blog.Directory", "err_need_direction"));        }        Leaf lf = new Leaf(code);        return lf.move(direction);    }    public Leaf getLeaf(String code) {        Leaf leaf = new Leaf();        return leaf.getLeaf(code);    }    public Leaf getBrother(String code, String direction) throws            ErrMsgException {        Leaf lf = getLeaf(code);        return lf.getBrother(direction);    }    public Vector getChildren(String code) throws ErrMsgException {        Leaf leaf = getLeaf(code);        return leaf.getChildren();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -