/// <summary> /// The UpDown_Click server event handler on this page is /// used to move a portal module up or down on a tab's layout pane /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data. /// </param> /// <remarks> /// </remarks> //protected void UpDownClick(object sender, ImageClickEventArgs e) //{ // var cmd = ((ImageButton)sender).CommandName; // if (this.tabList.SelectedIndex > -1) // { // int delta; // // Determine the delta to apply in the order number for the module // // within the list. +3 moves down one item; -3 moves up one item // if (cmd == "down") // { // delta = 3; // } // else // { // delta = -3; // } // var t = this.PortalPages[this.tabList.SelectedIndex]; // t.Order += delta; // this.OrderPages(); // this.Response.Redirect( // HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, this.PageID, "selectedtabID=" + t.ID)); // } //} /// <summary> /// The OrderPages helper method is used to reset /// the display order for tabs within the portal /// </summary> /// <remarks> /// </remarks> private void OrderPages() { var i = 1; this.PortalPages.Sort(); foreach (var t in this.PortalPages) { // number the items 1, 3, 5, etc. to provide an empty order // number when moving items up and down in the list. t.Order = i; i += 2; // rewrite tab to database var tabs = new PagesDB(); // 12/16/2002 Start - Cory Isakson tabs.UpdatePageOrder(t.ID, t.Order); // 12/16/2002 End - Cory Isakson } // gbs: Invalidate cache, fix for bug RBM-220 CurrentCache.RemoveAll("_PageNavigationSettings_"); }
/// <summary> /// The DeleteBtn_Click server event handler is used to delete /// the selected tab from the portal /// </summary> protected void DeleteBtn_Click(object sender, ImageClickEventArgs e) { //base.OnDelete(); if (tabList.SelectedIndex > -1) { try { // must delete from database too PageItem t = ( PageItem )portalPages[tabList.SelectedIndex]; PagesDB tabs = new PagesDB(); tabs.DeletePage(t.ID); portalPages.RemoveAt(tabList.SelectedIndex); if (tabList.SelectedIndex > 0) { t = ( PageItem )portalPages[tabList.SelectedIndex - 1]; } OrderPages(); Response.Redirect(HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", PageID, "SelectedPageID=" + t.ID)); } catch (SqlException) { Controls.Add( new LiteralControl("<br><span class='Error'>" + General.GetString("TAB_DELETE_FAILED", "Failed to delete Page", this) + "<br>")); } } }
/// <summary> /// Gets sub pages of given page /// </summary> /// <param name="pageid">page id</param> /// <returns> return json</returns> public JsonResult GetSubPages(string pageid, bool isPane, string parentid) { List <JsTreeModel> pages = new List <JsTreeModel>(); if (!isPane) { List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, Convert.ToInt32(pageid)); int i = 0; pages = (from page in childPages orderby page.PageOrder select new JsTreeModel() { id = page.PageID.ToString(), text = page.PageName, position = (i++).ToString(), //page.PageOrder.ToString(), lastpos = (childPages.Count - 1).ToString(), nodeType = "page", type = "page" //icon = "http://jstree.com/tree.png" }).ToList(); //pages.Where(pg => pg.lastpos == i.ToString()); } // Get panes and modules //if (isPane) //{ // GetPanes(parentid, pages, isPane, pageid); //} //else //{ // if (pageid != "0") // GetPanes(pageid, pages, isPane, string.Empty); //} return(Json(pages, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Add Update friendly url /// </summary> /// <param name="daynamicPageId">page id</param> /// <param name="friendlyurl">friendly url</param> private void AddUpdateDaynamicPagesFriendlyUrl(int daynamicPageId, string redirectToUrl, string friendlyurl) { PagesDB pages = new PagesDB(); divValidationErrorMessage.Visible = false; divErrorMessage.Visible = false; divSuccessMessage.Visible = false; if ((!redirectToUrl.StartsWith("/") && !redirectToUrl.StartsWith("http://") && !redirectToUrl.StartsWith("https://")) || (!friendlyurl.StartsWith("/") && !friendlyurl.StartsWith("http://") && !friendlyurl.StartsWith("https://")) ) { divValidationErrorMessage.Visible = true; } else { //when friendlyURL saved, Set result as (0/1) //change this method for rb_Pages_DynamicRedirects Table. string result = pages.UpdateFriendlyURL(redirectToUrl, friendlyurl, daynamicPageId); //If result get 0 then error message will display divErrorMessage.Visible = (result == "0"); //If result get 1 then success message will display divSuccessMessage.Visible = (result != "0"); //remove from cache SqlUrlBuilderProvider.ClearCachePageUrl(daynamicPageId); UrlBuilderHelper.ClearUrlElements(daynamicPageId); } }
private void BindData() { PagesDB pages = new PagesDB(); this.rptPages.DataSource = pages.GetPagesByModule(Convert.ToInt32(this.ddlModules.SelectedValue)); this.rptPages.DataBind(); }
/// <summary> /// The SavePageData helper method is used to persist the /// current tab settings to the database. /// </summary> /// <returns></returns> private int SavePageData() { // Construct Authorized User Roles string string authorizedRoles = ""; foreach (ListItem item in authRoles.Items) { if (item.Selected == true) { authorizedRoles = authorizedRoles + item.Text + ";"; } } // Add Page info in the database int NewPageID = new PagesDB().AddPage(this.PortalSettings.PortalID, Int32.Parse(parentPage.SelectedItem.Value), tabName.Text, 990000, authorizedRoles, showMobile.Checked, mobilePageName.Text); //Clear SiteMaps Cache AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches(); // Update custom settings in the database EditTable.UpdateControls(); return(NewPageID); }
/// <summary> /// Add Update friendly url /// </summary> /// <param name="pageId">page id</param> /// <param name="friendlyurl">friendly url</param> private void AddUpdateFriendlyUrl(int pageId, string friendlyurl, int dynamicPageId, bool addExtension = true) { PagesDB pages = new PagesDB(); string result = string.Empty; if (drpPageList.SelectedValue == "-1") { if (addExtension) { result = pages.CreateFriendlyURL(txtDyanmicPage.Text, (txtFriendlyURL.Text.StartsWith("/") ? txtFriendlyURL.Text : "/" + txtFriendlyURL.Text) + lblFriendlyExtension.Text, dynamicPageId); } else { result = pages.CreateFriendlyURL(txtDyanmicPage.Text, (txtFriendlyURL.Text.StartsWith("/") ? txtFriendlyURL.Text : "/" + txtFriendlyURL.Text), dynamicPageId); } } else { //when friendlyURL saved, Set result as (0/1) result = pages.UpdateFriendlyURL(pageId, friendlyurl); } //If result get 0 then error message will display divErrorMessage.Visible = (result == "0"); //If result get 1 then success message will display divSuccessMessage.Visible = (result != "0"); //remove from cache SqlUrlBuilderProvider.ClearCachePageUrl(pageId); UrlBuilderHelper.ClearUrlElements(pageId); }
/// <summary> /// Get PageFriendlyURL by PageID /// If exist then return otherwise emplty /// </summary> /// <param name="pageID">PageID</param> /// <returns>FriendlyURL</returns> private static string GetFriendlyURlbyPageID(int pageID) { PagesDB pages = new PagesDB(); //Get FriendlyURL from DB by pageid return(pages.GetFriendlyURl(pageID)); }
/// <summary> /// Set pages to dropdown list /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { PagesDB pgdb = new PagesDB(); // Get all pages pages = pgdb.GetPagesFlat(this.PortalSettings.PortalID); if (!IsPostBack) { btnSaveWithoutExtension.Visible = false; drpPageList.DataTextField = "Name"; drpPageList.DataValueField = "ID"; //Set it dropdown list drpPageList.DataSource = pages; drpPageList.DataBind(); divDyanamicPage.Visible = false; drpPageList.Items.Add(new ListItem() { Text = "Dynamic Page", Value = "-1" }); //div for messages will be false when page is loaded divErrorMessage.Visible = false; divSuccessMessage.Visible = false; // Set the page extension from web.config file to display lblFriendlyExtension.Text = System.Configuration.ConfigurationManager.AppSettings["FriendlyUrlExtension"].ToString(); LoadGrid(); } }
public JsonResult GetTreeData() { List <PageItem> pages = new PagesDB().GetPagesFlat(this.PortalSettings.PortalID); List <JsTreeModel> lstTree = new List <JsTreeModel>(); foreach (PageItem page in pages) { if (page.NestLevel == 0) { //JsTreeModel[] child = getChildrenTree(page); JsTreeModel node = new JsTreeModel { data = page.Name, attr = new JsTreeAttribute { id = "pjson_" + page.ID.ToString() }, //children = child, state = "closed" }; lstTree.Add(node); } } int root = 0; JsTreeModel rootNode = new JsTreeModel { data = "Root", attr = new JsTreeAttribute { id = "pjson_" + root.ToString(), rel = "root" }, children = lstTree.ToArray <JsTreeModel>(), }; return(Json(rootNode)); }
/// <summary> /// The BindData helper method is used to update the tab's /// layout panes with the current configuration information /// </summary> private void BindData() { // Populate the "ParentTab" Data DataTable dt_Pages = new PagesDB().GetPagesFlatTable(portalSettings.PortalID); DataColumn[] keys = new DataColumn[2]; keys[0] = dt_Pages.Columns["PageID"]; dt_Pages.PrimaryKey = keys; parentTabDropDown.DataSource = dt_Pages; //parentTabDropDown.DataValueField = "PageID"; //parentTabDropDown.DataTextField = "PageOrder"; parentTabDropDown.DataBind(); parentTabDropDown.Items.Insert(1, "Root"); //dt_Pages = null; // Preselects current tab as parent // Changes for Grischa Brockhaus copied by Mike Stone 7/1/2005 if (parentTabDropDown.SelectedIndex <= 0) { int currentTab = portalSettings.ActivePage.PageID; parentTabDropDown.SelectedValue = (currentTab.ToString()); } // parentTabDropDown.Items.FindByValue(currentTab .ToString()).Selected = true; // Translate //parentTabDropDown.Item(0).Text =General.GetString("ROOT_LEVEL", "Root Level", parentTabDropDown); }
public JsTreeModel[] getChildrenTree(PageItem page) { List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, page.ID); int count = 0; List <JsTreeModel> lstTree = new List <JsTreeModel>(); foreach (PageStripDetails childPage in childPages) { if (PortalSecurity.IsInRole("Admins") || (!PortalSecurity.IsInRole("Admins") && (childPage.PageID != 100 || childPage.ParentPageID == 100))) { PageItem aux = new PageItem(); aux.ID = childPage.PageID; aux.Name = childPage.PageName; //JsTreeModel[] childs = getChildrenTree(aux); JsTreeModel node = new JsTreeModel { data = aux.Name, attr = new JsTreeAttribute { id = "pjson_" + aux.ID.ToString() }, //children = childs, }; lstTree.Add(node); count++; } } JsTreeModel[] tree = lstTree.ToArray <JsTreeModel>(); return(tree); }
public JsonResult CutCopyPage(int pageId, string name, int parentId, bool isCopy) { if ((UserProfile.isCurrentUserAdmin) || UserProfile.CurrentUser.HasPermission(AccessPermissions.PAGE_CREATION)) { PagesDB db = new PagesDB(); if (isCopy) { IPortalTemplateServices services = PortalTemplateFactory.GetPortalTemplateServices(new PortalTemplateRepository()); int newpageid = services.CopyPage(pageId, name + "- Copy"); db.UpdatePageParent(newpageid, parentId, this.PortalSettings.PortalID); return(Json(new { pageId = newpageid })); } else { db.UpdatePageParent(pageId, parentId, this.PortalSettings.PortalID); return(Json(new { pageId = pageId })); } } else { string errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to cut page", this); if (isCopy) { errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to copy page", this); } return(Json(new { error = true, errorMess = errorMessage })); } }
public JsTreeModel[] getChildrenTree(PageItem page) { List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, page.ID); int count = 0; List <JsTreeModel> lstTree = new List <JsTreeModel>(); foreach (PageStripDetails childPage in childPages) { PageItem aux = new PageItem(); aux.ID = childPage.PageID; aux.Name = childPage.PageName; //JsTreeModel[] childs = getChildrenTree(aux); JsTreeModel node = new JsTreeModel { data = aux.Name, attr = new JsTreeAttribute { id = "pjson_" + aux.ID.ToString() }, //children = childs, state = "closed" }; lstTree.Add(node); count++; } JsTreeModel[] tree = lstTree.ToArray <JsTreeModel>(); return(tree); }
public JsonResult GetTreeModule(string result, int pageId) { List <PageItem> pages = new PagesDB().GetPagesFlat(this.PortalSettings.PortalID); var page = pages.First(p => p.ID == pageId); JsTreeModel[] child = getChildrenTree(page); List <JsTreeModel> child2 = new List <JsTreeModel>(); var panelist = result.Split('+').ToList(); var panetopage = ModelServices.GetPageModules(pageId); var lowerpane = panelist.ConvertAll(d => d.ToLower()); var i = 0; foreach (var pane in panelist) { JsTreeModel[] childm = getModuleToPane(pane, pageId); JsTreeModel nodem = new JsTreeModel { text = pane, id = i.ToString(), data = pane, attr = new JsTreeAttribute { id = "pjson_pane_" + i, rel = "folder" }, //children2 = childm }; child2.Add(nodem); i++; } // add other pane. foreach (var pane in panetopage) { if (!lowerpane.Contains(pane.Key)) { JsTreeModel[] childm = getModuleToPane(pane.Key, pageId); JsTreeModel nodem = new JsTreeModel { text = pane.Key, id = i.ToString(), data = pane.Key + " [Not present in current layout]", attr = new JsTreeAttribute { id = "pjson_pane_" + i, rel = "folder2" }, //children2 = childm }; child2.Add(nodem); i++; } panelist.Add(pane.Key); } var childlist = child.ToList(); foreach (var childmod in child2) { childlist.Add(childmod); } child = childlist.ToArray <JsTreeModel>(); return(Json(child)); }
/// <summary> /// Load grid /// </summary> private void LoadGrid() { PagesDB pgdb = new PagesDB(); // Load pages into grid this.gdPages.DataSource = pgdb.GetFriendlyURlPages(); this.gdPages.DataBind(); //Load Dynamic Pages into Grid this.gdDynamicPages.DataSource = pgdb.GetFriendlyURlFromDynamicPages(); this.gdDynamicPages.DataBind(); }
/// <summary> /// Get pageId from pagename /// </summary> /// <returns>PageID</returns> public static string GetPageIDFromPageName(string pagepath) { PagesDB DB = new PagesDB(); var settings = PortalSettings.GetPortalSettingsbyPageID(Portal.PageID, Config.DefaultPortal); int portalID = 0; if (settings != null) { portalID = settings.PortalID; } DataTable dtPages = DB.GetPagesFlatTable(portalID); //When friendly URl applied and go to Home page from and sub pages if (pagepath.ToLower().Contains("default.aspx")) { string page_ID = "1"; return(page_ID); } // Check requested page url contains the /site when friendly URL is on var handlerFlag = System.Configuration.ConfigurationManager.AppSettings["handlerFlag"]; if (pagepath.Contains("/" + handlerFlag)) { string[] splitpaths = pagepath.Split('/'); int index = Array.IndexOf(splitpaths, handlerFlag); int requesetedPageId = Convert.ToInt32(splitpaths[index + 1]); pagepath = HttpUrlBuilder.BuildUrl(requesetedPageId); } foreach (DataRow pageRow in dtPages.Rows) { int pageId = Convert.ToInt32(pageRow["PageID"]); string url = HttpUrlBuilder.BuildUrl(pageId); if (url.ToLower() == pagepath.ToLower()) { return(pageId.ToString()); } } string dynamicPage = DB.GetDynamicPageUrl(pagepath); if (!string.IsNullOrEmpty(dynamicPage)) { //-1 for dynamic pages return("-1"); } // if page is not found it will throw 404 error throw new HttpException(404, "Page not Found", 3); }
public JsonResult moveNode(int pageID, int newParent, int idOldNode, int selectedposition) { //Cache clearing Appleseed.Framework.Web.SqlUrlBuilderProvider.ClearCachePageUrl(pageID); Appleseed.Framework.Web.UrlBuilderHelper.ClearUrlElements(pageID); CurrentCache.RemoveAll("_PageNavigationSettings_"); PortalSettings.RemovePortalSettingsCache(pageID, PortalSettings.PortalAlias); Appleseed.Framework.Providers.AppleseedSiteMapProvider.AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches(); PortalSettings.UpdatePortalSettingParentPageCache(newParent, pageID); if (UserProfile.isCurrentUserAdmin || UserProfile.CurrentUser.HasPermission(AccessPermissions.PAGE_EDITING)) { PagesDB db = new PagesDB(); this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID); db.UpdatePageParent(Convert.ToInt32(pageID), Convert.ToInt32(newParent), this.PortalSettings.PortalID); int order; if (Convert.ToInt32(idOldNode) == -1) { order = 9999; } else { List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, newParent).Where(pg => pg.PageID != pageID).ToList(); if (childPages.Count == 0) { order = 0; } else { if (selectedposition < childPages.Count) { order = childPages[selectedposition].PageOrder - 1; } else { order = childPages[childPages.Count - 1].PageOrder + 1; } } } db.UpdatePageOrder(Convert.ToInt32(pageID), order); this.OrderPages(); return(Json("")); } else { this.OrderPages(); string errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to move page", this); return(Json(new { error = true, errorMess = errorMessage })); } }
private int getPageOrder(int idToSearch) { List <PageItem> pages = new PagesDB().GetPagesFlat(this.PortalSettings.PortalID); while (pages.Count > 0) { PageItem page = pages.First <PageItem>(); pages.Remove(page); if (page.ID == idToSearch) { return(page.Order); } } return(-1); }
public JsonResult remove(int id) { try { var tabs = new PagesDB(); tabs.DeletePage(id); return(Json(new { error = false })); } catch (SqlException) { string errorMessage = General.GetString("TAB_DELETE_FAILED", "Failed to delete Page", this); return(Json(new { error = true, errorMess = errorMessage })); } }
/// <summary> /// The BindData helper method is used to update the tab's /// layout panes with the current configuration information /// </summary> private void BindData() { // Populate the "ParentTab" Data DataTable dt_Pages = new PagesDB().GetPagesFlatTable(this.PortalSettings.PortalID); DataColumn[] keys = new DataColumn[2]; keys[0] = dt_Pages.Columns["PageID"]; dt_Pages.PrimaryKey = keys; parentTabDropDown.DataSource = dt_Pages; parentTabDropDown.DataValueField = "PageID"; parentTabDropDown.DataTextField = "PageOrder1"; parentTabDropDown.DataBind(); parentTabDropDown.Items.Insert(0, new ListItem(General.GetString("ROOT_LEVEL", "Root Level"), "0")); }
/// <summary> /// The AddPage_Click server event handler is used /// to add a new tab for this portal /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="T:System.EventArgs"/> instance containing the event data. /// </param> /// <remarks> /// </remarks> protected void AddPageClick(object sender, EventArgs e) { if (this.Settings["TAB_VERSION"] == null) { return; } if (this.Settings["TAB_VERSION"].ToString().ToLowerInvariant() == "true") { // Use Old Version // New tabs go to the end of the list var t = new PageItem { // Just in case it comes to be empty Name = General.GetString("TAB_NAME", "New Page Name"), ID = -1, Order = 990000 }; this.PortalPages.Add(t); // write tab to database var tabs = new PagesDB(); t.ID = tabs.AddPage(this.PortalSettings.PortalID, t.Name, t.Order); // Reset the order numbers for the tabs within the list this.OrderPages(); // Clear SiteMaps Cache AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches(); // Redirect to edit page // 3_aug_2004 Cory Isakson added returntabid so that PageLayout could return to the tab it was called from. // added mID by Mario Endara <*****@*****.**> to support security check (2004/11/09) this.Response.Redirect( HttpUrlBuilder.BuildUrl( "~/DesktopModules/CoreModules/Pages/PageLayout.aspx", t.ID, "mID=" + this.ModuleID + "&returntabid=" + this.Page.PageID)); } else { // Redirect to New Form - Mike Stone 19/12/2004 this.Response.Redirect( HttpUrlBuilder.BuildUrl( "~/DesktopModules/CoreModules/Pages/AddPage.aspx", "mID=" + this.ModuleID + "&returntabid=" + this.Page.PageID)); } }
/// <summary> /// The SavePageData helper method is used to persist the /// current tab settings to the database. /// </summary> /// <remarks> /// </remarks> private void SavePageData() { // Construct Authorized User Roles string var authorizedRoles = string.Empty; foreach (ListItem item in this.authRoles.Items) { if (item.Selected) { authorizedRoles = authorizedRoles + item.Text + ";"; } } var pageDB = new PagesDB(); if (!string.IsNullOrEmpty(this.friendlyUrl.Text) && pageDB.IsAlreadyExistsFriendlyUrl(this.friendlyUrl.Text, this.PageID)) { throw new Exception("FriendlyUrlIsAlreadyExists"); } else { // update Page info in the database pageDB.UpdatePage( this.PortalSettings.PortalID, this.PageID, Int32.Parse(this.parentPage.SelectedItem.Value), this.tabName.Text, this.PortalSettings.ActivePage.PageOrder, authorizedRoles, this.mobilePageName.Text, this.showMobile.Checked, this.friendlyUrl.Text); List <UserPagePermission> upPerms = new List <UserPagePermission>(); foreach (GridViewRow gdvRow in gdvUsersAuth.Rows) { upPerms.Add(new UserPagePermission() { PageId = this.PageID, UserId = Guid.Parse(((HiddenField)gdvRow.FindControl("hidUserId")).Value), Permission = Convert.ToInt16(((DropDownList)gdvRow.FindControl("ddlUserAuthPermission")).SelectedValue) }); } UserPagePermissionDB uppDB = new UserPagePermissionDB(); uppDB.UpdatePagePermissions(upPerms, this.PageID); // Update custom settings in the database this.EditTable.UpdateControls(); } }
/// <summary> /// The BindData helper method is used to update the tab's /// layout panes with the current configuration information /// </summary> private void BindData() { PageSettings tab = this.PortalSettings.ActivePage; // Populate Page Names, etc. tabName.Text = "New Page"; mobilePageName.Text = ""; showMobile.Checked = false; // Populate the "ParentPage" Data PagesDB t = new PagesDB(); IList <PageItem> items = t.GetPagesParent(this.PortalSettings.PortalID, PageID); parentPage.DataSource = items; parentPage.DataBind(); // Translate if (parentPage.Items.FindByText(" ROOT_LEVEL") != null) { parentPage.Items.FindByText(" ROOT_LEVEL").Text = General.GetString("ROOT_LEVEL", "Root Level", parentPage); } // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this tab UsersDB users = new UsersDB(); IList <AppleseedRole> roles = users.GetPortalRoles(this.PortalSettings.PortalAlias); // Clear existing items in checkboxlist authRoles.Items.Clear(); foreach (AppleseedRole role in roles) { ListItem item = new ListItem(); item.Text = role.Name; item.Value = role.Id.ToString(); if ((tab.AuthorizedRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authRoles.Items.Add(item); } }
/// <summary> /// Add Update friendly url /// </summary> /// <param name="daynamicPageId">page id</param> /// <param name="friendlyurl">friendly url</param> private void AddUpdateDaynamicPagesFriendlyUrl(int daynamicPageId, string redirectToUrl, string friendlyurl) { PagesDB pages = new PagesDB(); //when friendlyURL saved, Set result as (0/1) //change this method for rb_Pages_DynamicRedirects Table. string result = pages.UpdateFriendlyURL(redirectToUrl, friendlyurl, daynamicPageId); //If result get 0 then error message will display divErrorMessage.Visible = (result == "0"); //If result get 1 then success message will display divSuccessMessage.Visible = (result != "0"); //remove from cache SqlUrlBuilderProvider.ClearCachePageUrl(daynamicPageId); UrlBuilderHelper.ClearUrlElements(daynamicPageId); }
/// <summary> /// Get the friendlyURL by selecting the page /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void drpPageList_SelectedIndexChanged(object sender, EventArgs e) { divErrorMessage.Visible = false; divSuccessMessage.Visible = false; divDyanamicPage.Visible = (drpPageList.SelectedValue == "-1"); if (drpPageList.SelectedValue != "-1") { btnSaveWithoutExtension.Visible = false; PagesDB pages = new PagesDB(); // Get and Set friendlyURL from db to Textbox when change the dropdown value txtFriendlyURL.Text = pages.GetFriendlyURl(Convert.ToInt32(drpPageList.SelectedValue)); } else { btnSaveWithoutExtension.Visible = true; } }
public JsonResult GetTreeData() { List <PageItem> pages = new PagesDB().GetPagesFlat(this.PortalSettings.PortalID); List <JsTreeModel> lstTree = new List <JsTreeModel>(); foreach (PageItem page in pages) { if (page.NestLevel == 0) { //JsTreeModel[] child = getChildrenTree(page); JsTreeModel node = new JsTreeModel { text = page.Name, id = page.ID.ToString(), data = page.Name, attr = new JsTreeAttribute { id = "pjson_" + page.ID.ToString() }, //children = child, }; List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, page.ID); if (childPages.Count > 0) { //node.children } lstTree.Add(node); } } int root = 0; JsTreeModel rootNode = new JsTreeModel { text = "Root", id = root.ToString(), data = "Root", attr = new JsTreeAttribute { id = "pjson_" + root.ToString(), rel = "root" }, // children = lstTree.ToArray<JsTreeModel>() }; return(Json(rootNode)); }
/// <summary> /// Handles OnDelete /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void OnDelete(EventArgs e) { base.OnDelete(e); if (this._moduleID > 0) { ModulesDB modules = new ModulesDB(); // TODO add userEmail and useRecycler modules.DeleteModule(_moduleID); _moduleID = 0; } if (this._pageID > 0) { var tabs = new PagesDB(); tabs.DeletePage(this._pageID); } RedirectBackToReferringPage(); }
/// <summary> /// Set pages to dropdown list /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { PagesDB pgdb = new PagesDB(); // Get all pages pages = pgdb.GetPagesFlat(this.PortalSettings.PortalID); if (!IsPostBack) { btnSaveWithoutExtension.Visible = false; drpPageList.DataTextField = "Name"; drpPageList.DataValueField = "ID"; //Set it dropdown list drpPageList.DataSource = pages; drpPageList.DataBind(); divDyanamicPage.Visible = false; for (int i = 0; i < drpPageList.Items.Count; i++) { if (drpPageList.Items[i].Value == "345") { drpPageList.Items.Insert(i + 1, new ListItem() { Text = "---Secondary Short URL", Value = "-1" }); break; } } //div for messages will be false when page is loaded divErrorMessage.Visible = false; divSuccessMessage.Visible = false; // Set the page extension from web.config file to display lblFriendlyExtension.Text = System.Configuration.ConfigurationManager.AppSettings["FriendlyUrlExtension"]; LoadGrid(); } }
public void moveNode(int pageID, int newParent, int idOldNode) { PagesDB db = new PagesDB(); this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID); db.UpdatePageParent(pageID, newParent, this.PortalSettings.PortalID); int order; if (idOldNode == -1) { order = 9999; } else { order = this.getPageOrder(idOldNode) - 1; } db.UpdatePageOrder(pageID, order); this.OrderPages(); }