コード例 #1
0
        protected void SetProperties()
        {
            string @string = StringUtil.GetString(new string[1]
            {
                this.Source
            });

            if (Sitecore.Data.ID.IsID(@string))
            {
                this.DataSource = this.Source;
            }
            else if (this.Source != null && [email protected]().StartsWith("/", StringComparison.OrdinalIgnoreCase))
            {
                ParameterizedFieldSource pfs = ParameterizedFieldSourceFactory.GetFieldSource(this.Source);
                this.ExcludeTemplatesForSelection = pfs.ExcludeTemplatesForSelectionSource;
                this.IncludeTemplatesForSelection = pfs.IncludeTemplatesForSelectionSource;
                this.IncludeTemplatesForDisplay   = pfs.IncludeTemplatesForDisplaySource;
                this.ExcludeTemplatesForDisplay   = pfs.ExcludeTemplatesForDisplaySource;
                this.ExcludeItemsForDisplay       = pfs.ExcludeItemsForDisplaySource;
                this.IncludeItemsForDisplay       = pfs.IncludeItemsForDisplaySource;
                this.AllowMultipleSelection       = pfs.AllowMultipleSelection;
                this.DataSource   = pfs.DataSource;
                this.DatabaseName = pfs.DatabaseName;
            }
            else
            {
                this.DataSource = this.Source;
            }
        }
コード例 #2
0
        protected override void OnLoad(EventArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (!Sitecore.Context.ClientPage.IsEvent)
            {
                this.SetProperties();
                this.GetControlAttributes();
                base.SetViewStateString("ID", this.ID);

                FieldSuiteTreeviewEx ex = new FieldSuiteTreeviewEx
                {
                    ID = this.ID + "_all"
                };

                this.Controls.Add(ex);
                ex.ParentId      = this.ID;
                ex.DblClick      = this.ID + ".Add";
                ex.AllowDragging = false;
                ex.Enabled       = !ReadOnly;

                DataContext context = new DataContext();
                this.Controls.Add(context);
                context.ID           = GetUniqueID("D");
                context.Filter       = this.FormTemplateFilterForDisplay();
                ex.DataContext       = context.ID;
                context.DataViewName = "Master";
                if (!string.IsNullOrEmpty(this.DatabaseName))
                {
                    context.Parameters = "databasename=" + this.DatabaseName;
                }
                context.Root = this.DataSource;
                ex.ShowRoot  = true;
                ParameterizedFieldSource pfs = ParameterizedFieldSourceFactory.GetFieldSource(this.Source);
                ex.ExcludeTemplatesForSelection = pfs.ExcludeTemplatesForSelection.ToList();
                ex.IncludeTemplatesForSelection = pfs.IncludeTemplatesForSelection.ToList();
            }

            base.OnLoad(args);
        }