BUGFIX Fixed invalid HTML in AssetAdmin_uploadiframe.ss which could have an effect on file uploads

ENHANCEMENT Removed JS generated from PHP code in AssetAdmin::UploadForm() and placed it into AssetAdmin_uploadiframe.ss



git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@80863 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-07-02 05:23:35 +00:00 committed by Sam Minnee
parent a82a320da4
commit a0b19eca51
2 changed files with 37 additions and 33 deletions

View File

@ -125,6 +125,9 @@ JS
if(isset($data['ID']) && $data['ID'] != 'root') $folder = DataObject::get_by_id("Folder", $data['ID']);
else $folder = singleton('Folder');
// Don't modify the output of the template, or it will become invalid
ContentNegotiator::disable();
return array( 'CanUpload' => $folder->canEdit());
}
@ -140,16 +143,11 @@ JS
new HiddenField("action_doUpload", "", "1"),
new FileField("Files[0]" , _t('AssetAdmin.CHOOSEFILE','Choose file: ')),
new LiteralField('UploadButton',"
<input type='submit' value='". _t('AssetAdmin.UPLOAD', 'Upload Files Listed Below'). "' name='action_upload' id='Form_UploadForm_action_upload' class='action' />
<input type=\"submit\" value=\"". _t('AssetAdmin.UPLOAD', 'Upload Files Listed Below'). "\" name=\"action_upload\" id=\"Form_UploadForm_action_upload\" class=\"action\" />
"),
new LiteralField('MultifileCode',"
<p>" . _t('AssetAdmin.FILESREADY','Files ready to upload:') ."</p>
<div id='Form_UploadForm_FilesList'></div>
<script>
var multi_selector = new MultiSelector($('Form_UploadForm_FilesList'), null, $('Form_UploadForm_action_upload'));
multi_selector.addElement($('Form_UploadForm_Files-0'));
//new window.top.document.CMSMain_upload();
</script>
<div id=\"Form_UploadForm_FilesList\"></div>
")
), new FieldSet(
));

View File

@ -1,26 +1,32 @@
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<style>
body {
padding: 0;
margin: 0;
background-color: #fff !important;
}
fieldset {
padding: 0;
margin: 0;
border-style: none;
}
</style>
<% base_tag %>
</head>
<body>
<% if CanUpload %>
$UploadForm
<% else %>
<% _t('PERMFAILED','You do not have permission to upload files into this folder.') %>
<% end_if %>
</body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<% base_tag %>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title><% _t('TITLE', 'Image Uploading Iframe') %></title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<style type="text/css">
body {
padding: 0;
margin: 0;
background-color: #fff !important;
}
fieldset {
padding: 0;
margin: 0;
border-style: none;
}
</style>
</head>
<body>
<% if CanUpload %>
$UploadForm
<% else %>
<% _t('PERMFAILED','You do not have permission to upload files into this folder.') %>
<% end_if %>
<script type="text/javascript">
var multi_selector = new MultiSelector($('Form_UploadForm_FilesList'), null, $('Form_UploadForm_action_upload'));
multi_selector.addElement($('Form_UploadForm_Files-0'));
</script>
</body>
</html>