public BloomLibraryPublishControl(PublishView parentView, BookTransfer bookTransferrer, LoginDialog login, Book.Book book) { _parentView = parentView; _bookTransferrer = bookTransferrer; _loginDialog = login; _book = book; InitializeComponent(); _originalLoginText = _loginLink.Text; // Before anything might modify it (but after InitializeComponent creates it). _titleLabel.Text = book.BookInfo.Title; _progressBox.ShowDetailsMenuItem = true; _progressBox.ShowCopyToClipboardMenuItem = true; _progressBox.LinkClicked += _progressBox_LinkClicked; var metadata = book.GetLicenseMetadata(); // This is usually redundant, but might not be on old books where the license was set before the new // editing code was written. book.UpdateLicenseMetdata(metadata); var license = metadata.License; if (license == null || (license is NullLicense && string.IsNullOrWhiteSpace(metadata.CopyrightNotice))) { // A null license and no copyright indicates they never even opened the ClearShare dialog to choose a license. _usingCcControls = false; _usingNotesLabel = false; _licenseSuggestion.Text = _pleaseSetThis; _okToUpload = false; } else if (license is CreativeCommonsLicense) { _creativeCommonsLink.Text = license.Token.ToUpperInvariant(); _usingNotesSuggestion = false; if (string.IsNullOrWhiteSpace(license.RightsStatement)) { _licenseNotesLabel.Hide(); } else { _licenseNotesLabel.Text = LocalizationManager.GetString("PublishTab.Upload.AdditionalRequests", "AdditionalRequests: ") + license.RightsStatement; } } else if (license is NullLicense) { _usingCcControls = false; _licenseNotesLabel.Text = LocalizationManager.GetString("PublishTab.Upload.AllReserved", "All rights reserved (Contact the Copyright holder for any permissions.)"); if (!string.IsNullOrWhiteSpace(license.RightsStatement)) { _licenseNotesLabel.Text += Environment.NewLine + license.RightsStatement; } _licenseSuggestion.Text = LocalizationManager.GetString("PublishTab.Upload.SuggestAssignCC", "Suggestion: Assigning a Creative Commons License makes it easy for you to clearly grant certain permissions to everyone."); } else { // So far, this means it must be custom license (with non-blank rights...actually, currently, the palaso dialog will not allow a custom license with no rights statement). _usingCcControls = false; _licenseNotesLabel.Text = license.RightsStatement; _licenseSuggestion.Text = LocalizationManager.GetString("PublishTab.Upload.SuggestChangeCC", "Suggestion: Creative Commons Licenses make it much easier for others to use your book, even if they aren't fluent in the language of your custom license."); } _copyrightLabel.Text = book.BookInfo.Copyright; _languagesLabel.Text = string.Join(", ", book.AllLanguages.Select(lang => _book.PrettyPrintLanguage(lang)).ToArray()); _creditsLabel.Text = book.BookInfo.Credits; _summaryBox.Text = book.BookInfo.Summary; try { _loginDialog.LogIn(); // See if saved credentials work. } catch (Exception e) { Palaso.Reporting.ErrorReport.NotifyUserOfProblem(e, LocalizationManager.GetString("PublishTab.Upload.LoginFailure", "Bloom could not log in to BloomLibrary.org using your saved credentials. Please check your network connection.")); } _optional1.Left = _summaryBox.Right - _optional1.Width; // right-align these (even if localization changes their width) RequireValue(_copyrightLabel); RequireValue(_titleLabel); RequireValue(_languagesLabel); if (BookTransfer.UseSandbox) { var oldTextWidth = TextRenderer.MeasureText(_uploadButton.Text, _uploadButton.Font).Width; _uploadButton.Text = LocalizationManager.GetString("PublishTab.Upload.UploadSandbox", "Upload Book (to Sandbox)"); var neededWidth = TextRenderer.MeasureText(_uploadButton.Text, _uploadButton.Font).Width; _uploadButton.Width += neededWidth - oldTextWidth; } }