BUGFIX Fixed additional tabs for image popus in AssetTableField. They we're not being generated in non-english interfaces due to the translated title being used as the tab identifier

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@68757 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-12-13 22:27:04 +00:00 committed by Sam Minnee
parent 9845cadb3b
commit b62d7d832b

View File

@ -79,7 +79,7 @@ class AssetTableField extends ComplexTableField {
$detailFormFields = new FieldSet( $detailFormFields = new FieldSet(
new TabSet("BottomRoot", new TabSet("BottomRoot",
new Tab(_t('AssetTableField.MAIN', 'Main'), $mainTab = new Tab('Main',
new TextField("Title", _t('AssetTableField.TITLE','Title')), new TextField("Title", _t('AssetTableField.TITLE','Title')),
new TextField("Name", _t('AssetTableField.FILENAME','Filename')), new TextField("Name", _t('AssetTableField.FILENAME','Filename')),
new LiteralField("AbsoluteURL", $urlLink), new LiteralField("AbsoluteURL", $urlLink),
@ -91,59 +91,55 @@ class AssetTableField extends ComplexTableField {
) )
) )
); );
$mainTab->setTitle(_t('AssetTableField.MAIN', 'Main'));
if(is_a($childData,'Image')) { if(is_a($childData,'Image')) {
$tab = $detailFormFields->findOrMakeTab("BottomRoot.Image", _t('AssetTableField.IMAGE', 'Image'));
$big = $childData->URL; $big = $childData->URL;
$thumbnail = $childData->getFormattedImage('AssetLibraryPreview')->URL; $thumbnail = $childData->getFormattedImage('AssetLibraryPreview')->URL;
// Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab // Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab
$detailFormFields->addFieldToTab("BottomRoot."._t('AssetTableField.MAIN','Main'), $detailFormFields->addFieldToTab('BottomRoot.Main',
new ReadonlyField("Dimensions", _t('AssetTableField.DIM','Dimensions')), new ReadonlyField("Dimensions", _t('AssetTableField.DIM','Dimensions'))
"Created"
); );
$detailFormFields->addFieldToTab("BottomRoot", $tab->push(
new Tab(_t('AssetTableField.IMAGE', 'Image'), new LiteralField("ImageFull",
new LiteralField("ImageFull", '<a id="ImageEditorActivator" href="javascript: void(0)">' . "<img id='thumbnailImage' src='{$thumbnail}?r=" . rand(1,100000) . "' alt='{$childData->Name}' /><p>"._t('AssetTableField.EDITIMAGE', 'Edit this image')."</p>" . '</a>' .
'<a id="ImageEditorActivator" href="javascript: void(0)">' . "<img id='thumbnailImage' src='{$thumbnail}?r=" . rand(1,100000) . "' alt='{$childData->Name}' /><p>"._t('AssetTableField.EDITIMAGE', 'Edit this image')."</p>" . '</a>' . '<script type="text/javascript" src="cms/javascript/ImageEditor/Activator.js"></script><script type="text/javascript">var imageActivator = new ImageEditor.Activator.initialize();Event.observe("ImageEditorActivator","click",imageActivator.onOpen);</script>'
'<script type="text/javascript" src="cms/javascript/ImageEditor/Activator.js"></script><script type="text/javascript">var imageActivator = new ImageEditor.Activator.initialize();Event.observe("ImageEditorActivator","click",imageActivator.onOpen);</script>' )
)
),
'Main'
); );
if(class_exists('GalleryFile')) { if(class_exists('GalleryFile')) {
$detailFormFields->addFieldToTab("BottomRoot", $tab = $detailFormFields->findOrMakeTab("BottomRoot.GalleryOptions", _t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'));
new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), $tab->push(
new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ) new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') )
)
); );
} }
} }
else if (class_exists('GalleryFile')) { else if (class_exists('GalleryFile')) {
$tab = $detailFormFields->findOrMakeTab("BottomRoot.GalleryOptions", _t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'));
if( $childData->Extension == 'swf' ) { if( $childData->Extension == 'swf' ) {
$detailFormFields->addFieldToTab("BottomRoot", $tab->push(
new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ),
new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ), new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ),
new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ), new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') ),
new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') ), new HeaderField( 'SWFFileOptionsHeader', _t('AssetTableField.SWFFILEOPTIONS', 'SWF File Options') ),
new HeaderField( 'SWFFileOptionsHeader', _t('AssetTableField.SWFFILEOPTIONS', 'SWF File Options') ), new CheckboxField( 'Embed', _t('AssetTableField.ISFLASH', 'Is A Flash Document') ),
new CheckboxField( 'Embed', _t('AssetTableField.ISFLASH', 'Is A Flash Document') ), new CheckboxField( 'LimitDimensions', _t('AssetTableField.DIMLIMT', 'Limit The Dimensions In The Popup Window') )
new CheckboxField( 'LimitDimensions', _t('AssetTableField.DIMLIMT', 'Limit The Dimensions In The Popup Window') )
)
); );
} }
else { else {
$detailFormFields->addFieldToTab("BottomRoot", $tab = $detailFormFields->findOrMakeTab("BottomRoot.GalleryOptions", _t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'));
new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), $tab->push(
new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ), new TextField( "Content", _t('AssetTableField.CAPTION', 'Caption') ),
new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ), new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ),
new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') ) new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') )
)
); );
} }
} }
if($childData && $childData->hasMethod('BackLinkTracking')) { if($childData && $childData->hasMethod('BackLinkTracking')) {
$links = $childData->BackLinkTracking(); $links = $childData->BackLinkTracking();
if($links->exists()) { if($links->exists()) {