/// <summary> /// "Save as" button logic /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveAs_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "PNG (*.png)|*.png|PDF (*.pdf)|*.pdf|SVG (*.svg)|*.svg|Spreadsheet (*.csv)|*.csv"; saveFileDialog.FilterIndex = 1; if (saveFileDialog.ShowDialog() == true) { ExportSelection exportSelection = (ExportSelection)saveFileDialog.FilterIndex; switch (exportSelection) { case ExportSelection.PNG: SaveAsPNG(saveFileDialog.FileName); break; case ExportSelection.PDF: SaveAsPDF(saveFileDialog.FileName); break; case ExportSelection.SVG: SaveAsSVG(saveFileDialog.FileName); break; case ExportSelection.CSV: SaveAsCSV(saveFileDialog.FileName); break; } } }
[AllowAnonymous] // will do security check internally public HttpResponseMessage Download( int appId, string language, string defaultLanguage, string contentType, ExportSelection recordExport, ExportResourceReferenceMode resourcesReferences, ExportLanguageResolution languageReferences, string selectedIds = null) => _contentExportLazy.Value.Init(appId, Log).ExportContent( GetContext().User, language, defaultLanguage, contentType, recordExport, resourcesReferences, languageReferences, selectedIds);
[AllowAnonymous] // will do security check internally public HttpResponseMessage ExportContent(int appId, string language, string defaultLanguage, string contentType, ExportSelection recordExport, ExportResourceReferenceMode resourcesReferences, ExportLanguageResolution languageReferences, string selectedIds = null) { Log.Add($"export content start app:{appId}, language:{language}, defLang:{defaultLanguage}, type:{contentType}, ids:{selectedIds}"); // do security check and get data return(PortalSettings.UserInfo.IsInRole(PortalSettings.AdministratorRoleName) ? _eavCtc.ExportContent(appId, language, defaultLanguage, contentType, recordExport, resourcesReferences, languageReferences, selectedIds) : throw new HttpRequestException("Needs admin permissions to do this")); }
[AllowAnonymous] // will do security check internally public HttpResponseMessage Download( int appId, string language, string defaultLanguage, string contentType, ExportSelection recordExport, ExportResourceReferenceMode resourcesReferences, ExportLanguageResolution languageReferences, string selectedIds = null) => GetService <ContentExportApi>().Init(appId, Log).ExportContent( new DnnUser(), language, defaultLanguage, contentType, recordExport, resourcesReferences, languageReferences, selectedIds);
[AllowAnonymous] // will do security check internally public HttpResponseMessage ExportContent( int appId, string language, string defaultLanguage, string contentType, ExportSelection recordExport, ExportResourceReferenceMode resourcesReferences, ExportLanguageResolution languageReferences, string selectedIds = null) => new Eav.WebApi.ContentExportApi(Log).ExportContent( new DnnUser(UserInfo), appId, language, defaultLanguage, contentType, recordExport, resourcesReferences, languageReferences, selectedIds);