/// <inheritdoc /> protected override void OnOK(object sender, EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); var value = RawValue.Value; if (IsRichTextEditorMode()) { var mediaResponse = _selectedImageModelMapper.MapJsonStringToSelectedImageModel(value); if (mediaResponse != null) { ClientPipelineArgs pipeline = new ClientPipelineArgs(); pipeline.Parameters.Add(Templates.ImportImageClientPipeline.Parameters.SelectedImageJson, JsonConvert.SerializeObject(mediaResponse, Formatting.Indented)); Context.ClientPage.Start(this, "StartImageImport", pipeline); } else { FotoWareFieldsLog.WriteToLog("--- SelectImageFromFotoWare Dialog: Selected image must be exported before upload to media-library ---"); SheerResponse.Alert(_statusMessageService.GetImageMustBeExportedMessage()); } } else { SheerResponse.SetDialogValue(value); base.OnOK(sender, args); } }
/// <summary> /// Uploads the selected image to media-library and set value to image-field. /// </summary> /// <param name="args">ClientPipeline</param> protected void SelectFromFotoWare(ClientPipelineArgs args) { if (args.IsPostBack) { if (!args.HasResult || this.Value.Equals(args.Result)) { return; } SelectedImageModel selectedImage = null; if (args.Result == "Finished") { var selectedImageJson = args.Parameters[Templates.ImportImageClientPipeline.Parameters.SelectedImageJson]; selectedImage = _selectedImageModelMapper.MapJsonStringToSelectedImageModel(selectedImageJson); } else { selectedImage = _selectedImageModelMapper.MapJsonStringToSelectedImageModel(args.Result); args.Parameters.Add(Templates.ImportImageClientPipeline.Parameters.SelectedImageJson, args.Result); } if (selectedImage != null) { _fotoWareImageJob.StartJob(selectedImage, args, this.ImportImageFinished); } else { //image has to be exported to upload FotoWareFieldsLog.WriteToLog("--- FotoWareImageField: Selected image has to be exported before ---"); SheerResponse.Alert(_statusMessageService.GetImageMustBeExportedMessage()); } } else { _fotoWareImageJob.ResetStatus(); string url = UIUtil.GetUri("control:SelectImageFromFotoWareDialog"); string str = this.GetValue(); if (!string.IsNullOrEmpty(str)) { url = string.Format("{0}&value={1}", (object)url, (object)str); } SheerResponse.ShowModalDialog(url, "1200", "750", "", true, "1200", "750", false); args.WaitForPostBack(); } }