"A problem was encountered uploading the file %s for the %s field. (%s)",
ERR_ZEROLENGTH => "The file %s uploaded to the %s field was empty (zero length).",
ERR_IMAGEUPLOADERROR => "A problem was encountered uploading the image file %s for the %s field. (%s)",
ERR_UNSUPPORTEDIMAGEFORMAT => "The image file %s uploaded for the %s field was in an unsupported image format.",
ERR_UNKNOWNIMAGETYPE => "The image file %s uploaded for the %s field was of an unknown type.",
ERR_REQUIREDFIELDEMPTY => "%s%s is a required field.",
ERR_POSTEMPTY => "File or image upload was too large (No POST data received)",
ERR_IMAGESTORE => "There were problems with the image store:%s Contact the site administrator with this error to resolve them.",
ERR_TEMPSTORE => "tmp does not exist or is not writeable, contact the site administrator with this error.",
ERR_FILESTORE => "FileStorage does not exist or is not writeable, contact the site administrator with this error."
);
?>
GetDisplayName(), $ErrorInfoTwo);
?>
UserCanViewField($User, $Field))
{
$Edit = $EditingAllowed
? $Resource->UserCanEditField($User, $Field) : FALSE;
# if the field is not editable, don't allow editing in this
# interface
if (!$Field->Editable())
{
$Edit = FALSE;
}
$Error = $ErrorCode && in_array($Field->Id(), $ErrorFieldIds);
$EditValue = $Resource->GetByField($Field);
global $AF;
$SignalResult = $AF->SignalEvent(
($Edit ? "EVENT_PRE_FIELD_EDIT_FILTER"
: "EVENT_FIELD_DISPLAY_FILTER"), array(
"Field" => $Field,
"Resource" => $Resource,
"Value" => $EditValue));
$EditValue = $SignalResult["Value"];
# get additional HTML to display, if any
$Context = $Edit ? "EDIT" : "EDIT_COMPLETE_DISPLAY";
$SignalResult = $AF->SignalEvent(
"EVENT_APPEND_HTML_TO_FIELD_DISPLAY",
array(
"Field" => $Field, "Resource" => $Resource,
"Context" => $Context, "Html" => NULL));
$Html = $SignalResult["Html"];
switch ($Field->Type())
{
case MetadataSchema::MDFTYPE_TEXT:
case MetadataSchema::MDFTYPE_NUMBER:
case MetadataSchema::MDFTYPE_DATE:
case MetadataSchema::MDFTYPE_URL:
DisplayTextField(
$Field, $Resource, $Edit, $Error, $EditValue, $Html);
break;
case MetadataSchema::MDFTYPE_TIMESTAMP:
DisplayTimestampField(
$Field, $Resource, $Edit,
$Error, $EditValue, $Html);
break;
case MetadataSchema::MDFTYPE_POINT:
DisplayPointField(
$Field, $Resource, $Edit, $Error, $EditValue, $Html);
break;
case MetadataSchema::MDFTYPE_PARAGRAPH:
DisplayParagraphField(
$Field, $Resource, $Edit, $Error, $EditValue, $Html);
break;
case MetadataSchema::MDFTYPE_FLAG:
DisplayFlagField(
$Field, $Resource, $Edit, $Error, $EditValue, $Html);
break;
case MetadataSchema::MDFTYPE_TREE:
DisplayTreeField($Field, $Resource, $Edit, $Error, $Html);
break;
case MetadataSchema::MDFTYPE_CONTROLLEDNAME:
DisplayControlledNameField($Field, $Resource, $Edit, $Error, $Html);
break;
case MetadataSchema::MDFTYPE_OPTION:
DisplayOptionField($Field, $Resource, $Edit, $Error, $Html);
break;
case MetadataSchema::MDFTYPE_USER:
DisplayUserField($Field, $Resource, $Edit, $Error, $Html);
break;
case MetadataSchema::MDFTYPE_IMAGE:
DisplayImageField($Field, $Resource, $Edit, $Error, $Html);
break;
case MetadataSchema::MDFTYPE_FILE:
DisplayFileField($Field, $Resource, $Edit, $Error, $Html);
break;
}
}
}
?>
GetByField($Field);
# retrieve all possible values if user can edit this field
if ($IsEditable)
{
$Options = $Field->GetPossibleValues();
asort($Options);
}
# otherwise use just options that are set to display
else
{
$Options = $SetOptions;
}
$MaxLength = 0;
# determine the length of the longest value
foreach ($Options as $OptionName)
{
$Length = strlen($OptionName);
if ($Length > $MaxLength)
{
$MaxLength = $Length;
}
}
# determine how many values per row based on length of longest value
if ($MaxLength > 25) { $OptionsPerRow = 2; }
else if ($MaxLength > 17) { $OptionsPerRow = 3; }
else if ($MaxLength > 12) { $OptionsPerRow = 4; }
else { $OptionsPerRow = 5; }
# determine number of rows
$OptionCount = count($Options);
$NumberOfRows = intval(($OptionCount + ($OptionsPerRow - 1)) / $OptionsPerRow);
?>
1) { ?> class="cw-content-tallrow">
";
foreach ($Options as $OptionId => $OptionName)
{
?>