MetadataField = $MetadataField;
$this->HumanField = new HumanMetadataField($MetadataField);
$this->HumanField->SetNotSetText("—");
}
/**
* Escape for HTML and print the value returned from
* $this->HumanField->$Method($Arguments).
* @param string $Method method name
* @param array $Arguments method arguments
*/
public function __call($Method, $Arguments)
{
$Callback = array($this->HumanField, $Method);
$Value = call_user_func_array($Callback, $Arguments);
print defaulthtmlentities($Value);
}
/**
* Print a 1 if the metadata field can be toggled (enabled/disabled) or a 0
* if it can't be.
*/
public function FieldIsTogglable()
{
if (!isset(self::$ActivePlugins))
{
global $G_PluginManager;
self::$ActivePlugins = $G_PluginManager->GetActivePluginList();
}
$Id = $this->MetadataField->Id();
$Owner = $this->MetadataField->Owner();
$OwnerIsActive = in_array($Owner, self::$ActivePlugins);
global $G_SysConfig;
if ($G_SysConfig->ResourceRatingsEnabled() &&
$this->MetadataField->Name() == "Cumulative Rating")
{
$IsTogglable = FALSE;
}
else
{
$IsTogglable = !MetadataSchema::FieldToStdNameMapping($Id);
$IsTogglable = $IsTogglable && (!$Owner || $OwnerIsActive);
}
print defaulthtmlentities($IsTogglable ? "1" : "0");
}
/**
* @var array $ActivePlugins static array of active (enabled) plugins
*/
static protected $ActivePlugins;
/**
* @var MetadataField $MetadataField metadata field
*/
protected $MetadataField;
/**
* @var HumanMetadataField $HumanField $this->MetadataField wrapped in a
* HumanMetadataField object
*/
protected $HumanField;
}
/**
* Get the display text for the field, which includes the display name and the
* name in parentheses if a label is set. The text will be properly escaped
* HTML.
* @param MetadataField $Field metadata field
* @return the display text for the field as escaped HTML
*/
function GetFieldInfoDisplayText(MetadataField $Field)
{
$DisplayName = defaulthtmlentities($Field->GetDisplayName());
$Name = defaulthtmlentities($Field->Name());
return $DisplayName . (strlen($Field->Label()) ? " (".$Name.")" : "");
}
/**
* Print "enabled" or "disabled" if the field is enabled or disabled,
* respectively.
* @param MetadataField $Field metadata field
*/
function PrintEnabledText(MetadataField $Field)
{
print $Field->Enabled() ? "enabled" : "disabled";
}
/**
* Print the escaped metadata field ID.
* @param MetadataField $Field metadata field
*/
function PrintFieldIdText(MetadataField $Field)
{
print defaulthtmlentities($Field->Id());
}
/**
* Print the metadata field name text, which includes a link to the field
* editing page, the name of the field, the label of the field, and a help
* tooltip containing the field description.
* @param MetadataField $Field metadata field
*/
function PrintFieldNameText(MetadataField $Field)
{
global $AF;
$SafeFieldId = defaulthtmlentities($Field->Id());
$SafeFieldName = defaulthtmlentities(GetFieldInfoDisplayText($Field));
$SafeTitle = defaulthtmlentities(strip_tags($Field->Description()));
$SafeTooltip = defaulthtmlentities($Field->Description());
$HelpImage = $Field->Enabled() ? "help.png" : "help_disabled.png";
?>
Id());
?>
Edit
Id()] = $Schema->Name() . " Schema";
}
PrintOptionList("SC", $Options, $SchemaInUse->Id(), TRUE);
}
# ----- MAIN -----------------------------------------------------------------
$SafeSchemaId = defaulthtmlentities($H_Schema->Id());
$ChosenView = GetArrayValue($_GET, "View", "Metadata");
$Views = array(
"Metadata" => ".mfe-group-metadata",
"Display" => ".mfe-group-display",
"Search" => ".mfe-group-search");
# remove the chosen view
unset($Views[$ChosenView]);
# settings that should not be displayed or otherwise used
$DisabledSettings = array(
".mfe-field-userprivilegerestrictions",
".mfe-field-updatemethod",
".mfe-field-showqualifiers",
".mfe-field-associatedqualifierlist",
".mfe-field-useforoaisets",
".mfe-field-paragraphrows",
".mfe-field-paragraphcols",
".mfe-field-usewysiwygeditor",
".mfe-field-minvalue",
".mfe-field-maxvalue",
".mfe-field-flagonlabel",
".mfe-field-flagofflabel",
".mfe-field-defaultalttext",
".mfe-field-maxheight",
".mfe-field-maxwidth",
".mfe-field-maxpreviewheight",
".mfe-field-maxpreviewwidth",
".mfe-field-maxthumbnailheight",
".mfe-field-maxthumbnailwidth",
".mfe-field-pointprecision",
".mfe-field-pointdecimaldigits");
?>