Esempio n. 1
0
        /// <summary>
        /// Updates an existing folder.
        /// </summary>
        /// <param name="reader"></param>
        private void EditFolder(IDataReader reader)
        {
            FileTreeItem.UpdateFileItem(PageId, Name.Text, false, true, false, String.Empty, SiteId);

            // update folder access
            foreach (ListItem item in RolesList.Items)
            {
                if (item.Selected)
                {
                    using (IDataReader reader1 = FileTreeItem.PageAccessGetByRoleIdPageId(item.Value, PageId))
                    {
                        if (!reader1.Read())
                        {
                            FileTreeItem.AddPageAccess(item.Value, PageId);
                        }
                        reader1.Close();
                    }
                }
                else
                {
                    using (IDataReader reader2 = FileTreeItem.PageAccessGetByRoleIdPageId(item.Value, PageId))
                    {
                        if (reader2.Read())
                        {
                            FileTreeItem.DeletePageAccess((int)reader2["PageAccessId"]);
                        }
                        reader2.Close();
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates an existing page.
        /// </summary>
        /// <param name="reader"></param>
        private void EditPage(IDataReader reader)
        {
            string fileName      = MakePageName(Name.Text);
            bool   fileIsDefault = false;
            bool   fileIsPublic  = false;

            bool isFolder = (bool)reader["IsFolder"];

            if (isFolder)
            {
                return;
            }

            fileIsDefault = IsDefault.IsSelected;

            // clear old default in current folder
            if (fileIsDefault)
            {
                string outline = ((string)reader[_OutlineKey]).Substring(0, ((string)reader[_OutlineKey]).LastIndexOf('/') + 1);
                using (IDataReader reader2 = FileTreeItem.GetItemByOutline(outline, SiteId))
                {
                    while (reader2.Read())
                    {
                        FileTreeItem.UpdateFileItem((int)reader2[_PageIdKey], (string)reader2["Name"], (bool)reader2["IsPublic"], (bool)reader["IsFolder"], false, (string)reader2[reader2.FieldCount - 1] /*MasterPage*/, SiteId);
                    }
                    reader2.Close();
                }
            }

            // update page attributes
            FileTreeItem.UpdateFileItem(PageId, fileName, fileIsPublic, false, fileIsDefault, MasterPageText.Text, SiteId);
            PageAttributes.Update(PageId, txtTitle.Text, txtKeywords.Text, txtDescription.Text);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new folder.
        /// </summary>
        private void CreateFolder()
        {
            //create temporary folder with unique name
            string guid  = Guid.NewGuid().ToString();
            int    newId = FileTreeItem.AddFileItem(guid, true, true, false, String.Empty, SiteId);

            FileTreeItem.MoveTo(newId, Int32.Parse(Root.SelectedValue));
            FileTreeItem.UpdateFileItem(newId, Name.Text, true, true, false, String.Empty, SiteId);

            // update folder access
            foreach (ListItem item in RolesList.Items)
            {
                if (item.Selected)
                {
                    FileTreeItem.AddPageAccess(item.Value, newId);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new page.
        /// </summary>
        private void CreatePage()
        {
            int    newId       = 0;
            string newPageName = MakePageName(Name.Text);

            //create new page
            string guid = Guid.NewGuid().ToString();

            newId = FileTreeItem.AddFileItem(guid, true, false, false, MasterPageText.Text, SiteId);
            FileTreeItem.MoveTo(newId, int.Parse(Root.SelectedValue));
            FileTreeItem.UpdateFileItem(newId, newPageName, true, true, false, MasterPageText.Text, SiteId);

            //append meta description and keywords
            PageAttributes.Add(newId,
                               String.IsNullOrEmpty(txtTitle.Text) ? GlobalVariable.GetVariable(_GlobalVariableTitleKey, SiteId) : txtTitle.Text,
                               String.IsNullOrEmpty(txtKeywords.Text) ? GlobalVariable.GetVariable(_GlobalVariableMetaKeywordsKey, SiteId) : txtKeywords.Text,
                               String.IsNullOrEmpty(txtDescription.Text) ? GlobalVariable.GetVariable(_GlobalVariableMetaDescriptionKey, SiteId) : txtDescription.Text);
        }