ENHANCEMENT Changed markup of right panel forms in HtmlEditorField, titlebars and close buttons are now created through JavaScript. Also wrapped all fields in a container to make them easy to scroll in the panel

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92482 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:22:44 +00:00
parent fe6c80cf1f
commit 70deaa44e4

View File

@ -207,7 +207,11 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$this->controller,
"{$this->name}/LinkForm",
new FieldSet(
new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close').'" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.LINK', 'Link') . '</h2>'),
new LiteralField(
'Heading',
sprintf('<h3>%s</h3>', _t('HtmlEditorField.LINK', 'Link'))
),
$contentComposite = new CompositeField(
new OptionsetField(
'LinkType',
_t('HtmlEditorField.LINKTO', 'Link to'),
@ -219,7 +223,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
'file' => _t('HtmlEditorField.LINKFILE', 'Download a file'),
)
),
new TreeDropdownField('internal', _t('HtmlEditorField.PAGE', "Page"), 'SiteTree', 'ID', 'MenuTitle'),
new TreeDropdownField('internal', _t('HtmlEditorField.PAGE', "Page"), 'SiteTree', 'URLSegment', 'MenuTitle'),
new TextField('external', _t('HtmlEditorField.URL', 'URL'), 'http://'),
new EmailField('email', _t('HtmlEditorField.EMAIL', 'Email address')),
new TreeDropdownField('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'Filename'),
@ -227,6 +231,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
new TextField('LinkText', _t('HtmlEditorField.LINKTEXT', 'Link text')),
new TextField('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')),
new CheckboxField('TargetBlank', _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?'))
)
),
new FieldSet(
new FormAction('insert', _t('HtmlEditorField.BUTTONINSERTLINK', 'Insert link')),
@ -234,6 +239,8 @@ class HtmlEditorField_Toolbar extends RequestHandler {
)
);
$contentComposite->addExtraClass('content');
$form->loadDataFrom($this);
return $form;
@ -247,11 +254,11 @@ class HtmlEditorField_Toolbar extends RequestHandler {
*/
function ImageForm() {
Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/swfupload.js');
Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js");
Requirements::css('cms/css/TinyMCEImageEnhancement.css');
Requirements::javascript('cms/javascript/TinyMCEImageEnhancement.js');
Requirements::javascript(CMS_DIR . '/javascript/Upload.js');
Requirements::css(CMS_DIR .'/css/TinyMCEImageEnhancement.css');
Requirements::javascript(CMS_DIR . '/javascript/TinyMCEImageEnhancement.js');
Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/SWFUpload.js');
/**
* @todo Adding folders via this screen is not enabled just yet as it is still
@ -261,24 +268,24 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$this->controller,
"{$this->name}/ImageForm",
new FieldSet(
new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close') . '" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.IMAGE', 'Image') . '</h2>'),
new LiteralField(
'Heading',
sprintf('<h3>%s</h3>', _t('HtmlEditorField.IMAGE', 'Image'))
),
$contentComposite = new CompositeField(
new TreeDropdownField('FolderID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder'),
new LiteralField('AddFolderOrUpload',
'<div id="AddFolderGroup" style="display: none;">
'<div style="clear:both;"></div><div id="AddFolderGroup" style="display: none">
<a style="" href="#" id="AddFolder" class="link">' . _t('HtmlEditorField.CREATEFOLDER','Create Folder') . '</a>
<input style="display: none; margin-left: 2px; width: 94px;" id="NewFolderName" class="addFolder" type="text">
<a style="display: none;" href="#" id="FolderOk" class="link addFolder">' . _t('HtmlEditorField.OK','Ok') . '</a>
<a style="display: none;" href="#" id="FolderCancel" class="link addFolder">' . _t('HtmlEditorField.FOLDERCANCEL','Cancel') . '</a>
</div>
<![if !IE]>
<div id="UploadGroup" class="group" style="margin: 0 0 0 5px; clear: both; padding-top: 3px">
<div id="UploadGroup" class="group" style="display: none; margin-top: 2px;">
<a href="#" id="SWFUploadButton" class="link">' . _t('HtmlEditorField.UPLOAD','Upload') . '</a>
</div>
</div>'
<div id="UploadFiles">
</div>
<![endif]>'
),
new TextField('getimagesSearch', _t('HtmlEditorField.SEARCHFILENAME', 'Search by file name')),
new ThumbnailStripField('FolderImages', 'FolderID', 'getimages'),
@ -299,12 +306,15 @@ class HtmlEditorField_Toolbar extends RequestHandler {
new TextField('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), 100),
new TextField('Height', " x " . _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), 100)
)
)
),
new FieldSet(
new FormAction('insertimage', _t('HtmlEditorField.BUTTONINSERTIMAGE', 'Insert image'))
)
);
$contentComposite->addExtraClass('content');
$form->disableSecurityToken();
$form->loadDataFrom($this);
@ -313,15 +323,19 @@ class HtmlEditorField_Toolbar extends RequestHandler {
function FlashForm() {
Requirements::javascript(THIRDPARTY_DIR . "/behaviour.js");
Requirements::javascript(CMS_DIR . '/javascript/Upload.js');
Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js");
Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/swfupload.js');
Requirements::javascript(CMS_DIR . '/javascript/Upload.js');
Requirements::javascript(THIRDPARTY_DIR . '/SWFUpload/SWFUpload.js');
$form = new Form(
$this->controller,
"{$this->name}/FlashForm",
new FieldSet(
new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="'._t('HtmlEditorField.CLOSE', 'close').'" title="'._t('HtmlEditorField.CLOSE', 'close').'" />'._t('HtmlEditorField.FLASH', 'Flash').'</h2>'),
new LiteralField(
'Heading',
sprintf('<h3>%s</h3>', _t('HtmlEditorField.FLASH', 'Flash'))
),
$contentComposite = new CompositeField(
new TreeDropdownField("FolderID", _t('HtmlEditorField.FOLDER'), "Folder"),
new TextField('getflashSearch', _t('HtmlEditorField.SEARCHFILENAME', 'Search by file name')),
new ThumbnailStripField("Flash", "FolderID", "getflash"),
@ -329,11 +343,15 @@ class HtmlEditorField_Toolbar extends RequestHandler {
new TextField("Width", _t('HtmlEditorField.IMAGEWIDTHPX', "Width"), 100),
new TextField("Height", "x " . _t('HtmlEditorField.IMAGEHEIGHTPX', "Height"), 100)
)
)
),
new FieldSet(
new FormAction("insertflash", _t('HtmlEditorField.BUTTONINSERTFLASH', 'Insert Flash'))
)
);
$contentComposite->addExtraClass('content');
$form->loadDataFrom($this);
$form->disableSecurityToken();
return $form;