protected void Page_Load(object sender, EventArgs e) { Page.Form.DefaultButton = UpdateButton.UniqueID; _instanceId = Convert.ToInt32(Request.QueryString["InstanceId"]); _moduleId = Convert.ToInt32(Request.QueryString["ModuleId"]); _versionId = Convert.ToInt32(Request.QueryString["VersionId"]); if (Request.QueryString["InstanceId"] != null) { urlReferrer += "?InstanceId=" + Request.QueryString["InstanceId"]; } if (!IsPostBack) { //check user permissions. if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_instanceId, Page.User)) { throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE); } WebpageInfo page = Webpage.GetWebpage(_instanceId); WebModuleInfo module = WebModule.GetModule(_moduleId); Cms.Admin.BindPlaceholdersToList(page, PlaceholderDropDownList, module.Placeholder); ModuleNameTextBox.Text = module.Name; ModuleTypeName.InnerText = module.WebModuleType.Name; ModuleTypeDescription.InnerText = module.WebModuleType.Description; } }
protected void EditDeleteButton_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } //prevent malicious deletes. if (_page.InstanceId == Webpage.RootNavigationId) { throw new InvalidOperationException("The portal root may not be deleted."); } if (_page.ParentInstanceId == Webpage.RootNavigationId) { throw new InvalidOperationException("Root pages (website roots) may not be deleted."); } if (!_page.IsAlias) { if (_page.Children.Count > 0) { throw new InvalidOperationException("Pages with children may not be deleted."); } System.Collections.Generic.List <WebModuleInfo> modules = WebModule.GetModules(_instanceId); if (modules.Count > 0) { throw new InvalidOperationException("Pages with modules may not be deleted."); } } _urlReferrer += _page.ParentInstanceId.Value; Webpage.DeleteWebpage(_instanceId); Response.Redirect(_urlReferrer); }
private void InitModule() { int moduleId = 0; int.TryParse(Request["ModuleId"], out moduleId); this.ModuleId = moduleId; _webmodule = WebModule.GetModule(moduleId); WebpageInfo page = null; if (this.ModuleId <= 0 || null == _webmodule || null == (page = _webmodule.Webpage)) { Admin.RedirectToMainMenu(); } this.PageNavigationId = page.InstanceId; //check user permissions. if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User)) { throw new System.Security.SecurityException("The current user does not have permission to access this resource."); } }
private void InitModule() { int moduleId = 0; int.TryParse(Request["ModuleId"], out moduleId); this.ModuleId = moduleId; WebModuleInfo module = WebModule.GetModule(this.ModuleId); WebpageInfo page = null; if (this.ModuleId <= 0 || null == module || null == (page = module.Webpage)) { cms.Admin.RedirectToMainMenu(); //uncomment line below (and remove line above) for legacy WebModules. //Response.Redirect("~/WebModules/Admin/MyWebsite/Default.aspx?instanceId=" + Webpage.RootNavigationId); } this.PageNavigationId = page.InstanceId; //check user permissions. if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User)) { throw new System.Security.SecurityException("The current user does not have permission to access this resource."); } ModuleName.Text = module.Name; ModulTypeName.Text = module.WebModuleType.Name; MainMenuLink.HRef = cms.Admin.GetMainMenuUrl(this.PageNavigationId); //uncomment line below (and remove line above) for legacy WebModules. //MainMenuLink.HRef = "~/WebModules/Admin/MyWebsite/Default.aspx?instanceId=" + this.PageNavigationId; EnsureModule(); }
private void InitModule() { int moduleId = 0; int.TryParse(Request["ModuleId"], out moduleId); this.ModuleId = moduleId; WebModuleInfo module = WebModule.GetModule(this.ModuleId); WebpageInfo page = null; if (this.ModuleId <= 0 || null == module || null == (page = module.Webpage)) { cms.Admin.RedirectToMainMenu(); } Page.Title = module.WebModuleType.Name + " Module"; if (string.IsNullOrEmpty(txtStartDate.Text)) { txtStartDate.Text = DateTime.Now.AddMonths(-1).ToShortDateString(); } if (string.IsNullOrEmpty(txtEndDate.Text)) { txtEndDate.Text = DateTime.Now.ToShortDateString(); } }
private void InitModule() { int moduleId = 0; int.TryParse(Request["ModuleId"], out moduleId); this.ModuleId = moduleId; WebModuleInfo module = WebModule.GetModule(this.ModuleId); WebpageInfo page = null; if (this.ModuleId <= 0 || null == module || null == (page = module.Webpage)) { cms.Admin.RedirectToMainMenu(); } this.PageNavigationId = page.InstanceId; //check user permissions. if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User)) { throw new System.Security.SecurityException("The current user does not have permission to access this resource."); } ModuleName.Text = module.Name; ModulTypeName.Text = module.WebModuleType.Name; Page.Title = module.WebModuleType.Name + " Module"; MainMenuLink.HRef = cms.Admin.GetMainMenuUrl(this.PageNavigationId); EnsureModule(); }
protected void ModulesGridView_RowCommand(object sender, GridViewCommandEventArgs e) { string commandArg = e.CommandArgument.ToString(); int moduleId; if (commandArg != string.Empty) { string command = e.CommandName; if (command == "SortUp") { moduleId = int.Parse(commandArg); WebModule.SortWebModuleUp(_instanceId, moduleId); } else if (command == "SortDown") { moduleId = int.Parse(commandArg); WebModule.SortWebModuleDown(_instanceId, moduleId); } else if (command == "DeleteModule") { moduleId = int.Parse(commandArg); Response.Redirect("ModuleDelete.aspx?moduleID=" + moduleId + "&instanceID=" + _instanceId); } else if (command == "ViewShares") { moduleId = int.Parse(commandArg); Response.Redirect("PagesSharingModule.aspx?moduleID=" + moduleId + "&instanceID=" + _instanceId); } LoadModules(); } }
protected void LoadModules() { List <WebModuleInfo> modules = WebModule.GetModules(_instanceId); ModulesGridView.DataSource = modules; ModulesGridView.DataBind(); }
public static List <WebModuleInfo> GetMasterDetailChildrenFiltered(int moduleId, bool filteryByPostDateAndRemoveDate, bool orderByMostRecentPosting, string filterTag) { //get the module object. WebModuleInfo module = WebModule.GetModule(moduleId); //get the container page of the module. WebpageInfo page = module.Webpage; //get all the MasterDetail modules on the child pages. List <WebpageInfo> childPages = page.Children; List <WebModuleInfo> MasterDetailModules = new List <WebModuleInfo>(); foreach (WebpageInfo p in childPages) { MasterDetailModules.AddRange(p.Modules.FindAll( delegate(WebModuleInfo m) { return(m.WebModuleType == MasterDetailItem.ModuleType && !m.IsAlias); })); } if (filteryByPostDateAndRemoveDate) { //remove premature/expired/non-visible items. MasterDetailModules.RemoveAll( delegate(WebModuleInfo m) { WebpageInfo p = m.Webpage; return((p.PostDate.HasValue && DateTime.Now < p.PostDate) || (p.RemoveDate.HasValue && DateTime.Today >= p.RemoveDate) || (!p.Visible)); }); } if (!string.IsNullOrEmpty(filterTag)) { //remove non-matching tags. MasterDetailModules.RemoveAll( delegate(WebModuleInfo m) { MasterDetailItem item = MasterDetailItem.GetSafeResource(m.Id); string[] tagArray = item.Tags.Split(','); foreach (var s in tagArray) { if (s == filterTag) { return(false); } } return(true); }); } if (orderByMostRecentPosting) { MasterDetailModules.Sort(CompareWebModulesByPostDate); } return(MasterDetailModules); }
private void InitModule() { int moduleId = 0; int.TryParse(Request.QueryString["ModuleId"], out moduleId); this.ModuleId = moduleId; WebModuleInfo module = WebModule.GetModule(this.ModuleId); WebpageInfo page = null; if (this.ModuleId <= 0 || null == module || null == (page = module.Webpage)) { Redirect(Webpage.RootNavigationId); } this.PageNavigationId = page.InstanceId; //check user permissions. if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(this.PageNavigationId, Page.User)) { throw new System.Security.SecurityException("The current user does not have permission to access this resource."); } HeaderCtl.Text = module.WebModuleType.Name; EnsureModule(); }
public void Start() { WebModule module = new WebModule(); Task.Run(() => module.StartAsync()); System.Console.WriteLine(" WebUi is started."); }
public void TestRenderer() { WebModule mod = new WebModule(); Request request = new Request("GET", "", "1.1"); string result = mod.Render("index.pt", request: request); Console.WriteLine(result); Assert.Contains(result, "</html>"); }
// Start is called before the first frame update void Start() { //get UNIT JSON from web server ... webReqs = GetComponent <WebModule>(); _VRScreenManager = GetComponent <VR_ScreenManager>(); resourceRequestState = ResourceRequestState.waiting_for_resource; webReqs.fetchData(url); }
protected void bssExport_Click(object sender, EventArgs e) { WebModuleInfo module = WebModule.GetModule(this.ModuleId); bssExport.OutputFileName = string.Format("{0}-responses-{1:yyyy-MMM-dd}", Bss.BssString.Sanitize(module.Name, "_"), DateTime.Now); bssExport.DataSource = GetDataTable(); }
public WebModuleInfo CreateModule(WebpageInfo page) { WebModuleType moduleType = MasterDetailItem.ModuleType; return(WebModule.CreateModule( MasterDetailItem.Chop(page.Title, 30, false), moduleType.WebApplicationType.Name, moduleType.Name, page.Id, "Body", -1)); }
protected void UpdateButton_Click(object sender, EventArgs e) { WebpageInfo p = Webpage.GetWebpage(_instanceId); if (null == p) { throw new ArgumentException("Invalid navigation id (page not found)."); } WebModule.UpdatePageModuleSettings(ModuleNameTextBox.Text, p.Id, _moduleId, PlaceholderDropDownList.SelectedValue); Response.Redirect(urlReferrer); }
protected void Application_Start() { NinjectModule moduleBL = new ServiceModule(); NinjectModule moduleWeb = new WebModule(); var kernel = new StandardKernel(moduleBL, moduleWeb); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); kernel.Unbind <ModelValidatorProvider>(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfiguration.Configure(); NinjectModule webModule = new WebModule(); NinjectModule serviceModule = new ServiceModule("DefaultConnection"); var kernel = new StandardKernel(webModule, serviceModule); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
protected override void OnLoad(EventArgs e) { if (IsPostBack) { _webmodule = WebModule.GetModule(this.ModuleId); } else { InitModule(); EnsureModule(); } base.OnLoad(e); }
protected void Page_Load(object sender, EventArgs e) { //check user permissions. if (_instanceId.HasValue && !BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_instanceId.Value, Page.User)) { throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE); } int n; string strModuleId = Request.QueryString["moduleId"]; if (int.TryParse(strModuleId, out n)) { _moduleId = n; _module = WebModule.GetModule(_moduleId.Value); } string strInstanceId = Request.QueryString["InstanceId"]; if (int.TryParse(strInstanceId, out n)) { _instanceId = n; _page = Webpage.GetWebpage(_instanceId.Value); } if (!IsPostBack) { lvPages.DataSource = null; if (_moduleId.HasValue) { var pages = (from w in Webpage.GetWebpagesSharingModule(_moduleId.Value) orderby w.Path select new { w.InstanceId, w.Path }).Distinct(); lvPages.DataSource = pages; } lvPages.DataBind(); if (Request.UrlReferrer != null) { Referrer = Request.UrlReferrer.PathAndQuery; } if (_module != null) { literalModuleName.Text = _module.Name; literalModuleType.Text = _module.ModuleTypeName; } } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); //dependency injection var webModule = new WebModule(); var serviceModule = new ServiceModule(); var kernel = new StandardKernel(webModule, serviceModule); kernel.Unbind <ModelValidatorProvider>(); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
private void LeavePage() { int instanceId; WebModuleInfo module = WebModule.GetModule(_moduleId); if (_moduleId == 0 || null == module || null == module.Webpage) { instanceId = Webpage.RootNavigationId; } else { instanceId = module.Webpage.InstanceId; } Response.Redirect("~/WebModules/Admin/MyWebsite/Default.aspx?InstanceId=" + instanceId); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperWebConfiguration.Configure(); NinjectModule orderModule = new WebModule(); NinjectModule serviceModule = new ServiceModule(ConfigurationManager.ConnectionStrings["RentalContext"].ToString()); var kernel = new StandardKernel(orderModule, serviceModule); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); }
//finds the first content list that "contains" this item, if any. public MasterDetailSetting GetContentList() { WebModuleInfo module = WebModule.GetModule(this.ModuleId); WebpageInfo parentPage = module.Webpage.Parent; MasterDetailSetting itemList = null; foreach (WebModuleInfo m in parentPage.Modules) { if (m.WebModuleType == MasterDetailList.ModuleType) { itemList = MasterDetailSetting.FetchByID(m.Id); break; } } return(itemList); }
public static void RegisterDependencies(HttpConfiguration config) { var builder = new ContainerBuilder(); var coreModule = new CoreModule(); builder.RegisterModule(coreModule); var webModule = new WebModule(); builder.RegisterModule(webModule); var container = builder.Build(); Mapper.Initialize(x => x.ConstructServicesUsing(container.Resolve)); RegisterMvcResolver(container, config); }
protected void MasterDetail_Item_List_OnRowCommand(object sender, GridViewCommandEventArgs e) { int moduleId = int.Parse(e.CommandArgument.ToString()); if (e.CommandName == "MoveUp" || e.CommandName == "MoveDown") { WebModuleInfo module = WebModule.GetModule(moduleId); WebpageInfo page = module.Webpage; if (e.CommandName == "MoveUp") { Webpage.SortWebpageUp(page.InstanceId); } else { Webpage.SortWebpageDown(page.InstanceId); } Response.Redirect(Request.Url.ToString()); } }
//creates/updates the current content item and associated objects. //does not create new CMS objects. public void Save() { if (this.ModuleId <= 0) { throw new InvalidOperationException("Invalid module id: " + this.ModuleId); } WebModuleInfo module = WebModule.GetModule(this.ModuleId); WebpageInfo page = GetInput_WebpageInfo(module.Webpage); //save webpage properties. //note: do not update WebpageInfo.PathName, that may hurt SEO. Webpage.UpdateWebpage(page); //note: we don't need to update the module. //set the module id for the below methods to use. this.ModuleId = module.Id; SaveMasterDetailItem(); }
protected void SaveButton_Click(object sender, EventArgs e) { if (PlaceholderDropDownList.Items.Count == 0) { throw new InvalidOperationException("The template (master page) must have a content placeholder."); } WebModuleType selectedModuleType = GetSelectedModuleType(); WebModuleInfo module = null; int aliasModuleId = -1; string placeholder = PlaceholderDropDownList.SelectedItem.ToString(); string instanceName = ModuleNameTextBox.Text.Trim(); if (string.IsNullOrEmpty(instanceName)) { //auto-generate a unique name for the module instance int i = 1; List <WebModuleInfo> pageModules = WebModule.GetModules(_instanceId); do { instanceName = selectedModuleType.Name + " " + i++; } while (pageModules.Exists( delegate(WebModuleInfo m) { return(m.Name == instanceName); })); } if (UseExistingModule.Checked) { aliasModuleId = int.Parse(ExistingModulesPagesSelect.Text); } module = WebModule.CreateModule( instanceName, selectedModuleType.WebApplicationType.Name, selectedModuleType.Name, _pageId, placeholder, aliasModuleId); Response.Redirect(module.GetAddUrl()); }
//also deletes webpage if it is empty. public static void DestroyMasterDetailItem(int moduleId) { //get the module object. WebModuleInfo module = WebModule.GetModule(moduleId); //get the container page of the module. WebpageInfo page = module.Webpage; //this cascades and destroys the MasterDetail associated items/resources. WebModule.DeleteModule(moduleId); //destory the item (this cascades down the resources). //MasterDetail_Item.Destroy(moduleId); //destory all associated item resources. //MasterDetail_ItemResource.Destroy(MasterDetail_ItemResource.Columns.ModuleId, moduleId); //if the page has no modules left on it, remove it also. if (null == page.Modules || page.Modules.Count == 0) { Webpage.DeleteWebpage(page.InstanceId); } }
public void Load_MasterDetail_ItemResource_AndAssociatedObjects(MasterDetailItem itemRes) { WebModuleInfo module = WebModule.GetModule(itemRes.ModuleId); WebpageInfo page = Webpage.GetWebpage(module.Webpage.InstanceId); tbTitle.Text = page.Title; //WebpageInfo respects current culture. tbMetaKeywords.Text = page.MetaKeywords; tbMetaDescription.Text = page.MetaDescription; tbPageNavigationText.Text = page.Text; tbShortDesc.Text = itemRes.ShortDescription; tbLongDesc.Text = itemRes.LongDescription; tbTags.Text = itemRes.Tags; ImagePathCtl.ImagePath = itemRes.ImagePath; cbIsVisible.Checked = page.Visible; cbIsFeatured.Checked = itemRes.IsFeatured; if (page.PostDate.HasValue) { calPostDate.Date = page.PostDate.Value.Date; if (page.PostDate.Value.TimeOfDay.TotalSeconds > 0.001) { tbPostTime.Text = page.PostDate.Value.ToShortTimeString(); } else { tbPostTime.Text = string.Empty; } } if (page.RemoveDate.HasValue) { calRemoveDate.Date = page.RemoveDate.Value; } }
private void AddMainViewPages() { foreach (MainViewInfo mainView in _context.MainViews.Values) { PortalPage page = CollectionUtils.Find( _context.Portal.Pages, delegate(PortalPage item) { return StringUtils.CaseInsensitiveEquals(item.PageAlias, mainView.MainTable); }); if (page == null) { page = new PortalPage(); _context.Portal.Pages.Add(page); } page.PageAlias = mainView.MainTable; page.PageTitle = mainView.FullName; page.PageDescription = mainView.FullName; if (mainView.Entity != null) { page.InheritsFrom = "Sage.Platform.WebPortal.EntityPage, Sage.Platform.WebPortal"; string entityTypeName = string.Format("Sage.Entity.Interfaces.{0}, Sage.Entity.Interfaces", mainView.Entity.InterfaceName); if (page.PageProperties.HasProperty("EntityTypeName")) { page.PageProperties["EntityTypeName"].PropertyValue = entityTypeName; } else { page.PageProperties.Add("EntityTypeName", entityTypeName); } WebModule module = CollectionUtils.Find( page.Modules, delegate(WebModule item) { return StringUtils.CaseInsensitiveEquals(item.ModuleTypeName, "Sage.SalesLogix.Client.GroupBuilder.Modules.GroupViewerModule, Sage.SalesLogix.Client.GroupBuilder.Modules"); }); if (module == null) { module = new WebModule(); page.Modules.Add(module); } module.ModuleTypeName = "Sage.SalesLogix.Client.GroupBuilder.Modules.GroupViewerModule, Sage.SalesLogix.Client.GroupBuilder.Modules"; module.Validate(); module.Save(); SmartPartMapping smartPart = GetSmartPart(page, "LiveGroupViewer"); smartPart.SmartPart = @"SmartParts\GroupBuilder\LiveGroupViewer.ascx"; smartPart.TargetWorkspace = "MainContent"; smartPart.ShowInMode = "List"; smartPart.Title = "Entity Group Viewer"; smartPart.Validate(); smartPart.Save(); } if (mainView.DetailForm != null) { AppendSmartPart(page, mainView.DetailForm, "MainContent", mainView.DetailForm.DialogCaption); } page.Validate(); page.Save(); } }