private void newProjectButton_Button_Pressed(object sender, EventArgs e) { New_Project_Form projForm = new New_Project_Form(); this.Hide(); projForm.ShowDialog(); if (projForm.Valid_Project_Code.Length > 0) { try { string projCode = projForm.Valid_Project_Code; SobekCM_Item newProj = new SobekCM_Item(); newProj.BibID = projCode; newProj.VID = "00001"; newProj.Bib_Info.Main_Title.Title = "Project level metadata for '" + projCode + "'"; newProj.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Project; newProj.Save_METS(Application.StartupPath + "\\Projects\\" + projCode + ".pmets"); MetaTemplate_UserSettings.Current_Project = projCode; MetaTemplate_UserSettings.Save(); MessageBox.Show("New project '" + projCode + "' created and set to be your new default project.\n\nClick EDIT PROJECT to make any changes to the new project.", "New Project Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ee) { MessageBox.Show("Unable to save new project file.\n\nEnsure you have access to write in the PROJECTS subfolder.\n\n" + Application.StartupPath + "\\Projects\n\n" + ee.Message); } } // Get the list of PROJECTS projectComboBox.Items.Clear(); projectComboBox.Items.Add("(none)"); string[] project_files = Directory.GetFiles(Application.StartupPath + "\\Projects\\", "*.pmets"); foreach (string thisFile in project_files) { FileInfo thisFileInfo = new FileInfo(thisFile); string name = thisFileInfo.Name.Replace(thisFileInfo.Extension, ""); projectComboBox.Items.Add(name); } if ((MetaTemplate_UserSettings.Current_Project.Length > 0) && (projectComboBox.Items.Contains(MetaTemplate_UserSettings.Current_Project))) { projectComboBox.Text = MetaTemplate_UserSettings.Current_Project; } else { projectComboBox.SelectedIndex = 0; } this.Show(); }
private void Save_Settings() { // Save the primary metadata schema if ((!dublinCoreRadioButton.Checked) && (!marcXmlRadioButton.Checked) && (!modsRadioButton.Checked)) { MessageBox.Show("Please select the bibliograhpic schema to use when creating metadata for your resource.\n\nThis can always be changed later through the preferences menu.", "Select Option", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dublinCoreRadioButton.Checked) { MetaTemplate_UserSettings.Bibliographic_Metadata = Bibliographic_Metadata_Enum.DublinCore; } if (modsRadioButton.Checked) { MetaTemplate_UserSettings.Bibliographic_Metadata = Bibliographic_Metadata_Enum.MODS; } if (marcXmlRadioButton.Checked) { MetaTemplate_UserSettings.Bibliographic_Metadata = Bibliographic_Metadata_Enum.MarcXML; } // Save the base template if ((!dcTemplateRadioButton.Checked) && (!standardRadioButton.Checked) && (!completeRadioButton.Checked) && (!otherRadioButton.Checked)) { MessageBox.Show("Please select the base template you wish to utilize.\n\nThis can always be changed later through the preferences menu.", "Select Option", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dcTemplateRadioButton.Checked) { MetaTemplate_UserSettings.Default_Template = "DUBLINCORE"; } if (standardRadioButton.Checked) { MetaTemplate_UserSettings.Default_Template = "STANDARD"; } if (completeRadioButton.Checked) { MetaTemplate_UserSettings.Default_Template = "COMPLETE"; } if (otherRadioButton.Checked) { MetaTemplate_UserSettings.Default_Template = otherComboBox.Text; } // Save the add-ons List <string> newEnabled = new List <string>(); foreach (CheckBox thisCheckBox in checkBoxes) { if (thisCheckBox.Checked) { int counter = Convert.ToInt32(thisCheckBox.Tag); newEnabled.Add(addOns[counter].FileName.ToUpper()); } } MetaTemplate_UserSettings.AddOns_Enabled = newEnabled; if (xmlExtensionRadioButton.Checked) { MetaTemplate_UserSettings.METS_File_Extension = ".xml"; } else { MetaTemplate_UserSettings.METS_File_Extension = ".mets"; } // Populate all the sobekcm default aggregations List <string> aggregations = new List <string>(); if (aggregationTextBox1.Text.Trim().Length > 0) { aggregations.Add(aggregationTextBox1.Text.Trim().ToUpper()); } if ((aggregationTextBox2.Text.Trim().Length > 0) && (!aggregations.Contains(aggregationTextBox2.Text.Trim().ToUpper()))) { aggregations.Add(aggregationTextBox2.Text.Trim().ToUpper()); } if ((aggregationTextBox3.Text.Trim().Length > 0) && (!aggregations.Contains(aggregationTextBox3.Text.Trim().ToUpper()))) { aggregations.Add(aggregationTextBox3.Text.Trim().ToUpper()); } if ((aggregationTextBox4.Text.Trim().Length > 0) && (!aggregations.Contains(aggregationTextBox4.Text.Trim().ToUpper()))) { aggregations.Add(aggregationTextBox4.Text.Trim().ToUpper()); } if ((aggregationTextBox5.Text.Trim().Length > 0) && (!aggregations.Contains(aggregationTextBox5.Text.Trim().ToUpper()))) { aggregations.Add(aggregationTextBox5.Text.Trim().ToUpper()); } MetaTemplate_UserSettings.SobekCM_Aggregations = aggregations; // Populate all the sobekcm default wordmarks List <string> wordmars = new List <string>(); if (wordmarksTextBox1.Text.Trim().Length > 0) { wordmars.Add(wordmarksTextBox1.Text.Trim().ToUpper()); } if ((wordmarksTextBox2.Text.Trim().Length > 0) && (!wordmars.Contains(wordmarksTextBox2.Text.Trim().ToUpper()))) { wordmars.Add(wordmarksTextBox2.Text.Trim().ToUpper()); } if ((wordmarksTextBox3.Text.Trim().Length > 0) && (!wordmars.Contains(wordmarksTextBox3.Text.Trim().ToUpper()))) { wordmars.Add(wordmarksTextBox3.Text.Trim().ToUpper()); } if ((wordmarksTextBox4.Text.Trim().Length > 0) && (!wordmars.Contains(wordmarksTextBox4.Text.Trim().ToUpper()))) { wordmars.Add(wordmarksTextBox4.Text.Trim().ToUpper()); } if ((wordmarksTextBox5.Text.Trim().Length > 0) && (!wordmars.Contains(wordmarksTextBox5.Text.Trim().ToUpper()))) { wordmars.Add(wordmarksTextBox5.Text.Trim().ToUpper()); } MetaTemplate_UserSettings.SobekCM_Wordmarks = wordmars; // Populate all the sobekcm default web skins List <string> webskins = new List <string>(); if (webSkinTextBox1.Text.Trim().Length > 0) { webskins.Add(webSkinTextBox1.Text.Trim().ToUpper()); } if ((webSkinTextBox2.Text.Trim().Length > 0) && (!webskins.Contains(webSkinTextBox2.Text.Trim().ToUpper()))) { webskins.Add(webSkinTextBox2.Text.Trim().ToUpper()); } if ((webSkinTextBox3.Text.Trim().Length > 0) && (!webskins.Contains(webSkinTextBox3.Text.Trim().ToUpper()))) { webskins.Add(webSkinTextBox3.Text.Trim().ToUpper()); } if ((webSkinTextBox4.Text.Trim().Length > 0) && (!webskins.Contains(webSkinTextBox4.Text.Trim().ToUpper()))) { webskins.Add(webSkinTextBox4.Text.Trim().ToUpper()); } if ((webSkinTextBox5.Text.Trim().Length > 0) && (!webskins.Contains(webSkinTextBox5.Text.Trim().ToUpper()))) { webskins.Add(webSkinTextBox5.Text.Trim().ToUpper()); } MetaTemplate_UserSettings.SobekCM_Web_Skins = webskins; // Populate all the sobekcm default viewers List <string> viewers = new List <string>(); if (viewersComboBox1.Text.Trim().Length > 0) { viewers.Add(viewersComboBox1.Text.Trim()); } if (viewersComboBox2.Text.Trim().Length > 0) { viewers.Add(viewersComboBox2.Text.Trim()); } if (viewersComboBox3.Text.Trim().Length > 0) { viewers.Add(viewersComboBox3.Text.Trim()); } if (viewersComboBox4.Text.Trim().Length > 0) { viewers.Add(viewersComboBox4.Text.Trim()); } MetaTemplate_UserSettings.SobekCM_Viewers = viewers; // Set the default project if (projectComboBox.Text != "(none)") { MetaTemplate_UserSettings.Current_Project = projectComboBox.Text; } else { MetaTemplate_UserSettings.Current_Project = String.Empty; } MetaTemplate_UserSettings.Individual_Creator = nameTextBox.Text; MetaTemplate_UserSettings.Perform_Version_Check_On_StartUp = !disableVersionCheckBox.Checked; MetaTemplate_UserSettings.Include_SobekCM_File_Section = sobekcmFileCheckBox.Checked; MetaTemplate_UserSettings.FDA_Account = accountTextBox.Text.Trim(); MetaTemplate_UserSettings.FDA_SubAccount = subAccountTextBox.Text.Trim(); MetaTemplate_UserSettings.FDA_Project = projectTextBox.Text.Trim(); MetaTemplate_UserSettings.FCLA_Flag_FDA = fdaCheckBox.Checked; MetaTemplate_UserSettings.FCLA_Flag_PALMM = palmmCheckBox.Checked; MetaTemplate_UserSettings.PALMM_Code = palmmCodeTextBox.Text; MetaTemplate_UserSettings.Include_Checksums = checksumsCheckBox.Checked; MetaTemplate_UserSettings.Default_Source_Code = sourceCodeTextBox.Text; MetaTemplate_UserSettings.Default_Source_Statement = sourceStatementTextBox.Text; MetaTemplate_UserSettings.Show_Metadata_PostSave = showMetadataCheckBox.Checked; MetaTemplate_UserSettings.Always_Add_Page_Images = alwaysAddPageImagesCheckBox.Checked; MetaTemplate_UserSettings.Always_Add_NonPage_Files = alwaysAddNonPageFilesCheckBox.Checked; MetaTemplate_UserSettings.Always_Recurse_Through_Subfolders_On_New = alwaysRecurseWhenAddingFilesCheckBox.Checked; MetaTemplate_UserSettings.Page_Images_In_Seperate_Folders_Can_Be_Same_Page = subfoldersPageImagesSepFolderCheckBox.Checked; MetaTemplate_UserSettings.Default_Rights_Statement = rightsTextBox.Text; MetaTemplate_UserSettings.Default_Funding_Note = fundingTextBox.Text; MetaTemplate_UserSettings.Save(); // Configure the metadata Metadata_Profile_Configurer.Configure_Metadata_From_UserSettings(); DialogResult = DialogResult.OK; Close(); }