Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Commit

Permalink
folder rename finished. It has took so long time because was need to …
Browse files Browse the repository at this point in the history
…find and fix bug in server PHP rename method. Also fixed some bugs and file row layout corrected (but not finished)
  • Loading branch information
Afanasyev-Alexander committed Mar 8, 2012
1 parent 54531bb commit d86d991
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 107 deletions.
4 changes: 2 additions & 2 deletions classes/kohana/controller/filebrowser.php
Expand Up @@ -228,7 +228,7 @@ public function action_rename()
$_POST = Arr::extract($_POST, array('filename'));

$current_fname = APPPATH.$this->_directory.$this->_path;
$new_fname = $path.$_POST['filename']
$new_fname = $path.DIRECTORY_SEPARATOR.$_POST['filename']
.( ! empty($extension) ? '.'.$extension : '');

$is_directory = is_dir($current_fname);
Expand Down Expand Up @@ -300,7 +300,7 @@ public function action_crop()
if ($_POST)
{
$this->auto_render = FALSE;

$_POST = Arr::extract($_POST, array(
'filename',
'image_width',
Expand Down
24 changes: 15 additions & 9 deletions media/filebrowser/directories.js
@@ -1,5 +1,6 @@
;
(function($){
var parentsArray;
$.fn.folderTree = function(opt){
var opt = $.extend({
autoTurnTree : true, //auto open tree to folder which files is currently opened in browser
Expand All @@ -21,8 +22,6 @@
else return this;
};

var parentsArray;

$.fn.processFolder = function(){
var dir = this[0], dirP = $(dir).children("p");
var isRoot = ($(this).attr("id") == "root") ? true : false;
Expand All @@ -45,7 +44,7 @@
$("i", this.children("p")).toggle(
function(){ // open folder
$(dir).addClass("process");
var fullPath = $(dir).buildFullPath();
var fullPath = $(dir).buildFullPath(false);
$.getJSON(global_config.dirs_url + fullPath, function(data){
$(dir).removeClass("process").addClass("open").getD().open = true;
$("div", dir).remove();
Expand Down Expand Up @@ -95,10 +94,7 @@
// end add handlers to click on "open/close" icon

$("a", this.children("p")).click(function(){ // click for files load
path = $(dir).buildFullPath();
parentsArray = path.split("/");
parentsArray.shift();
parentsArray.pop();
path = $(dir).buildFullPath(true);
$.getJSON('/'+global_config.files_url+((!isRoot)? path : ''), function(data){
$("#files-row").empty().append($("#tpl-files").tmpl(data));
$("p", opt.container).removeClass("selected").children("i").removeClass("icon-white");
Expand All @@ -125,7 +121,7 @@

// public methods of folders tree

$.fn.buildFullPath = function(){
$.fn.buildFullPath = function(refreshParentsArray){
var pathTxt = '';
var parent = function(folder){
if(!folder.data("data").isRoot){
Expand All @@ -135,6 +131,11 @@
else return;
};
parent(this);
if(refreshParentsArray) {
parentsArray = pathTxt.split("/");
parentsArray.pop();
console.log (parentsArray);
}
return "/" + pathTxt;
};

Expand All @@ -149,10 +150,15 @@
var dirData = this.getD();
dirData.name = name;
$("a", this.children("p")).text(name);
if(dirData.filesLoaded) {
path = $(this).buildFullPath(true);
$("#breadcrumb").breadcrumbUpdate();
}
if(dirData.isParentOfSelected) {
this.find("div").each(function(){
if($(this).getD().filesLoaded){
path = $(this).buildFullPath();
path = $(this).buildFullPath(true);
$("#breadcrumb").breadcrumbUpdate();
}
});
}
Expand Down
7 changes: 1 addition & 6 deletions media/filebrowser/global.css
Expand Up @@ -64,15 +64,12 @@ a {
}

.file .icon {
display: table-cell;
width: 110px;
height: 75px;
margin: 0 auto 10px;
background-position: center center;
background-repeat: no-repeat;
position: relative;
text-align: center;
vertical-align: middle;
-moz-user-select: none;
}

Expand All @@ -83,12 +80,10 @@ a {
.file p {
white-space: nowrap;
position: relative;
overflow: hidden;
line-height: 100%;
}

.file p.name {
line-height: 15px;
overflow-x: hidden;
}

.file p i {
Expand Down

0 comments on commit d86d991

Please sign in to comment.