示例#1
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        private void LoadDataAndDataBind()
        {
            DataTable  files  = FileTreeItem.LoadItemByFolderIdDT(FolderId);
            DataColumn column = new DataColumn("CheckboxEnabled", typeof(System.Boolean));

            files.Columns.Add(column);
            files.Columns.Add(new DataColumn("ImageUrl", typeof(string)));
            using (IDataReader reader = FileTreeItem.LoadParent(FolderId))
            {
                if (reader.Read())
                {
                    DataRow row = files.NewRow();
                    row["CheckboxEnabled"] = false;
                    row["PageId"]          = (int)reader["PageId"];
                    row["Name"]            = "[..]";
                    row["IsDefault"]       = false;
                    row["IsPublic"]        = true;
                    row["IsFolder"]        = true;
                    row["Order"]           = -1000000;
                    row["SiteId"]          = SiteId;
                    row["ImageUrl"]        = Page.ResolveUrl("~/Apps/Content/images/Up One Level.png");
                    files.Rows.InsertAt(row, 0);
                }
                reader.Close();
            }

            DataView view = new DataView(files);

            view.Sort = "IsFolder DESC, Order";

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("PageId", "SiteId", "IsFolder");
            MyListView.DataSource = view;
            DataBind();
        }
示例#2
0
        /// <summary>
        /// Checks if entered name unique.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
        public void NameCheck(object sender, ServerValidateEventArgs args)
        {
            bool pageExists = false;
            int  idToCheck  = 0;

            if (PageId > 0)
            {
                using (IDataReader reader = FileTreeItem.GetItemById(PageId))
                {
                    if (reader.Read())
                    {
                        pageExists = true;

                        // get parent id
                        using (IDataReader parentReader = FileTreeItem.LoadParent(PageId))
                        {
                            if (parentReader.Read())
                            {
                                idToCheck = (int)parentReader[_PageIdKey];
                            }
                            parentReader.Close();
                        }
                    }
                    reader.Close();
                }
            }

            if (!pageExists)
            {
                idToCheck = Int32.Parse(Root.SelectedValue);
            }

            // check if page exists
            string newPageName = MakePageName(Name.Text);

            if (PageExists(idToCheck, newPageName))
            {
                args.IsValid = false;
                return;
            }

            args.IsValid = true;
        }
示例#3
0
        /// <summary>
        /// Binds the tool bar.
        /// </summary>
        private void BindToolBar()
        {
            int folderId = 0;

            using (IDataReader reader = FileTreeItem.LoadParent(CMSContext.Current.PageId))
            {
                if (reader.Read())
                {
                    folderId = reader.GetInt32(0);
                }

                reader.Close();
            }

            if (CanEdit)
            {
                Tabs.Tabs[1].Visible = true;
            }
            else
            {
                Tabs.Tabs[1].Visible = false;
            }

            if (CanAdmin)
            {
                string adminUrl = GlobalVariable.GetVariable("cm_url", CMSContext.Current.SiteId);
                if (!String.IsNullOrEmpty(adminUrl))
                {
                    string url = String.Format("{0}/default.aspx?_a=Content&_v=Folder-List&folderid={1}&siteid={2}", adminUrl, folderId.ToString(), CMSContext.Current.SiteId);//, //Membership.GetUser(Page.User.Identity.Name).ProviderUserKey.ToString());
                    Tabs.Tabs[2].NavigateUrl = url;
                }
                else
                {
                    Tabs.Tabs[2].Visible = false;
                }
            }
            else
            {
                Tabs.Tabs[2].Visible = false;
            }
        }