$package("com.qn.dlg");

com.qn.dlg.NewFolderDlg = function (){
}

com.qn.dlg.NewFolderDlg.prototype = new js.ui.BaseWindow();

com.qn.dlg.NewFolderDlg.prototype.basePath = null;

com.qn.dlg.NewFolderDlg.prototype.extendUI = function (){
	var __this = this;
	this.setTitle(props("New Folder"));
	var extui = this.getDomNode("com.qn.dlg.NewFolderDlg");
	this.container.appendChild(extui);
	this.okButton = extui.getElementsByTagName("input")[1];
	this.cancelButton = extui.getElementsByTagName("input")[2];
	this.nameText = extui.getElementsByTagName("input")[0];
	this.cancelButton.onclick = this.closeButton.ui.onclick;
	this.okButton.onclick = function(){
		var newfn = __this.nameText.value;
		if(newfn==""){
			browser.messageBox("Name can't empty.");
			__this.nameText.focus();
			return;
		}
		if(!com.qn.io.File.prototype.validateFilename(newfn)){
			browser.messageBox("Filename invalidate.");
			__this.nameText.focus();
			return;
		}
		var file = new com.qn.io.File();
		file.setPath(__this.basePath + "/" + newfn);
		file.mkdir();
		__this.close();
	}
}



