Commit 2bac977e authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add cancel option to file browser inside edit blog post

parent 038fdd64
......@@ -125,9 +125,6 @@ $textinputform = pieform(array(
$getstring = quotestrings(array(
'mahara' => array(
),
'artefact.file' => array(
'myfiles',
),
'artefact.blog' => array(
'absolutemiddle',
'absolutebottom',
......@@ -137,7 +134,6 @@ $getstring = quotestrings(array(
'blogpost',
'border',
'bottom',
'browsemyfiles',
'cancel',
'dimensions',
'horizontalspace',
......@@ -183,19 +179,29 @@ uploader.createid = {$createid};
// File browser instance allows users to attach files from the my files area
var browser = null;
var browsebutton = INPUT({'id':'browsebutton', 'type':'button', 'class':'button',
'value':{$getstring['browsemyfiles']}, 'onclick':browsemyfiles});
function browsemyfiles() {
hideElement('browsebutton');
insertSiblingNodesAfter('browsebutton', H3(null, {$getstring['myfiles']}));
showElement('filebrowser');
browser = new FileBrowser('filebrowser', '{$wwwroot}artefact/file/myfiles.json.php', null,
function () {}, {$getstring['attach']}, attachtopost);
browser.init();
showElement('browsemyfiles');
if (!elementDimensions('foldernav')) {
browser = new FileBrowser('filebrowser', '{$wwwroot}artefact/file/myfiles.json.php', null,
function () {}, {$getstring['attach']}, attachtopost);
browser.init();
insertSiblingNodesBefore('foldernav',
INPUT({'type':'button','class':'button','value':{$getstring['cancel']},
'onclick':function () {
hideElement('browsemyfiles');
showElement('browsebutton');
}}));
}
}
addLoadEvent(function () {insertSiblingNodesBefore('filebrowser', browsebutton);});
addLoadEvent(function () {connect('browsebutton', 'onclick', browsemyfiles);});
......
......@@ -14,17 +14,21 @@
{$textinputform}
<div id='insertimage'></div>
<div id='uploader'></div>
<table id='filebrowser' style='display: none;' class='tablerenderer'>
<thead><tr>
<th></th>
<th>{str section=artefact.file tag=name}</th>
<th>{str section=artefact.file tag=description}</th>
<th>{str section=artefact.file tag=size}</th>
<th>{str section=mahara tag=date}</th>
<th></th>
</tr></thead>
<tbody><tr><td></td></tr></tbody>
</table>
<input id='browsebutton' type='button' class='button' value='{str tag=browsemyfiles section=artefact.blog}'>
<div id='browsemyfiles' style='display: none;'>
<h3>{str tag=myfiles section='artefact.file'}</h3>
<table id='filebrowser' class='tablerenderer'>
<thead><tr>
<th></th>
<th>{str section=artefact.file tag=name}</th>
<th>{str section=artefact.file tag=description}</th>
<th>{str section=artefact.file tag=size}</th>
<th>{str section=mahara tag=date}</th>
<th></th>
</tr></thead>
<tbody><tr><td></td></tr></tbody>
</table>
</div>
<h3>{str section=artefact.blog tag=attachedfiles}</h3>
<table id='attachedfiles' class='tablerenderer'>
<thead><tr>
......
Markdown is supported
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