/protected/extensions/yii-debug-toolbar/views/panels/asset.php

https://github.com/LosYear/FluentCMS · PHP · 88 lines · 83 code · 5 blank · 0 comment · 8 complexity · 5dccdc53f97ada26a986fa6ee7658e6e MD5 · raw file

  1. <table>
  2. <thead>
  3. <tr>
  4. <th class="al-r"><?php echo YiiDebug::t('Properties')?></th>
  5. <th></th>
  6. </tr>
  7. </thead>
  8. <tbody>
  9. <tr class="even">
  10. <th><?php echo YiiDebug::t('Assets path')?></th>
  11. <td><?php echo $AM->getBasePath()?></td>
  12. </tr><tr class="odd">
  13. <th><?php echo YiiDebug::t('Exclude files')?></th>
  14. <td><?php echo implode(',', $AM->excludeFiles)?></td>
  15. </tr><tr class="even">
  16. <th><?php echo YiiDebug::t('New dir mode')?></th>
  17. <td><?php echo $AM->newDirMode?></td>
  18. </tr><tr class="odd">
  19. <th><?php echo YiiDebug::t('New file mode')?></th>
  20. <td><?php echo $AM->newFileMode?></td>
  21. </tr>
  22. </tbody>
  23. </table>
  24. <table>
  25. <thead>
  26. <tr>
  27. <th class="al-r"><?php echo YiiDebug::t('Load assets')?></th>
  28. <th class="al-l"><?php echo YiiDebug::t('Path')?></th>
  29. <th><?php echo YiiDebug::t('Files')?></th>
  30. <th><?php echo YiiDebug::t('Date create')?></th>
  31. <th></th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php
  36. $DF = new CDateFormatter(Yii::app()->sourceLanguage);
  37. $i=0;
  38. foreach($assets as $asset){
  39. $i++;
  40. $path = $AM->getBasePath().'/'.$asset;
  41. $files = CFileHelper::findFiles($path);
  42. $fileList = implode('<br />', $files);
  43. $blockAll = false;
  44. if(preg_match('|yii\.debug\.toolbar\.js|is', $fileList)) $blockAll = true;
  45. ?>
  46. <tr class="<?php echo $i%2?'even':'odd'?>">
  47. <th><?php echo $asset?></th>
  48. <td>
  49. <a title="<?php echo YiiDebug::t('Show files')?>" href="#"
  50. onclick="jQuery('.details', $(this).parent('td')).toggleClass('hidden'); return false;"><?php echo $path?></a>
  51. <div class='details hidden'>
  52. <?php echo $fileList?>
  53. </div>
  54. </td>
  55. <td class="al-c"><?php echo YiiDebug::t('{n} file|{n} files', array(count($files)))?></td>
  56. <td class="al-c"><?php echo $DF->formatDateTime(filemtime($path))?></td>
  57. <td class="al-c">
  58. <a class="deleteAsset" href="<?php echo $this->owner->assetsUrl?>/ajax.php?deleteasset=<?php echo $asset?>"
  59. onclick="deleteAsset(this, <?php echo $blockAll?'true':'false'?>); return false;">
  60. <?php echo YiiDebug::t('Clean')?></a>
  61. </td>
  62. </tr>
  63. <?php } ?>
  64. </tbody>
  65. </table>
  66. <script type="text/javascript">
  67. function deleteAsset(link, blockAll){
  68. $.getJSON(link.href, {}, function(data){
  69. if(data == 'ok'){
  70. $(link).parents('tr').remove();
  71. if(blockAll){
  72. $('a.deleteAsset').remove();
  73. }
  74. }
  75. if(data == 'notexists'){
  76. alert('<?php echo YiiDebug::t('Path not found.')?>');
  77. }
  78. if(data == 'unknow'){
  79. alert('<?php echo YiiDebug::t('Unknow error.')?>');
  80. }
  81. });
  82. }
  83. </script>