Web file management system implemented by ExtJS

Source: Internet
Author: User
Tags parent directory

The last article was sent to wait for an interview opportunity, not yet achieved Beijing has a. NET training course. This is the homework arranged by the teacher here, let's use. Netajax realized, think that extjs+xml write may be better this thing will come out, the main idea is to use ExtJS to implement the foreground UI, and then Ajax way to implement and server information interaction, Here does not use the ASP.net under the AJAX implementation, is uses the ExtJS own AJAX realization. Mainly because of the efficiency of the consideration, and then there is extjs built the page basically feel that there is no need to use other Ajax technology, his page has not been refreshed, want is the data, data is through the general process of production of XML implementation. The following is the specific implementation of the way, and encountered some problems.


ExtJS I am also the first time to use, I hope that my experience can also give me the same as beginners ExtJS friends some tips (after all, at that time, took a lot of detours).
ExtJS and jquery are much like most functional implementations are implemented at initialization time. is not basically called with an input. Personally think this is more than jquery do, such as jquery Ajax can also be written in the input, but extjs you will find that if you write this, other things will be difficult to write. EXT also implemented the same way as C #: Properties, methods, and even the mechanism to implement events. Most ExtJS controls have a handler that can be configured to start implementing events. It's a bit like defining an ASP when defining a ExtJS control. NET control There are some configuration information followed by the ExtJS after seeing the thing can be said to be completely JS object-oriented, tough and strong.
Next, I'll introduce my web file management system here.

The first is a number of file compression, copy, etc. BLL here do not do too much introduction, is some System.File.IO for the operation of the file class, has implemented some of the features of the foreground.

Class for file description

File Description Class
Enumeration type description file is a file or a folder
public enum FileType {File, Folder};
File Description Class
public class Dealfiles
{
public string FileName {get; set;}
Public FileType FileType {get; set;}
Public Dealfiles (String Name, FileType Type)
{

FileName = Name;
FileType = Type;
}
Public Dealfiles ()
{ }

IO file Action class

FileManager.cs
Using System;
Using System.Collections.Generic;
Using System.Web;
Using System.IO;

<summary>
Realize File Manager handler (new Folder,new file,copy,paste,del,move,rename,cut)
</summary>
Namespace Dragonj
{
public class FileManager
{
Public FileManager ()
{
//
TODO: Add constructor logic here
//
}
public string path {get; set;}
Public FileManager (String parentpath)
{
This.path = Parentpath;
}
<summary>
Copying files and folders (external access)
</summary>
<param name= "List" ></param>
<param name= "Comedir" ></param>
<param name= "Todir" ></param>
<returns></returns>
public bool CopyFiles (list<dealfiles> List, String comedir, String todir)
{
BOOL ret = FALSE;
Try
{
foreach (Dealfiles i in list)
{
if (I.filetype = = Filetype.folder)
{
Foldercopy (I.filename, Comedir, Todir);
}
Else
{
Datacopy (I.filename, Comedir, Todir);
}
}
ret = true;
}
catch (Exception e)
{

Throw e;
}
return ret;
}
<summary>
Copying files to a specified directory
</summary>
<param name= "filename" ></param>
<param name= "Comedir" ></param>
<param name= "Todir" ></param>
<returns></returns>
private bool Datacopy (string filename, string comedir, String todir)
{
BOOL ret = FALSE;
String New_filename;
if (Comedir = = Todir)
{
New_filename = "copy" + filename;
}
Else
{
New_filename = filename;
}
Try
{
File.Copy (Path.Combine (comedir, filename), path.combine (todir, filename));
ret = true;
}
catch (Exception e)
{
Throw e;
}
return ret;
}

<summary>
Copy folder to specified directory
</summary>
<param name= "FolderName" ></param>
<param name= "Comedir" ></param>
<param name= "Todir" ></param>
<returns></returns>
private bool Foldercopy (string folderName, String Comedir, String todir)
{
BOOL ret = FALSE;
String New_foldername;
if (Comedir = = Todir)
{
New_foldername = "copy" + FolderName;
}
Else
{
New_foldername = FolderName;
}
Try
{
if (Directory.Exists (Path.Combine (Comedir, FolderName))
{
string[] files = Directory.GetFiles (Path.Combine (Comedir, folderName));
Directory.CreateDirectory (Path.Combine (Todir, folderName));
foreach (string file in files)
{
Datacopy (path.getfilename (file), Path.Combine (Comedir, FolderName), Path.Combine (Todir, folderName));
}
The parent directory that is not written to the Zip class is constantly changing to see if it works
string[] dirs = Directory.getdirectories (Path.Combine (Comedir, folderName));
foreach (String dir in dirs)
{
if (! Foldercopy (Path.getfilename (dir), Path.Combine (Comedir, FolderName), Path.Combine (Todir, FolderName))
{
return false;
}
}
ret = true;
}
}
catch (Exception e)
{
Throw e;
}
return ret;
}
<summary>
Delete files and folders (external access)
</summary>
<param name= "List" ></param>
<param name= "dir" ></param>
<returns></returns>
public bool DelFiles (list<dealfiles> List, string dir)
{
BOOL ret =

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.