示例#1
0
        private string GetCategories(string itemPath)
        {
            List <string> categories       = new List <string>();
            Database      db               = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database;
            Item          item             = db.GetItem(itemPath);
            ID            categoriesRootId = new ID("{41E44203-3CB9-45DD-8EED-9E36B5282D68}");
            string        source           = item.Fields[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")].Source;

            if (!string.IsNullOrEmpty(source))
            {
                var classificationSourceItems = LookupSources.GetItems(item, source);
                if ((classificationSourceItems != null) && (classificationSourceItems.Length > 0))
                {
                    Item taxonomies = classificationSourceItems.ToList().Find(sourceItem => sourceItem.Name.Equals("Taxonomies"));
                    if (taxonomies != null)
                    {
                        categoriesRootId = taxonomies.ID;
                    }
                }
            }

            Item categoriesRoot = db.GetItem(categoriesRootId);

            foreach (Item categoryGroupItem in categoriesRoot.Children)
            {
                categories.AddRange(GetCategories(categoryGroupItem.DisplayName, categoryGroupItem));
            }

            return(string.Join("|", categories.ToArray()));
        }
示例#2
0
 private Item[] GetSources(Item currentItem, Field field)
 {
     using (new LanguageSwitcher(CurrentLanguage))
     {
         return(LookupSources.GetItems(currentItem, field.Source));
     }
 }
        void RenderCarousel()
        {
            var currentItem = GetItem();

            if (currentItem == null)
            {
                Items.InnerHtml = "<strong>Current item not found</strong>";
                return;
            }

            var items  = LookupSources.GetItems(GetItem(), Source);
            var output = new HtmlTextWriter(new StringWriter());

            var ul = new TagBuilder("ul");

            if (Disabled)
            {
                ul.Class = "disabled";
            }

            ul.Start(output);
            RenderItems(output, items);
            output.Write("</ul>");

            Items.InnerHtml = output.InnerWriter.ToString();
        }
示例#4
0
        protected Item[] GetPotentialItems()
        {
            string path = this.FeedItem["source"];

            Item[] items = null;

            if (!String.IsNullOrEmpty(path))
            {
                if (path.StartsWith("query:") || path.StartsWith("fast:"))
                {
                    items = LookupSources.GetItems(this.FeedItem, path);
                }
                else
                {
                    Item item = this.FeedItem.Database.GetItem(path);

                    if (item != null)
                    {
                        items = item.Axes.GetDescendants();
                    }
                }
            }
            else
            {
                items = this.FeedItem.Axes.GetDescendants();
            }

            return(items);
        }
        /// <summary>
        /// This runs the query on the axes for the item passed in making it relative to that item
        /// </summary>
        /// <param name="currentItem"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        private static Item GetQueriedItem(Item currentItem, string query)
        {
            if (currentItem == null || string.IsNullOrEmpty(query))
            {
                return(null);
            }

            Item[] returnItems = LookupSources.GetItems(currentItem, query);

            return((returnItems != null && returnItems.Any()) ? returnItems.First() : null);
        }
示例#6
0
        /// <summary>
        /// </summary>
        /// <param name="updatedItem"></param>
        /// <param name="fieldId"></param>
        /// <param name="label"></param>
        /// <returns></returns>
        private Item GetDatasource(Item updatedItem, string fieldId, string label)
        {
            var dataSourcePath = GetDatasourcePath(updatedItem, fieldId);

            Item[] datasourceItems = null;
            if (updatedItem.Fields[new ID(fieldId)].TypeKey == "treelist" && dataSourcePath.IndexOf("IncludeTemplatesForSelection", StringComparison.InvariantCultureIgnoreCase) > 0)
            {
                var templatesStr = dataSourcePath.Substring(dataSourcePath.IndexOf("IncludeTemplatesForSelection",
                    StringComparison.InvariantCultureIgnoreCase));
                templatesStr = templatesStr.Substring(templatesStr.IndexOf("=", StringComparison.Ordinal) + 1).Trim();
                if (templatesStr.IndexOf("&", StringComparison.Ordinal) != -1)
                {
                    templatesStr = templatesStr.Substring(0, templatesStr.IndexOf("&", StringComparison.Ordinal));
                }
                if (!string.IsNullOrWhiteSpace(templatesStr))
                {
                    var startPath = dataSourcePath.Trim();
                    startPath = startPath.Substring(startPath.IndexOf("=", StringComparison.InvariantCultureIgnoreCase) + 1).Trim();
                    startPath = startPath.Substring(0, startPath.IndexOf("&", StringComparison.InvariantCultureIgnoreCase));
                    if (!string.IsNullOrWhiteSpace(startPath))
                    {
                        var startItem = updatedItem.Database.SelectSingleItem(startPath);
                        if (startItem != null)
                        {
                            var templates = templatesStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                            datasourceItems = GetDescendantsByTemplateNamesWithFallback(startItem, templates).ToArray();
                        }
                    }
                }
            }
            else
            {
                datasourceItems = LookupSources.GetItems(updatedItem, dataSourcePath);
            }

            if (datasourceItems == null)
            {
                return null;
            }

            label = label.Trim();
            if (label.Contains('&'))
            {
                label = System.Web.HttpUtility.HtmlDecode(label);
            }

            return datasourceItems.FirstOrDefault(c =>
                label.Equals(c.Name, StringComparison.InvariantCultureIgnoreCase) ||
                label.Equals(c.DisplayName, StringComparison.InvariantCultureIgnoreCase));
        }
        /// <summary>
        /// Gets the items.
        /// </summary>
        /// <param name="current">The current.</param>
        /// <param name="source">The source.</param>
        /// <returns>The items.</returns>
        static IList <Item> GetItems(Item current, string source)
        {
            Assert.ArgumentNotNull(current, "source");
            Assert.ArgumentNotNull(source, "source");

            if (source.Length == 0)
            {
                return(new List <Item>());
            }

            var urlString = new UrlString(source);

            var path = urlString.Path;

            return(LookupSources.GetItems(current, path));
        }
示例#8
0
        protected void Set(ClientPipelineArgs args)
        {
            Database db = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database;

            if (args.IsPostBack)
            {
                if (args.HasResult && (args.Result != "undefined"))
                {
                    Item item = db.GetItem(args.Parameters["item"]);
                    using (new EditContext(item))
                    {
                        item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")] = args.Result;
                    }
                }
            }
            else
            {
                UrlString url =
                    new UrlString(
                        ControlManager.GetControlUrl(new ControlName("Sitecore.Shell.Applications.Taxonomy.Dialogs.SetTags")));
                UrlHandle handle = new UrlHandle();
                handle["categories"] = GetCategories(args.Parameters["item"]);
                Item item = db.GetItem(args.Parameters["item"]);
                handle["value"] = item[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")];
                ID     categoriesRootId = new ID("{41E44203-3CB9-45DD-8EED-9E36B5282D68}");
                string source           = item.Fields[new ID("{0F347169-F131-4276-A69D-187C0CAC3740}")].Source;
                if (!string.IsNullOrEmpty(source))
                {
                    var classificationSourceItems = LookupSources.GetItems(item, source);
                    if ((classificationSourceItems != null) && (classificationSourceItems.Length > 0))
                    {
                        Item taxonomies = classificationSourceItems.ToList().Find(sourceItem => sourceItem.Name.Equals("Taxonomies"));
                        if (taxonomies != null)
                        {
                            categoriesRootId = taxonomies.ID;
                        }
                    }
                }
                handle["categoriesRootId"] = categoriesRootId.ToString();
                handle.Add(url);
                SheerResponse.ShowModalDialog(url.ToString(), "400px", "150px", string.Empty, true);
                args.WaitForPostBack();
            }
        }
示例#9
0
        private void GetFieldLookups([NotNull] XmlTextWriter output, [NotNull] Field field)
        {
            Assert.ArgumentNotNull(output, nameof(output));
            Assert.ArgumentNotNull(field, nameof(field));

            var isValueLookup = false;
            var hasSubItems   = false;

            IEnumerable <Item> items = null;

            try
            {
                switch (field.Type.ToLowerInvariant())
                {
                case "lookup":
                case "droplink":
                case "multilist":
                case "checklist":
                case "name lookup value list":
                    if (field.Item != null && !string.IsNullOrEmpty(field.Source))
                    {
                        items = LookupSources.GetItems(field.Item, field.Source);
                    }

                    break;

                case "valuelookup":
                case "droplist":
                    if (field.Item != null && !string.IsNullOrEmpty(field.Source))
                    {
                        items         = LookupSources.GetItems(field.Item, field.Source);
                        isValueLookup = true;
                    }

                    break;

                case "tree list":
                case "treelist":
                case "treelistex":
                    MultilistField m = field;
                    items = m.GetItems();
                    break;

                case "grouped droplist":
                    if (field.Item != null && !string.IsNullOrEmpty(field.Source))
                    {
                        items         = LookupSources.GetItems(field.Item, field.Source);
                        hasSubItems   = true;
                        isValueLookup = true;
                    }

                    break;

                case "grouped droplink":
                    if (field.Item != null && !string.IsNullOrEmpty(field.Source))
                    {
                        items       = LookupSources.GetItems(field.Item, field.Source);
                        hasSubItems = true;
                    }

                    break;

                default:
                    return;
                }
            }
            catch (Exception ex)
            {
                Log.Error("Failed to get Lookup source", ex, this);
                items = null;
            }

            if (items == null)
            {
                return;
            }

            output.WriteStartElement("lookup");

            foreach (var i in items)
            {
                var value = isValueLookup ? i.Name : i.ID.ToString();

                output.WriteStartElement("item");

                output.WriteAttributeString("value", value);
                output.WriteAttributeString("name", i.Name);

                if (hasSubItems)
                {
                    foreach (Item child in i.Children)
                    {
                        if (child == null)
                        {
                            continue;
                        }

                        value = isValueLookup ? child.Name : child.ID.ToString();

                        output.WriteStartElement("item");

                        output.WriteAttributeString("value", value);
                        output.WriteAttributeString("name", child.Name);

                        output.WriteEndElement();
                    }
                }

                output.WriteEndElement();
            }

            output.WriteEndElement();
        }
示例#10
0
 /// <summary>
 /// Returns a list of items for a field
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public List <Item> GetItems()
 {
     return((ContextItem.IsNull()) ? new List <Item>() : LookupSources.GetItems(ContextItem, this.Source).ToList());
 }
示例#11
0
        protected override void DoRender(HtmlTextWriter output)
        {
            this.RewriteSource();

            IDictionary dictionary;
            ArrayList   list;

            Assert.ArgumentNotNull(output, "output");
            Item current = Sitecore.Context.ContentDatabase.GetItem(this.ItemID, Language.Parse(this.ItemLanguage));

            Item[] sources = null;
            using (new LanguageSwitcher(this.ItemLanguage))
            {
                sources = LookupSources.GetItems(current, this.Source);
            }
            this.GetSelectedItems(sources, out list, out dictionary);
            base.ServerProperties["ID"] = this.ID;
            string str = string.Empty;

            if (this.ReadOnly)
            {
                str = " disabled=\"disabled\"";
            }
            output.Write("<input id=\"" + this.ID + "_Value\" type=\"hidden\" value=\"" + StringUtil.EscapeQuote(this.Value) + "\" />");
            output.Write("<table" + this.GetControlAttributes() + ">");
            output.Write("<tr>");
            output.Write("<td class=\"scContentControlMultilistCaption\" width=\"50%\">" + Translate.Text("All") + "</td>");
            output.Write("<td width=\"20\">" + Images.GetSpacer(20, 1) + "</td>");
            output.Write("<td class=\"scContentControlMultilistCaption\" width=\"50%\">" + Translate.Text("Selected") + "</td>");
            output.Write("<td width=\"20\">" + Images.GetSpacer(20, 1) + "</td>");
            output.Write("</tr>");
            output.Write("<tr>");
            output.Write("<td valign=\"top\" height=\"100%\">");
            output.Write("<select id=\"" + this.ID + "_unselected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"10\"" + str + " ondblclick=\"javascript:scContent.multilistMoveRight('" + this.ID + "')\" onchange=\"javascript:document.getElementById('" + this.ID + "_all_help').innerHTML=this.selectedIndex>=0?this.options[this.selectedIndex].innerHTML:''\" >");
            foreach (DictionaryEntry entry in dictionary)
            {
                Item item = entry.Value as Item;
                if (item != null)
                {
                    output.Write("<option value=\"" + this.GetItemValue(item) + "\">" + item.DisplayName + "</option>");
                }
            }
            output.Write("</select>");
            output.Write("</td>");
            output.Write("<td valign=\"top\">");
            this.RenderButton(output, "Core/16x16/arrow_blue_right.png", "javascript:scContent.multilistMoveRight('" + this.ID + "')");
            output.Write("<br />");
            this.RenderButton(output, "Core/16x16/arrow_blue_left.png", "javascript:scContent.multilistMoveLeft('" + this.ID + "')");
            output.Write("</td>");
            output.Write("<td valign=\"top\" height=\"100%\">");
            output.Write("<select id=\"" + this.ID + "_selected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"10\"" + str + " ondblclick=\"javascript:scContent.multilistMoveLeft('" + this.ID + "')\" onchange=\"javascript:document.getElementById('" + this.ID + "_selected_help').innerHTML=this.selectedIndex>=0?this.options[this.selectedIndex].innerHTML:''\">");
            for (int i = 0; i < list.Count; i++)
            {
                Item item3 = list[i] as Item;
                if (item3 != null)
                {
                    output.Write("<option value=\"" + this.GetItemValue(item3) + "\">" + item3.DisplayName + "</option>");
                }
                else
                {
                    string path = list[i] as string;
                    if (path != null)
                    {
                        string str3;
                        Item   item4 = Sitecore.Context.ContentDatabase.GetItem(path);
                        if (item4 != null)
                        {
                            str3 = item4.DisplayName + ' ' + Translate.Text("[Not in the selection List]");
                        }
                        else
                        {
                            str3 = path + ' ' + Translate.Text("[Item not found]");
                        }
                        output.Write("<option value=\"" + path + "\">" + str3 + "</option>");
                    }
                }
            }
            output.Write("</select>");
            output.Write("</td>");
            output.Write("<td valign=\"top\">");
            this.RenderButton(output, "Core/16x16/arrow_blue_up.png", "javascript:scContent.multilistMoveUp('" + this.ID + "')");
            output.Write("<br />");
            this.RenderButton(output, "Core/16x16/arrow_blue_down.png", "javascript:scContent.multilistMoveDown('" + this.ID + "')");
            output.Write("</td>");
            output.Write("</tr>");
            output.Write("<tr>");
            output.Write("<td valign=\"top\">");
            output.Write("<div style=\"border:1px solid #999999;font:8pt tahoma;padding:2px;margin:4px 0px 4px 0px;height:14px\" id=\"" + this.ID + "_all_help\"></div>");
            output.Write("</td>");
            output.Write("<td></td>");
            output.Write("<td valign=\"top\">");
            output.Write("<div style=\"border:1px solid #999999;font:8pt tahoma;padding:2px;margin:4px 0px 4px 0px;height:14px\" id=\"" + this.ID + "_selected_help\"></div>");
            output.Write("</td>");
            output.Write("<td></td>");
            output.Write("</tr>");
            output.Write("</table>");
        }
示例#12
0
        private void WriteParametersTemplate([NotNull] XmlTextWriter output, [NotNull] Item templateItem)
        {
            Debug.ArgumentNotNull(output, nameof(output));
            Debug.ArgumentNotNull(templateItem, nameof(templateItem));

            var template = TemplateManager.GetTemplate(templateItem.ID, templateItem.Database);

            foreach (var field in template.GetFields(true))
            {
                if (field.Template.BaseIDs.Length == 0)
                {
                    continue;
                }

                output.WriteStartElement("field");
                output.WriteAttributeString("name", field.Name);
                output.WriteAttributeString("type", field.Type);
                output.WriteAttributeString("category", field.Section.Name);
                output.WriteAttributeString("description", field.GetToolTip(Language.Current));

                var title = field.GetTitle(Language.Current);
                if (!string.IsNullOrEmpty(title))
                {
                    output.WriteAttributeString("displayname", title);
                }

                var bindingMode = BindingMode.ReadWrite;

                var source = new UrlString(field.Source);

                var bindMode = source.Parameters["bindmode"];
                if (!string.IsNullOrEmpty(bindMode))
                {
                    switch (bindMode.ToLowerInvariant())
                    {
                    case "readwrite":
                        bindingMode = BindingMode.ReadWrite;
                        break;

                    case "read":
                        bindingMode = BindingMode.Read;
                        break;

                    case "write":
                        bindingMode = BindingMode.Write;
                        break;

                    case "server":
                        bindingMode = BindingMode.Server;
                        break;

                    case "none":
                        bindingMode = BindingMode.None;
                        break;
                    }
                }

                output.WriteAttributeString("bindmode", bindingMode.ToString());

                var subtype = source.Parameters["subtype"];
                if (!string.IsNullOrEmpty(subtype))
                {
                    output.WriteAttributeString("subtype", subtype.ToLowerInvariant());
                }

                var editor = source.Parameters["editor"];
                if (!string.IsNullOrEmpty(editor))
                {
                    output.WriteAttributeString("editor", editor);
                }

                var valueLookup = string.Compare(field.Type, "valuelookup", StringComparison.InvariantCultureIgnoreCase) == 0 || string.Compare(field.Type, "droplist", StringComparison.InvariantCultureIgnoreCase) == 0;
                var lookup      = string.Compare(field.Type, "lookup", StringComparison.InvariantCultureIgnoreCase) == 0 || string.Compare(field.Type, "droplink", StringComparison.InvariantCultureIgnoreCase) == 0;

                if (valueLookup || lookup)
                {
                    var items = LookupSources.GetItems(templateItem.Database.GetRootItem(), field.Source);
                    if (items.Length > 0)
                    {
                        output.WriteStartElement("values");

                        foreach (var item in items)
                        {
                            output.WriteStartElement("value");
                            output.WriteAttributeString("displayname", item.Name);
                            output.WriteValue(valueLookup ? item.Name : item.ID.ToString());
                            output.WriteEndElement();
                        }

                        output.WriteEndElement();
                    }
                }

                output.WriteEndElement();
            }
        }
        protected override void DoRender(HtmlTextWriter output)
        {
            Assert.ArgumentNotNull((object)output, "output");
            Item current = Sitecore.Configuration.Factory.GetDatabase("master").GetItem(this.ItemID, Language.Parse(this.ItemLanguage));

            Item[] sources = (Item[])null;
            using (new LanguageSwitcher(this.ItemLanguage))
                sources = LookupSources.GetItems(current, this.Source);
            ArrayList   selected;
            IDictionary unselected;

            this.GetSelectedItems(sources, out selected, out unselected);
            this.ServerProperties["ID"] = (object)this.ID;
            string str1 = string.Empty;

            if (this.ReadOnly)
            {
                str1 = " disabled=\"disabled\"";
            }
            output.Write("<input id=\"" + this.ID + "_Value\" type=\"hidden\" value=\"" + StringUtil.EscapeQuote(this.Value) + "\" />");
            output.Write("<div class='scContentControlMultilistContainer'>");
            output.Write("<table" + this.GetControlAttributes() + ">");
            output.Write("<tr>");
            output.Write("<td class=\"scContentControlMultilistCaption\" width=\"50%\">" + Translate.Text("All") + "</td>");
            output.Write("<td width=\"20\">" + Images.GetSpacer(20, 1) + "</td>");
            output.Write("<td class=\"scContentControlMultilistCaption\" width=\"50%\">" + Translate.Text("Selected") + "</td>");
            output.Write("<td width=\"20\">" + Images.GetSpacer(20, 1) + "</td>");
            output.Write("</tr>");
            output.Write("<tr>");
            output.Write("<td valign=\"top\" height=\"100%\">");
            output.Write("<select id=\"" + this.ID + "_unselected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"10\"" + str1 + " ondblclick=\"javascript:scContent.multilistMoveRight('" + this.ID + "')\" onchange=\"javascript:document.getElementById('" + this.ID + "_all_help').innerHTML=this.selectedIndex>=0?this.options[this.selectedIndex].innerHTML:''\" >");
            foreach (DictionaryEntry dictionaryEntry in unselected)
            {
                var obj = dictionaryEntry.Value;
                output.Write("<option value=\"" + obj + "\">" + obj + "</option>");
            }
            output.Write("</select>");
            output.Write("</td>");
            output.Write("<td valign=\"top\">");
            this.RenderButton(output, "Office/16x16/navigate_right.png", "javascript:scContent.multilistMoveRight('" + this.ID + "')");
            output.Write("<br />");
            this.RenderButton(output, "Office/16x16/navigate_left.png", "javascript:scContent.multilistMoveLeft('" + this.ID + "')");
            output.Write("</td>");
            output.Write("<td valign=\"top\" height=\"100%\">");
            output.Write("<select id=\"" + this.ID + "_selected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"10\"" + str1 + " ondblclick=\"javascript:scContent.multilistMoveLeft('" + this.ID + "')\" onchange=\"javascript:document.getElementById('" + this.ID + "_selected_help').innerHTML=this.selectedIndex>=0?this.options[this.selectedIndex].innerHTML:''\">");
            for (int index = 0; index < selected.Count; ++index)
            {
                var obj1 = selected[index];
                if (obj1 != null)
                {
                    output.Write("<option value=\"" + obj1 + "\">" + obj1 + "</option>");
                }
                else
                {
                    string str3 = Translate.Text("[Item not found]");
                    output.Write("<option value=\"\">" + str3 + "</option>");
                }
            }
            output.Write("</select>");
            output.Write("</td>");
            output.Write("<td valign=\"top\">");
            this.RenderButton(output, "Office/16x16/navigate_up.png", "javascript:scContent.multilistMoveUp('" + this.ID + "')");
            output.Write("<br />");
            this.RenderButton(output, "Office/16x16/navigate_down.png", "javascript:scContent.multilistMoveDown('" + this.ID + "')");
            output.Write("</td>");
            output.Write("</tr>");
            output.Write("<tr>");
            output.Write("<td valign=\"top\">");
            output.Write("<div class=\"scContentControlMultilistHelp\" id=\"" + this.ID + "_all_help\"></div>");
            output.Write("</td>");
            output.Write("<td></td>");
            output.Write("<td valign=\"top\">");
            output.Write("<div class=\"scContentControlMultilistHelp\" id=\"" + this.ID + "_selected_help\"></div>");
            output.Write("</td>");
            output.Write("<td></td>");
            output.Write("</tr>");
            output.Write("</table>");
            output.Write("</div>");
        }
 protected virtual Item[] GetItems(Item current)
 {
     Assert.ArgumentNotNull(current, "current");
     return(LookupSources.GetItems(current, this.Source));
 }
示例#15
0
        /// <summary>
        /// Renders the control.
        /// </summary>
        /// <param name="output">The output.</param>
        protected override void DoRender(HtmlTextWriter output)
        {
            Assert.ArgumentNotNull(output, "output");
            var current = Sitecore.Context.ContentDatabase.GetItem(this.ItemId, Language.Parse(this.ItemLanguage));

            Item[] sources;
            using (new LanguageSwitcher(this.ItemLanguage))
            {
                sources = LookupSources.GetItems(current, this.Source);
            }

            ArrayList   selected;
            IDictionary unselected;

            this.GetSelectedItems(sources, out selected, out unselected);
            this.ServerProperties["ID"] = this.ID;

            output.Write("<input id=\"" + this.ID + "_Value\" type=\"hidden\" value=\"" + StringUtil.EscapeQuote(this.Value) + "\" />");
            output.Write("<div class='scContentControlMultilistContainer'>");

            output.Write("<div class=\"select-lebel\">Fast Sorting:</div>");
            var selectControl = string.Format(
                "<select id=\"{0}\" name=\"{1}\" type=\"text\"{2} value=\"{3}\" onchange=\"FastSorting('{4}')\">{5}</select>",
                this.ID + "_SortBy",
                this.ID + "_SortBy",
                "text",
                string.Empty,
                this.ID,
                this.InitializeSelect());

            output.Write(selectControl);

            output.Write("<table" + this.GetControlAttributes() + ">");
            output.Write("<tr><td class=\"scContentControlMultilistCaption\" >All</td><td class=\"scContentControlMultilistCaption\" >Selected</td></tr>");
            output.Write("<tr>");
            output.Write("<td>");

            output.Write("<ul id=\"" + this.ID + "_sortable1\" class=\"connectedSortable\" >");
            foreach (DictionaryEntry dictionaryEntry in unselected)
            {
                var obj = dictionaryEntry.Value as Item;
                if (obj != null)
                {
                    output.Write("<li class=\"ui-state-default\" value=\"" + this.FormatValue(obj) + "\">" + obj.DisplayName + "</li>");
                }
            }

            output.Write("</ul>");
            output.Write("</td>");
            output.Write("<td>");
            output.Write("<ul id=\"" + this.ID + "_sortable2\" class=\"connectedSortable\" >");
            foreach (object t in selected)
            {
                var obj1 = t as Item;
                if (obj1 != null)
                {
                    output.Write("<li class=\"ui-state-default\" value=\"" + this.FormatValue(obj1) + "\">" + obj1.DisplayName + "</li>");
                }
            }

            output.Write("</ul>");
            output.Write("</td>");
            output.Write("</tr>");
            output.Write("</table>");
            output.Write("</div>");

            var script  = "<script type=\"text/JavaScript\" language=\"javascript\"> jQuery( \"#[0]_sortable1, #[0]_sortable2\" ).sortable({connectWith: \".connectedSortable\" }).disableSelection(); </script>".Replace("[0]", this.ID);
            var script2 = "<script type=\"text/JavaScript\" language=\"javascript\"> jQuery('#[0]_sortable2').bind(\"DOMSubtreeModified\",function(){SetValue('[0]')}); </script>".Replace("[0]", this.ID);

            output.Write(script);
            output.Write(script2);
        }
示例#16
0
 internal virtual IEnumerable <Item> GetItems(Item item, string source)
 {
     return(LookupSources.GetItems(item, source));
 }