private void Default_PreRender(object sender, EventArgs e) { #region Features string featureAssembly; string featureAssemblyClassName; if (IsCategoryFilterOn && CurrentEventCategory.FeatureAssembly != null) { featureAssembly = CurrentEventCategory.FeatureAssembly; featureAssemblyClassName = CurrentEventCategory.FeatureAssemblyClassName; } else { featureAssembly = BLL.Mandator.FeatureAssembly; featureAssemblyClassName = BLL.Mandator.FeatureAssemblyClassName; } if (featureAssembly != null) { try { Assembly a = Assembly.LoadFrom(featureAssembly); IFeature feature = (IFeature)a.CreateInstance(featureAssemblyClassName); // IFeature feature = (IFeature)a.CreateInstance(BLL.Mandator.FeatureAssemblyClassName, false, BindingFlags.CreateInstance, null, new object[]{Request}, null, null); feature.AddContent(pnlFeature, Request); } catch (Exception ex) { Helpers.TrySendErrorMail(ex); Label lbl = new Label(); lbl.Text = "Beim Versuch das FeatureAssembly auszuführen ist folgender Fehler aufgetreten: "; lbl.Text += ex.ToString(); pnlFeature.Controls.Clear(); pnlFeature.Controls.Add(lbl); } } #endregion EventCategories.Attributes.Add("onchange", String.Format("document.getElementById('{0}').checked = false;document.getElementById('{0}').click();", chkCategoryFilterOn.ClientID)); EventCategoryFilterPopup.PopupText = IsCategoryFilterOn ? "Filter deaktivieren" : "Nach Kategorie filtern"; EventCategoryFilterPopup.PopupIconSrc = IsCategoryFilterOn ? "images\\icons\\filter_on.gif" : "images\\icons\\filter_off.gif"; if (BLL.Mandator.UseSubscriptions) { dgrSubscriptions.DataBind(); // events.DataBind(); pnlAddSubscription.Visible = !BLL.IsReader(); AddSubscriptionCell.Visible = !BLL.IsReader(); if (!pnlAddContact.Visible) { pnlSubscriptions.Visible = true; } notifSubscription.Visible = true; // string styleBlock = @" //<style type=""text/css""> //<!-- //#pnlEventContainer > #pnlEvent //{ // width: 10%; //} // //#eventList //{ // vertical-align: bottom; //} //#eventChooser > #eventList //{ // vertical-align: baseline; //} //--> //</style>"; // if(!IsClientScriptBlockRegistered("StyleHack")) // RegisterClientScriptBlock("StyleHack", styleBlock); pnlEvent.Style["FLOAT"] = "left"; pnlEvent.Style["MARGIN-BOTTOM"] = "auto"; pnlEventDetails.Style["MARGIN-RIGHT"] = "auto"; string clientScript = string.Format(pbHelpers.JavaScriptString, @" fResetEventDetailSize(); /*Überwachung von Veränderung der Fenstergrösse initialisieren*/ window.onresize = fResetEventDetailSize; "); RegisterStartupScriptIfNeeded("EventDetailHandling", clientScript); if (IsOldEvent) { pnlAddSubscription.Visible = false; subscriptionStates.Enabled = false; email.Enabled = false; email.BackColor = Color.FromKnownColor(KnownColor.LightGray); subscriptionTime.Enabled = false; subscriptionTime.BackColor = Color.FromKnownColor(KnownColor.LightGray); // maxNotifications.Enabled = false; // maxNotifications.BackColor = Color.FromKnownColor(KnownColor.LightGray); txtComment.Enabled = false; txtComment.BackColor = Color.FromKnownColor(KnownColor.LightGray); AddSubscription.Enabled = false; dgrSubscriptions.Columns[1].Visible = false; dgrSubscriptions.Columns[9].Visible = false; } else { subscriptionStates.Enabled = true; email.Enabled = true; email.BackColor = Color.White; subscriptionTime.Enabled = true; subscriptionTime.BackColor = Color.White; // maxNotifications.Enabled = true; // maxNotifications.BackColor = Color.White; txtComment.Enabled = true; txtComment.BackColor = Color.White; AddSubscription.Enabled = true; dgrSubscriptions.Columns[1].Visible = true; dgrSubscriptions.Columns[9].Visible = true; } dgrSubscriptions.Columns[9].Visible = BLL.Mandator.IsLiftManagementEnabled && dgrSubscriptions.Columns[9].Visible; } else { // string styleBlock = @" //<style type=""text/css""> //<!-- //#eventDetails //{ // width: 100%; //} // //TABLE#pnlEventDetails DIV //{ // width: auto; //} // //#eventList //{ // vertical-align: bottom; //} // #eventChooser > #eventList // { // vertical-align: baseline; //} //--> //</style>"; // if(!IsClientScriptBlockRegistered("StyleHack")) // RegisterClientScriptBlock("StyleHack", styleBlock); pnlAddSubscription.Visible = false; AddSubscriptionCell.Visible = false; pnlSubscriptions.Visible = false; notifSubscription.Visible = false; pnlEvent.Style["FLOAT"] = "none"; pnlEvent.Style["MARGIN-BOTTOM"] = "20px"; pnlEventDetails.Style["MARGIN-RIGHT"] = "5px"; } string titleAdd; if (CurrentEvent == null) { titleAdd = "Kein(e) " + BLL.Mandator.EventName + " ausgewählt"; lblSubscriptions.Text = "Es ist kein Anlass ausgewählt."; dgrSubscriptions.Visible = false; legendDiv.Visible = false; } else { titleAdd = CurrentEvent.EventTitle; lblSubscriptions.Text = "Zur Zeit sind für diesen Anlass folgende Einträge vorhanden:"; dgrSubscriptions.Visible = true; legendDiv.Visible = BLL.Mandator.IsLiftManagementEnabled; } Page.Title = BLL.Mandator.SiteTitle + " - " + titleAdd; pageTitle.InnerText = BLL.Mandator.SiteTitle + " - " + titleAdd; helptext.Text = BLL.Mandator.HelpText; if (pnlAddSubscription.Visible) { string previousValue = null; if (IsPostBack) { previousValue = subscriptionStates.SelectedValue; } subscriptionStates.DataSource = BLL.ListSubscriptionStates(CurrentEvent.EventCategory); subscriptionStates.DataBind(); if (!IsPostBack && subscriptionStates.Items.Count > 0) { subscriptionStates.Items[0].Selected = true; } else if (IsPostBack && subscriptionStates.Items.Count > 0) { //try to set previous value try { subscriptionStates.SelectedValue = previousValue; } catch { subscriptionStates.Items[0].Selected = true; } } subscriptionMailContainer.Visible = BLL.IsAdministrator() || BLL.IsManager(); } if (BLL.IsReader()) { chkNotifSubscription.Visible = false; txtNumSmsNotifications.Visible = false; numSmsNotificationsLabel.Visible = false; lblNofifSubscriptionDisabled.Text = "Da du nur Leserechte besitzt, kannst<br>du diese Option nicht nutzen."; lblNofifSubscriptionDisabled.Visible = true; } else { if (CurrentEvent != null && EventSiteBL.GetContactSetting(BLL.CurrentContact, CurrentEvent.EventCategory).SmsNotifSubscriptionsOn) { chkNotifSubscription.Visible = true; txtNumSmsNotifications.Visible = true; numSmsNotificationsLabel.Visible = true; lblNofifSubscriptionDisabled.Visible = false; SetNotifSubscriptionFields(); string notifSubscriptionChangeScript = string.Format(@" <SCRIPT type=""text/javascript"" language=""javascript""> function UpdateNotifSubscriptionChange() {{ var nofifSubscriptionElem; var maxNotificationsElem; nofifSubscriptionElem = document.getElementById('{0}'); maxNotificationsElem = document.getElementById('{1}'); document.getElementById('{4}').style.backgroundColor = 'yellow'; var notifSubscriptionOn; var maxNotifications; notifSubscriptionOn = nofifSubscriptionElem.checked; if(notifSubscriptionOn) {{ maxNotifications = maxNotificationsElem.value; }} else {{ maxNotificationsElem.value = ''; maxNotifications = ''; }} //alert(notifSubscriptionOn); //alert(maxNotifications); //ajax postback to update notifSubscription EventSiteBL.UpdateNotifSubscription('{2}', {3}, notifSubscriptionOn, maxNotifications, UpdateNotifSubscription_CallBack); }} function UpdateNotifSubscription_CallBack(response) {{ if (response.error != null) {{ alert(response.error.description + '\nDie Einstellung konnte nicht gespeichert werden!'); }} else {{ document.getElementById('{4}').style.backgroundColor = '#eeeeee'; }} }} </SCRIPT> ", chkNotifSubscription.ClientID, txtNumSmsNotifications.ClientID, BLL.Mandator.MandatorId, CurrentEvent == null ? "" : CurrentEvent.EventId.ToString(), notifSubscription.ClientID); RegisterStartupScriptIfNeeded("notifSubscriptionChangeScript", notifSubscriptionChangeScript); chkNotifSubscription.Attributes.Add("onclick", "UpdateNotifSubscriptionChange();"); txtNumSmsNotifications.Attributes.Add("onchange", "UpdateNotifSubscriptionChange();"); txtNumSmsNotifications.Attributes.Add("onkeyup", "UpdateNotifSubscriptionChange();"); } else if (CurrentEvent != null) { chkNotifSubscription.Visible = false; txtNumSmsNotifications.Visible = false; numSmsNotificationsLabel.Visible = false; if (BLL.Mandator.UseEventCategories) { lblNofifSubscriptionDisabled.Text = "Du hast die Abonnierungsfunktion auf dieser<br>Kategorie zur Zeit ausgeschaltet"; } else { lblNofifSubscriptionDisabled.Text = "Du hast die Abonnierungsfunktion<br>zur Zeit ausgeschaltet"; } lblNofifSubscriptionDisabled.Visible = true; } else { chkNotifSubscription.Checked = false; txtNumSmsNotifications.Text = string.Empty; chkNotifSubscription.Visible = false; txtNumSmsNotifications.Visible = false; numSmsNotificationsLabel.Visible = false; lblNofifSubscriptionDisabled.Text = "Momentan ist kein Anlass ausgewählt"; lblNofifSubscriptionDisabled.Visible = true; } } events.Visible = !BLL.Mandator.ShowEventsAsList; eventList.Visible = BLL.Mandator.ShowEventsAsList; EventDetails_EventUrlLabel.Visible = BLL.Mandator.UseEventUrl; EventDetails_EventUrlControl.Visible = BLL.Mandator.UseEventUrl; EventDetails_MinMaxSubscriptions.Visible = BLL.Mandator.UseMinMaxSubscriptions; EventDetails_EventCategory.Visible = BLL.Mandator.UseEventCategories; EventCategoryFilterPopup.Visible = BLL.Mandator.UseEventCategories; }