Form file attachment icons and fileloader.js are no longer loaded inline.

This commit is contained in:
Kaleb Murphy 2008-08-14 00:28:19 +00:00
parent 771b4aeb1e
commit 478dc1d085
3 changed files with 125 additions and 16 deletions

View file

@ -24,7 +24,7 @@
- fixed: CS Thread sort on last post reply is now working correctly.
- fixed: Gallery Cross Publish now works properly
- fixed: Exposed a form element for the GalleryAlbum Others Can Add property
- fixed: Form attachment icons no longer break Safari 3 (no longer loaded inline).
7.5.19
- fixed: paginator doesn't show correct number of page links with a limit applied
- fixed: user profile defaults can contain arbitrary perl code

View file

@ -246,23 +246,13 @@ sub toHtml {
my @files = @{ $storage->getFiles } if (defined $storage);
my $maxFiles = $self->get('maxAttachments') - scalar(@files);
if ($maxFiles > 0) {
$self->session->style->setScript($self->session->url->extras('FileUploadControl.js'),{type=>"text/javascript"});
$uploadControl = '<noscript>
$uploadControl = '<script type="text/javascript" src="'.$self->session->url->extras('FileUploadControl.js') .'"></script>';
$uploadControl .= '<noscript>
</noscript>';
$uploadControl .= '<script type="text/javascript">
var fileIcons = new Array();
';
opendir(DIR,$self->session->config->get("extrasPath").'/fileIcons');
my @icons = readdir(DIR);
closedir(DIR);
foreach my $file (@icons) {
unless ($file eq "." || $file eq "..") {
my $ext = $file;
$ext =~ s/(.*?)\.gif/$1/;
$uploadControl .= 'fileIcons["'.$ext.'"] = "'.$self->session->url->extras('fileIcons/'.$file).'";'."\n";
}
}
$uploadControl .= '<script type="text/javascript" src="'.$self->session->url->extras('fileIcons.js') .'"</script>';
$uploadControl .= '<script type="text/javascript">';
$uploadControl .= sprintf q!var uploader = new FileUploadControl("%s", fileIcons, "%s","%d", "%s"); uploader.addRow(); </script>!
, $self->get("name")."_file", $i18n->get("removeLabel"), $maxFiles, $self->get("size");
$uploadControl .= WebGUI::Form::Hidden->new($self->session, {

119
www/extras/fileIcons.js Normal file
View file

@ -0,0 +1,119 @@
var fileIcons = new Array();
fileIcons["p65"] = "/extras/fileIcons/p65.gif";
fileIcons["exe"] = "/extras/fileIcons/exe.gif";
fileIcons["class"] = "/extras/fileIcons/class.gif";
fileIcons["xls"] = "/extras/fileIcons/xls.gif";
fileIcons["dia"] = "/extras/fileIcons/dia.gif";
fileIcons["hqx"] = "/extras/fileIcons/hqx.gif";
fileIcons["mp3"] = "/extras/fileIcons/mp3.gif";
fileIcons["js"] = "/extras/fileIcons/js.gif";
fileIcons["arj"] = "/extras/fileIcons/arj.gif";
fileIcons["ace"] = "/extras/fileIcons/ace.gif";
fileIcons["sxc"] = "/extras/fileIcons/sxc.gif";
fileIcons["cnf"] = "/extras/fileIcons/cnf.gif";
fileIcons["pict"] = "/extras/fileIcons/pict.gif";
fileIcons["rar"] = "/extras/fileIcons/rar.gif";
fileIcons["gz"] = "/extras/fileIcons/gz.gif";
fileIcons["ai"] = "/extras/fileIcons/ai.gif";
fileIcons["xlt"] = "/extras/fileIcons/xlt.gif";
fileIcons["jar"] = "/extras/fileIcons/jar.gif";
fileIcons["mov"] = "/extras/fileIcons/mov.gif";
fileIcons["cab"] = "/extras/fileIcons/cab.gif";
fileIcons["png"] = "/extras/fileIcons/png.gif";
fileIcons["sxg"] = "/extras/fileIcons/sxg.gif";
fileIcons["sxi"] = "/extras/fileIcons/sxi.gif";
fileIcons["dot"] = "/extras/fileIcons/dot.gif";
fileIcons["tiff"] = "/extras/fileIcons/tiff.gif";
fileIcons["tif"] = "/extras/fileIcons/tif.gif";
fileIcons["ppt"] = "/extras/fileIcons/ppt.gif";
fileIcons["stc"] = "/extras/fileIcons/stc.gif";
fileIcons["pic"] = "/extras/fileIcons/pic.gif";
fileIcons["psd"] = "/extras/fileIcons/psd.gif";
fileIcons["java"] = "/extras/fileIcons/java.gif";
fileIcons["123"] = "/extras/fileIcons/123.gif";
fileIcons["swf"] = "/extras/fileIcons/swf.gif";
fileIcons["mpeg"] = "/extras/fileIcons/mpeg.gif";
fileIcons["sdc"] = "/extras/fileIcons/sdc.gif";
fileIcons["log"] = "/extras/fileIcons/log.gif";
fileIcons["mrproject"] = "/extras/fileIcons/mrproject.gif";
fileIcons["wri"] = "/extras/fileIcons/wri.gif";
fileIcons["readme"] = "/extras/fileIcons/readme.gif";
fileIcons["as"] = "/extras/fileIcons/as.gif";
fileIcons["dwg"] = "/extras/fileIcons/dwg.gif";
fileIcons["tgz"] = "/extras/fileIcons/tgz.gif";
fileIcons["lyx"] = "/extras/fileIcons/lyx.gif";
fileIcons["css"] = "/extras/fileIcons/css.gif";
fileIcons["sxd"] = "/extras/fileIcons/sxd.gif";
fileIcons["wk3"] = "/extras/fileIcons/wk3.gif";
fileIcons["mpp"] = "/extras/fileIcons/mpp.gif";
fileIcons["sti"] = "/extras/fileIcons/sti.gif";
fileIcons["rtf"] = "/extras/fileIcons/rtf.gif";
fileIcons["sdw"] = "/extras/fileIcons/sdw.gif";
fileIcons["eps"] = "/extras/fileIcons/eps.gif";
fileIcons["xla"] = "/extras/fileIcons/xla.gif";
fileIcons["cif"] = "/extras/fileIcons/cif.gif";
fileIcons["pps"] = "/extras/fileIcons/pps.gif";
fileIcons["sylk"] = "/extras/fileIcons/sylk.gif";
fileIcons["kpr"] = "/extras/fileIcons/kpr.gif";
fileIcons["sdp"] = "/extras/fileIcons/sdp.gif";
fileIcons["gnumeric"] = "/extras/fileIcons/gnumeric.gif";
fileIcons["gif"] = "/extras/fileIcons/gif.gif";
fileIcons["sea"] = "/extras/fileIcons/sea.gif";
fileIcons["ksp"] = "/extras/fileIcons/ksp.gif";
fileIcons["tab"] = "/extras/fileIcons/tab.gif";
fileIcons["tar"] = "/extras/fileIcons/tar.gif";
fileIcons["sdd"] = "/extras/fileIcons/sdd.gif";
fileIcons["pdf"] = "/extras/fileIcons/pdf.gif";
fileIcons["jpg"] = "/extras/fileIcons/jpg.gif";
fileIcons["aw"] = "/extras/fileIcons/aw.gif";
fileIcons["txt"] = "/extras/fileIcons/txt.gif";
fileIcons["m3u"] = "/extras/fileIcons/m3u.gif";
fileIcons["sql"] = "/extras/fileIcons/sql.gif";
fileIcons["ram"] = "/extras/fileIcons/ram.gif";
fileIcons["com"] = "/extras/fileIcons/com.gif";
fileIcons["pm"] = "/extras/fileIcons/pm.gif";
fileIcons["htm"] = "/extras/fileIcons/htm.gif";
fileIcons["mdb"] = "/extras/fileIcons/mdb.gif";
fileIcons["ra"] = "/extras/fileIcons/ra.gif";
fileIcons["conf"] = "/extras/fileIcons/conf.gif";
fileIcons["iso"] = "/extras/fileIcons/iso.gif";
fileIcons["bat"] = "/extras/fileIcons/bat.gif";
fileIcons["doc"] = "/extras/fileIcons/doc.gif";
fileIcons["indd"] = "/extras/fileIcons/indd.gif";
fileIcons["dxf"] = "/extras/fileIcons/dxf.gif";
fileIcons["vdx"] = "/extras/fileIcons/vdx.gif";
fileIcons["slk"] = "/extras/fileIcons/slk.gif";
fileIcons["xlc"] = "/extras/fileIcons/xlc.gif";
fileIcons["unknown"] = "/extras/fileIcons/unknown.gif";
fileIcons[".svn"] = "/extras/fileIcons/.svn";
fileIcons["oleo"] = "/extras/fileIcons/oleo.gif";
fileIcons["tsv"] = "/extras/fileIcons/tsv.gif";
fileIcons["abw"] = "/extras/fileIcons/abw.gif";
fileIcons["wk4"] = "/extras/fileIcons/wk4.gif";
fileIcons["mpg"] = "/extras/fileIcons/mpg.gif";
fileIcons["sxm"] = "/extras/fileIcons/sxm.gif";
fileIcons["rpm"] = "/extras/fileIcons/rpm.gif";
fileIcons["pif"] = "/extras/fileIcons/pif.gif";
fileIcons["rtx"] = "/extras/fileIcons/rtx.gif";
fileIcons["vsd"] = "/extras/fileIcons/vsd.gif";
fileIcons["kwd"] = "/extras/fileIcons/kwd.gif";
fileIcons["jpeg"] = "/extras/fileIcons/jpeg.gif";
fileIcons["ps"] = "/extras/fileIcons/ps.gif";
fileIcons["wk1"] = "/extras/fileIcons/wk1.gif";
fileIcons["wav"] = "/extras/fileIcons/wav.gif";
fileIcons["mif"] = "/extras/fileIcons/mif.gif";
fileIcons["bmp"] = "/extras/fileIcons/bmp.gif";
fileIcons["sxw"] = "/extras/fileIcons/sxw.gif";
fileIcons["z"] = "/extras/fileIcons/z.gif";
fileIcons["dwf"] = "/extras/fileIcons/dwf.gif";
fileIcons["zip"] = "/extras/fileIcons/zip.gif";
fileIcons["csv"] = "/extras/fileIcons/csv.gif";
fileIcons["stw"] = "/extras/fileIcons/stw.gif";
fileIcons["xld"] = "/extras/fileIcons/xld.gif";
fileIcons["html"] = "/extras/fileIcons/html.gif";
fileIcons["avi"] = "/extras/fileIcons/avi.gif";
fileIcons["xml"] = "/extras/fileIcons/xml.gif";
fileIcons["wks"] = "/extras/fileIcons/wks.gif";
fileIcons["psp"] = "/extras/fileIcons/psp.gif";
fileIcons["config"] = "/extras/fileIcons/config.gif";
fileIcons["sit"] = "/extras/fileIcons/sit.gif";