Example #1
0
        public static Stream GetInventioPageStream(string path)
        {
            Stream ret = null;

            InventioPage page = PageWorker.SelectByPath(path, PageWorker.RepositoryWebConfig);

            if (page != null)
            {
                InventioLayout layout = LayoutWorker.SelectById(page.IdLayout, LayoutWorker.RepositoryWebConfig);
                if (layout != null)
                {
                    string raw    = System.Text.Encoding.UTF8.GetString(layout.Body);
                    string parsed = string.Empty;

                    // BEGIN RazorEngine Template // TODO igual hay que meterlo en global asax
                    var config = new RazorEngine.Configuration.TemplateServiceConfiguration
                    {
                        //BaseTemplateType = typeof(InventioTemplateBase<>)
                        BaseTemplateType = typeof(InventioTemplateBase <>),
                        Resolver         = new InventioTemplateResolver()
                    };

                    using (var service = new TemplateService(config))
                    {
                        RazorEngine.Razor.SetTemplateService(service);
                        parsed = Razor.Parse(raw);
                    }
                    // END RazorEngine

                    ret = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parsed), false);
                }
            }

            return(ret);
        }
Example #2
0
        public static bool IsInventioPage(string path)
        {
            bool ret = false;

            if (!string.IsNullOrWhiteSpace(path))
            {
                InventioPage selected = PageWorker.SelectByPath(path, PageWorker.RepositoryWebConfig);
                ret = selected != null;
            }

            return(ret);
        }
Example #3
0
 public static void RemovePage(string path)
 {
     if (!string.IsNullOrWhiteSpace(path))
     {
         InventioNavigationNode nav = NavigationWorker.SelectByPath(path, NavigationWorker.RepositoryWebConfig);
         if (nav != null)
         {
             NavigationWorker.Remove(nav.Id, NavigationWorker.RepositoryWebConfig);
         }                                                                                           // eliminamos navigation
         InventioPage page = PageWorker.SelectByPath(path, PageWorker.RepositoryWebConfig);
         if (page != null)
         {
             PageWorker.Remove(page.Id, PageWorker.RepositoryWebConfig);
         }                                                                                 // eliminamos página
     }
 }