예제 #1
0
        public ReturnValue columnEdit(double classId, double moduleId, string maxIco, double skinId, double contentSkinId, double _skinId, double _contentSkinId, string className, string dirName, int type, double saveDataType, string custom, int watermark, int thumbnailWidth = 0, int thumbnailHeight = 0, int thumbnailForce = 0, double id = 0, int saveRemoteImages = 0, int inherit = 0, string _domainName = "", string domainName = "", string keyword = "", string info = "", int titleRepeat = 0)
        {
            ColumnInfo columnInfo = new ColumnInfo();

            columnInfo.id             = id;
            columnInfo.className      = className;
            columnInfo.classId        = classId;
            columnInfo.moduleId       = moduleId;
            columnInfo.dirName        = dirName;
            columnInfo.keyword        = keyword;
            columnInfo.maxIco         = maxIco;
            columnInfo.saveDataType   = saveDataType;
            columnInfo.skinId         = skinId;
            columnInfo.contentSkinId  = contentSkinId;
            columnInfo._skinId        = _skinId;
            columnInfo._contentSkinId = _contentSkinId;
            columnInfo.info           = info;
            columnInfo.watermark      = watermark;

            columnInfo.custom = custom;

            columnInfo.thumbnailWidth   = thumbnailWidth;
            columnInfo.thumbnailHeight  = thumbnailHeight;
            columnInfo.thumbnailForce   = thumbnailForce;
            columnInfo.saveRemoteImages = saveRemoteImages;
            columnInfo.inherit          = inherit;
            columnInfo.domainName       = domainName;
            columnInfo._domainName      = _domainName;

            columnInfo.titleRepeat = titleRepeat;
            ReturnValue err = new ReturnValue();
            Permissions p   = null;

            if (columnInfo.classId == 7)
            {
                p = loginInfo.value.getModulePermissions(columnInfo.moduleId);//获取上线栏目权限
            }
            else
            {
                ColumnInfo parentColumn = ColumnClass.get(columnInfo.classId);
                columnInfo.rootId = parentColumn.rootId;
                p = this.loginInfo.value.getColumnPermissions(parentColumn);//获取上线栏目权限
            }
            if (!p.all)
            {
                err.errNo  = -1;
                err.errMsg = "没有编辑该栏目的权限";
                return(err);
            }
            ColumnClass.edit(columnInfo, this.loginInfo.value);
            Config.loadDomain();
            return(err);
        }
예제 #2
0
        public ReturnValue addColumn(double moduleId, double classId, double dataTypeId, string list)
        {
            ReturnValue errinfo = new ReturnValue();
            Permissions p       = null;

            if (classId < 8)
            {
                classId = 7;
                p       = loginInfo.value.getModulePermissions(moduleId);
            }
            else
            {
                p = loginInfo.value.getColumnPermissions(classId);
            }
            if (!p.all)
            {
                errinfo.errNo  = -1;
                errinfo.errMsg = "没有编辑该栏目的权限";
                return(errinfo);
            }
            string [] _list = list.Split('\n');
            string    msg   = "";

            double[] parentid = new double[] { classId, -1, -1, -1, -1, -1, -1 };
            for (int i = 0; i < _list.Length; i++)
            {
                if (_list[i].Trim() != "")
                {
                    int layer = Regex.Split(_list[i], "  ").Length - 1;
                    classId = parentid[layer];
                    string[] temp = _list[i].Trim().Split('\t');
                    string   classname = temp[0].Trim(), dirname = "", keyword = "";
                    if (temp.Length > 1)
                    {
                        dirname = temp[1];
                    }
                    else
                    {
                        dirname = classname.GetPinYin();
                        if (dirname.Length > 15)
                        {
                            dirname = classname.GetPinYin('2');
                        }
                        dirname = Regex.Replace(dirname, "[ " + @"\-_" + "`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]", "");
                    }
                    if (temp.Length > 2)
                    {
                        keyword = temp[2];
                    }
                    ColumnInfo info = new ColumnInfo();
                    info.className = classname;
                    info.classId   = classId;
                    info.keyword   = keyword;
                    if (classId != 7)
                    {
                        ColumnInfo parent = ColumnClass.get(classId);
                        if (parent != null)
                        {
                            info.rootId = parent.rootId;
                        }
                    }
                    info.moduleId     = moduleId;
                    info.dirName      = dirname;
                    info.saveDataType = dataTypeId;
                    ReturnValue err = new ReturnValue();
                    if (classId < 1)
                    {
                        err.errNo  = -1;
                        err.errMsg = "上级栏目不存在";
                    }
                    else
                    {
                        ColumnClass.edit(info, loginInfo.value);
                    }
                    if (err.errNo > -1)
                    {
                        double newId = Convert.ToDouble(err.userData);
                        if (newId > 0)
                        {
                            parentid[layer + 1] = newId;
                        }
                    }
                    else
                    {
                        msg += "[" + classname + "]";
                        //errinfo.errNo = -1;
                        //errinfo.errMsg += classname+"添加失败 "+err.errMsg + "<br>";
                    }
                }
            }
            errinfo.userData = msg;
            return(errinfo);
        }