Commit bdd3dd50 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use different IDs for newly uploaded attachments and attachments from

my files
parent 450f708e
......@@ -115,6 +115,9 @@ $form = pieform(array(
$getstring = quotestrings(array(
'mahara' => array(
),
'artefact.file' => array(
'myfiles',
),
'artefact.blog' => array(
'attach',
'blogpost',
......@@ -146,6 +149,7 @@ var browsebutton = INPUT({'id':'browsebutton', 'type':'button', 'value':{$getstr
'onclick':browsemyfiles});
function browsemyfiles() {
hideElement('browsebutton');
insertSiblingNodesAfter('browsebutton', H3(null, {$getstring['myfiles']}));
browser = new FileBrowser('filebrowser', '{$wwwroot}artefact/file/myfiles.json.php',
function () {}, {$getstring['attach']}, attachtopost);
browser.init();
......@@ -191,12 +195,13 @@ function checknoattachments() {
// Add a newly uploaded file to the attached files list.
function attachtopost(data) {
var rowid = data.uploadnumber ? 'uploaded:' + data.uploadnumber : 'existing:' + data.id;
appendChildNodes(attached.tbody,
TR({'id':'attached_new:' + data.uploadnumber},
TR({'id':rowid},
map(partial(TD,null),
[data.title, data.description,
INPUT({'type':'button', 'value':{$getstring['remove']},
'onclick':"removefrompost('attached_new:"+data.uploadnumber+"')"})])));
'onclick':"removefrompost('"+rowid+"')"})])));
checknoattachments();
}
......
......@@ -198,6 +198,9 @@ function FileBrowser(element, source, changedircallback, actionname, actioncallb
r.title);
return TD(null, link);
}
if (self.actionname) {
return TD(null, r.title);
}
return TD(null, A({'href':'download.php?file=' + r.id}, r.title));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment