", {"class": "btn"}).html("Back").click(function(){ImgManagerDialog.openDirectory(parentDirName,"../")}) ));
}else{
divActions.append( $("").html(dirName) );
divActions.append( $("
").append($("", {"class": "btn btn-info"}).html(' Delete').click(function(){
if(confirm("Are you sure you want to delete folder and it's content ? ")){
var dir = dirName;
if(parentDirName){
dir = parentDirName+"/"+dirName;
}
$.ajax({
url: tinyMCEPopup.getWindowArg('plugin_url')+'/libs/ajax.php?deleteFolder=1&folder='+dir,
type: 'GET',
dataType: 'text json',
success:function(){
li.remove();
ImgManagerDialog.populateDirsAfterUpdate();
},
error:function(){
alert("Error eccured. Please refresh site and try again");
}
});
}
})));
}
divThumb.append(img);
divThumb.append(divActions);
li.append(divThumb);
return li;
},
getParentDir: function(parentDirName){
if(parentDirName){
if(parentDirName.split("/").length == 1 || parentDirName == "../"){
parentDirName = null;
}else{
var split = parentDirName.split("/");
split.pop();
parentDirName = split.join("/");
}
}
return parentDirName;
},
toogleConstrains: function(item){
if($(item).attr("constrains") == 1){
$(item).attr("id","constrains_0");
$(item).attr("constrains","0");
}else{
$(item).attr("id","constrains_1");
$(item).attr("constrains","1");
}
},
checkConstrains: function(changed)
{
var dialog = $("#imageInserModal");
var constrains = dialog.find(".constrains");
if(constrains.attr("constrains") == 1)
{
var orginal_width = dialog.find("#imgOrigWidth").val();
var orginal_height = dialog.find("#imgOrigHeight").val();
var widthObj = dialog.find("#imgWidth");
var heightObj = dialog.find("#imgHeight");
var width = parseInt(widthObj.val());
var height = parseInt(heightObj.val());
if(orginal_width > 0 && orginal_height > 0)
{
if(changed == 'width' && width > 0) {
heightObj.val( parseInt((width/orginal_width)*orginal_height) );
}
if(changed == 'height' && height > 0) {
widthObj.val( parseInt((height/orginal_height)*orginal_width) );
}
}
}
},
jCropUpdateCoords: function(c){
jQuery('#x').val(c.x);
jQuery('#y').val(c.y);
jQuery('#w').val(c.w);
jQuery('#h').val(c.h);
},
jCropCheckCoords: function(){
if (parseInt(jQuery('#w').val())>0) return true;
alert('Please select a crop region.');
return false;
}
};