Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3174996
Commits
23bd2c00
Commit
23bd2c00
authored
18 years ago
by
Steven Wittens
Browse files
Options
Downloads
Patches
Plain Diff
#60532
: multiple file upload broken in some browsers
parent
00f8037e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
misc/drupal.js
+6
-6
6 additions, 6 deletions
misc/drupal.js
modules/upload.module
+17
-14
17 additions, 14 deletions
modules/upload.module
modules/upload/upload.module
+17
-14
17 additions, 14 deletions
modules/upload/upload.module
with
40 additions
and
34 deletions
misc/drupal.js
+
6
−
6
View file @
23bd2c00
...
...
@@ -113,7 +113,7 @@ function HTTPPost(uri, callbackFunction, callbackParameter, object) {
* window.parent.iframeHandler() after submission.
*/
function
redirectFormButton
(
uri
,
button
,
handler
)
{
//
Make sure we hav
e an iframe to target
//
(Re)creat
e an iframe to target
.
createIframe
();
// Trap the button
...
...
@@ -140,8 +140,8 @@ function redirectFormButton(uri, button, handler) {
// Get response from iframe body
try
{
response
=
(
iframe
.
contentWindow
||
iframe
.
contentDocument
||
iframe
).
document
.
body
.
innerHTML
;
// Firefox 1.0.x hack: Re
place
control characters
response
=
response
.
replace
(
/
[\f\n\r\t
\v
]
/g
,
'
'
);
// Firefox 1.0.x hack: Re
move (corrupted)
control characters
response
=
response
.
replace
(
/
[\f\n\r\t]
/g
,
'
'
);
if
(
window
.
opera
)
{
// Opera-hack: it returns innerHTML sanitized.
response
=
response
.
replace
(
/"/g
,
'
"
'
);
...
...
@@ -151,8 +151,8 @@ function redirectFormButton(uri, button, handler) {
response
=
null
;
}
// Recreate the iframe: re-using an old iframe can sometimes cause browser bugs.
createIframe
()
;
$
(
'
redirect-target
'
).
onload
=
null
;
$
(
'
redirect-target
'
).
src
=
'
about:blank
'
;
response
=
parseJson
(
response
);
// Check response code
...
...
@@ -353,7 +353,7 @@ function createIframe() {
*/
function
deleteIframe
()
{
var
holder
=
$
(
'
redirect-holder
'
);
if
(
typeof
holder
!=
'
undefined
'
)
{
if
(
holder
!=
null
)
{
removeNode
(
holder
);
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/upload.module
+
17
−
14
View file @
23bd2c00
...
...
@@ -235,6 +235,7 @@ function upload_form_alter($form_id, &$form) {
drupal_add_js
(
'misc/progress.js'
);
drupal_add_js
(
'misc/upload.js'
);
// Attachments fieldset
$form
[
'attachments'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'File attachments'
),
...
...
@@ -245,7 +246,13 @@ function upload_form_alter($form_id, &$form) {
'#suffix'
=>
'</div>'
,
'#weight'
=>
30
,
);
$form
[
'attachments'
]
+=
_upload_form
(
$node
);
// Wrapper for fieldset contents (used by upload JS).
$form
[
'attachments'
][
'wrapper'
]
=
array
(
'#prefix'
=>
'<div id="attach-wrapper">'
,
'#suffix'
=>
'</div>'
,
);
$form
[
'attachments'
][
'wrapper'
]
+=
_upload_form
(
$node
);
$form
[
'#attributes'
][
'enctype'
]
=
'multipart/form-data'
;
}
}
...
...
@@ -268,7 +275,7 @@ function _upload_validate(&$node) {
// Bypass validation for uid = 1.
if
(
$user
->
uid
!=
1
)
{
//Update filesize accumulator.
//
Update filesize accumulator.
$filesize
+=
$file
->
filesize
;
// Validate file against all users roles.
...
...
@@ -545,6 +552,7 @@ function upload_delete_revision($node) {
function
_upload_form
(
$node
)
{
$form
[
'#theme'
]
=
'upload_form_new'
;
if
(
is_array
(
$node
->
files
)
&&
count
(
$node
->
files
))
{
$form
[
'files'
][
'#theme'
]
=
'upload_form_current'
;
$form
[
'files'
][
'#tree'
]
=
TRUE
;
...
...
@@ -568,10 +576,15 @@ function _upload_form($node) {
}
if
(
user_access
(
'upload files'
))
{
// This div is hidden when the user uploads through JS.
$form
[
'new'
]
=
array
(
'#prefix'
=>
'<div id="attach-hide">'
,
'#suffix'
=>
'</div>'
,
);
$form
[
'new'
][
'upload'
]
=
array
(
'#type'
=>
'file'
,
'#title'
=>
t
(
'Attach new file'
),
'#size'
=>
40
);
$form
[
'new'
][
'
fileop
'
]
=
array
(
'#type'
=>
'button'
,
'#value'
=>
t
(
'Attach'
),
'#name'
=>
'
fileop
'
,
'#attributes'
=>
array
(
'id'
=>
'
fileop
'
));
$form
[
'new'
][
'
attach
'
]
=
array
(
'#type'
=>
'button'
,
'#value'
=>
t
(
'Attach'
),
'#name'
=>
'
attach
'
,
'#attributes'
=>
array
(
'id'
=>
'
attach
'
));
// The class triggers the js upload behaviour.
$form
[
'
fileop
'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
url
(
'upload/js'
,
NULL
,
NULL
,
TRUE
),
'#attributes'
=>
array
(
'class'
=>
'upload'
));
$form
[
'
attach
'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
url
(
'upload/js'
,
NULL
,
NULL
,
TRUE
),
'#attributes'
=>
array
(
'class'
=>
'upload'
));
}
// Needed for JS
...
...
@@ -579,15 +592,6 @@ function _upload_form($node) {
return
$form
;
}
function
theme_upload_form_new
(
$form
)
{
$output
.
=
'<div id="fileop-wrapper">'
.
"
\n
"
;
$output
.
=
'<div id="fileop-hide">'
.
"
\n
"
;
$output
.
=
form_render
(
$form
)
.
"
\n
"
;
$output
.
=
"</div>
\n
"
;
$output
.
=
"</div>
\n
"
;
return
$output
;
}
function
theme_upload_form_current
(
&
$form
)
{
$header
=
array
(
t
(
'Delete'
),
t
(
'List'
),
t
(
'Description'
),
t
(
'Size'
));
...
...
@@ -659,7 +663,6 @@ function upload_js() {
}
$form
=
form_builder
(
'upload_js'
,
$form
);
$output
=
theme
(
'status_messages'
)
.
form_render
(
$form
);
// We send the updated file attachments form.
print
drupal_to_js
(
array
(
'status'
=>
TRUE
,
'data'
=>
$output
));
exit
;
...
...
This diff is collapsed.
Click to expand it.
modules/upload/upload.module
+
17
−
14
View file @
23bd2c00
...
...
@@ -235,6 +235,7 @@ function upload_form_alter($form_id, &$form) {
drupal_add_js
(
'misc/progress.js'
);
drupal_add_js
(
'misc/upload.js'
);
// Attachments fieldset
$form
[
'attachments'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'File attachments'
),
...
...
@@ -245,7 +246,13 @@ function upload_form_alter($form_id, &$form) {
'#suffix'
=>
'</div>'
,
'#weight'
=>
30
,
);
$form
[
'attachments'
]
+=
_upload_form
(
$node
);
// Wrapper for fieldset contents (used by upload JS).
$form
[
'attachments'
][
'wrapper'
]
=
array
(
'#prefix'
=>
'<div id="attach-wrapper">'
,
'#suffix'
=>
'</div>'
,
);
$form
[
'attachments'
][
'wrapper'
]
+=
_upload_form
(
$node
);
$form
[
'#attributes'
][
'enctype'
]
=
'multipart/form-data'
;
}
}
...
...
@@ -268,7 +275,7 @@ function _upload_validate(&$node) {
// Bypass validation for uid = 1.
if
(
$user
->
uid
!=
1
)
{
//Update filesize accumulator.
//
Update filesize accumulator.
$filesize
+=
$file
->
filesize
;
// Validate file against all users roles.
...
...
@@ -545,6 +552,7 @@ function upload_delete_revision($node) {
function
_upload_form
(
$node
)
{
$form
[
'#theme'
]
=
'upload_form_new'
;
if
(
is_array
(
$node
->
files
)
&&
count
(
$node
->
files
))
{
$form
[
'files'
][
'#theme'
]
=
'upload_form_current'
;
$form
[
'files'
][
'#tree'
]
=
TRUE
;
...
...
@@ -568,10 +576,15 @@ function _upload_form($node) {
}
if
(
user_access
(
'upload files'
))
{
// This div is hidden when the user uploads through JS.
$form
[
'new'
]
=
array
(
'#prefix'
=>
'<div id="attach-hide">'
,
'#suffix'
=>
'</div>'
,
);
$form
[
'new'
][
'upload'
]
=
array
(
'#type'
=>
'file'
,
'#title'
=>
t
(
'Attach new file'
),
'#size'
=>
40
);
$form
[
'new'
][
'
fileop
'
]
=
array
(
'#type'
=>
'button'
,
'#value'
=>
t
(
'Attach'
),
'#name'
=>
'
fileop
'
,
'#attributes'
=>
array
(
'id'
=>
'
fileop
'
));
$form
[
'new'
][
'
attach
'
]
=
array
(
'#type'
=>
'button'
,
'#value'
=>
t
(
'Attach'
),
'#name'
=>
'
attach
'
,
'#attributes'
=>
array
(
'id'
=>
'
attach
'
));
// The class triggers the js upload behaviour.
$form
[
'
fileop
'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
url
(
'upload/js'
,
NULL
,
NULL
,
TRUE
),
'#attributes'
=>
array
(
'class'
=>
'upload'
));
$form
[
'
attach
'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
url
(
'upload/js'
,
NULL
,
NULL
,
TRUE
),
'#attributes'
=>
array
(
'class'
=>
'upload'
));
}
// Needed for JS
...
...
@@ -579,15 +592,6 @@ function _upload_form($node) {
return
$form
;
}
function
theme_upload_form_new
(
$form
)
{
$output
.
=
'<div id="fileop-wrapper">'
.
"
\n
"
;
$output
.
=
'<div id="fileop-hide">'
.
"
\n
"
;
$output
.
=
form_render
(
$form
)
.
"
\n
"
;
$output
.
=
"</div>
\n
"
;
$output
.
=
"</div>
\n
"
;
return
$output
;
}
function
theme_upload_form_current
(
&
$form
)
{
$header
=
array
(
t
(
'Delete'
),
t
(
'List'
),
t
(
'Description'
),
t
(
'Size'
));
...
...
@@ -659,7 +663,6 @@ function upload_js() {
}
$form
=
form_builder
(
'upload_js'
,
$form
);
$output
=
theme
(
'status_messages'
)
.
form_render
(
$form
);
// We send the updated file attachments form.
print
drupal_to_js
(
array
(
'status'
=>
TRUE
,
'data'
=>
$output
));
exit
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment