protected void ResolvePrintLink() { lnkPrintView.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Member/PrintView.aspx?po={0}&fq={1}", HttpUtility.UrlEncode(Convert.ToBase64String(JsonConvert.SerializeObject(PrintOptions1.Options, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Ignore }).Compress())), HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString())); }
/// <summary> /// Parameters to add to edit link to preserve context on return. /// </summary> protected string EditContextParams(int PageIndex) { System.Collections.Specialized.NameValueCollection dictParams = new System.Collections.Specialized.NameValueCollection(); // Add the existing keys first - since we may overwrite them below! foreach (string szKey in Request.QueryString.Keys) { dictParams[szKey] = Request.QueryString[szKey]; } // Issue #458: clone and reverse are getting duplicated and the & is getting url encoded, so even edits look like clones dictParams.Remove("Clone"); dictParams.Remove("Reverse"); if (!Restriction.IsDefault) { dictParams["fq"] = Restriction.ToBase64CompressedJSONString(); } if (HasPrevSort) { if (!String.IsNullOrEmpty(LastSortExpr)) { dictParams["se"] = LastSortExpr; } if (LastSortDir != SortDirection.Descending || !String.IsNullOrEmpty(LastSortExpr)) { dictParams["so"] = LastSortDir.ToString(); } } if (PageIndex != 0) { dictParams["pg"] = PageIndex.ToString(CultureInfo.InvariantCulture); } System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (string szkey in dictParams) { sb.AppendFormat(CultureInfo.InvariantCulture, "{0}{1}={2}", sb.Length == 0 ? string.Empty : "&", szkey, HttpUtility.UrlEncode(dictParams[szkey])); } return(sb.ToString()); }
protected void Refresh() { bool fRestrictionIsDefault = Restriction.IsDefault; mfbLogbook1.DetailsParam = fRestrictionIsDefault ? string.Empty : "fq=" + HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString()); mfbLogbook1.User = Page.User.Identity.Name; mfbLogbook1.Restriction = Restriction; mfbLogbook1.RefreshData(); if (mfbChartTotals1.Visible) { mfbChartTotals1.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook1.Data, Restriction.UserName); mfbChartTotals1.Refresh(); } if (mfbTotalSummary1.Visible) { mfbTotalSummary1.CustomRestriction = Restriction; } ResolvePrintLink(); pnlFilter.Visible = !fRestrictionIsDefault && IsNewFlight; mfbQueryDescriptor1.DataSource = fRestrictionIsDefault ? null : Restriction; apcFilter.LabelControl.Font.Bold = !fRestrictionIsDefault; apcFilter.IsEnhanced = !fRestrictionIsDefault; if (!IsNewFlight) { mfbLogbook1.GetNeighbors(FlightID, out int prevFlightID, out int nextFlightID); mfbEditFlight1.SetPrevFlight(prevFlightID); mfbEditFlight1.SetNextFlight(nextFlightID); } mfbQueryDescriptor1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Master.SelectedTab = tabID.tabLogbook; using (DataForFlight = new FlightData()) { if (!IsPostBack) { try { CurrentFlightID = InitRequestedFlightID(); if (CurrentFlightID == LogbookEntryCore.idFlightNone) { throw new MyFlightbookException("No valid ID passed"); } InitPassedRestriction(); int iTab = GetRequestedTabIndex(); if (AccordionCtrl.Panes[iTab].Visible) { AccordionCtrl.SelectedIndex = iTab; } LogbookEntryDisplay led = CurrentFlight = LoadFlight(CurrentFlightID); SetUpChart(TelemetryData); UpdateChart(); UpdateRestriction(); SetUpDownload(led); // shouldn't happen but sometimes does: GetUserAircraftByID returns null. Not quite sure why. Aircraft ac = (new UserAircraft(led.User).GetUserAircraftByID(led.AircraftID)) ?? new Aircraft(led.AircraftID); fmvAircraft.DataSource = new Aircraft[] { ac }; fmvAircraft.DataBind(); if (String.IsNullOrEmpty(CurrentFlight.FlightData) && TabIndexRequiresFlightData(iTab)) { AccordionCtrl.SelectedIndex = DefaultTabIndex; } } catch (MyFlightbookException ex) { lblPageErr.Text = ex.Message; AccordionCtrl.Visible = mfbGoogleMapManager1.Visible = pnlMap.Visible = pnlAccordionMenuContainer.Visible = pnlFlightDesc.Visible = false; return; } if (DoDirectDownload()) { return; } } else { DataForFlight.Data = TelemetryData; UpdateChart(); } if (Restriction != null && !Restriction.IsDefault) { mfbFlightContextMenu.EditTargetFormatString = mfbFlightContextMenu.EditTargetFormatString + "?fq=" + HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString()); } mfbFlightContextMenu.Flight = CurrentFlight; cmbAltUnits.SelectedValue = ((int)DataForFlight.AltitudeUnits).ToString(CultureInfo.InvariantCulture); cmbSpeedUnits.SelectedValue = ((int)DataForFlight.SpeedUnits).ToString(CultureInfo.InvariantCulture); if (!DataForFlight.HasDateTime) { lnkSendCloudAhoy.Visible = false; } SetUpMaps(); if (!IsPostBack) { // Bind details - this will bind everything else. fmvLE.DataSource = new LogbookEntryDisplay[] { CurrentFlight }; fmvLE.DataBind(); } } // DataForFlight is disposed - set it to null!! DataForFlight = null; }
protected void Page_Load(object sender, EventArgs e) { Master.SelectedTab = tabID.tabLogbook; // Set the multi-drag handles to use the hidden controls mhsClip.MultiHandleSliderTargets[0].ControlID = hdnClipMin.ClientID; mhsClip.MultiHandleSliderTargets[1].ControlID = hdnClipMax.ClientID; using (FlightData fd = new FlightData()) { if (!IsPostBack) { try { CurrentFlightID = InitRequestedFlightID(); if (CurrentFlightID == LogbookEntryCore.idFlightNone) { throw new MyFlightbookException("No valid ID passed"); } InitPassedRestriction(); int iTab = GetRequestedTabIndex(); if (AccordionCtrl.Panes[iTab].Visible) { AccordionCtrl.SelectedIndex = iTab; } LogbookEntryDisplay led = CurrentFlight = LoadFlight(CurrentFlightID); SetUpChart(DataTableForFlightData(fd), cmbXAxis, cmbYAxis1, cmbYAxis2); UpdateChart(fd); UpdateRestriction(); SetUpDownload(led); // shouldn't happen but sometimes does: GetUserAircraftByID returns null. Not quite sure why. Aircraft ac = (new UserAircraft(led.User).GetUserAircraftByID(led.AircraftID)) ?? new Aircraft(led.AircraftID); fmvAircraft.DataSource = new Aircraft[] { ac }; fmvAircraft.DataBind(); if (String.IsNullOrEmpty(CurrentFlight.FlightData) && TabIndexRequiresFlightData(iTab)) { AccordionCtrl.SelectedIndex = DefaultTabIndex; } } catch (MyFlightbookException ex) { lblPageErr.Text = ex.Message; AccordionCtrl.Visible = mfbGoogleMapManager1.Visible = pnlMap.Visible = pnlAccordionMenuContainer.Visible = pnlFlightDesc.Visible = false; return; } if (DoDirectDownload()) { return; } } else { UpdateChart(fd); } if (Restriction != null && !Restriction.IsDefault) { mfbFlightContextMenu.EditTargetFormatString = mfbFlightContextMenu.EditTargetFormatString + "?fq=" + HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString()); } mfbFlightContextMenu.Flight = CurrentFlight; cmbAltUnits.SelectedValue = ((int)fd.AltitudeUnits).ToString(CultureInfo.InvariantCulture); cmbSpeedUnits.SelectedValue = ((int)fd.SpeedUnits).ToString(CultureInfo.InvariantCulture); if (!fd.HasDateTime) { lnkSendCloudAhoy.Visible = false; } SetUpMaps(fd); if (!IsPostBack) { DistanceDisplay = CurrentFlight.GetPathDistanceDescription(fd.ComputePathDistance()); // Bind details - this will bind everything else. CurrentFlight.UseHHMM = Viewer.UsesHHMM; // make sure we capture hhmm correctly. fmvLE.DataSource = new LogbookEntryDisplay[] { CurrentFlight }; fmvLE.DataBind(); } } }
protected void lnkRestrictSelected_Click(object sender, EventArgs e) { IsInSelectMode = false; Restriction.EnumeratedFlights = SelectedItems; Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/Logbooknew.aspx?fq={0}", HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString()))); }