Ejemplo n.º 1
0
        private void BindTree()
        {
            var ctlLists    = new ListController();
            var colLists    = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID);
            var indexLookup = new Hashtable();

            listTree.Nodes.Clear();

            foreach (ListInfo list in colLists)
            {
                String filteredNode;
                if (list.DisplayName.Contains(":"))
                {
                    var finalPeriod = list.DisplayName.LastIndexOf(".", StringComparison.InvariantCulture);
                    filteredNode = list.DisplayName.Substring(finalPeriod + 1);
                }
                else
                {
                    filteredNode = list.DisplayName;
                }
                var node = new DnnTreeNode {
                    Text = filteredNode
                };
                {
                    node.Value    = list.Key;
                    node.ToolTip  = String.Format(LocalizeString("NoEntries"), list.EntryCount);
                    node.ImageUrl = IconController.IconURL("Folder");
                }
                if (list.Level == 0)
                {
                    listTree.Nodes.Add(node);
                }
                else
                {
                    if (indexLookup[list.ParentList] != null)
                    {
                        var parentNode = (DnnTreeNode)indexLookup[list.ParentList];

                        parentNode.Nodes.Add(node);
                    }
                }

                //Add index key here to find it later, should suggest with Joe to add it to DNNTree
                if (indexLookup[list.Key] == null)
                {
                    indexLookup.Add(list.Key, node);
                }
            }
        }
Ejemplo n.º 2
0
        public void LoadLists()
        {
            var listController = new ListController();

            foreach (ListInfo objList in listController.GetListInfoCollection())
            {
                if (!objList.SystemList)
                {
                    // for some reason, the "DataType" is not marked as a system list, but we want to exclude that one too
                    if (objList.DisplayName != "DataType")
                    {
                        cboCategoriesList.Items.Add(new ListItem(objList.DisplayName, objList.DisplayName));
                    }
                }
            }

            if (cboCategoriesList.Items.Count == 0)
            {
                lstNoListsAvailable.Text    = Localization.GetString("msgNoListsAvailable.Text", LocalResourceFile);
                lstNoListsAvailable.Visible = true;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Loads top level entry list
        /// </summary>
        private void BindListInfo()
        {
            lblListName.Text           = ListName;
            lblListParent.Text         = ParentKey;
            rowListParent.Visible      = (!string.IsNullOrEmpty(ParentKey));
            chkEnableSortOrder.Checked = EnableSortOrder;
            if (!SystemList && ShowDelete)
            {
                cmdDeleteList.Visible = true;
                ClientAPI.AddButtonConfirm(cmdDeleteList, Localization.GetString("DeleteItem"));
            }
            else
            {
                cmdDeleteList.Visible = false;
            }
            switch (Mode)
            {
            case "ListEntries":
                EnableView(true);
                break;

            case "EditEntry":
                EnableView(false);
                EnableEdit(false);
                break;

            case "AddEntry":
                EnableView(false);
                EnableEdit(false);
                if (SelectedList != null)
                {
                    txtParentKey.Text = SelectedList.ParentKey;
                }
                else
                {
                    rowEnableSortOrder.Visible = true;
                }
                txtEntryName.Text        = ListName;
                rowListName.Visible      = false;
                txtEntryValue.Text       = "";
                txtEntryText.Text        = "";
                cmdSaveEntry.CommandName = "SaveEntry";
                break;

            case "AddList":
                EnableView(false);
                EnableEdit(true);

                rowListName.Visible      = true;
                txtParentKey.Text        = "";
                txtEntryName.Text        = "";
                txtEntryValue.Text       = "";
                txtEntryText.Text        = "";
                txtEntryName.ReadOnly    = false;
                cmdSaveEntry.CommandName = "SaveList";

                var ctlLists = new ListController();

                ddlSelectList.Enabled        = true;
                ddlSelectList.DataSource     = ctlLists.GetListInfoCollection(string.Empty, string.Empty, PortalSettings.ActiveTab.PortalID);
                ddlSelectList.DataTextField  = "DisplayName";
                ddlSelectList.DataValueField = "Key";
                ddlSelectList.DataBind();
                //ddlSelectList.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), ""));
                ddlSelectList.InsertItem(0, Localization.GetString("None_Specified"), "");

                //Reset dropdownlist
                ddlSelectParent.ClearSelection();
                ddlSelectParent.Enabled = false;

                break;
            }
        }