From: avl Date: Thu, 6 Aug 2009 10:27:11 +0000 (+0300) Subject: fm update X-Git-Tag: 0.5~384 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=4024fab3d1322e3ef5c12da9bc6d00b36e6f6b5e;p=ipf.git fm update --- diff --git a/ipf/admin/templates/admin/filebrowser.html b/ipf/admin/templates/admin/filebrowser.html index aa586b3..98a6909 100644 --- a/ipf/admin/templates/admin/filebrowser.html +++ b/ipf/admin/templates/admin/filebrowser.html @@ -20,7 +20,17 @@ a:hover{color:black !important;} var curr_dir = '{$curr_dir}'; var upload_url = '{$upload_url}'; var admin_media_url = '{$ADMIN_MEDIA_URL}'; +var mouseX = 0; +var mouseY = 0; {literal} + +$().mousemove( function(e) { + mouseX = e.pageX; + mouseY = e.pageY; + $('#prop').css('top',mouseY+5); + $('#prop').css('left',mouseX+10); +}); + function click_file(filename, image, w, h){ var fname = upload_url+curr_dir+filename; $('#picname').show(); @@ -37,6 +47,20 @@ function click_file(filename, image, w, h){ return false; } +function line_over(id, is_dir, is_image, type, size, filename){ + if (is_image==1){ + $('#prop').hide(); + var fname = upload_url+curr_dir+filename; + $('#prop').html(''); + $('#prop').css('top',mouseY+5); + $('#prop').css('left',mouseX+10); + $('#prop').show(); + } +} + +function line_out(id){ + $('#prop').hide(); +} var FileBrowserDialogue = { init : function () { @@ -97,8 +121,9 @@ tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
+ -
+
@@ -129,14 +154,14 @@ tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue); {foreach $dirs as $dir} - + {$dir['name']} SUB-DIR {if $dir['name']!='..'}delete{/if} {/foreach} {foreach $files as $file} - + {$file['name']} {$file['type']} {$file['size']} @@ -145,7 +170,8 @@ tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue); {/foreach} - + + {/block} diff --git a/ipf/admin/views.php b/ipf/admin/views.php index b6edcef..32cc820 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -259,6 +259,35 @@ function IPF_Admin_Views_Logout($request, $match){ return IPF_Shortcuts::RenderToResponse('admin/logout.html', $context, $request); } +function cmp($a, $b){ + if ($a['name'] == $b['name']) { + return 0; + } + return ($a['name'] < $b['name']) ? -1 : 1; +} + +function dir_recursive($dir, $path=DIRECTORY_SEPARATOR, $level=''){ + $dirtree = array(); + if ($level=='') + $dirtree[] = array('path'=>'', 'name'=>'Root Folder'); + $dd = array(); + if ($dh = @opendir($dir)) { + while (($file = readdir($dh)) !== false) { + if (($file=='.') || ($file=='..')) continue; + if (filetype($dir . $file)=='dir') + $dd[] = $file; + } + closedir($dh); + sort($dd); + foreach($dd as $file){ + $dirtree[] = array('path'=>$path.$file, 'name'=>$level.$file); + $dirtree = array_merge($dirtree, dir_recursive($dir.$file.DIRECTORY_SEPARATOR, $path.$file.DIRECTORY_SEPARATOR, $level.'--')); + } + } + return $dirtree; + //print_r($dirtree); +} + function IPF_Admin_Views_FileBrowser($request, $match){ $ca = IPF_Admin_App::checkAdminAuth($request); if ($ca!==true) return $ca; @@ -280,7 +309,6 @@ function IPF_Admin_Views_FileBrowser($request, $match){ } } - if ($request->method=="POST"){ if (@$request->POST['new_folder']!='') @mkdir($dir.$request->POST['new_folder']); @@ -288,11 +316,9 @@ function IPF_Admin_Views_FileBrowser($request, $match){ if (@$request->POST['new_name']!='') @rename($dir.$request->POST['old_name'], $dir.$request->POST['new_name']); - if (@$request->POST['move']!=''){ - @rename($dir.$request->POST['old_name'], $dir.$request->POST['move'].DIRECTORY_SEPARATOR.$request->POST['old_name']); + if (@$request->POST['action']=='move'){ + @rename($dir.$request->POST['old_name'], $upload_path.$request->POST['move'].DIRECTORY_SEPARATOR.$request->POST['old_name']); } - - if (@$_FILES['file']){ $uploadfile = $dir . basename($_FILES['file']['name']); @move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile); @@ -340,8 +366,11 @@ function IPF_Admin_Views_FileBrowser($request, $match){ } closedir($dh); } - sort(&$dirs); + usort(&$dirs, 'cmp'); + usort(&$files, 'cmp'); + $dirtree = dir_recursive($upload_path); + $pth = split(DIRECTORY_SEPARATOR,$curr_dir); $path = array(); $cd = '/admin/filebrowser/'; @@ -352,8 +381,9 @@ function IPF_Admin_Views_FileBrowser($request, $match){ $context = array( 'page_title' => __('File Browser'), + 'dirtree' => $dirtree, 'dirs' => $dirs, - 'files' => $files, + 'files' => $files, 'path' => $path, 'upload_url' => $upload_url, 'curr_dir' => $curr_dir,