From e27513f11e21226680c484288b3121c36d8fed15 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 9 Apr 2008 11:15:02 +0000 Subject: [PATCH] Merged revisions 47721 via svnmerge from svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r47721 | ischommer | 2008-01-08 15:58:39 +1300 (Tue, 08 Jan 2008) | 1 line formatting, syncing logic with FileField ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52402 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/SimpleImageField.php | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/forms/SimpleImageField.php b/forms/SimpleImageField.php index d46b99a93..8ac08893e 100755 --- a/forms/SimpleImageField.php +++ b/forms/SimpleImageField.php @@ -22,16 +22,35 @@ class SimpleImageField extends FileField { $imageField = ""; } - $field = "
"; - $field .= $this->createTag("input", array("type" => "file", "name" => $this->name)) . $this->createTag("input", array("type" => "hidden", "name" => "MAX_FILE_SIZE", "value" => 30*1024*1024)); - if($imageField && $imageField->exists()) { - if($imageField->hasMethod('Thumbnail') && $imageField->Thumbnail()) $field .= "Thumbnail()->URL()."\" />"; - else if($imageField->CMSThumbnail()) $field .= "CMSThumbnail()->URL()."\" />"; - else {} // This shouldn't be called but it sometimes is for some reason, so we don't do anything - } - $field .= "
"; + $html = "
"; + $html .= $this->createTag("input", + array( + "type" => "file", + "name" => $this->name, + "id" => $this->id(), + "tabindex" => $this->getTabIndex() + ) + ) . + $html .= $this->createTag("input", + array( + "type" => "hidden", + "name" => "MAX_FILE_SIZE", + "value" => $this->getAllowedMaxFileSize(), + "tabindex" => $this->getTabIndex() + ) + ); - return $field; + if($imageField && $imageField->exists()) { + if($imageField->hasMethod('Thumbnail') && $imageField->Thumbnail()) { + $html .= "Thumbnail()->URL()."\" />"; + } else if($imageField->CMSThumbnail()) { + $html .= "CMSThumbnail()->URL()."\" />"; + } + } + + $html .= "
"; + + return $html; } /**