Exemple #1
0
        /// <summary>
        ///     Returns a value for the logical "less than" operator node.
        /// </summary>
        /// <param name="context">Context to evaluate expressions against.</param>
        /// <param name="evalContext">Current expression evaluation context.</param>
        /// <returns>Node's value.</returns>
        protected override object Get(object context, EvaluationContext evalContext)
        {
            var lhs = GetLeftValue(context, evalContext);
            var rhs = GetRightValue(context, evalContext);

            return(CompareUtils.Compare(lhs, rhs) < 0);
        }
Exemple #2
0
        protected override object Evaluate(object context, BaseNode.EvaluationContext evalContext)
        {
            object first = base.Left.EvaluateInternal(context, evalContext);
            object obj3  = base.Right.EvaluateInternal(context, evalContext);

            if (first == null)
            {
                return(obj3 == null);
            }
            if (obj3 == null)
            {
                return(false);
            }
            if (first.GetType() == obj3.GetType())
            {
                return(first.Equals(obj3));
            }
            if (first.GetType().IsEnum&& (obj3 is string))
            {
                return(first.Equals(Enum.Parse(first.GetType(), (string)obj3)));
            }
            if (obj3.GetType().IsEnum&& (first is string))
            {
                return(obj3.Equals(Enum.Parse(obj3.GetType(), (string)first)));
            }
            return(CompareUtils.Compare(first, obj3) == 0);
        }
Exemple #3
0
        protected override object Evaluate(object context, EvaluationContext evalContext)
        {
            object left  = Left.EvaluateInternal(context, evalContext);
            object right = Right.EvaluateInternal(context, evalContext);

            return(CompareUtils.Compare(left, right) > 0);
        }
Exemple #4
0
        protected override object Evaluate(object context, BaseNode.EvaluationContext evalContext)
        {
            object first  = base.Left.EvaluateInternal(context, evalContext);
            object second = base.Right.EvaluateInternal(context, evalContext);

            return(CompareUtils.Compare(first, second) <= 0);
        }
Exemple #5
0
        /// <summary>
        /// Returns a value for the logical equality operator node.
        /// </summary>
        /// <param name="context">Context to evaluate expressions against.</param>
        /// <param name="evalContext">Current expression evaluation context.</param>
        /// <returns>Node's value.</returns>
        protected override object Get(object context, EvaluationContext evalContext)
        {
            var lhs = GetLeftValue(context, evalContext);
            var rhs = GetRightValue(context, evalContext);

            if (lhs == null)
            {
                return(rhs == null);
            }
            if (rhs == null)
            {
                return(false);
            }
            if (lhs.GetType() == rhs.GetType())
            {
                if (lhs is Array)
                {
                    return(ArrayUtils.AreEqual(lhs as Array, rhs as Array));
                }
                return(lhs.Equals(rhs));
            }
            if (lhs.GetType().IsEnum&& rhs is string)
            {
                return(lhs.Equals(Enum.Parse(lhs.GetType(), (string)rhs)));
            }
            if (rhs.GetType().IsEnum&& lhs is string)
            {
                return(rhs.Equals(Enum.Parse(rhs.GetType(), (string)lhs)));
            }
            return(CompareUtils.Compare(lhs, rhs) == 0);
        }
        /// <summary>
        /// Returns a value for the logical inequality operator node.
        /// </summary>
        /// <param name="context">Context to evaluate expressions against.</param>
        /// <param name="evalContext">Current expression evaluation context.</param>
        /// <returns>Node's value.</returns>
        protected override object Get(object context, EvaluationContext evalContext)
        {
            object leftVal  = GetLeftValue(context, evalContext);
            object rightVal = GetRightValue(context, evalContext);

            if (leftVal == null)
            {
                return(rightVal != null);
            }
            else if (rightVal == null)
            {
                return(true);
            }
            else if (leftVal.GetType() == rightVal.GetType())
            {
                if (leftVal is Array)
                {
                    return(!ArrayUtils.AreEqual(leftVal as Array, rightVal as Array));
                }
                else
                {
                    return(!leftVal.Equals(rightVal));
                }
            }
            else
            {
                return(CompareUtils.Compare(leftVal, rightVal) != 0);
            }
        }
Exemple #7
0
        protected override object Evaluate(object context, EvaluationContext evalContext)
        {
            object left  = Left.EvaluateInternal(context, evalContext);
            object right = Right.EvaluateInternal(context, evalContext);

            if (left == null)
            {
                return(right == null);
            }
            else if (right == null)
            {
                return(false);
            }
            else if (left.GetType() == right.GetType())
            {
                return(left.Equals(right));
            }
            else if (left.GetType().IsEnum&& right is string)
            {
                return(left.Equals(Enum.Parse(left.GetType(), (string)right)));
            }
            else if (right.GetType().IsEnum&& left is string)
            {
                return(right.Equals(Enum.Parse(right.GetType(), (string)left)));
            }
            else
            {
                return(CompareUtils.Compare(left, right) == 0);
            }
        }
        /// <summary>
        /// Returns a value for the logical "greater than or equal" operator node.
        /// </summary>
        /// <param name="context">Context to evaluate expressions against.</param>
        /// <param name="evalContext">Current expression evaluation context.</param>
        /// <returns>Node's value.</returns>
        protected override object Get(object context, EvaluationContext evalContext)
        {
            object left  = GetLeftValue(context, evalContext);
            object right = GetRightValue(context, evalContext);

            return(CompareUtils.Compare(left, right) >= 0);
        }
        private bool ValidateInteger(JSchema schema, object value)
        {
            if (!TestType(schema, JSchemaType.Integer, value))
            {
                return(false);
            }

            if (schema.Maximum != null)
            {
                object v;
#if HAVE_BIG_INTEGER
                v = (value is BigInteger d) ? (double)d : value;
#else
                v = value;
#endif

                if (CompareUtils.CompareInteger(v, schema.Maximum) > 0)
                {
                    RaiseError($"Integer {value} exceeds maximum value of {schema.Maximum}.", ErrorType.Maximum, schema, value, null);
                }
                if (schema.ExclusiveMaximum && CompareUtils.CompareInteger(v, schema.Maximum) == 0)
                {
                    RaiseError($"Integer {value} equals maximum value of {schema.Maximum} and exclusive maximum is true.", ErrorType.Maximum, schema, value, null);
                }
            }

            if (schema.Minimum != null)
            {
                object v;
#if HAVE_BIG_INTEGER
                v = (value is BigInteger d) ? (double)d : value;
#else
                v = value;
#endif

                if (CompareUtils.CompareInteger(v, schema.Minimum) < 0)
                {
                    RaiseError($"Integer {value} is less than minimum value of {schema.Minimum}.", ErrorType.Minimum, schema, value, null);
                }
                if (schema.ExclusiveMinimum && CompareUtils.CompareInteger(v, schema.Minimum) == 0)
                {
                    RaiseError($"Integer {value} equals minimum value of {schema.Minimum} and exclusive minimum is true.", ErrorType.Minimum, schema, value, null);
                }
            }

            if (schema.MultipleOf != null)
            {
                if (!MathHelpers.IsIntegerMultiple(value, schema.MultipleOf.Value))
                {
                    RaiseError($"Integer {JsonConvert.ToString(value)} is not a multiple of {schema.MultipleOf}.", ErrorType.MultipleOf, schema, value, null);
                }
            }

            return(true);
        }
Exemple #10
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var displayAttributes = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);

            if (!_isContent)
            {
                if (!_isList)
                {
                    if (CblDisplayAttributes.Items.Count == 0)
                    {
                        FailMessage("必须至少选择一项!");
                        return;
                    }
                    SiteInfo.Additional.ChannelEditAttributes = displayAttributes;

                    Body.AddSiteLog(SiteId, "设置栏目编辑项", $"编辑项:{displayAttributes}");
                }
                else
                {
                    if (!CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelName))
                    {
                        FailMessage("必须选择栏目名称项!");
                        return;
                    }
                    if (!CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelIndex))
                    {
                        FailMessage("必须选择栏目索引项!");
                        return;
                    }
                    SiteInfo.Additional.ChannelDisplayAttributes = displayAttributes;

                    Body.AddSiteLog(SiteId, "设置栏目显示项", $"显示项:{displayAttributes}");
                }
                DataProvider.SiteDao.Update(SiteInfo);
            }
            else
            {
                var nodeInfo            = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
                var attributesOfDisplay = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);
                nodeInfo.Additional.ContentAttributesOfDisplay = attributesOfDisplay;

                DataProvider.ChannelDao.Update(nodeInfo);

                Body.AddSiteLog(SiteId, "设置内容显示项", $"显示项:{attributesOfDisplay}");
            }

            if (!_isList)
            {
                LayerUtils.CloseWithoutRefresh(Page);
            }
            else
            {
                LayerUtils.Close(Page);
            }
        }
Exemple #11
0
        public bool GreaterThan(ref Indexed <T> x, ref Indexed <T> y)
        {
            int  c      = CompareUtils.Compare(ref x.Value, ref y.Value);
            bool result = c > 0;

            if (c == 0)
            {
                result = x.Index > y.Index;
            }
            return(result);
        }
Exemple #12
0
        public bool LessThan(ref Indexed <T> x, ref Indexed <T> y)
        {
            int  c      = CompareUtils.Compare(ref x.Value, ref y.Value);
            bool result = c < 0;

            if (c == 0)
            {
                result = x.Index < y.Index;
            }
            return(result);
        }
Exemple #13
0
        /// <summary>
        /// Returns the largest item in the source collection.
        /// </summary>
        /// <param name="source">
        /// The source collection to process.
        /// </param>
        /// <param name="args">
        /// Ignored.
        /// </param>
        /// <returns>
        /// The largest item in the source collection.
        /// </returns>
        public object Process(ICollection source, object[] args)
        {
            object maxItem = null;

            foreach (object item in source)
            {
                if (CompareUtils.Compare(maxItem, item) < 0)
                {
                    maxItem = item;
                }
            }
            return(maxItem);
        }
Exemple #14
0
        /// <summary>
        /// Returns the smallest item in the source collection.
        /// </summary>
        /// <param name="source">
        /// The source collection to process.
        /// </param>
        /// <param name="args">
        /// Ignored.
        /// </param>
        /// <returns>
        /// The smallest item in the source collection.
        /// </returns>
        public object Process(ICollection source, object[] args)
        {
            object minItem = null;

            foreach (object item in source)
            {
                if ((minItem == null && item != null) || (CompareUtils.Compare(minItem, item) > 0))
                {
                    minItem = item;
                }
            }
            return(minItem);
        }
Exemple #15
0
        protected override object Evaluate(object context, BaseNode.EvaluationContext evalContext)
        {
            object first = base.Left.EvaluateInternal(context, evalContext);
            IList  list  = base.Right.EvaluateInternal(context, evalContext) as IList;

            if ((list == null) || (list.Count != 2))
            {
                throw new ArgumentException("Right operand for the 'between' operator has to be a two-element list.");
            }
            object second = list[0];
            object obj4   = list[1];

            return((CompareUtils.Compare(first, second) < 0) ? ((object)0) : ((object)(CompareUtils.Compare(first, obj4) <= 0)));
        }
Exemple #16
0
        /// <summary>
        /// Returns a value for the logical IN operator node.
        /// </summary>
        /// <param name="context">Context to evaluate expressions against.</param>
        /// <param name="evalContext">Current expression evaluation context.</param>
        /// <returns>
        /// true if the left operand is contained within the right operand, false otherwise.
        /// </returns>
        protected override object Get(object context, EvaluationContext evalContext)
        {
            object value = GetLeftValue(context, evalContext);
            IList  range = GetRightValue(context, evalContext) as IList;

            if (range == null || range.Count != 2)
            {
                throw new ArgumentException("Right operand for the 'between' operator has to be a two-element list.");
            }

            object low  = range[0];
            object high = range[1];

            return(CompareUtils.Compare(value, low) >= 0 && CompareUtils.Compare(value, high) <= 0);
        }
 private static FrameworkType GetFrameworkTypeByPublicKeyToken(byte[] publicKeyToken)
 {
     if (CompareUtils.Equals(publicKeyToken, CodeModelUtils.EcmaPublicKeyToken, false))
     {
         return(FrameworkType.MicrosoftNet);
     }
     else if (CompareUtils.Equals(publicKeyToken, SilverlightFramework.PublicKeyToken, false))
     {
         return(FrameworkType.Silverlight);
     }
     else
     {
         return(FrameworkType.MicrosoftNet);
     }
 }
 public int CompareTo(object obj)
 {
     if (obj is SubscriptionInfo)
     {
         SubscriptionInfo other = (SubscriptionInfo)obj;
         //return (string.Equals(other.Selector, _selector) && string.Equals(other.Subtopic, _subtopic)) ? 0 : -1;
         int result = CompareUtils.Compare(other.Selector, _selector) * -1;
         if (result == 0)
         {
             result = CompareUtils.Compare(other.Subtopic, _subtopic);
         }
         return(result);
     }
     return(-1);
 }
Exemple #19
0
        public static bool IsAncestorOrSelf(int publishmentSystemId, int parentId, int childId)
        {
            if (parentId == childId)
            {
                return(true);
            }
            var nodeInfo = GetNodeInfo(1, childId);

            if (nodeInfo == null)
            {
                return(false);
            }
            if (CompareUtils.Contains(nodeInfo.ParentsPath, parentId.ToString()))
            {
                return(true);
            }
            return(false);
        }
Exemple #20
0
        public static bool IsAncestorOrSelf(int publishmentSystemID, int parentID, int childID)
        {
            if (parentID == childID)
            {
                return(true);
            }
            var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemID, childID);

            if (nodeInfo == null)
            {
                return(false);
            }
            if (CompareUtils.Contains(nodeInfo.ParentsPath, parentID.ToString()))
            {
                return(true);
            }
            return(false);
        }
Exemple #21
0
        protected override object Evaluate(object context, BaseNode.EvaluationContext evalContext)
        {
            object first = base.Left.EvaluateInternal(context, evalContext);
            object obj3  = base.Right.EvaluateInternal(context, evalContext);

            if (first == null)
            {
                return(obj3 != null);
            }
            if (obj3 == null)
            {
                return(true);
            }
            if (first.GetType() == obj3.GetType())
            {
                return(!first.Equals(obj3));
            }
            return(CompareUtils.Compare(first, obj3) != 0);
        }
Exemple #22
0
        protected override object Evaluate(object context, EvaluationContext evalContext)
        {
            object left  = Left.EvaluateInternal(context, evalContext);
            object right = Right.EvaluateInternal(context, evalContext);

            if (left == null)
            {
                return(right != null);
            }
            else if (right == null)
            {
                return(true);
            }
            else if (left.GetType() == right.GetType())
            {
                return(!left.Equals(right));
            }
            else
            {
                return(CompareUtils.Compare(left, right) != 0);
            }
        }
Exemple #23
0
        private static int Compare(ref Indexed <T?> x, ref Indexed <T?> y)
        {
            int c;

            if (x.Value is T xValue)
            {
                c = 1;
                if (y.Value is T yValue)
                {
                    c = CompareUtils.Compare(ref xValue, ref yValue);
                }
            }
            else
            {
                c = 0;
                if (y.Value is not null)
                {
                    c = -1;
                }
            }
            return(c);
        }
Exemple #24
0
        /// <summary>
        /// 返回储存容器中除自身以外所有 type 和值都相同的 binding
        /// </summary>
        virtual public IList <IBinding> GetSameNullId(IBinding binding)
        {
            List <IBinding> bindingList = new List <IBinding>();

            int length = typeBindings[binding.type].Count;

            for (int i = 0; i < length; i++)
            {
                if (typeBindings[binding.type][i].id != null ||
                    typeBindings[binding.type][i].constraint != binding.constraint)
                {
                    continue;
                }

                if (binding.constraint == ConstraintType.MULTIPLE)
                {
                    if (CompareUtils.isSameValueIList(
                            typeBindings[binding.type][i].valueList,
                            binding.valueList) &&
                        !CompareUtils.isSameObject(typeBindings[binding.type][i], binding))
                    {
                        bindingList.Add(typeBindings[binding.type][i]);
                    }
                }
                else
                {
                    if (CompareUtils.isSameObject(
                            typeBindings[binding.type][i].value,
                            binding.value) &&
                        !CompareUtils.isSameObject(typeBindings[binding.type][i], binding))
                    {
                        bindingList.Add(typeBindings[binding.type][i]);
                    }
                }
            }

            return(bindingList);
        }
        /// <summary>
        /// Returns a value for the logical equality operator node.
        /// </summary>
        /// <param name="context">Context to evaluate expressions against.</param>
        /// <param name="evalContext">Current expression evaluation context.</param>
        /// <returns>Node's value.</returns>
        protected override object Get(object context, EvaluationContext evalContext)
        {
            object left  = GetLeftValue(context, evalContext);
            object right = GetRightValue(context, evalContext);

            if (left == null)
            {
                return(right == null);
            }
            else if (right == null)
            {
                return(false);
            }
            else if (left.GetType() == right.GetType())
            {
                if (left is Array)
                {
                    return(ArrayUtils.AreEqual(left as Array, right as Array));
                }
                else
                {
                    return(left.Equals(right));
                }
            }
            else if (left.GetType().IsEnum&& right is string)
            {
                return(left.Equals(Enum.Parse(left.GetType(), (string)right)));
            }
            else if (right.GetType().IsEnum&& left is string)
            {
                return(right.Equals(Enum.Parse(right.GetType(), (string)left)));
            }
            else
            {
                return(CompareUtils.Compare(left, right) == 0);
            }
        }
Exemple #26
0
        public bool Equals(IAssemblySignature x, IAssemblySignature y)
        {
            if (x == y)
            {
                return(true);
            }

            if (x == null || y == null)
            {
                return(false);
            }

            if (x.Name != y.Name)
            {
                return(false);
            }

            if ((_flags & SignatureComparisonFlags.IgnoreAssemblyStrongName) != SignatureComparisonFlags.IgnoreAssemblyStrongName)
            {
                if (x.Culture != y.Culture)
                {
                    return(false);
                }

                if (!CompareUtils.Equals(x.Version, y.Version, true))
                {
                    return(false);
                }

                if (!CompareUtils.Equals(x.PublicKeyToken, y.PublicKeyToken))
                {
                    return(false);
                }
            }

            return(true);
        }
        public int IndexOf(byte[] item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            for (int i = 0; i < _count; i++)
            {
                var entry = _entries[i];

                if (item.Length != entry.Size)
                {
                    continue;
                }

                if (CompareUtils.Equals(_buffer, entry.Offset, item, 0, entry.Size, false))
                {
                    return(i);
                }
            }

            return(-1);
        }
        private bool EqualsAssembly(IAssemblySignature x, IAssemblySignature y)
        {
            if (x == y)
            {
                return(true);
            }

            if (x == null || y == null)
            {
                return(false);
            }

            if (x.Name != y.Name)
            {
                return(false);
            }

            if (!CompareUtils.Equals(x.PublicKeyToken, y.PublicKeyToken))
            {
                return(false);
            }

            return(true);
        }
Exemple #29
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID", "ReturnUrl");

            _nodeId    = Body.GetQueryInt("NodeID");
            _returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            if (Body.GetQueryString("CanNotEdit") == null && Body.GetQueryString("UncheckedChannel") == null)
            {
                if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                {
                    PageUtils.RedirectToErrorPage("您没有修改栏目的权限!");
                    return;
                }
            }
            if (Body.IsQueryExists("CanNotEdit"))
            {
                Submit.Visible = false;
            }

            var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);

            if (nodeInfo != null)
            {
                channelControl = (ChannelAuxiliaryControl)FindControl("ControlForAuxiliary");
                if (!IsPostBack)
                {
                    BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "编辑栏目", string.Empty);

                    var contentModelInfoList = ContentModelManager.GetContentModelInfoList(PublishmentSystemInfo);
                    foreach (var modelInfo in contentModelInfoList)
                    {
                        ContentModelID.Items.Add(new ListItem(modelInfo.ModelName, modelInfo.ModelId));
                    }
                    ControlUtils.SelectListItems(ContentModelID, nodeInfo.ContentModelId);

                    channelControl.SetParameters(nodeInfo.Additional.Attributes, true, IsPostBack);

                    NavigationPicPath.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", PublishmentSystemInfo.PublishmentSystemUrl));

                    var showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, true, ChannelFilePathRule.ClientID);
                    CreateChannelRule.Attributes.Add("onclick", showPopWinString);

                    showPopWinString = ModalFilePathRule.GetOpenWindowString(PublishmentSystemId, _nodeId, false, ContentFilePathRule.ClientID);
                    CreateContentRule.Attributes.Add("onclick", showPopWinString);

                    showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, NavigationPicPath.ClientID);
                    SelectImage.Attributes.Add("onclick", showPopWinString);

                    showPopWinString = ModalUploadImage.GetOpenWindowString(PublishmentSystemId, NavigationPicPath.ClientID);
                    UploadImage.Attributes.Add("onclick", showPopWinString);
                    IsChannelAddable.Items[0].Value = true.ToString();
                    IsChannelAddable.Items[1].Value = false.ToString();
                    IsContentAddable.Items[0].Value = true.ToString();
                    IsContentAddable.Items[1].Value = false.ToString();

                    ELinkTypeUtils.AddListItems(LinkType);

                    NodeGroupNameCollection.DataSource = DataProvider.NodeGroupDao.GetDataSource(PublishmentSystemId);

                    ChannelTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ChannelTemplate);

                    ContentTemplateID.DataSource = DataProvider.TemplateDao.GetDataSourceByType(PublishmentSystemId, ETemplateType.ContentTemplate);

                    DataBind();

                    ChannelTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                    ControlUtils.SelectListItems(ChannelTemplateID, nodeInfo.ChannelTemplateId.ToString());

                    ContentTemplateID.Items.Insert(0, new ListItem("<未设置>", "0"));
                    ControlUtils.SelectListItems(ContentTemplateID, nodeInfo.ContentTemplateId.ToString());

                    NodeName.Text      = nodeInfo.NodeName;
                    NodeIndexName.Text = nodeInfo.NodeIndexName;
                    LinkUrl.Text       = nodeInfo.LinkUrl;

                    foreach (ListItem item in NodeGroupNameCollection.Items)
                    {
                        if (CompareUtils.Contains(nodeInfo.NodeGroupNameCollection, item.Value))
                        {
                            item.Selected = true;
                        }
                        else
                        {
                            item.Selected = false;
                        }
                    }
                    FilePath.Text            = nodeInfo.FilePath;
                    ChannelFilePathRule.Text = nodeInfo.ChannelFilePathRule;
                    ContentFilePathRule.Text = nodeInfo.ContentFilePathRule;

                    //NodeProperty
                    ControlUtils.SelectListItems(LinkType, ELinkTypeUtils.GetValue(nodeInfo.LinkType));
                    ControlUtils.SelectListItems(IsChannelAddable, nodeInfo.Additional.IsChannelAddable.ToString());
                    ControlUtils.SelectListItems(IsContentAddable, nodeInfo.Additional.IsContentAddable.ToString());

                    NavigationPicPath.Text = nodeInfo.ImageUrl;

                    var formCollection = new NameValueCollection();
                    formCollection[NodeAttribute.Content] = nodeInfo.Content;
                    Content.SetParameters(PublishmentSystemInfo, NodeAttribute.Content, formCollection, true, IsPostBack);

                    Keywords.Text    = nodeInfo.Keywords;
                    Description.Text = nodeInfo.Description;

                    //this.Content.PublishmentSystemID = base.PublishmentSystemID;
                    //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.PublishmentSystemInfo.PublishmentSystemUrl);

                    if (nodeInfo.NodeType == ENodeType.BackgroundPublishNode)
                    {
                        LinkURLRow.Visible           = false;
                        LinkTypeRow.Visible          = false;
                        ChannelTemplateIDRow.Visible = false;
                        FilePathRow.Visible          = false;
                    }
                }
                else
                {
                    channelControl.SetParameters(Request.Form, true, IsPostBack);
                }
            }
        }
Exemple #30
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            _relatedIdentity = Body.GetQueryInt("RelatedIdentity");
            _isList          = Body.GetQueryBool("IsList");
            _isContent       = Body.GetQueryBool("IsContent");

            if (!_isContent)
            {
                var displayAttributes = SiteInfo.Additional.ChannelDisplayAttributes;
                if (!_isList)
                {
                    displayAttributes = SiteInfo.Additional.ChannelEditAttributes;
                }

                if (IsPostBack)
                {
                    return;
                }

                //添加默认属性
                var listitem = new ListItem("栏目名称", ChannelAttribute.ChannelName);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelName))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                listitem = new ListItem("栏目索引", ChannelAttribute.ChannelIndex);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelIndex))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                listitem = new ListItem("生成页面路径", ChannelAttribute.FilePath);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.FilePath))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                if (!_isList)
                {
                    listitem = new ListItem("栏目图片地址", ChannelAttribute.ImageUrl);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ImageUrl))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("栏目正文", ChannelAttribute.Content);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Content))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("外部链接", ChannelAttribute.LinkUrl);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.LinkUrl))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("链接类型", ChannelAttribute.LinkUrl);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.LinkUrl))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("内容默认排序规则", nameof(ChannelInfoExtend.DefaultTaxisType));
                    if (CompareUtils.Contains(displayAttributes, nameof(ChannelInfoExtend.DefaultTaxisType)))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("栏目模版", ChannelAttribute.ChannelTemplateId);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelTemplateId))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("内容模版", ChannelAttribute.ContentTemplateId);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ContentTemplateId))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("关键字列表", ChannelAttribute.Keywords);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Keywords))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);

                    listitem = new ListItem("页面描述", ChannelAttribute.Description);
                    if (CompareUtils.Contains(displayAttributes, ChannelAttribute.Description))
                    {
                        listitem.Selected = true;
                    }
                    CblDisplayAttributes.Items.Add(listitem);
                }

                listitem = new ListItem("栏目组", ChannelAttribute.ChannelGroupNameCollection);
                if (CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelGroupNameCollection))
                {
                    listitem.Selected = true;
                }
                CblDisplayAttributes.Items.Add(listitem);

                var styleInfoList = TableStyleManager.GetTableStyleInfoList(DataProvider.ChannelDao.TableName, _relatedIdentities);

                foreach (var styleInfo in styleInfoList)
                {
                    listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                    if (CompareUtils.Contains(displayAttributes, styleInfo.AttributeName))
                    {
                        listitem.Selected = true;
                    }

                    CblDisplayAttributes.Items.Add(listitem);
                }

                if (string.IsNullOrEmpty(displayAttributes))
                {
                    if (!_isList)
                    {
                        foreach (ListItem item in CblDisplayAttributes.Items)
                        {
                            item.Selected = true;
                        }
                    }
                    else
                    {
                        ControlUtils.SelectMultiItems(CblDisplayAttributes, ChannelAttribute.ChannelName, ChannelAttribute.ChannelIndex);
                    }
                }
            }
            else
            {
                var nodeInfo  = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
                var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo);
                _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _relatedIdentity);
                var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

                if (IsPostBack)
                {
                    return;
                }

                var styleInfoList            = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
                var columnTableStyleInfoList = ContentUtility.GetColumnTableStyleInfoList(SiteInfo, styleInfoList);
                foreach (var styleInfo in columnTableStyleInfoList)
                {
                    if (styleInfo.AttributeName == ContentAttribute.Title)
                    {
                        continue;
                    }
                    var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);

                    if (_isList)
                    {
                        if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                        {
                            listitem.Selected = true;
                        }
                    }
                    else
                    {
                        listitem.Selected = true;
                    }

                    CblDisplayAttributes.Items.Add(listitem);
                }
            }
        }