rejetto forum

Replacing Icons per Folder Specific not File Extensions

0 Members and 1 Guest are viewing this topic.

Offline Stonesteel

  • Occasional poster
  • *
    • Posts: 31
    • View Profile
Greetings!

I've managed to replaced the icons per file extensions, also added additional extensions and icons. I am wondering if there's a way that I can replace those icons but by folder names, not with their file extensions?
"No Matter How Gifted You Are, Alone Cannot Change The World."


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
for all folders in the VFS except HOME,
 go to properties --> Other tab --> Icon

and choice the desired icon

I don't remember if is it posible to add icon file inside a real subfolder as with Windows by desktop.ini


Offline Stonesteel

  • Occasional poster
  • *
    • Posts: 31
    • View Profile
Hello Mars, I think you are referring to the icons in the left pane of the HFS UI screen.. uhmm what I am referring is the icon in the left part of the content in the viewer's screen.
"No Matter How Gifted You Are, Alone Cannot Change The World."


Offline Stonesteel

  • Occasional poster
  • *
    • Posts: 31
    • View Profile
Any update here? appreciate your feedback, thanks. :)
"No Matter How Gifted You Are, Alone Cannot Change The World."


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
In accordance with my first message, you have to add your icons inside hfs

expert mode--> Menu -> Other options -> Add icons

then go to settings panel -> Icon masks

add the "mkv" extension  and associate the desired icon   (number 1000 and upper)

Else:
This is what is found in the default template
Quote
[file=folder=link|private]
   <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
        <input type='checkbox' class='selector' name='selection' value='%item-url%' {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
      {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
      {.if not|{.get|can access.}|<img src='/~img_lock'>.}
      <a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
      {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
      {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}

 it is also possible specify what icons to use an icon from icon masks…
/~img#      where ‘#’ is the number of the icon in the icon list of HFS.

We are using the macro SWITCH, in the next example change the default icon file by your one but you have to respect the next full syntax

Quote
<img src="{.switch|%item-ext%|,|mkv|/~img25|%item-icon%.}">

Switch works as this:
{.switch|X|separator|B,C|value1|D|value2|F|value3|default_value.}

if X == B or C then {.switch.} is replaced by value1
elseif X == D  then {.switch.} isreplaced by value2
elseif X == F  then {.switch.} isreplaced by value3
else {.switch.} isreplaced by default_value

you can replace /~img25  by a full path as /icons/mkv.ico

Quote
<img src="{.switch|%item-ext%|,|mkv|/icons/mkv.ico|%item-icon%.}">

to do that , create a real folder icons as hidden and browsable for all users and guest, and put your ico files inside


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
ok, you want to replace that with... what?
« Last Edit: October 05, 2013, 03:09:01 AM by rejetto »


Offline Stonesteel

  • Occasional poster
  • *
    • Posts: 31
    • View Profile
Hi Mars, if you notice the image I posted, I've already changed the default icon for media. here are the codes in the template that I modified, I separated the media into music and movie category and added other extensions.

Quote
[file]
<tr>
<td class="iconCol">
   <a href="%item-url%"><div style="
{.switch|%item-ext%|,|
   html,htm,url| background:url('/template/rawr_default/images/icons/www.gif') center center no-repeat
   |bat,bak,dat,ini,sys,vfs| background:url('/template/rawr_default/images/icons/settings.gif') center center no-repeat
   |msi,exe| background:url('/template/rawr_default/images/icons/application.gif') center center no-repeat
   |zip,tar,rar,gz,7z,tgz| background:url('/template/rawr_default/images/icons/archive.png') center center no-repeat
   |iso| background:url('/template/rawr_default/images/icons/iso.png') center center no-repeat
   |as,aspx,css,js,txt,as,php,tpl,xml| background:url('/template/rawr_default/images/icons/text.gif') center center no-repeat
   |rtf,otf| background:url('/template/rawr_default/images/icons/document.gif') center center no-repeat
   |pdf| background:url('/template/rawr_default/images/icons/pdf.png') center center no-repeat
   |doc,docx| background:url('/template/rawr_default/images/icons/word.png') center center no-repeat
   |xls,xlsx| background:url('/template/rawr_default/images/icons/excel.png') center center no-repeat
   |ppt,pptx| background:url('/template/rawr_default/images/icons/ppt.png') center center no-repeat
   |mp3,wma,m4a,aac,wav| background:url('/template/rawr_default/images/icons/musics.png') center center no-repeat
   |mp4,wmv,avi,divx,mkv,mov,flv,3gp,rmvb,mpg| background:url('/template/rawr_default/images/icons/media.gif') center center no-repeat
   |jpg,jpeg,png,gif|
      {.if|{.filesize|%folder-resource%\previews_and_thumbnails\thumb-%item-name%.jpg.}|
         background:url('previews_and_thumbnails/thumb-%item-name%.jpg') center center no-repeat
         |
         background:url('/template/rawr_default/images/icons/image.gif') center center no-repeat
      .}
   |
      {.if|{.filesize|/template/rawr_default/images/icons/%item-ext%.gif.}|
         background:url('/template/rawr_default/images/icons/%item-ext%.gif') center center no-repeat
         |
         background:url('/template/rawr_default/images/icons/default.gif') center center no-repeat
      .}
.}
   "></div></a>
</td>

and these are the codes in the default template.

Quote
<tr>
<td class="iconCol">
   <a href="%item-url%"><div style="
{.switch|%item-ext%|,|
   html,htm,url| background:url('/template/rawr_default/images/icons/www.gif') center center no-repeat
   |bat,bak,dat,ini,sys,vfs| background:url('/template/rawr_default/images/icons/settings.gif') center center no-repeat
   |msi,exe| background:url('/template/rawr_default/images/icons/application.gif') center center no-repeat
   |zip,tar,rar,gz,7z| background:url('/template/rawr_default/images/icons/archive.png') center center no-repeat
   |as,aspx,css,js,txt,as,php,tpl,xml| background:url('/template/rawr_default/images/icons/text.gif') center center no-repeat
   |doc,docx,xls,xlsx,rtf,ppt,pptx,otf| background:url('/template/rawr_default/images/icons/document.gif') center center no-repeat
   |mp3,mp4,wma,wmv,avi,divx,mkv,m4a,aac,mov,flv,3gp,rmvb,mpg| background:url('/template/rawr_default/images/icons/media.gif') center center no-repeat
     |jpg,jpeg,png,gif|
      {.if|{.filesize|%folder-resource%\previews_and_thumbnails\thumb-%item-name%.jpg.}|
         background:url('previews_and_thumbnails/thumb-%item-name%.jpg') center center no-repeat
         |
         background:url('/template/rawr_default/images/icons/image.gif') center center no-repeat
      .}
   |
      {.if|{.filesize|/template/rawr_default/images/icons/%item-ext%.gif.}|
         background:url('/template/rawr_default/images/icons/%item-ext%.gif') center center no-repeat
         |
         background:url('/template/rawr_default/images/icons/default.gif') center center no-repeat
      .}
.}
   "></div></a>
</td>

@Mars and rejetto, What I am asking Sirs is if there is a chance that I can change the icons based on the name of their directory, for example, In my server, I have 6 directories/real folder (Anime, Applications, Musics, Movies, Readings, Series). then if I enter the Musics folder, all the icons inside the music folder will be the same regardless of its file extensions. I hope you got my point. :)
« Last Edit: October 06, 2013, 01:54:25 AM by Stonesteel »
"No Matter How Gifted You Are, Alone Cannot Change The World."


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
what you would like, would not that all files have the same icon that represents the directory which contains them?


Offline Stonesteel

  • Occasional poster
  • *
    • Posts: 31
    • View Profile
something like that I think, for example earlier, the Music folder, all files on the Music folder (.mp3,.wav,.jpg,.txt,.png,.cue) will have the same music icon, regardless of its extension, same music icon because it was inside a music folder. :)
"No Matter How Gifted You Are, Alone Cannot Change The World."


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
I found two ways to display the icons of the parent directories

1 - display the icon of the Container directory,
this method is reliable only in descending mode. it uses the principle of storing each subfolder icon in a specific variable belonging to each folder

2 - display the icon that can be defined in one of parent folders.
 The restriction is that the directory belongs to VFS because I use the Properties-> Diff template to get the result


Application with te default template:

Quote from: Method 1
Update the section with blue lines

[+folder]
<td class='nosize'>folder<td>%item-modified%<td>%item-dl-count%
{.set|#icon_|/~img1.}
{.set|#icon{.replace| |_|{.replace|/|_|%folder%.}%item-name%_.}|%item-icon%.}

Quote from: Method 2
select an item of VFS, add those line (in  red) by using Properties-> Diff template  and replace /~img8 with your personnal icon
[icon_folder]
{.set|diff_icon|/~img8.}


 
Quote from: Method 1 & 2

[file=folder=link|private]
   <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
      Container: <img src="{.^#icon{.replace| |_|{.replace|/|_|%folder%.}.}.}">
      Style: {.$icon_folder.}<img src="{.^diff_icon.}">
      <p>
      <input type='checkbox' class='selector' name='selection' value='%item-url%' {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
      {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
      {.if not|{.get|can access.}|<img src='/~img_lock'>.}
      <a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
      {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
      {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}

Result: (see attached files)
see icons of folder in vfs  they are reproduced for "Container"

"Style" icon is  obtained by DiffTemplate
"New folder"  ---> {.set|diff_icon|/~img8.}
"le 12" --->{.set|diff_icon|/~img10.}

It is also possible to define the Diff template of Home  ;)

if you use the 1 method with your Music folder then all the items of each of its subdirectories have the same icon set in its Diff Template
« Last Edit: October 06, 2013, 06:41:12 PM by Mars »


Offline Stonesteel

  • Occasional poster
  • *
    • Posts: 31
    • View Profile
Thank you very much for your effort Mars. Is this applicable in every version of HFS? I'm currently using HFS 282. I'll give this a try in my server.  ;D
"No Matter How Gifted You Are, Alone Cannot Change The World."