setIcon("BackArrow.svg");
$ReturnButton->setLink("index.php?P=EditMetadataField&Id=" . $H_Field->id());
}
if (isset($H_IsVocabPreview)) {
$Version = strlen($H_Vocabulary->Version())
? $H_Vocabulary->Version() : "(no version specified)";
$Terms = $H_Vocabulary->TermList();
$URLElement = "Url() . "\" target=\"_blank\">"
. $H_Vocabulary->Url() . "";
$OwnerElement = "OwnerUrl() . "\" target=\"_blank\">"
. $H_Vocabulary->OwnerName() . "";
$TermsHtml = "
";
foreach ($Terms as $Term) {
$TermsHtml .= "- " . $Term . "
";
}
$TermsHtml .= "
";
$PopulateButton = new HtmlButton("Populate");
$PopulateButton->setIcon("MagicWand.svg");
$PopulateButton->setLink("index.php?P=PopulateField&ID=" . $H_Field->id()
. "&VH=" . $H_Vocabulary->Hash() . "&CP=Y");
$CancelSingleButton = new HtmlButton("Cancel");
$CancelSingleButton->setIcon("Cross.svg");
$CancelSingleButton->addSemanticClass("btn-danger");
$CancelSingleButton->setLink("index.php?P=PopulateField&ID=" . $H_Field->id());
$ConfirmPopulateTable = new HtmlTable();
$ConfirmPopulateTable->setTableClass("table table-striped");
$ConfirmPopulateTable->addRowsWithHeaders([
["Vocabulary", "" . $H_Vocabulary->Name() . " (" . count($Terms) . " terms)"],
["Version", $Version],
["URL", $URLElement],
["Owner/Maintainer", $OwnerElement],
["Description", $H_Vocabulary->Description()]
]);
if ($H_Vocabulary->HasQualifier() && strlen($H_Vocabulary->QualifierUrl())) {
$QualifierElement = "QualifierUrl() . "\">"
. $H_Vocabulary->QualifierName() . "";
$ConfirmPopulateTable->addRowWithHeader(["Qualifier", $QualifierElement]);
}
if (strlen($H_Vocabulary->QualifierNamespace())) {
$NamespaceElement = "QualifierNamespace() . "\">"
. $H_Vocabulary->QualifierNamespace() . "";
$ConfirmPopulateTable->addRowWithHeader(["Namespace", $NamespaceElement]);
}
$ConfirmPopulateTable->addRowWithHeader(["Terms", $TermsHtml]);
}
$PreviewButton = new HtmlButton("Preview");
$PreviewButton->setIcon("EyeOpen.svg");
$PreviewButton->setSize(HtmlButton::SIZE_SMALL);
$CancelAllButton = new HtmlButton("Cancel");
$CancelAllButton->setIcon("Cross.svg");
$CancelAllButton->addSemanticClass("btn-danger");
$CancelAllButton->setLink("index.php?P=EditMetadataField&Id=" . $H_Field->id());
$AvailableVocabs = new HtmlTable();
$AvailableVocabs->addHeaderRow(["Name", "Version", "Owner", "Description", ""]);
$AvailableVocabs->setTableClass("table table-striped");
if ($H_Vocabularies !== null) {
foreach ($H_Vocabularies as $Vocab) {
$PreviewButton->setLink("index.php?P=PopulateField&ID=" . $H_Field->id()
. "&VH=" . $Vocab->Hash());
$AvailableVocabs->addRow([
$Vocab->Name(),
$Vocab->Version(),
"OwnerUrl() . "\" target=\"_blank\">" . $Vocab->OwnerName() . "",
$Vocab->Description() . " (" . count($Vocab->TermList()) . " terms)",
$PreviewButton->getHtml()
]);
}
}
# ----- DISPLAY --------------------------------------------------------------
/*
CASES:
- display error messages
- import vocab and display result
- preview vocab and confirm import
- display list of available vocabs
*/
$AF->setPageTitle("Populate Metadata Field");
?>
Error Encountered
Field Populated
The = $H_Field->getDisplayName(); ?> field was populated with
= $H_AddedItemCount; ?> new terms.
TermList())) { ?>
= count($H_Vocabulary->TermList()) - $H_AddedItemCount; ?> terms
were skipped because they were already present in the vocabulary for the
field.
= $ReturnButton->getHtml(); ?>
Confirm Populate
If some of the terms are already in use for this field, they will not be
replaced or overwritten.
= $ConfirmPopulateTable->getHtml(); ?>
= $PopulateButton->getHtml(); ?>
= $CancelSingleButton->getHtml(); ?>
Available Vocabularies
Controlled vocabularies available for populating the =
$H_Field->getDisplayName(); ?> field:
= $AvailableVocabs->getHtml(); ?>
= $CancelAllButton->getHtml(); ?>