Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
d6af6b17
Commit
d6af6b17
authored
Dec 19, 2006
by
Richard Mansfield
Browse files
Pass upload script to uploader
parent
975bafa8
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/index.php
View file @
d6af6b17
...
...
@@ -35,7 +35,7 @@ $javascript = <<<JAVASCRIPT
var copyrightnotice = '{$copyright}';
var browser = new FileBrowser('filelist');
var uploader = new FileUploader('uploader', null, null, browser.refresh, browser.fileexists);
var uploader = new FileUploader('uploader',
'upload.php',
null, null, browser.refresh, browser.fileexists);
browser.changedircallback = uploader.updatedestination;
JAVASCRIPT;
...
...
htdocs/artefact/file/js/uploader.js
View file @
d6af6b17
function
FileUploader
(
element
,
foldername
,
folderid
,
uploadcallback
,
fileexists
)
{
function
FileUploader
(
element
,
uploadscript
,
foldername
,
folderid
,
uploadcallback
,
fileexists
)
{
var
self
=
this
;
this
.
element
=
element
;
this
.
foldername
=
foldername
?
foldername
:
get_string
(
'
home
'
)
;
this
.
uploadscript
=
uploadscript
;
this
.
folderid
=
folderid
;
this
.
foldername
=
foldername
?
foldername
:
get_string
(
'
home
'
);
this
.
uploadcallback
=
uploadcallback
;
if
(
typeof
(
fileexists
)
==
'
function
'
)
{
...
...
@@ -42,7 +43,7 @@ function FileUploader(element, foldername, folderid, uploadcallback, fileexists)
this
.
initform
=
function
()
{
var
form
=
FORM
({
'
method
'
:
'
post
'
,
'
id
'
:
'
uploadform
'
,
'
enctype
'
:
'
multipart/form-data
'
,
'
encoding
'
:
'
multipart/form-data
'
,
'
action
'
:
'
upload
.php
'
,
'
target
'
:
''
});
'
action
'
:
self
.
upload
script
,
'
target
'
:
''
});
var
cancelform
=
function
()
{
if
(
$
(
'
uploadformmessage
'
))
{
$
(
'
uploadformmessage
'
).
innerHTML
=
''
;
...
...
@@ -57,11 +58,12 @@ function FileUploader(element, foldername, folderid, uploadcallback, fileexists)
};
var
notice
=
SPAN
(
null
);
notice
.
innerHTML
=
copyrightnotice
;
var
destinationattributes
=
(
self
.
folderid
===
false
)
?
{
'
style
'
:
'
display: none;
'
}
:
null
;
appendChildNodes
(
form
,
TABLE
(
null
,
TBODY
(
null
,
TR
(
null
,
TH
({
'
colSpan
'
:
2
},
LABEL
(
null
,
get_string
(
'
uploadfile
'
)))),
TR
(
null
,
TH
(
null
,
LABEL
(
null
,
get_string
(
'
destination
'
))),
TR
(
destinationattributes
,
TH
(
null
,
LABEL
(
null
,
get_string
(
'
destination
'
))),
TD
(
null
,
SPAN
({
'
id
'
:
'
uploaddest
'
},
self
.
foldername
))),
TR
(
null
,
TH
(
null
,
LABEL
(
null
,
get_string
(
'
copyrightnotice
'
))),
TD
(
null
,
INPUT
({
'
type
'
:
'
checkbox
'
,
'
name
'
:
'
notice
'
}),
notice
)),
...
...
@@ -81,6 +83,7 @@ function FileUploader(element, foldername, folderid, uploadcallback, fileexists)
'
onclick
'
:
function
()
{
if
(
self
.
sendform
(
true
))
{
cancelform
();
}
}}),
INPUT
({
'
type
'
:
'
button
'
,
'
value
'
:
get_string
(
'
cancel
'
),
'
onclick
'
:
cancelform
}))))));
hideElement
(
form
.
replace
);
hideElement
(
form
);
return
form
;
...
...
@@ -155,7 +158,7 @@ function FileUploader(element, foldername, folderid, uploadcallback, fileexists)
}
replaceChildNodes
(
$
(
'
uploadstatusline
'
+
data
.
uploadnumber
),
IMG
({
'
src
'
:
config
.
themeurl
+
image
}),
data
.
message
);
this
.
uploadcallback
();
this
.
uploadcallback
(
data
);
}
addLoadEvent
(
this
.
init
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment