/// <summary> /// The command method when selecting a page /// </summary> private void PageSelected() { //convert the page name to the page enum SelectedPage = (ApplicationPage)Enum.Parse(typeof(ApplicationPage), PageName.Replace(" ", "")); //true if not already selected then go to the next page if (DI.Application.CurrentPage != SelectedPage) { DI.Application.GoToPage(SelectedPage); } }
public ConsoleResultModel Run() { TabController tc = new TabController(); List <PageModelBase> lst = new List <PageModelBase>(); List <PageModelBase> lstOut = new List <PageModelBase>(); if (ParentId.HasValue) { lst = GetPagesByParentId((int)ParentId); } else { TabCollection tabs = tc.GetTabsByPortal(PortalId); foreach (KeyValuePair <int, TabInfo> kvp in tabs) { lst.Add(new PageModelBase(kvp.Value)); } } // filter results if needed if (Deleted.HasValue) { var query = from page in lst where page.IsDeleted == Deleted select page; List <PageModelBase> filteredList = query.ToList(); lst = filteredList; } bool bSearchTitle = false; string searchTitle = null; bool bSearchName = false; string searchName = null; bool bSearchPath = false; string searchPath = null; bool bSearchSkin = false; string searchSkin = null; bool bMatchVisibility = PageVisible.HasValue; if (!string.IsNullOrEmpty(PageName)) { searchName = PageName.Replace("*", ".*"); bSearchName = true; } if (!string.IsNullOrEmpty(PageTitle)) { searchTitle = PageTitle.Replace("*", ".*"); bSearchTitle = true; } if (!string.IsNullOrEmpty(PagePath)) { searchPath = PagePath.Replace("*", ".*"); bSearchPath = true; } if (!string.IsNullOrEmpty(PageSkin)) { searchSkin = PageSkin.Replace("*", ".*"); bSearchSkin = true; } if (bSearchTitle || bSearchName || bSearchPath || bSearchSkin || bMatchVisibility) { bool bIsMatch = false; foreach (PageModelBase pim in lst) { bIsMatch = true; if (bSearchTitle) { bIsMatch = bIsMatch & Regex.IsMatch(pim.Title, searchTitle, RegexOptions.IgnoreCase); } if (bSearchName) { bIsMatch = bIsMatch & Regex.IsMatch(pim.Name, searchName, RegexOptions.IgnoreCase); } if (bSearchPath) { bIsMatch = bIsMatch & Regex.IsMatch(pim.Path, searchPath, RegexOptions.IgnoreCase); } if (bSearchSkin) { bIsMatch = bIsMatch & Regex.IsMatch(pim.Skin, searchSkin, RegexOptions.IgnoreCase); } if (bMatchVisibility) { bIsMatch = bIsMatch & (pim.IncludeInMenu == PageVisible); } if (bIsMatch) { lstOut.Add(pim); } } } else { lstOut = lst; } var msg = string.Format("{0} page{1} found", lstOut.Count, (lstOut.Count != 1 ? "s" : "")); return(new ConsoleResultModel(msg) { data = lstOut, fieldOrder = new string[] { "TabId", "ParentId", "Name", "Title", "Skin", "Path", "IncludeInMenu", "IsDeleted" } }); }
private string BuildSideMenuItem(int displayMode, MenuInfo objMenuInfo, string pageLink, string caption) { StringBuilder html = new StringBuilder(); string title = objMenuInfo.PageName; pageLink = pageLink.Replace("&", "-and-"); string image = appPath + "/PageImages/" + objMenuInfo.IconFile; string imageTag = objMenuInfo.IconFile != string.Empty ? "<img src=" + image + ">" : ""; string arrowStyle = objMenuInfo.ChildCount > 0 ? "<span class='sf-sub-indicator'></span>" : ""; string firstclass = string.Empty; string activeClass = objMenuInfo.PageName == PageName.Replace("-", " ") ? " sfActive" : ""; string isParent = objMenuInfo.ChildCount > 0 ? (objMenuInfo.Level == 1 ? "class='sfParent level1 " + activeClass + "'" : "class='sfParent " + activeClass + "'") : (objMenuInfo.Level == 1 ? "class='level1 " + activeClass + "'" : "class='" + activeClass + "'"); switch (displayMode) { case 0: //image only if (caption == "1") { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'><span class='sfPageicon'>"); html.Append(imageTag); html.Append("</span>"); html.Append(arrowStyle); html.Append("</a>"); } else { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'><span class='sfPageicon'>"); html.Append(imageTag); html.Append("</span>"); html.Append(arrowStyle); html.Append("</a>"); } break; case 1: //text only if (caption == "1") { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(title); html.Append("</span></a>"); } else { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(title.Replace("-", " ")); html.Append("</span></a>"); } break; case 2: //text and image both if (caption == "1") { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(title); html.Append("</span></a>"); } else { html.Append("<a "); html.Append(isParent); html.Append(" href='"); html.Append(pageLink); html.Append("'>"); html.Append(arrowStyle); html.Append("<span class='sfPagename'>"); html.Append(GetSideMenuPadding(objMenuInfo.Level)); html.Append(title.Replace("-", " ")); html.Append("</span></a>"); } break; } return(html.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { int index = Request.Url.AbsoluteUri.ToLower().IndexOf(PageName.Replace("members_", "").Substring(0, PageName.Replace("members_", "").Length - 5)); if (index != -1) { Application["BaseURI"] = Request.Url.AbsoluteUri.Substring(0, index); } int index2a = Request.Url.AbsoluteUri.ToLower().IndexOf("//"); if (Request.Url.AbsoluteUri.Length - index2a > 1) { index2a = Request.Url.AbsoluteUri.ToLower().IndexOf("/", index2a + 2); if (index2a > 1) { Application["BaseURI2"] = Request.Url.AbsoluteUri.Substring(0, index2a + 1); } } if (DDCommon.CommonRoutines.isNothing(Application["marre"])) { Application["marre"] = Application["BaseURI"]; } string baseURL = Request.Url.ToString(); int index2 = baseURL.IndexOf("//"); Application["BaseURIWithoutTrailingSlash"] = baseURL.Substring(0, baseURL.IndexOf("/", index2 + 2)); } catch { } if (svm.RecordUserHits) { if (svm.UserHostAddress == null) { List <DbParameter> dbParameters2 = new List <DbParameter>(); dbParameters2.Add(CommonClientSide.CommonMethods.buildStringParm( "UserSiteParm", Request.UserHostAddress, ParameterDirection.Input)); CommonClientSide.CommonMethods.executeNonQuery("usprecorduserhit", dbParameters2, Session.SessionID); //TODO: (1)Add UserName to this table. } } if (svm.RecordPageHits) { List <DbParameter> dbParameters = new List <DbParameter>(); dbParameters.Add(CommonClientSide.CommonMethods.buildStringParm( "PageNameParm", PageName, ParameterDirection.Input)); CommonClientSide.CommonMethods.executeNonQuery("usprecordpagehit", dbParameters, Session.SessionID); } string lastPushed = string.Empty; try { if (svm.PagesVisited.Count > 0) { lastPushed = svm.PagesVisited.Peek(); } } catch { } if (!lastPushed.Equals(Request.AppRelativeCurrentExecutionFilePath)) { svm.PagesVisited.Push(Request.AppRelativeCurrentExecutionFilePath); } svm.UserHostAddress = Request.UserHostAddress; svm.IsInitialCallToPage = false; child_Page_Load(sender, e); } }