/// <summary> /// obtm a informao das seces e constroi os objectos que /// representam a sua informao no menu (SectionMenuLink) /// </summary> /// <returns>o contentor com os objectos menuLink que representam a /// a informao das seces</returns> private ArrayList calculateMotherSections() { ArrayList sectionsCollection = ((SectionCollection)SectionUtility.getAllSections()).getOrderedSections(); ArrayList menuSection = new ArrayList(); int menuLevel = getMenuLevel(); foreach (SectionInfo sectionInfo in sectionsCollection) { if (!sectionInfo.isVisible) { continue; } if (sectionInfo.sectionName.CompareTo("Admin") == 0) { if (!checkRole("admin")) { continue; } } if (sectionInfo.sectionParentId <= menuLevel) { SectionMenuLink link = new SectionMenuLink(sectionInfo.sectionName, sectionInfo.sectionPath); menuSection.Add(link); } } return(menuSection); }
private ArrayList getOrderedSections() { lock (sync) { ArrayList orderedSections = (ArrayList)Context.Cache["SubSectionsMenu"]; if (orderedSections == null) { orderedSections = ((SectionCollection)SectionUtility.getAllSections()).getOrderedSections(); Context.Cache["SubSectionsMenu"] = orderedSections; } return(orderedSections); } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); commandMenu.DataSource = SectionUtility.getAllSections(); commandMenu.DataBind(); }
private void Application_BeginRequest(Object source, EventArgs e) { //obter o HttpContext HttpContext Context = HttpContext.Current; // verificar o wiki string path = CheckWiki(Context.Request.Path); // obter os paths do ficheiro e da base string requestPath = OrionGlobals.removePathInfo(path); string requestBasePath = OrionGlobals.getSectionPath(requestPath); Log.log("Request to: {0}", requestPath); try { //Descobrir qual a seco pedida e adiciona-la ao Items Log.log("Checking for {0} section... ", requestPath); SectionInfo sectionInfo = SectionUtility.getSectionInfoFromFullPath(requestPath); if (sectionInfo == null) { Log.log("\tsectionInfo is null"); //normalmente acontece quando e named page sectionInfo = SectionUtility.getSectionInfoFromBasePath(requestBasePath); } else { Log.log("\tsectionInfo ok"); } //quando imagem cai aqui ou outra coisa qq que n seja seco if (sectionInfo == null) { Log.log("\tsectionInfo is null"); return; } //adiciona aos items a Items Context.Items["SectionInfo"] = sectionInfo; Log.log("\tSectionInfo: {0}", sectionInfo.sectionName); //Descobrir qual a skin corrente MasterSkinInfo masterSkinInfo = MasterSkinUtility.getMasterSkinInfoFromId(sectionInfo.sectionSkinId); if (masterSkinInfo == null) { masterSkinInfo = MasterSkinUtility.getMasterSkinInfoFromId(1); } //adiciona o nmero da skin (Caso a skin tenha vrios esquemas de cor) storeSkinNumber(masterSkinInfo.masterSkinCount); //adiciona aos items a Items Context.Items["MasterSkinInfo"] = masterSkinInfo; PageInfo pageInfo = getPageInfo(sectionInfo, masterSkinInfo, requestPath); if (pageInfo != null) { Context.Items["PageInfo"] = pageInfo; Chronos.Utils.Log.log("Request: " + requestPath); Log.log("Rewriting Path to '{0}'...", OrionGlobals.UrlBasePage); if (requestPath.IndexOf(".aspx") >= 0) { Log.log("\tDone!"); Context.RewritePath(OrionGlobals.UrlBasePage); } else { Log.log("\tNot rewrited! '{0}' isn't aspx", requestPath); } } else { Log.log("PageInfo is null for '{0}'", requestPath); } } catch (Exception exception) { try { ExceptionLog.log(exception); } catch (Exception exp) { HttpContext.Current.Cache[OrionGlobals.SessionId + "AlnitakException"] = new ExceptionInfo(exp);; } //mostrar a pgina de erro global HttpContext.Current.Server.Transfer(OrionGlobals.resolveBase(OrionGlobals.getConfigurationValue("pagePath", "globalError"))); } }