"No", 1 => "Yes"]; } /** * Get an array of options available for a privilege value.The array keys are * values for the form and the values are the labels for the form. * @return array array of privilege options */ function GetPrivilegeOptions() { $PrivilegeFactory = new PrivilegeFactory(); return ["--" => "--"] + $PrivilegeFactory->getPrivileges(true, false); } /** * Get an array of options available for SearchGroupLogic. * @return array of options */ function GetSearchGroupLogicOptions() { return [ SearchEngine::LOGIC_OR => "OR", SearchEngine::LOGIC_AND => "AND" ]; } /** * Get the escaped option text and value for a flag value. * @param int $State TRUE if the flag is on and FALSE if the flag is OFF * @return array the first value is the text, the second is the value */ function GetSafeFlagOption($State) { return [ defaulthtmlentities(StdLib::getArrayValue(GetFlagOptions(), $State ? 1 : 0)), defaulthtmlentities($State ? 1 : 0) ]; } /** * Transform an array of field type enumerations to an array of human-readable * strings. * @param array $Types Array of field type enumerations * @return array array of field human-readable strings */ function MakeTypesHumanReadable(array $Types) { $Strings = MetadataField::$FieldTypeHumanEnums; foreach ($Types as $Constant => $Type) { $Types[$Constant] = StdLib::getArrayValue($Strings, $Constant, "Unknown"); } return $Types; } /** * Print the type field for the given metadata field data. * @param array $Data metadata field data * @param string|null $Error field error, if one exists * @return void */ function PrintTypeField(array $Data, $Error) { $AllowedTypes = MakeTypesHumanReadable($Data["AllowedTypes"]); $HasNoAllowedTypes = !count($AllowedTypes); $SafeType = defaulthtmlentities($Data["Type"]); $SafeTypeName = defaulthtmlentities(MetadataField::$FieldTypeHumanEnums[$Data["Type"]]); ?>
for="F_Type">Type printHtml(); ?> All fields.
Schema name() ?> All fields.
Name All fields.
for="F_Name">Name All fields.
for="F_Label">Display Name All fields.
Description <?PHP print $SafeValue; ?> All fields.
for="F_Instructions">Instructions <?PHP print $SafeValue; ?> All fields.
for="F_Enabled">Enabled printHtml(); ?> All fields.
for="F_Editable">Editable printHtml(); ?> All fields.
for="F_Optional">Optional printHtml(); ?> Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, User, Image, File, URL, and Point fields.
for="F_UsesQualifiers">Uses Qualifiers printHtml(); ?> Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, Image, File, URL, and Point fields.
for="F_HasItemLevelQualifiers">Has Item Level Qualifiers printHtml(); ?> Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, Image, File, URL, Email, and Point fields.
for="F_CopyOnResourceDuplication">Copy on Resource Duplication printHtml(); ?> All fields.
for="F_ObfuscateValueForAnonymousUsers">Obfuscate for Anonymous Users printHtml(); ?> Email fields.
"--"] + $Options; ?>
for="F_DefaultQualifier">Default Qualifier printHtml(); ?> Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, Image, File, URL, and Point fields.
for="F_AssociatedQualifierList">Allowed Qualifiers size(8); $OptList->multipleAllowed(true); $OptList->printHtml(); ?> Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, Image, File, URL, Email, and Point fields.
for="F_ShowQualifiers">Show Qualifiers printHtml(); ?> (on the full record page) Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, Image, File, URL, and Point fields.
for="F_IncludeInKeywordSearch">Include in Keyword Search printHtml(); ?> Text, Paragraph, Number, Tree, Controlled Name, Option, User, Image, File, and URL fields.
for="F_IncludeInAdvancedSearch">Include in Advanced Search printHtml(); ?> Text, Paragraph, Number, Date, Timestamp, Flag, Tree, Controlled Name, Option, User, Image, File, URL, and Reference fields.
for="F_IncludeInFacetedSearch">Include in Faceted Search printHtml(); ?> Tree, Controlled Name, and Option fields.
for="F_IncludeInSortOptions">Include in Sort Options printHtml(); ?> Text, Number, Date, Timestamp, and URL fields.
Search Weight (1-20) Text, Paragraph, Number, Date, Timestamp, Tree, Controlled Name, Option, User, Image, File, URL, and Reference fields.
Search Group Logic printHtml(); ?> (determines how multiple selections for this field are combined) Tree, Controlled Name, and Option fields.
Facets Show Only Terms Used In Results printHtml(); ?> (determines if search facets will show all top-level terms for the given field rather than only those associated with the current set of search results) Tree, Controlled Name, and Option fields.
Option List Field Threshold (1 or more) Tree and Controlled Name fields.
Incremental Search Field Threshold (1 or more) Tree, Controlled Name, and Reference fields.
Max Number of Search Results (10 or more) Tree, Controlled Name, and Reference fields.
for="F_UseForOaiSets">Use for OAI Sets printHtml(); ?> Tree, Controlled Name, and Option fields.
for="F_DisplayAsLIstForAdvancedSearch">Display as list for Advanced Search printHtml(); ?> Tree fields.
for="F_MaxDepthForAdvancedSearch">Max Depth For Advanced Search (1 or more)
When Display As List For Advanced Search is enabled, this sets the maximum number of levels of a Tree field to include in the list (e.g., 1 to only list top-level classifications). Tree fields.
Field Size characters Text, Number, Date, and Point fields.
" for="F_MaxLength">Max Length characters characters
(Note: making this value smaller will not truncate any existing field values) Text and URL fields.
None"; } ?>
for="F_DefaultValue[Generic]">Default Value Text and Paragraph fields.
Update Unset Values With Default Value?
None"; } ?>
for="F_DefaultValue[Numeric]">Default Value Number fields.
Update Unset Values With Default Value?
$Data["FlagOffLabel"] ?? MetadataField::getDefaultValue("FlagOffLabel"), 1 => $Data["FlagOnLabel"] ?? MetadataField::getDefaultValue("FlagOnLabel"), ]; $SafeText = defaulthtmlentities($Value ? $Options[1] : $Options[0]); $SafeValue = defaulthtmlentities($Value ? 1 : 0); ?>
for="F_DefaultValue[Flag]">Default Value printHtml(); ?> Flag fields.
null, "Y" => null]; $SafeValue = defaulthtmlentities($DefaultValue["X"]); $SafeValue2 = defaulthtmlentities($DefaultValue["Y"]); if ($Data["HasOwner"]) { if (!strlen($SafeValue)) { $SafeValue = "None"; } if (!strlen($SafeValue2)) { $SafeValue2 = "None"; } } ?>
for="F_DefaultValue[Point1]">Default Value X: , Y: X: Y: Point fields.
Update Unset Values With Default Value?
for="F_AllowHTML">Allow HTML in Text printHtml(); ?> Tree and Paragraph fields.
Min Value Number fields.
Max Value Number fields.
class="mv-form-requiredfield" for="F_PointPrecision">Point Precision digits to the left of the decimal point digits to the left of the decimal point Point fields.
" for="F_PointDecimalDigits">Decimal Digits in Point digits to the right of the decimal point digits to the right of the decimal point Point fields.
for="F_UpdateMethod">Update Method printIfEmpty(false); $OptList->printHtml(); ?> Timestamp and User fields.
Paragraph Rows Paragraph fields.
Paragraph Cols Paragraph fields.
for="F_UseWysiwygEditor">Use WYSIWYG Editor printHtml(); ?> Paragraph fields.
Flag On Label Flag fields.
Flag Off Label Flag fields.
for="F_AllowMultiple">Allow Multiple printHtml(); ?> Option fields.
getPrivileges(true, false); $Selected = $Data["UserPrivilegeRestrictions"]; ?>
for="F_UserPrivilegeRestrictions">Restrict to Users With One of the Following size(8); $OptList->multipleAllowed(true); $OptList->printHtml(); ?> User fields.
id()); $SchemaPrivs = $Schema->viewingPrivileges(); ?>
Viewing Permissions Schema requirements are: id()); ?>
This field separately requires: displaySet("ViewingPrivileges", $Data["ViewingPrivileges"]); ?> All fields.
authoringPrivileges(); $PrivsetUI = new PrivilegeEditingUI($Schema->id()); ?>
Authoring Permissions Schema requirements are: id()); ?>
This field separately requires: displaySet("AuthoringPrivileges", $Data["AuthoringPrivileges"]); ?> All fields.
id()); $SchemaPrivs = $Schema->editingPrivileges(); ?>
Editing Permissions Schema requirements are: id()); ?>
This field separately requires: displaySet("EditingPrivileges", $Data["EditingPrivileges"]); ?> All fields.
setIcon("Pencil.svg"); $EditButton->setSize(HtmlButton::SIZE_SMALL); $EditButton->setLink("index.php?P=EditMetadataSchema&SC=" . $SchemaId); return $EditButton->getHtml(); } /** * Display the option list of referenceable schema ids. * @param array $Data Metadata field data. * @param mixed $Error Field error, if one exists */ function PrintReferenceableSchemaIds(array $Data, $Error): void { $Schemas = MetadataSchema::getAllSchemas(); $OptionValues = []; foreach ($Schemas as $Schema) { $OptionValues[$Schema->Id()] = $Schema->Name(); } $OptionList = new HtmlOptionList( "F_ReferenceableSchemaIds[]", $OptionValues, $Data["ReferenceableSchemaIds"] ); $OptionList->multipleAllowed(true); $OptionList->size(count($Schemas)); ?>
Referenceable Schemas printHtml(); ?> Reference fields.
usesAndLogic() ? "AND" : "OR"; $Conditions = $PrivilegeSet->getConditions(); $Subsets = $PrivilegeSet->getSubsets(); $RequiredUserPrivileges = $PrivilegeSet->getPrivileges(); $AllSchemas = MetadataSchema::getAllSchemas(); # map of friendly names for operators $OpNames = [ "==" => "is", "!=" => "is not", ">" => "is greater than", "<" => "is less than" ]; # construct an array to hold descriptions of each priv element $Elements = []; # foreach user privilege foreach ($RequiredUserPrivileges as $Privilege) { $PrivFlag = new Privilege($Privilege); $Elements [] = "Current user has ".$PrivFlag->name()." privilege"; } # foreach condition foreach ($Conditions as $Condition) { # field conditions try { # get the field $Field = MetadataField::getField($Condition["FieldId"]); $Prefix = $AllSchemas[$Field->schemaId()]->AbbreviatedName(); $SafeName = defaulthtmlentities("[".$Prefix."] " .$Field->getDisplayName()); $SafeOperator = $OpNames[ $Condition["Operator"] ]; # proper dislpay of 'current user' tests against user fields if ($Field->type() == MetadataSchema::MDFTYPE_USER && is_null($Condition["Value"])) { $SafeValue = "current user"; } elseif ($Field->type() == MetadataSchema::MDFTYPE_OPTION) { # proper display of cname values and the contains / # does not contain test. if (ControlledName::itemExists($Condition["Value"])) { $CName = new ControlledName($Condition["Value"]); $SafeValue = defaulthtmlentities($CName->name()); } else { $SafeValue = "(INVALID VALUE Id=".$Condition["Value"].")"; } if ($Condition["Operator"] == "==") { $SafeOperator = "contains"; } elseif ($Condition["Operator"] == "!=") { $SafeOperator = "does not contain"; } } elseif ($Field->type() == MetadataSchema::MDFTYPE_FLAG) { # friendly names for flag values $SafeValue = ($Condition["Value"] == 1) ? "true" : "false"; } else { # otherwise display the literal value $SafeValue = defaulthtmlentities($Condition["Value"]); } } catch (Exception $e) { # handle invalid (or deleted) fields $SafeName = "INVALID FIELD"; $SafeValue = defaulthtmlentities($Condition["Value"]); } # append friendly description to our list $Elements [] = $SafeName." ".$SafeOperator." ".$SafeValue; } # foreach subset foreach ($Subsets as $Subset) { # for subgroups, wrap a div around a recursive call to ourself $Elements [] = "(
". getPrivilegeDescriptionHtml($Subset). "
)"; } # glue together all the elements we collected with our logic return implode(" ".$Logic."
", $Elements); } # ----- SETUP ---------------------------------------------------------------- if (!isset($H_Errors)) { throw new Exception("H_Errors not defined."); } if (!isset($H_FieldData)) { throw new Exception("H_FieldData not defined."); } if (!isset($H_Qualifiers)) { throw new Exception("H_Qualifiers not defined."); } if (!isset($H_Schema)) { throw new Exception("H_Schema not defined."); } if (!isset($H_TypeBasedDefaults)) { throw new Exception("H_TypeBasedDefaults not defined."); } if (!isset($H_Warnings)) { throw new Exception("H_Warnings not defined."); } $SafeSchemaId = defaulthtmlentities($H_Schema->Id()); $SafeId = defaulthtmlentities($H_FieldData["Id"]); $SafeName = defaulthtmlentities($H_FieldData["Name"]); $SafeMappedName = defaulthtmlentities($H_FieldData["MappedName"]); $SafeTypeAsName = defaulthtmlentities($H_FieldData["TypeAsName"]); $SafeOwner = defaulthtmlentities($H_FieldData["Owner"]); $ExportFieldButton = new HtmlButton("Export Field"); $ExportFieldButton->setIcon("FileExport.svg"); $ExportFieldButton->setSize(HtmlButton::SIZE_SMALL); $ExportFieldButton->setLink("index.php?P=DBExportField&Id=" . $SafeId); $PopulateFieldButton = new HtmlButton("Populate Field"); $PopulateFieldButton->setIcon("MagicWand.svg"); $PopulateFieldButton->setSize(HtmlButton::SIZE_SMALL); $PopulateFieldButton->addClass("mfe mfe-button mfe-submit-populatefield"); $PopulateFieldButton->setValue("Populate Field..."); $AddButton = new HtmlButton("Add Field"); $AddButton->setIcon("Plus.svg"); $AddButton->setSize(HtmlButton::SIZE_SMALL); $AddButton->makeSubmitButton(); $UpdateButton = new HtmlButton("Update Field"); $UpdateButton->setIcon("Disk.svg"); $UpdateButton->setSize(HtmlButton::SIZE_SMALL); $UpdateButton->makeSubmitButton(); $DeleteButton = new HtmlButton("Delete Field"); $DeleteButton->setIcon("Delete.svg"); $DeleteButton->setSize(HtmlButton::SIZE_SMALL); $DeleteButton->makeSubmitButton(); $CancelButton = new HtmlButton("Cancel"); $CancelButton->setIcon("Cross.svg"); $CancelButton->setSize(HtmlButton::SIZE_SMALL); $CancelButton->makeSubmitButton(); $CancelButton->addSemanticClass("btn-danger"); $AF = ApplicationFramework::getInstance(); # ----- DISPLAY -------------------------------------------------------------- ?>

# Metadata Field

(required fields are circled)

getHtml(); } if ($H_FieldData["CanPopulate"]) { print $PopulateFieldButton->getHtml(); } ?>
1) { ?>

1) { ?>

Please Note: This field is currently designated the Resource Field. Some field attributes cannot be modified and the field cannot be deleted until another metadata field is selected for Resource Field. hasPriv(PRIV_SYSADMIN)) { ?> This can be changed using the Edit Metadata Schema page. This field was created by the core software. Some field attributes cannot be modified and the field cannot be deleted. This field was created by the plugin. Some field attributes cannot be modified and the field cannot be deleted. This field cannot be deleted because at least one enabled tree field must exist to provide resource browsing functionality.To delete this field, create a new tree field or enable one that is currently disabled. This field cannot be deleted because it is currently in use by the privileges system.

Basic Information | Applies To
--- | ---
Qualifiers | Applies To
For Dublin Core compliant schemas, Qualifiers are equivalent to DC Encoding Schemes. |
Search | Applies To
Resource Editing | Applies To
OAI | Applies To
Type-Specific Information | Applies To
Privileges | Applies To

getHtml() ?> getHtml() ?> getHtml() ?> getHtml() ?>