Commit 1e084f8e authored by Francois Marier's avatar Francois Marier
Browse files

file browser: remove confusing UI in folder block (bug #808593)



The broken download link has been removed when a directory is
selected (both in the AJAX call and the form setup).

This also fixes the display of the "No files found" message to
make sure that it's only displayed when the selection list is
empty and to hide it in the case of folder selection.

Change-Id: I1a2b2e5d6ea7cf803b7c9d23e9a91186a39d9b03
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent 58d74fc4
......@@ -545,9 +545,16 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
}
var remove = INPUT({'type': 'submit', 'class':'button small unselect', 'name':self.id+'_unselect[' + id + ']', 'value':get_string('remove')});
connect(remove, 'onclick', self.unselect);
filelink = ''
if (self.filedata[id].artefacttype == 'folder') {
filelink = self.filedata[id].title;
}
else {
filelink = A({'href':self.config.wwwroot + 'artefact/file/download.php?file=' + id, 'target':'_blank'}, self.filedata[id].title);
}
appendChildNodes(tbody, TR({'class': 'r' + rows.length % 2 + (highlight ? ' highlight-file' : '')},
TD(null, IMG({'src':self.filedata[id].icon})),
TD(null, A({'href':self.config.wwwroot + 'artefact/file/download.php?file=' + id, 'target':'_blank'}, self.filedata[id].title)),
TD(null, filelink),
TD(null, self.filedata[id].description),
TD(null, remove, INPUT({'type':'hidden', 'name':self.id+'_selected[' + id + ']', 'value':id}))
));
......
{if $config.select}
{include file="artefact:file:form/selectedlist.tpl" selectedlist=$selectedlist prefix=$prefix highlight=$highlight}
{include file="artefact:file:form/selectedlist.tpl" selectedlist=$selectedlist prefix=$prefix highlight=$highlight selectfolders=$config.selectfolders}
{/if}
<script type="text/javascript">
......
<p id="{$prefix}_empty_selectlist"{if !$selectedlist} class="hidden"{/if}>{str tag=nofilesfound section=artefact.file}</p>
<p id="{$prefix}_empty_selectlist"{if $selectedlist} class="hidden"{/if}>{if !$selectfolders}{str tag=nofilesfound section=artefact.file}{/if}</p>
<table id="{$prefix}_selectlist" class="fullwidth {if !$selectedlist} hidden{/if}">
<thead>
<tr>
......@@ -16,7 +16,7 @@
<img src="{if $file->artefacttype == 'image'}{$WWWROOT}artefact/file/download.php?file={$file->id}&size=20x20{else}{theme_url filename=images/`$file->artefacttype`.gif}{/if}">
</td>
<td class="valign">
<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" target="_blank" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}">{$displaytitle}</a>
{if $selectfolders}{$displaytitle}{else}<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" target="_blank" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}">{$displaytitle}</a>{/if}
</td>
<td class="valign">{$file->description}</td>
<td>
......
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