private void btnDelete_Click(object sender, EventArgs e) { if(itemId > -1) { CalendarEvent calendarEvent = new CalendarEvent(itemId); if (calendarEvent.ModuleId != moduleId) { SiteUtils.RedirectToAccessDeniedPage(this); return; } calendarEvent.ContentChanged += new ContentChangedEventHandler(calendarEvent_ContentChanged); calendarEvent.Delete(); CurrentPage.UpdateLastModifiedTime(); SiteUtils.QueueIndexing(); } if (hdnReturnUrl.Value.Length > 0) { WebUtils.SetupRedirect(this, hdnReturnUrl.Value); return; } WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl()); }
private void PopulateControls() { if (itemId > -1) { CalendarEvent calendarEvent = new CalendarEvent(itemId); if (calendarEvent.ModuleId != moduleId) { SiteUtils.RedirectToAccessDeniedPage(this); return; } //this.lblTitle.Text = calendarEvent.Title; heading.Text = calendarEvent.Title + " - " + calendarEvent.EventDate.ToShortDateString(); Title = SiteUtils.FormatPageTitle(siteSettings, calendarEvent.Title); this.litDescription.Text = calendarEvent.Description; //this.lblDate.Text = calendarEvent.EventDate.ToShortDateString(); this.lblStartTime.Text = calendarEvent.StartTime.ToShortTimeString(); this.lblEndTime.Text = calendarEvent.EndTime.ToShortTimeString(); if (calendarEvent.Location.Length > 0) { gmap.GMapApiKey = GmapApiKey; gmap.Location = calendarEvent.Location; gmap.EnableMapType = GoogleMapEnableMapTypeSetting; gmap.EnableZoom = GoogleMapEnableZoomSetting; gmap.ShowInfoWindow = GoogleMapShowInfoWindowSetting; gmap.EnableLocalSearch = GoogleMapEnableLocalSearchSetting; gmap.MapHeight = GoogleMapHeightSetting; gmap.MapWidth = GoogleMapWidthSetting; gmap.EnableDrivingDirections = GoogleMapEnableDirectionsSetting; gmap.GmapType = mapType; gmap.ZoomLevel = GoogleMapInitialZoomSetting; gmap.DirectionsButtonText = EventCalResources.DrivingDirectionsButton; gmap.DirectionsButtonToolTip = EventCalResources.DrivingDirectionsButton; } else { gmap.Visible = false; } } }
private static void IndexItem(CalendarEvent calendarEvent) { if (WebConfigSettings.DisableSearchIndex) { return; } if (calendarEvent == null) return; try { //SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); //if ((siteSettings == null) // || (calendarEvent == null)) //{ // return; //} Module module = new Module(calendarEvent.ModuleId); Guid calendarFeatureGuid = new Guid("c5e6a5df-ac2a-43d3-bb7f-9739bc47194e"); ModuleDefinition calendarFeature = new ModuleDefinition(calendarFeatureGuid); // get list of pages where this module is published List<PageModule> pageModules = PageModule.GetPageModulesByModule(calendarEvent.ModuleId); foreach (PageModule pageModule in pageModules) { PageSettings pageSettings = new PageSettings( calendarEvent.SiteId, pageModule.PageId); //don't index pending/unpublished pages if (pageSettings.IsPending) { continue; } mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem(); if (calendarEvent.SearchIndexPath.Length > 0) { indexItem.IndexPath = calendarEvent.SearchIndexPath; } indexItem.SiteId = calendarEvent.SiteId; indexItem.PageId = pageSettings.PageId; indexItem.PageName = pageSettings.PageName; indexItem.ViewRoles = pageSettings.AuthorizedRoles; indexItem.ModuleViewRoles = module.ViewRoles; indexItem.ItemId = calendarEvent.ItemId; indexItem.ModuleId = calendarEvent.ModuleId; indexItem.ViewPage = "EventCalendar/EventDetails.aspx"; indexItem.FeatureId = calendarFeatureGuid.ToString(); indexItem.FeatureName = calendarFeature.FeatureName; indexItem.FeatureResourceFile = calendarFeature.ResourceFile; indexItem.ModuleTitle = module.ModuleTitle; indexItem.Title = calendarEvent.Title; indexItem.Content = calendarEvent.Description; indexItem.PublishBeginDate = pageModule.PublishBeginDate; indexItem.PublishEndDate = pageModule.PublishEndDate; indexItem.CreatedUtc = calendarEvent.CreatedDate; indexItem.LastModUtc = calendarEvent.LastModUtc; mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem); } if (debugLog) log.Debug("Indexed " + calendarEvent.Title); } catch (System.Data.Common.DbException ex) { log.Error("CalendarEventIndexBuilderProvider.IndexItem", ex); } }
private void btnUpdate_Click(object sender, EventArgs e) { Page.Validate("eventcalendaredit"); if (Page.IsValid) { int userId = -1; Guid userGuid = Guid.Empty; if(Request.IsAuthenticated) { //SiteUser siteUser = new SiteUser(siteSettings, Context.User.Identity.Name); SiteUser siteUser = SiteUtils.GetCurrentSiteUser(); userId = siteUser.UserId; userGuid = siteUser.UserGuid; } CalendarEvent calEvent = new CalendarEvent(itemId); if ((itemId > -1)&&(calEvent.ModuleId != moduleId)) { SiteUtils.RedirectToAccessDeniedPage(this); return; } calEvent.ContentChanged += new ContentChangedEventHandler(calendarEvent_ContentChanged); Module m = new Module(this.moduleId); calEvent.ModuleId = m.ModuleId; calEvent.ModuleGuid = m.ModuleGuid; calEvent.UserId = userId; calEvent.UserGuid = userGuid; calEvent.LastModUserGuid = userGuid; calEvent.Title = this.txtTitle.Text; calEvent.Description = edContent.Text; calEvent.EventDate = DateTime.Parse(this.dpEventDate.Text); calEvent.StartTime = DateTime.Parse(this.ddStartTime.SelectedValue); calEvent.EndTime = DateTime.Parse(this.ddEndTime.SelectedValue); calEvent.Location = txtLocation.Text; if(calEvent.Save()) { CurrentPage.UpdateLastModifiedTime(); //CacheHelper.TouchCacheDependencyFile(cacheDependencyKey); CacheHelper.ClearModuleCache(moduleId); SiteUtils.QueueIndexing(); if (hdnReturnUrl.Value.Length > 0) { WebUtils.SetupRedirect(this, hdnReturnUrl.Value); return; } WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl()); } } }
private void PopulateControls() { if (itemId > -1) { CalendarEvent calEvent = new CalendarEvent(itemId); if (calEvent.ModuleId != moduleId) { SiteUtils.RedirectToAccessDeniedPage(this); return; } this.txtTitle.Text = calEvent.Title; edContent.Text = calEvent.Description; this.dpEventDate.Text = calEvent.EventDate.ToShortDateString(); ListItem item; item = ddStartTime.Items.FindByValue(calEvent.StartTime.ToShortTimeString()); if (item != null) { ddStartTime.ClearSelection(); item.Selected = true; } item = ddEndTime.Items.FindByValue(calEvent.EndTime.ToShortTimeString()); if (item != null) { ddEndTime.ClearSelection(); item.Selected = true; } txtLocation.Text = calEvent.Location; } else { btnDelete.Visible = false; } }