rejetto forum

Customized icons per folder

0 Members and 1 Guest are viewing this topic.

Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
Hey all, Second request in one day :|

Is there a way to assign icons per folder (not icons displayed in VFS but within the actual fileserver)

Like I have a linux folder and I want to give ita  customized icon but keep the other icons blue (Folder.gif).
I went under MIME and instead of putting a file mask i put "linux" and then gave it a mime description associated with some random icon (video/mpeg) but no luck there.

Has this not been implemented yet, I would know how to do it in HTML but it would never get updated upon adding new folders. Perhaps a file called linux.gif (if foldername was "linux") and that would be what was displayed in the root.

Ideas?

-Kurt


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
If you mean on the template... u just need to change the link the folder icon downloads from... locate [folder] then the image and change the url... that'd fix that... you cant change the icon for folders to your own on hfs itself... using a mixture of Diff Template and normal template u could achieve what i think you are asking for...


Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
Yea, but that changes the folder icon for all the folders. Here is what I mean

I have these folders:

applications, linux, movies, music, remote access, scripting

I want to change the icon for Linux from the blue folder I have now (Terayon template) to a customized icon but not change all the folders. (ie I want each folder to have its own icon) Since its generated using Delphi I assume it doesnt show anywhere in the code (template or config files) the specific name of the folders because they are generated each time, but if it is, i dont plan on updating folders in root at all, so I couldjust specify Folder.gif = myicon.jpg.  Does anyone know if the folders are archived in a text file somewhere where I can manually changed the icon loaded next to them. Full Idea seen here:


<br>

Any help is appreciated.
Also, since upgrading to 2.2a this morning I get this when trying to listen to a wma/mp3 via windows media player icon but streaming (of mp3's) still work fine.


<br>

Thanks again,
-Kurt


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
Hmm... no sorry i don't think this is possible with hfs, you can change the template a folder uses atm tho... it could be done with javascript, or by manually coding the folder links and hiding the folders you create links for... only problem with that is those folders will be shown on every page... so even still, you require some javascript to only show those links at the root of the server... i haven't got time to have a go at it right now, im working on the AHAH updating server statistics atm.


Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
Appreciate the reply.

Thanks, I'll put it to the back of my mind while I get everything else going.
Other thoughts are welcome though, anyone done it sucessfully?

-Kurt


Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Replace this line:
Code: [Select]
<img src="/template/icons/folder.gif" alt="" />
with this:

Code: [Select]
<script type="text/javascript">document.write("%item-name%"=="Linux"?"<img src=\"/template/icons/linux.gif\" alt=\"\" />":"<img src=\"/template/icons/folder.gif\" alt=\"\" />");</script><noscript><img src="/template/icons/folder.gif" alt="" /></noscript>
Assuming that linux.gif is located in '/template/icons/' ;D


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
yes, with HFS you can, but NOT with THAT template.
indeed, when you change the icon in the VFS, this is reflected by the browser.
but since HFS only support small icons, the author of that template decided to use a fixed (but bigger) image.


Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
Giant Eagle, good to hear from you since you made it :)

From the code you posted it looks like its still going to make all the folders (in your template they are blue, Folder.gif) the linux icon, but I see no distinction saying that that is ONLY for the linux folder except: ...item-name%"=="Linux"?"<......

are you saying that I should replace the folder.gif line entirely and put an ...item-name%"=="Linux"?"<...... for the linux folder and a
...item-name%"=="Music"?"<...... for the music folder and so on?

Rejetto, I did see what you posted, Thank you but I think I was pretty clear, I think Eagle is saying it is possible.

Thanks,
-Kurt
« Last Edit: July 27, 2007, 01:20:09 AM by kwondra34 »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
yes i did know that solution, and very few things are impossible with computers.
but i meant it was not practical to ask people to know javascript. you are lucky Geagle made the code for you. ;)


Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
Hey, Giant Eagle.. I'm still curious where this goes, found one entry in hfs.tpl that was close to the line you mentioned to replace but that didnt work, nor did it change the folder to an X or anything) Obviously you know what your talking about but im not sure which config file to change, sorry :)

Just a little better instructions and im good :) Thanks man.

-Kurt


Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
I love you Giant Eagle.... Thank you very much... Search wasnt working well but the entry matched perfectly. Thanks much :)

-Kurt


Offline kwondra34

  • Occasional poster
  • *
    • Posts: 18
    • View Profile
Hey. got it working with multiple exceptions also. Just need some help removing borders around icons, tryed all places I could think of for border="0", little help.  Code is posted here:
Code: [Select]
[folder]
<tr>
<td class="row1" align="center" valign="middle" height="50"><a href="%item-url%" class="messageimagelink"> <script type="text/javascript">document.write("%item-name%"=="applications"?"<img src=\"/template/icons/box.gif\" alt=\"\" />":"");</script>
<script type="text/javascript">document.write("%item-name%"=="linux"?"<img src=\"/template/icons/PPT.gif\" alt=\"\" />":"");</script>
<script type="text/javascript">document.write("%item-name%"=="movies"?"<img src=\"/template/icons/MOV.gif\" alt=\"\" />":"");</script>
<script type="text/javascript">document.write("%item-name%"=="music"?"<img src=\"/template/icons/MusicStream.gif\" alt=\"\" />":"");</script>
<script type="text/javascript">document.write("%item-name%"=="remote access"?"<img src=\"/template/icons/Users.gif\" alt=\"\" />":"");</script>
<script type="text/javascript">document.write("%item-name%"=="scripting"?"<img src=\"/template/icons/INI.gif\" alt=\"\" />":"");</script>
<script type="text/javascript">document.write("%item-name%"=="television"?"<img src=\"/template/icons/Videos.gif\" alt=\"\" />":"");</script>


Semi final product seen here with borders:


Thanks everyone, especially Giant Eagle :)
-Kurt


Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Your code can be optimized a lot XD

Code: [Select]
<script type="text/javascript">var img; switch("%item-name%") {
case "applications": img="Users.gif";break
case "linux": img="PPT.gif";break
case "movies": img="MOV.gif";break
case "music": img="MusicStream.gif";break
case "remote access": img="Users.gif";break
case "scripting": img="INI.gif";break
case "television": img="Videos.gif";break
default: img="folder.gif";}
document.write("<img src=\"/template/icons/"+img+"\" alt=\"\" border=\"0\" alt=\"\" />");</script><noscript>
document.write("<img src=\"/template/icons/folder.gif\" alt=\"\" border=\"0\" alt=\"\" />"); </noscript>

It shows the default folder icon when you dont have a custom icon set for it or when the user does not hava javascript enabled. You can easily add more custom icons to it by adding this line:

case "custom name": img="custom image"; break