.page-header
  %h2
    %li.icon-folder-open
    = Yii::t("app", "File Explorer")
%h4=$path

%b=t('Upload')
!=HtmlHelper::createForm(array(array('type'=>'file','name'=>'upload','prefix'=>'','suffix'=>''),array('type'=>'hidden','name'=>'path','value'=>$path)), url('debug/upload'), 'post')

-if(app()->session['debugMode_fileExplorer_getDirSize'] == 'yes')
  %a(href="#{url('debug/fileexplorer',array('path'=>$path,'dirSize'=>'no'))}")=t('Disable folder size calculation')
-else
  %a(href="#{url('debug/fileexplorer',array('path'=>$path,'dirSize'=>'yes'))}")=t('Enable folder size calculation')

%table.table.table-condensed
  %thead
    %tr
      %th=t('Name')
      %th=t('Type')
      %th=t('Size')
      %th=t('Actions')
  %tbody
    -foreach($folder as $item)
      -if($item->getFilename() == '.')
        -continue
      %tr
        %td
          -if($item->isDir())
            %a(href="#{url('debug/fileexplorer', array('path'=>$item->getRealPath()))}")
              .icon-folder-close-alt
              =$item->getFilename()
          -else
            .icon-file-alt
            =$item->getFilename()
        %td
          -if($item->isDir())
            ='<DIRECTORY>'
          -else
            =strtoupper($item->getExtension())
        %td
          -if($item->isdot())
            ='-'
          -else
            -if($item->isDir())
              -if(app()->session['debugMode_fileExplorer_getDirSize'] == 'yes')
                =formatBytes(@dirSize($item->getRealPath()))
              -else
                ='-'
            -else
              =formatBytes($item->getSize())
        %td
          -if(!$item->isDot())
            .btn-group
              %a.btn.btn-small.dropdown-toggle(data-toggle="dropdown" href="#")
                = Yii::t("app", "Actions")
                %span.caret
              %ul.dropdown-menu.pull-right
                %li
                  %a(href="#{url('debug/rename',array('path'=>$item->getRealPath()))}")
                    =t('Rename')
                -if($item->isDir())
                  %li
                    %a(href="#{url('debug/deleteDir',array('path'=>$item->getRealPath(),'empty'=>true,'return'=>$this->getAbsoluteUrl()))}" onclick="return confirm('#{t('Are you sure you want to delete this item?')}')")
                      =t('Empty')
                  %li
                    %a(href="#{url('debug/deleteDir',array('path'=>$item->getRealPath(),'empty'=>false,'return'=>$this->getAbsoluteUrl()))}" onclick="return confirm('#{t('Are you sure you want to delete this item?')}')")
                      =t('Delete')
                -else
                  %li
                    %a(href="#{url('debug/viewAsText',array('filename'=>$item->getRealPath()))}")
                      =t('View as text')
                  %li
                    %a(href="#{url('debug/viewAsImage',array('filename'=>$item->getRealPath()))}")
                      =t('View as image')
                  %li
                    %a(href="#{url('debug/watchLog',array('filename'=>$item->getRealPath()))}")
                      =t('Watch as text')
                  -if(strtoupper($item->getExtension()) == "ZIP")
                    %li
                      %a(href="#{url('debug/unzip',array('filename'=>$item->getRealPath(),'path'=>$path,'return'=>$this->getAbsoluteUrl()))}")
                        =t('Unzip')
                  %li
                    %a(href="#{url('debug/download',array('filename'=>$item->getRealPath()))}")
                      =t('Download')
                  %li
                    %a(href="#{url('debug/editAsText',array('filename'=>$item->getRealPath()))}")
                      =t('Edit')
                  %li
                    %a(href="#{url('debug/deleteFile',array('filename'=>$item->getRealPath(),'return'=>$this->getAbsoluteUrl()))}" onclick="return confirm('#{t('Are you sure you want to delete this item?')}')")
                      =t('Delete')

%b=t('Create')
!=HtmlHelper::createForm(array(array('type'=>'text','name'=>'name','prefix'=>'','suffix'=>''),array('type'=>'hidden','name'=>'path','value'=>$path),array('type'=>'radio','name'=>'type','value'=>'file','suffix'=>''),array('type'=>'radio','name'=>'type','value'=>'folder','suffix'=>'','options'=>array('checked'=>'checked')), array('type'=>'hidden','name'=>'return','value'=>$this->getAbsoluteUrl())), url('debug/create'), 'get')

%br

%b=t('Jump to:')
%form
  %input(name="path" type="text" value="#{$path}" style="width: 100%;")  
  %input(type="submit")  
  