Пример #1
0
    public Item[] ListQuery(Item item)
    {
        bool flag = !string.IsNullOrWhiteSpace(Context.RawUrl) && Context.RawUrl.Contains("hdl");

        if (flag)
        {
            string renderingId = FieldEditorOptions.Parse(new UrlString(Context.RawUrl)).Parameters["rendering"];

            if (!string.IsNullOrEmpty(renderingId))
            {
                ItemUri renderingItemUri = new ItemUri(renderingId);

                var containers = DependencyResolver.Current.GetService <IPresentationRepository>().GetStylesItem(renderingItemUri.ItemID, item);

                if (containers == null)
                {
                    return(new Item[0]);
                }

                return(containers.Children.ToArray <Item>());
            }
        }

        var result = new Item[0];

        return(result);
    }
Пример #2
0
        public void Process(GetLookupSourceItemsArgs args)
        {
            if (!args.Item.InheritsFrom(SitecoreIDs.StandardRenderingParametersTemplateId))
            {
                return;
            }

            var url = WebUtil.GetQueryString();

            if (string.IsNullOrWhiteSpace(url))
            {
                return;
            }
            try
            {
                var parameters = FieldEditorOptions.Parse(new UrlString(url)).Parameters;

                var currentItemUri = parameters["contentitem"];
                if (string.IsNullOrEmpty(currentItemUri))
                {
                    return;
                }

                var contentItemUri = new ItemUri(currentItemUri);
                var contextItem    = Database.GetItem(contentItemUri);

                args.Item = contextItem;
            }
            catch (Exception ex)
            {
                Sitecore.Diagnostics.Log.Error(ex.Message, ex, this);
            }
        }
Пример #3
0
        public string GenerateUrl()
        {
            var fieldList         = CreateFieldDescriptors(RequestContext.Argument);
            var fieldeditorOption = new FieldEditorOptions(fieldList);

            fieldeditorOption.SaveItem = true;
            return(fieldeditorOption.ToUrlString().ToString());
        }
        public string GenerateUrl()
        {
            var fieldList         = CreateFieldDescriptors(RequestContext.Argument.ToLower());
            var fieldeditorOption = new FieldEditorOptions(fieldList);

            //Save item when ok button is pressed
            fieldeditorOption.SaveItem = true;
            return(fieldeditorOption.ToUrlString().ToString());
        }
Пример #5
0
        private string GenerateUrl()
        {
            var fieldList          = CreateFieldDescriptors(RequestContext.Argument);
            var fieldEditorOptions = new FieldEditorOptions(fieldList)
            {
                SaveItem = true
            };

            return(fieldEditorOptions.ToUrlString().ToString());
        }
        public static string GenerateFieldEditorUrl(Item item, IEnumerable <TemplateField> fields)
        {
            var fieldsEditor = string.Join("|", fields.Select(x => x.FieldName));

            FieldEditorOptions fieldEditorOption = new FieldEditorOptions(CreateFieldDescriptors(item, fieldsEditor));

            fieldEditorOption.SaveItem         = true;
            fieldEditorOption.PreserveSections = true;
            return(fieldEditorOption.ToUrlString().ToString());
        }
Пример #7
0
        /// <summary>
        /// Generates the url for the editor dialog.
        /// </summary>
        /// <returns>
        /// Returns the url for the dialog form.
        /// </returns>
        public string GenerateUrl()
        {
            List <FieldDescriptor> fieldList = RequestContext.Item.CreateFieldDescriptors();

            FieldEditorOptions fieldeditorOption = new FieldEditorOptions(fieldList)
            {
                PreserveSections = true,
                //Save item when ok button is pressed
                SaveItem = true
            };

            return(fieldeditorOption.ToUrlString().ToString());
        }
Пример #8
0
        public void Process(GetLookupSourceItemsArgs args)
        {
            if (!args.Source.Contains(scapePrefix))
            {
                return;
            }

            Item contextItem;

            // Only goes ahead if this is a Parameters Template
            if (args.Item.Template.BaseTemplates.Where(bt => bt.ID == BaseParameterTemplate).Any())
            {
                // This whole block is to get Context Item
                string url = WebUtil.GetQueryString();
                if (string.IsNullOrWhiteSpace(url))
                {
                    args.Source = String.Empty;
                    return;
                }

                FieldEditorParameters parameters = null;
                try
                {
                    parameters = FieldEditorOptions.Parse(new UrlString(url)).Parameters;
                }
                catch (Exception) { }
                if (parameters == null)
                {
                    args.Source = String.Empty;
                    return;
                }
                var currentItemId = parameters["contentitem"];
                if (string.IsNullOrEmpty(currentItemId))
                {
                    args.Source = String.Empty;
                    return;
                }
                ItemUri contentItemUri = new ItemUri(currentItemId);
                contextItem = Database.GetItem(contentItemUri);
            }
            else
            {
                contextItem = args.Item;
            }

            // Now to the custom (site-specific) parameters
            var sourceName = args.Source.Replace(scapePrefix, "").Trim();

            args.Source = provider.GetSource(contextItem, sourceName);
        }
Пример #9
0
        public string GenerateUrl()
        {
            var parameters        = WebUtil.ParseQueryString(RequestContext.Argument);
            var fieldeditorOption = new FieldEditorOptions(CreateFieldDescriptors(parameters["fieldnames"], parameters["datasource"]));

            if (!string.IsNullOrWhiteSpace(parameters["dialogtitle"]))
            {
                fieldeditorOption.DialogTitle = parameters["dialogtitle"];
            }

            bool boolValue;

            fieldeditorOption.PreserveSections = !bool.TryParse(parameters["preservesections"], out boolValue) || boolValue;

            fieldeditorOption.SaveItem = true;
            return(fieldeditorOption.ToUrlString().ToString());
        }
Пример #10
0
        public void Process(GetLookupSourceItemsArgs args)
        {
            //should we care?
            if (HasLookup(args.Source))
            {
                var url = WebUtil.GetQueryString();

                if (string.IsNullOrWhiteSpace(url))
                {
                    return;
                }

                var fieldEditorOptions = FieldEditorOptions.Parse(new UrlString(url));
                var parameters         = fieldEditorOptions.Parameters;

                var currentItemId = parameters[Constants.FieldEditor.RenderingParameters.ContentItem];

                if (string.IsNullOrEmpty(currentItemId))
                {
                    return;
                }

                // get the context item.
                var contentItemUri = new ItemUri(currentItemId);

                var contextItem = Database.GetItem(contentItemUri);


                // get all item fields, filter out standard fields and order. maybe group by section in future?
                contextItem.Fields.ReadAll();
                var itemFields = contextItem.Fields.Where(f => !f.Name.StartsWith("__")).OrderBy(f => f.DisplayName);

                foreach (Field field in itemFields)
                {
                    // check if we support the field type
                    if (IsSupportedField(field))
                    {
                        args.Result.Add(field.InnerItem);
                    }
                }


                // if no other queries to be served, no need to continue pipeline
                args.AbortPipeline();
            }
        }
        public void Run(ClientPipelineArgs args)
        {
            if (!args.IsPostBack)
            {
                var item   = Sitecore.Data.Database.GetItem(ItemUri.Parse(args.Parameters["uri"]));
                var fields = new List <FieldDescriptor>();
                FieldEditorOptions options = new FieldEditorOptions(fields);
                options.SaveItem    = true;
                options.DialogTitle = "Item Bucket settings";
                foreach (var fieldDescriptor in GetFields(item).Select(s => new FieldDescriptor(item, s)))
                {
                    options.Fields.Add(fieldDescriptor);
                }
                Context.ClientPage.ClientResponse.ShowModalDialog(options.ToUrlString().ToString(), true);

                args.WaitForPostBack();
            }
        }
        protected FieldEditorOptions GetOptions(ClientPipelineArgs args, NameValueCollection form)
        {
            Item item = Database.GetItem(ItemUri.Parse(args.Parameters["uri"]));
            List <FieldDescriptor> fieldDescriptors = new List <FieldDescriptor>();

            fieldDescriptors.Add(new FieldDescriptor(item, Data.ProjectFieldId.ToString()));
            List <FieldDescriptor> fieldDescriptors1 = fieldDescriptors;

            Assert.IsNotNull(item, "item");
            FieldEditorOptions pageEditFieldEditorOption = new FieldEditorOptions(fieldDescriptors1);

            pageEditFieldEditorOption.Title       = "Select Project";
            pageEditFieldEditorOption.Icon        = "";
            pageEditFieldEditorOption.DialogTitle = "Select Project";
            FieldEditorOptions pageEditFieldEditorOption1 = pageEditFieldEditorOption;

            return(pageEditFieldEditorOption1);
        }
        public void Run(ClientPipelineArgs args)
        {
            if (!args.IsPostBack)
            {
                var item = Sitecore.Data.Database.GetItem(ItemUri.Parse(args.Parameters["uri"]));
                var fields = new List<FieldDescriptor>();
                FieldEditorOptions options = new FieldEditorOptions(fields);
                options.SaveItem = true;
                options.DialogTitle = "Item Bucket settings";
                foreach (var fieldDescriptor in GetFields(item).Select(s => new FieldDescriptor(item, s)))
                {
                    options.Fields.Add(fieldDescriptor);
                }
                Context.ClientPage.ClientResponse.ShowModalDialog(options.ToUrlString().ToString(), true);

                args.WaitForPostBack();
            }


        }
Пример #14
0
        private void OpenEditDialog(Item item)
        {
            if (item == null)
            {
                return;
            }

            var fieldList          = this.CreateFieldDescriptors(item);
            var fieldEditorOptions = new FieldEditorOptions(fieldList)
            {
                SaveItem = true,
            };
            var url = fieldEditorOptions.ToUrlString().ToString();

            SheerResponse.ShowModalDialog(new ModalDialogOptions(url)
            {
                Width           = "800",
                Height          = "600",
                Response        = false,
                ForceDialogSize = false,
            });
        }