Commit 100cde3f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Ugly file,folder icons stolen from apache

parent a52ded3f
......@@ -39,10 +39,6 @@ $javascript = <<<JAVASCRIPT
var copyrightnotice = '{$copyright}';
var browser = new FileBrowser('filelist', '{$wwwroot}artefact/file/myfiles.json.php', {'adminfiles':true});
browser.createfolderscript = '{$wwwroot}artefact/file/createfolder.json.php';
browser.deletescript = '{$wwwroot}artefact/file/delete.json.php';
browser.updatemetadatascript = '{$wwwroot}artefact/file/updatemetadata.json.php';
browser.downloadscript = '{$wwwroot}artefact/file/download.php';
var uploader = new FileUploader('uploader', '{$wwwroot}artefact/file/upload.php', {'adminfiles':true},
null, null, browser.refresh, browser.fileexists);
browser.changedircallback = uploader.updatedestination;
......
......@@ -15,6 +15,7 @@
<div id='uploader'></div>
<table id='filebrowser' style='display: none;'>
<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>
......
......@@ -18,10 +18,10 @@ function FileBrowser(element, source, statevars, changedircallback, actionname,
this.actionname = actionname;
this.canmodify = !actionname;
this.filenames = {};
this.deletescript = 'delete.json.php';
this.createfolderscript = 'createfolder.json.php';
this.updatemetadatascript = 'updatemetadata.json.php';
this.downloadscript = 'download.php';
this.deletescript = config.wwwroot+'artefact/file/delete.json.php';
this.createfolderscript = config.wwwroot+'artefact/file/createfolder.json.php';
this.updatemetadatascript = config.wwwroot+'artefact/file/updatemetadata.json.php';
this.downloadscript = config.wwwroot+'artefact/file/download.php';
if (this.actionname) {
this.lastcolumnfunc = function(r) {
......@@ -73,6 +73,7 @@ function FileBrowser(element, source, statevars, changedircallback, actionname,
self.element,
self.source,
[
function (r) { return TD(null, self.icon(r.artefacttype)); },
self.formatname,
'description',
function (r) { return TD(null, (r.artefacttype != 'folder') ? self.showsize(r.size) : null); },
......@@ -202,7 +203,7 @@ function FileBrowser(element, source, statevars, changedircallback, actionname,
this.showsize = function(bytes) {
if (bytes < 1024) {
return bytes + 'b';
return bytes + (bytes > 0 ? 'b' : '');
}
if (bytes < 1048576) {
return Math.floor((bytes / 1024) * 10 + 0.5) / 10 + 'k';
......@@ -210,6 +211,10 @@ function FileBrowser(element, source, statevars, changedircallback, actionname,
return Math.floor((bytes / 1048576) * 10 + 0.5) / 10 + 'M';
}
this.icon = function (type) {
return IMG({'src':config.themeurl+type+'.gif'});
}
this.formatname = function(r) {
self.filenames[r.title] = true;
if (r.artefacttype == 'folder') {
......
......@@ -10,6 +10,7 @@
<div id="uploader"></div>
<table id="filelist" class="tablerenderer">
<thead><tr>
<th></th>
<th>{str tag=name section=artefact.file}</th>
<th>{str tag=description section=artefact.file}</th>
<th>{str tag=size section=artefact.file}</th>
......
......@@ -10,6 +10,7 @@
<div id="uploader"></div>
<table id="filelist" class="tablerenderer">
<thead><tr>
<th></th>
<th>{str tag=name section=artefact.file}</th>
<th>{str tag=description section=artefact.file}</th>
<th>{str tag=size section=artefact.file}</th>
......
......@@ -4,7 +4,8 @@
<title>{$title|default:"Mahara"|escape}</title>
<script type="text/javascript">
var config = {literal}{{/literal}
'themeurl': '{$THEMEURL}'
'themeurl': '{$THEMEURL}',
'wwwroot': '{$WWWROOT}'
{literal}}{/literal};
</script>
{foreach from=$JAVASCRIPT item=script} <script type="text/javascript" src="{$script}"></script>
......
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