Dotclear


Ignore:
Timestamp:
02/05/14 15:53:27 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Visually split each group of files in three sub-groups (if any) : theme's files, parent's theme's file, template set's files, fixes #1704

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/themeEditor/class.themeEditor.php

    r2607 r2647  
    4747     } 
    4848 
    49      public function filesList($type,$item='%1$s') 
     49     public function filesList($type,$item='%1$s',$split=true) 
    5050     { 
    5151          $files = $this->getFilesFromType($type); 
     
    5656 
    5757          $list = ''; 
    58           foreach ($files as $k => $v) 
    59           { 
    60                if (strpos($v,$this->user_theme) === 0) { 
    61                     $li = sprintf('<li class="default-file">%s</li>',$item); 
    62                } elseif ($this->parent_theme && strpos($v,$this->parent_theme) === 0) { 
    63                     $li = sprintf('<li class="parent-file">%s</li>',$item); 
    64                } else { 
    65                     $li = sprintf('<li>%s</li>',$item); 
    66                } 
    67                $list .= sprintf($li,$k,html::escapeHTML($k)); 
     58          if ($split) { 
     59               // First part for current theme 
     60               $list_theme = ''; 
     61               foreach ($files as $k => $v) 
     62               { 
     63                    if (strpos($v,$this->user_theme) === 0) { 
     64                         $li = sprintf('<li class="default-file">%s</li>',$item); 
     65                         $list_theme .= sprintf($li,$k,html::escapeHTML($k)); 
     66                    } 
     67               } 
     68               // Second part for parent theme if any 
     69               $list_parent = ''; 
     70               foreach ($files as $k => $v) 
     71               { 
     72                    if ((strpos($v,$this->user_theme) !== 0) && ($this->parent_theme && strpos($v,$this->parent_theme) === 0)) { 
     73                         $li = sprintf('<li class="parent-file">%s</li>',$item); 
     74                         $list_parent .= sprintf($li,$k,html::escapeHTML($k)); 
     75                    } 
     76               } 
     77               // Third part for template set 
     78               $list_tpl = ''; 
     79               foreach ($files as $k => $v) 
     80               { 
     81                    if ((strpos($v,$this->user_theme) !== 0) && ($this->parent_theme && strpos($v,$this->parent_theme) !== 0)) { 
     82                         $li = sprintf('<li>%s</li>',$item); 
     83                         $list_tpl .= sprintf($li,$k,html::escapeHTML($k)); 
     84                    } 
     85               } 
     86               $list .= ($list_theme != '' ? sprintf('<li class="group-file">'.__('From theme:').'<ul>%s</ul></li>',$list_theme) : ''); 
     87               $list .= ($list_parent != '' ? sprintf('<li class="group-file">'.__('From parent:').'<ul>%s</ul></li>',$list_parent) : ''); 
     88               $list .= ($list_tpl != '' ? sprintf('<li class="group-file">'.__('From template set:').'<ul>%s</ul></li>',$list_tpl) : ''); 
     89          } else { 
     90               foreach ($files as $k => $v) 
     91               { 
     92                    if (strpos($v,$this->user_theme) === 0) { 
     93                         $li = sprintf('<li class="default-file">%s</li>',$item); 
     94                    } elseif ($this->parent_theme && strpos($v,$this->parent_theme) === 0) { 
     95                         $li = sprintf('<li class="parent-file">%s</li>',$item); 
     96                    } else { 
     97                         $li = sprintf('<li>%s</li>',$item); 
     98                    } 
     99                    $list .= sprintf($li,$k,html::escapeHTML($k)); 
     100               } 
    68101          } 
    69102 
Note: See TracChangeset for help on using the changeset viewer.

Sites map