attachment_dir.tpl.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. defined('IN_ADMIN') or exit('No permission resources.');
  3. include $this->admin_tpl('header','admin');
  4. ?>
  5. <script language="JavaScript" src="<?php echo JS_PATH?>jquery.imgpreview.js"></script>
  6. <script type="text/javascript">
  7. $(document).ready(function(){
  8. var obj=$("#imgPreview a[rel]");
  9. if(obj.length>0) {
  10. $('#imgPreview a[rel]').imgPreview({
  11. srcAttr: 'rel',
  12. imgCSS: { width: 200 }
  13. });
  14. }
  15. });
  16. </script>
  17. <div class="bk15"></div>
  18. <div class="pad-lr-10">
  19. <table width="100%" cellspacing="0" class="search-form">
  20. <tbody>
  21. <tr>
  22. <td><div class="explain-col">
  23. <a href="?m=attachment&c=manage"><?php echo L('database_schema')?></a>
  24. </div>
  25. </td>
  26. </tr>
  27. </tbody>
  28. </table>
  29. <div class="table-list">
  30. <table width="100%" cellspacing="0" id="imgPreview">
  31. <tr>
  32. <td align="left"><?php echo L("local_dir")?>:<?php echo $local?></td><td></td>
  33. </tr>
  34. <?php if ($dir !='' && $dir != '.'):?>
  35. <tr>
  36. <td align="left"><a href="<?php echo '?m=attachment&c=manage&a=dir&dir='.stripslashes(dirname($dir))?>"><img src="<?php echo IMG_PATH?>folder-closed.gif" /><?php echo L("parent_directory")?></a></td><td></td>
  37. </tr>
  38. <?php endif;?>
  39. <?php
  40. if(is_array($list)) {
  41. foreach($list as $v) {
  42. $filename = basename($v)
  43. ?>
  44. <tr>
  45. <?php if (is_dir($v)) {
  46. echo '<td align="left"><img src="'.IMG_PATH.'folder-closed.gif" /> <a href="?m=attachment&c=manage&a=dir&dir='.(isset($_GET['dir']) && !empty($_GET['dir']) ? stripslashes($_GET['dir']).'/' : '').$filename.'"><b>'.$filename.'</b></a></td><td width="10%"></td>';
  47. } else {
  48. echo '<td align="left" ><img src="'.file_icon($filename,'gif').'" /><a rel="'.$local.'/'.$filename.'">'.$filename.'</a></td><td width="10%"><a href="javascript:;" onclick="preview(\''.$local.'/'.$filename.'\')">'.L('preview').'</a> | <a href="javascript:;" onclick="att_delete(this,\''.urlencode($filename).'\',\''.urlencode($local).'\')">'.L('delete').'</a> </td>';
  49. }?>
  50. </tr>
  51. <?php
  52. }
  53. }
  54. ?>
  55. </table>
  56. </div>
  57. </div>
  58. </body>
  59. <script type="text/javascript">
  60. function preview(filepath) {
  61. if(IsImg(filepath)) {
  62. window.top.art.dialog({title:'<?php echo L('preview')?>',fixed:true, content:'<img src="'+filepath+'" />',time:8});
  63. } else {
  64. window.top.art.dialog({title:'<?php echo L('preview')?>',fixed:true, content:'<a href="'+filepath+'" target="_blank"/><img src="<?php echo IMG_PATH?>admin_img/down.gif"><?php echo L('click_open')?></a>'});
  65. }
  66. }
  67. function att_delete(obj,filename,localdir){
  68. window.top.art.dialog({content:'<?php echo L('del_confirm')?>', fixed:true, style:'confirm', id:'att_delete'},
  69. function(){
  70. $.get('?m=attachment&c=manage&a=pulic_dirmode_del&filename='+filename+'&dir='+localdir+'&pc_hash='+pc_hash,function(data){
  71. if(data) $(obj).parent().parent().fadeOut("slow");
  72. })
  73. },
  74. function(){});
  75. };
  76. function IsImg(url){
  77. var sTemp;
  78. var b=false;
  79. var opt="jpg|gif|png|bmp|jpeg";
  80. var s=opt.toUpperCase().split("|");
  81. for (var i=0;i<s.length ;i++ ){
  82. sTemp=url.substr(url.length-s[i].length-1);
  83. sTemp=sTemp.toUpperCase();
  84. s[i]="."+s[i];
  85. if (s[i]==sTemp){
  86. b=true;
  87. break;
  88. }
  89. }
  90. return b;
  91. }
  92. </script>
  93. </html>