Author |
Topic |
|
Intrepidone
Average Member
Canada
515 Posts |
Posted - 23 April 2002 : 10:45:00
|
Hi HuwR,
Question for you about this MOD. I have it working on V3.3.03 (very easy to install). I have edit UploadEngine.asp so depending on the file extension, it will add an Icon to click on to d-load the file that matches the file extension (as you can see in the pic below)
I did this by adding more code to UploadEngine.asp like the code below<script language="JavaScript"> <!-- function addDoc() { var fname, resultString resultString ='<%= boolSuccess %>'; fname = '<%= faname %>'; if (resultString) window.opener.document.PostTopic.Message.value+= '[ url="pop_download.asp?mode=Edit&dir=' + '<%=strFolder%>' + '&file=' + fname + '"][img ]icon_word.gif[ /img][/url ]'; window.close(); }
//--> </script> and other code in the necessary places, my question is can this be done an easier way, so I don't have to add all this code for every file extension I want a different button for. I thought I could do it in the first function addfile(), by using if's related to the file extension but could not get it.
No rush on answering as I do have it working the way I want it to, just curious if there was an easier way to accomplish this.
Intrepidone |
|
crash
Advanced Member
Netherlands
2064 Posts |
Posted - 23 April 2002 : 10:51:00
|
goodies! question: could you mail me the code(s) for that? and the images? i would LOVE to use that!
thanks already!
Crash's Site | Crash is from
|
|
|
Intrepidone
Average Member
Canada
515 Posts |
Posted - 23 April 2002 : 11:29:27
|
Sure Crash,
I am just leaving for work right now, so I'll gather the files together (and make a few more images at work ) and send them to you.
I will send you the UploadEngine.asp file with the changes I have made and all the images.
Intrepidone |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 23 April 2002 : 11:38:34
|
you could simply change the addfile() function so it accepted a parameter which is the image to display like this
function addfile(myImage) { var fname, resultString resultString ='<%= boolSuccess %>'; fname = '<%= faname %>'; if (resultString) window.opener.document.PostTopic.Message.value+= '[ url="pop_download.asp?mode=Edit&dir=' + '<%=strSubFolder%>' + '&file=' + fname + '"][ img]images\/'+ myImage + '[ /img][ /url]'; window.close(); }
then where the asp code checks the extension, assign the image to a variable which you can then pass in the call to add file like so
<a href="JavaScript:onClick= addfile(<%= myImageVar %>)">Close Window</A>
|
|
|
Intrepidone
Average Member
Canada
515 Posts |
Posted - 24 April 2002 : 15:40:59
|
Hey Crash,
It may be a few days before I can email you the files. My internet at home is down and they said it may not be up until the weekend. Me is not a happy camper because my I run my forum from my server at home, as you can see the link to the image I posted here is not working.
I am at work right now and we are very limited to what we can do behind the firewall, so it has to wait until I get going at home.
Surprised I can get to Snitz behind the Firewall
Intrepidone |
|
|
crash
Advanced Member
Netherlands
2064 Posts |
Posted - 24 April 2002 : 15:44:34
|
i'll wait for that! you will mail the code when you're at home?
Crash's Site | Crash is from
|
|
|
crash
Advanced Member
Netherlands
2064 Posts |
Posted - 30 April 2002 : 16:23:16
|
still nothing?
Crash's Site | Crash is from
|
|
|
Peopls
New Member
83 Posts |
Posted - 30 April 2002 : 16:32:23
|
If it's not too much trouble could you chuck the files over my way aswell please?
|
|
|
crash
Advanced Member
Netherlands
2064 Posts |
Posted - 30 April 2002 : 16:33:44
|
IF he/she's coming back...
Crash's Site | Crash is from
|
|
|
Intrepidone
Average Member
Canada
515 Posts |
Posted - 01 May 2002 : 08:03:49
|
Sorry Crash,
I will gather the files up when I get home from work and post it here (probably around 8pm EST)
Intrepidone
Edited by - Intrepidone on 01 May 2002 08:05:40 |
|
|
crash
Advanced Member
Netherlands
2064 Posts |
Posted - 01 May 2002 : 14:09:15
|
can't wait to get my hands on the code!!!
Crash's Site | Crash is from
|
|
|
Intrepidone
Average Member
Canada
515 Posts |
Posted - 01 May 2002 : 20:43:45
|
Ok, here it is
You can download file extensions MOD here for File Attachment MOD
I know I don't have to tell you this, but incase others use this, read the readme file first and like always, backup your UploadEngine.asp and pop_upload.asp files first.
Also, this is important !! By default I have these files in my Forum directory. You may have a link to attach a file in forum/Mods so you should change the link to forum.
What this does is very simple, in the readme are a list of file extensions I have allowed. Users like pretty pictures, so I changed the UploadEngine.asp so depending on what file extension is uploaded, it will attach an appropriate image to match that file extension. The images are ........ A Floppy Disk, Access, Excel, PowerPoint, Word, Outlook, Zip File, PDF, Notepad, I.E. and Imageing
I know diddly squat about coding and I am sure someone else could have done better so let me know how it works
Intrepidone
Edited by - Intrepidone on 01 May 2002 20:46:04 |
|
|
crash
Advanced Member
Netherlands
2064 Posts |
Posted - 02 May 2002 : 03:05:48
|
thank you! will try this asap!
Crash's Site | Crash is from
|
|
|
|
Topic |
|