Esempio n. 1
0
        void BuildTree()
        {
            for (int i = 0; i < RootDirectories.Count; i++)
            {
                RootDirectory rootDir  = RootDirectories [i];
                FolderNode    treeNode = new FolderNode(this);
                Nodes.Add(treeNode);
                treeNode.ImageUrl = Controller.GetRootFolderSmallImage(rootDir);
                SetText(rootDir, treeNode, i);
                treeNode.Value = PathSeparator + rootDir.TextInternal;
                if (_fileView != null)
                {
                    treeNode.NavigateUrl = "javascript:" + _fileView.ClientScriptReference + ".Navigate(\"" + treeNode.ValuePath + "\");";
                }
                else
                {
                    treeNode.NavigateUrl = "javascript:" + ClientScriptReference + ".OnSelect(\"" + Controller.GetPathHashCode(treeNode.ValuePath) + "\", \"" + treeNode.ValuePath + "\");";
                }
            }

            for (int i = 0; i < RootDirectories.Count; i++)
            {
                ExpandRecursive(Nodes [i], RootDirectories [i].ExpandDepth);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     FileManager1.RootDirectories.Clear ();
     RootDirectory rootDirectory = new RootDirectory ();
     rootDirectory.DirectoryPath = DirectoryManager.GetRootDirectoryPath (Context);
     rootDirectory.Text = "My Documents";
     FileManager1.RootDirectories.Add (rootDirectory);
 }
Esempio n. 3
0
 void SetText(RootDirectory rootDir, FolderNode treeNode, int index)
 {
     if (rootDir.ShowRootIndex)
     {
         treeNode.Text = String.Format(CultureInfo.InvariantCulture, "{0} ([{1}])", rootDir.TextInternal, index);
     }
     else
     {
         treeNode.Text = rootDir.TextInternal;
     }
 }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {

        FileManager1.RootDirectories.Clear();
        RootDirectory rootDirectory = new RootDirectory();
        rootDirectory.DirectoryPath = DirectoryManager.GetRootDirectoryPath(Context) + DropDownList1.SelectedValue;
        rootDirectory.Text = DropDownList1.SelectedItem.Text;
        FileManager1.RootDirectories.Add(rootDirectory);

        FileManager1.Directory = null;
        
    }
 public RootDirectory this [string name] {
     get {
         for (int i = 0; i < Count; i++)
         {
             RootDirectory dir = this [i];
             if (String.Compare(dir.TextInternal, name, true) == 0)
             {
                 return(dir);
             }
         }
         return(null);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // create instance
        FileManager fileManager = new FileManager ();

        // set layouts
        fileManager.Height = 400;
        fileManager.Width = 600;

        // add root directory
        RootDirectory rootDirectory = new RootDirectory ();
        rootDirectory.DirectoryPath = DirectoryManager.GetRootDirectoryPath (Context);
        rootDirectory.Text = "My Documents";
        fileManager.RootDirectories.Add (rootDirectory);

        PlaceHolder1.Controls.Add (fileManager);
    }
	protected void Page_Load (object sender, EventArgs e) {

		// create instance
		FileManager fileManager = new FileManager ();

		// set layouts
		fileManager.Height = 400;
		fileManager.Width = 600;

		// add root directory
		RootDirectory rootDirectory = new RootDirectory ();
		rootDirectory.DirectoryPath = DirectoryManager.GetRootDirectoryPath (Context);
		rootDirectory.Text = "My Documents";
		fileManager.RootDirectories.Add (rootDirectory);

        fileManager.ExecuteCommand += FileManagerOnExecuteCommand;

        FileManagerCommand wyswygCmd = new FileManagerCommand();
        wyswygCmd.CommandName = "WYSWYG";
        wyswygCmd.Name = "Edit with WYSWYG editor";

        FileManagerCommand editCmd = new FileManagerCommand();
        editCmd.CommandName = "EditText";
        editCmd.Name = "Edit";

	    FileType htmlFileType = new FileType();
        htmlFileType.Extensions = "htm, html";
        htmlFileType.Name = "HTML Document";
        htmlFileType.LargeImageUrl = "images/32x32/html.gif";
        htmlFileType.SmallImageUrl = "images/16x16/html.gif";
        htmlFileType.Commands.Add(wyswygCmd);
        htmlFileType.Commands.Add(editCmd);
        fileManager.FileTypes.Add(htmlFileType);

        FileType txtFileType = new FileType();
        txtFileType.Extensions = "txt, js, css";
        txtFileType.Name = "HTML Document";
        txtFileType.Commands.Add(editCmd);
        fileManager.FileTypes.Add(txtFileType);

		PlaceHolder1.Controls.Add (fileManager);
	}
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //getting the root folder, if not create
            string patientID = Request.QueryString["PatientID"];

            if (patientID == null || patientID.Trim() == "")
            {
                throw new ApplicationException("Patient information is not available");
            }

            string cmdText = "SELECT PatientID, Greeting, FirstName, MiddleName, LastName, NickName FROM Patient WHERE PatientID = " + patientID;
            SqlDataReader drPatient = DBUtil.ExecuteReader(cmdText);
            if (!drPatient.Read())
            {
                throw new ApplicationException("Patient information is not available");
            }

            string patientName = drPatient["FirstName"].ToString() + " " + drPatient["LastName"].ToString();
            FileManagerTab.HeaderText = "Documents for " + patientName;

            string path = GetFolder("~/Data", patientID);

            fmPatient.RootDirectories.Clear();
            RootDirectory rootDirectory = new RootDirectory();
            rootDirectory.DirectoryPath = path;
            rootDirectory.Text = patientName;
            rootDirectory.ShowRootIndex = false;
            fmPatient.RootDirectories.Add(rootDirectory);

            fmPatient.FileViewMode = FileViewRenderMode.Thumbnails;
            
            if(!String.IsNullOrEmpty(Request.QueryString["path"]))
            {
                string targetPath = Request.QueryString["path"];
                string fileMgrPath = VirtualPathUtility.ToAbsolute(path);
                //Response.Write("targetPath: " + targetPath + "<br>path: " + path + "<br>fileMgrPath: " + fileMgrPath + "<br>FInal: " + targetPath.Replace(fileMgrPath, "[0]"));
                fmPatient.Directory = targetPath.Replace(fileMgrPath, "[0]");
            }
        }
    }
        /// <summary>
        ///  获得用户信息 和 订单
        /// </summary>
        /// <param name="UserStrData"></param>
        /// <returns></returns>
        public void GetUserDataTable(string UserStrData)
        {
            HiddenField1.Value = UserStrData;
            //从中分离出用户ID

               int A1 = UserStrData.IndexOf("_");

               if (A1 > 0)
               {
               string RID = UserStrData.Substring(A1+1, UserStrData.Length - A1-1);

            //   UserDir = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\USER\\" + ClassLibraryWeiBao.ClassServerCOM.GetMasterPasswordBytes(RID));
               UserDir =  ClassLibraryWeiBao.ClassServerCOM.GetMasterPasswordBytes(RID);

               //得到订单文件
               string PathFileN = System.IO.Path.Combine(Server.MapPath("~"), "user_dir/sysuser/shangcheng/dingdan/" + UserStrData + ".dll");

               string data = System.IO.File.ReadAllText(PathFileN, System.Text.Encoding.UTF8);

               Label10.Text = data;//.Replace("\r\n","<br/>");

               System.Globalization.CultureInfo culture = null;

               string langName = new System.Globalization.CultureInfo("zh-CN").NativeName;

               culture = new System.Globalization.CultureInfo("zh-CN");
               FileManager1.Culture = culture;

               FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Details;
               //Thumbnails

               FileManager1.RootDirectories.Clear();
               RootDirectory rootDirectory = new RootDirectory();
               string PathOne = "~\\USER_DIR\\USER\\" + UserDir;

               rootDirectory.DirectoryPath = PathOne;
               rootDirectory.Text = "用户信息";
               FileManager1.RootDirectories.Add(rootDirectory);

               FileManager1.HideEXT = true;

               GetUserData(UserDir);

               for (int i = 0; i < typeof(ToolbarOptions).GetProperties().Length; i++)
               {
                   PropertyInfo prop = typeof(ToolbarOptions).GetProperties()[i];

                   if (prop.PropertyType == typeof(bool))
                   {

                       if (prop.Name == "ShowRenameButton")
                       {
                           prop.SetValue(FileManager1.ToolbarOptions, false, null);
                       }

                       //ShowMoveButton;ShowFolderUpButton;ShowNewFolderButton
                       if (prop.Name == "ShowMoveButton")
                       {
                           prop.SetValue(FileManager1.ToolbarOptions, false, null);
                       }
                       if (prop.Name == "ShowFolderUpButton")
                       {
                           prop.SetValue(FileManager1.ToolbarOptions, false, null);
                       }
                       if (prop.Name == "ShowNewFolderButton")
                       {
                           prop.SetValue(FileManager1.ToolbarOptions, false, null);
                       }
                   }
               }

               }
               else
               {
               Response.Redirect("login.aspx");
               }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;

            //读取的时候
            HttpCookie cookie2 = Request.Cookies["weiweixing"];

            if (cookie2 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string name = cookie2.Values["name"];
            if (name == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string md5 = cookie2.Values["md5"];
            if (md5 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            //给button1添加客户端事件
              //  ButtonSeven.Attributes.Add("OnClick", "return  jsED()");

            FileManager1.RootDirectories.Clear();
            RootDirectory rootDirectory = new RootDirectory();
            rootDirectory.DirectoryPath ="~/user_dir/sysuser/mypost/zhuan/";
            rootDirectory.Text = "关键词转向";
            FileManager1.RootDirectories.Add(rootDirectory);

            System.Globalization.CultureInfo culture = null;
            string langName = new System.Globalization.CultureInfo("zh-CN").NativeName;

            culture = new System.Globalization.CultureInfo("zh-CN");
            FileManager1.Culture = culture;

            FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Icons;

            Button9.Attributes.Add("OnClick", "return  jsED()");

            //    Button10.Attributes.Add("OnClick", "return  jsModel()");

            FileManager1.HideEXT = true;

            for (int i = 0; i < typeof(ToolbarOptions).GetProperties().Length; i++)
            {
                PropertyInfo prop = typeof(ToolbarOptions).GetProperties()[i];

                if (prop.PropertyType == typeof(bool))
                {

                    if (prop.Name == "ShowRenameButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }

                    //ShowMoveButton;ShowFolderUpButton;ShowNewFolderButton
                    if (prop.Name == "ShowMoveButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                    if (prop.Name == "ShowFolderUpButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                    if (prop.Name == "ShowNewFolderButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                }
            }
        }
 public void Insert(int index, RootDirectory rootDirectory)
 {
     ((IList) this).Insert (index, rootDirectory);
 }
 public void CopyTo(RootDirectory [] rootDirectoryArray, int index)
 {
     base.CopyTo (rootDirectoryArray, index);
 }
 public int Add(RootDirectory rootDirectory)
 {
     return ((IList) this).Add (rootDirectory);
 }
 internal string GetRootFolderSmallImage(RootDirectory rootDir)
 {
     if (rootDir == null)
         return _defaultRootFolderSmallImage;
     if (rootDir.SmallImageUrl.Length > 0)
         return rootDir.SmallImageUrl;
     return _defaultRootFolderSmallImage;
 }
Esempio n. 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserDir = Request.QueryString["id"];

            //读取的时候
            HttpCookie cookie2 = Request.Cookies["weiweixing"];

            if (cookie2 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string name = cookie2.Values["name"];
            if (name == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string md5 = cookie2.Values["md5"];
            if (md5 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            System.Globalization.CultureInfo culture = null;

            string langName = new System.Globalization.CultureInfo("zh-CN").NativeName;

            culture = new System.Globalization.CultureInfo("zh-CN");
            FileManager1.Culture = culture;

            FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Details;
            //Thumbnails

            FileManager1.RootDirectories.Clear();
            RootDirectory rootDirectory = new RootDirectory();
            string PathOne = "~\\USER_DIR\\USER\\" + UserDir;

            rootDirectory.DirectoryPath = PathOne;
            rootDirectory.Text = "用户信息";
            FileManager1.RootDirectories.Add(rootDirectory);

            FileManager1.HideEXT = true;

            if (Page.IsPostBack) return;

            GetUserData(UserDir);

            for (int i = 0; i < typeof(ToolbarOptions).GetProperties().Length; i++)
            {
                PropertyInfo prop = typeof(ToolbarOptions).GetProperties()[i];

                if (prop.PropertyType == typeof(bool))
                {

                    if (prop.Name == "ShowRenameButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }

                    //ShowMoveButton;ShowFolderUpButton;ShowNewFolderButton
                    if (prop.Name == "ShowMoveButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                    if (prop.Name == "ShowFolderUpButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                    if (prop.Name == "ShowNewFolderButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _mst = Utils.CStrDef(Request.QueryString["mst"]);
            _name = GetName(_mst);

            HF_FileBrowserConfig.Attributes["data-filesfolder"] = _mst;
            FilesFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-filesfolder"]) ?
                        HF_FileBrowserConfig.Attributes["data-filesfolder"] : _mst);

            CultureInfo culture;
            try
            {
                culture = new CultureInfo(Request["langCode"]);
            }
            catch (Exception)
            {
                culture = CultureInfo.CurrentCulture;
            }
            FileManager1.ShowAddressBar = false;
            FileManager1.AllowUpload = true;

            String cbReference =
                Page.ClientScript.GetCallbackEventReference(this,
                "arg", "ReceiveServerData", "context");
            String callbackScript;
            callbackScript = "function CallServer(arg, context)" +
                "{ " + cbReference + ";}";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
                "CallServer", callbackScript, true);

            if (!IsPostBack)
            {
                int fnumber = 0;
                string caller, fn;

                // the caller is CKEditor
                if (!string.IsNullOrEmpty(Request["CKEditor"]))
                {
                    caller = "ckeditor";
                }
                else
                    caller = (String.IsNullOrEmpty(Request["caller"]) ? "parent" : Request["caller"]);

                HF_Opener.Value = caller;

                fn = Request["fn"];

                if (!String.IsNullOrEmpty(fn))
                    HF_CallBack.Value = fn;

                if (int.TryParse(Request["CKEditorFuncNum"], out fnumber))
                    HF_CKEditorFunctionNumber.Value = fnumber.ToString();

                if (!String.IsNullOrEmpty(Request["field"]))
                    HF_Field.Value = Request["field"];

                string mainRoot = "~/File/ThuVien";

                if (FileManager1.Culture == null)
                    FileManager1.Culture = culture;

                HF_CurrentCulture.Value = FileManager1.Culture.Name;

                FileManager1.CustomToolbarButtons[0].Text = FileManager1.Controller.GetResourceString("View_file", "View File");
                Upload_button.InnerText = FileManager1.Controller.GetResourceString("Upload_file_click", "Click here to download a file");
                DND_message.InnerText = FileManager1.Controller.GetResourceString("Upload_dnd", "Or drag 'nd drop one or more files on the above area");

                if (!String.IsNullOrEmpty(FileManager1.MainDirectory))
                    mainRoot = FileManager1.MainDirectory;
                //mainRoot = ResolveClientUrl(mainRoot);
                if (!Directory.Exists(Server.MapPath(ResolveClientUrl(mainRoot))))
                    throw new Exception("User directory with write privileges is needed.");

                DirectoryInfo mainRootInfo = new DirectoryInfo(Server.MapPath(ResolveClientUrl(mainRoot)));

                mainRootInfo.CreateSubdirectory(FilesFolder);

                CreateFolder(_mst);

                RootDirectory files;
                FileManager1.RootDirectories.Clear();
                files = new RootDirectory();
                files.ShowRootIndex = false;
                files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder;
                files.LargeImageUrl = "~/FileBrowser/img/32/folder-document-alt.png";
                files.SmallImageUrl = "~/FileBrowser/img/16/folder-document-alt.png";
                files.Text = FileManager1.Controller.GetResourceString("Root_File", _name + "-" + _mst);
                FileManager1.RootDirectories.Add(files);
            }
            TestPermission();
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ImageFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-imagefolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-imagefolder"] : "images");

            FlashFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-filesfolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-filesfolder"] : "flash");

            MediaFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-mediafolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-mediafolder"] : "media");

            FilesFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-filesfolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-filesfolder"] : "files");

            if (Request.Url.Host.IndexOf("localhost") > -1)
                FileManager1.DefaultAccessMode = AccessMode.Write;

            CultureInfo culture;
            try
            {
                culture = new CultureInfo(Request["langCode"]);
            }
            catch (Exception)
            {
                culture = CultureInfo.CurrentCulture;
            }
            FileManager1.ShowAddressBar = false;
            FileManager1.AllowUpload = false;

            String cbReference =
                Page.ClientScript.GetCallbackEventReference(this,
                "arg", "ReceiveServerData", "context");
            String callbackScript;
            callbackScript = "function CallServer(arg, context)" +
                "{ " + cbReference + ";}";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
                "CallServer", callbackScript, true);

            if (!IsPostBack)
            {
                /**
                 * -------- Parameters --------------
                 * CKEDITOR automatically call FileManager service adding two custom parameters
                 * CKEditorFuncNum e type.
                 * First parameter allows you to pass choosen file url back to CKEDITOR
                 * through callback function
                 * Type paramete is used to restrict the file search to a
                 * specific folder
                 *
                 * Tiny MCE 4 use the type parameter and field parameter wich is
                 * the id of the field whose value must be set.
                 *
                 *
                 * Other recognized parameters
                 * caller:
                 *      allowed values: ckeditor, tinymce, parent, top
                 *      default: caller id defaulted to ckeditor if the CKEditor parameter is specified otherwise to parent
                 *      Idicates the object to wich the callback must be return
                 *
                 * fn:
                 *      allowed values: any string
                 *      default: null
                 *      Function name to be called.
                 *
                 * langCode:
                 *      allowed value: a standard language code
                 *      default: current language
                 *      CKEdito pass this paramenter automatically
                 *
                 */

                int fnumber = 0;
                string caller, fn;

                // the caller is CKEditor
                if (!string.IsNullOrEmpty(Request["CKEditor"]))
                {
                    caller = "ckeditor";
                }
                else
                    caller = (String.IsNullOrEmpty(Request["caller"]) ? "parent" : Request["caller"]);

                HF_Opener.Value = caller;

                fn = Request["fn"];

                if (!String.IsNullOrEmpty(fn))
                    HF_CallBack.Value = fn;

                if (int.TryParse(Request["CKEditorFuncNum"], out fnumber))
                    HF_CKEditorFunctionNumber.Value = fnumber.ToString();

                if (!String.IsNullOrEmpty(Request["field"]))
                    HF_Field.Value = Request["field"];

                string type = "";
                string mainRoot = "~/userfiles";

                if (FileManager1.Culture == null)
                    FileManager1.Culture = culture;

                HF_CurrentCulture.Value = FileManager1.Culture.Name;

                FileManager1.CustomToolbarButtons[0].Text = FileManager1.Controller.GetResourceString("View_file", "View File");
                Upload_button.InnerText = FileManager1.Controller.GetResourceString("Upload_file_click", "Click here to download a file");
                DND_message.InnerText = FileManager1.Controller.GetResourceString("Upload_dnd", "Or drag 'nd drop one or more files on the above area");

                if (!String.IsNullOrEmpty(FileManager1.MainDirectory))
                    mainRoot = FileManager1.MainDirectory;
                //mainRoot = ResolveClientUrl(mainRoot);
                if (!Directory.Exists(Server.MapPath(ResolveClientUrl(mainRoot))))
                    throw new Exception("User directory with write privileges is needed.");

                DirectoryInfo mainRootInfo = new DirectoryInfo(Server.MapPath(ResolveClientUrl(mainRoot)));

                mainRootInfo.CreateSubdirectory(ImageFolder);
                mainRootInfo.CreateSubdirectory(FilesFolder);
                mainRootInfo.CreateSubdirectory(FlashFolder);
                mainRootInfo.CreateSubdirectory(MediaFolder);

                if (!String.IsNullOrEmpty(Request["type"]))
                {
                    type = Request["type"];
                }

                RootDirectory images, flash, files, media;
                // Display text of root folders are localized using WebFileBrowser resources files
                // in "/App_GlobalResources/WebFileManager" and GetResoueceString method
                // of FileManager.Controller class
                switch (type)
                {
                    case "images":
                    case "image":
                        FileManager1.RootDirectories.Clear();
                        images = new RootDirectory();
                        images.ShowRootIndex = false;
                        images.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + ImageFolder;
                        images.Text = FileManager1.Controller.GetResourceString("Root_Image", "Images");
                        images.LargeImageUrl = "~/FileBrowser/img/32/camera.png";
                        images.SmallImageUrl = "~/FileBrowser/img/16/camera.png";
                        FileManager1.RootDirectories.Add(images);
                        break;
                    case "flash":
                        FileManager1.RootDirectories.Clear();
                        flash = new RootDirectory();
                        flash.ShowRootIndex = false;
                        flash.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FlashFolder;
                        flash.LargeImageUrl = "~/FileBrowser/img/32/folder-flash.png";
                        flash.SmallImageUrl = "~/FileBrowser/img/16/folder-flash.png";
                        flash.Text = FileManager1.Controller.GetResourceString("Root_Flash", "Flash Movies");
                        FileManager1.RootDirectories.Add(flash);
                        break;
                    case "files":
                        FileManager1.RootDirectories.Clear();
                        files = new RootDirectory();
                        files.ShowRootIndex = false;
                        files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder;
                        files.LargeImageUrl = "~/FileBrowser/img/32/folder-document-alt.png";
                        files.SmallImageUrl = "~/FileBrowser/img/16/folder-document-alt.png";
                        files.Text = FileManager1.Controller.GetResourceString("Root_File", "Files");
                        FileManager1.RootDirectories.Add(files);
                        break;
                    case "media":
                        FileManager1.RootDirectories.Clear();
                        media = new RootDirectory();
                        media.ShowRootIndex = false;
                        media.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + MediaFolder;
                        media.LargeImageUrl = "~/FileBrowser/img/32/folder-video-alt.png";
                        media.SmallImageUrl = "~/FileBrowser/img/16/folder-video-alt.png";
                        media.Text = FileManager1.Controller.GetResourceString("Root_Media", "Media");
                        FileManager1.RootDirectories.Add(media);
                        break;
                    default:
                        FileManager1.RootDirectories.Clear();
                        files = new RootDirectory();
                        files.ShowRootIndex = false;
                        files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder;
                        files.LargeImageUrl = "~/FileBrowser/img/32/folder-document-alt.png";
                        files.SmallImageUrl = "~/FileBrowser/img/16/folder-document-alt.png";
                        // Display text of root folders are localized using WebFileBrowser resources files
                        // in "/App_GlobalResources/WebFileManager" and GetResoueceString method
                        // of FileManager.Controller class
                        files.Text = FileManager1.Controller.GetResourceString("Root_File", "Files");
                        FileManager1.RootDirectories.Add(files);

                        flash = new RootDirectory();
                        flash.ShowRootIndex = false;
                        flash.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FlashFolder;
                        flash.LargeImageUrl = "~/FileBrowser/img/32/folder-flash.png";
                        flash.SmallImageUrl = "~/FileBrowser/img/16/folder-flash.png";
                        flash.Text = FileManager1.Controller.GetResourceString("Root_Flash", "Flash Movies");
                        FileManager1.RootDirectories.Add(flash);

                        images = new RootDirectory();
                        images.ShowRootIndex = false;
                        images.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + ImageFolder;
                        images.Text = FileManager1.Controller.GetResourceString("Root_Image", "Images");
                        images.LargeImageUrl = "~/FileBrowser/img/32/camera.png";
                        images.SmallImageUrl = "~/FileBrowser/img/16/camera.png";
                        FileManager1.RootDirectories.Add(images);

                        media = new RootDirectory();
                        media.ShowRootIndex = false;
                        media.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + MediaFolder;
                        media.LargeImageUrl = "~/FileBrowser/img/32/folder-video-alt.png";
                        media.SmallImageUrl = "~/FileBrowser/img/16/folder-video-alt.png";
                        media.Text = FileManager1.Controller.GetResourceString("Root_Media", "Media");
                        FileManager1.RootDirectories.Add(media);

                        break;
                }
            }

            AccessMode fbAccessMode;
            if (MagicSession.Current.FileBrowserAccessMode == AccessMode.Default)
                fbAccessMode = FileManager1.DefaultAccessMode;
            else
                fbAccessMode = MagicSession.Current.FileBrowserAccessMode;

            Literal content;

            switch (fbAccessMode)
            {
                case AccessMode.Delete:
                    FileManager1.Visible = true;
                    Panel_upload.Visible = true;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = false;
                    FileManager1.AllowDelete = true;
                    FileManager1.AllowOverwrite = true;
                    break;
                case AccessMode.DenyAll:
                    FileManager1.Visible = false;
                    Panel_upload.Visible = false;
                    Panel_deny.Visible = true;
                    content = new Literal();
                    content.Text = "<h1>" + FileManager1.Controller.GetResourceString("Upload_Error_3", "User does not have sufficient privileges.") + "<br/>&nbsp;</h1>";
                    Panel_deny.Controls.Add(content);
                    break;
                case AccessMode.ReadOnly:
                case AccessMode.Default:
                    FileManager1.Visible = true;
                    Panel_upload.Visible = true;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = true;
                    break;
                case AccessMode.Write:
                    FileManager1.Visible = true;
                    Panel_upload.Visible = true;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = false;
                    FileManager1.AllowDelete = false;
                    FileManager1.AllowOverwrite = false;
                    break;
                default:
                    break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;

            //读取的时候
            HttpCookie cookie2 = Request.Cookies["weiweixing"];

            if (cookie2 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string name = cookie2.Values["name"];
            if (name == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string md5 = cookie2.Values["md5"];
            if (md5 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            if (Page.IsPostBack) return;

            FileManager1.RootDirectories.Clear();
            RootDirectory rootDirectory = new RootDirectory();
            rootDirectory.DirectoryPath = "~/user_dir/sysuser/table/table1";
            rootDirectory.Text = "我的表单";
            FileManager1.RootDirectories.Add(rootDirectory);

            System.Globalization.CultureInfo culture = null;
            string langName = new System.Globalization.CultureInfo("zh-CN").NativeName;

            culture = new System.Globalization.CultureInfo("zh-CN");
            FileManager1.Culture = culture;

            FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Icons;

            FileManager1.HideEXT = true;

            ButtonThree.Attributes.Add("OnClick", "return  jsModel()");
            ButtonFour.Attributes.Add("OnClick", "return  jsModel()");
            ButtonFive.Attributes.Add("OnClick", "return  jsModel()");
            ButtonSix.Attributes.Add("OnClick", "return  jsModel()");

            //ButtonOne.ToolTip = "abc";

            //ButtonOne.PostBackUrl = "#";
            //ButtonOne.Attributes.Add("OnClick", "javascript:window.open('../admin/main35.aspx','newwindow','width=800,height=600,scrollbars=yes,top=50,left=50');");
            for (int i = 0; i < typeof(ToolbarOptions).GetProperties().Length; i++)
            {
                PropertyInfo prop = typeof(ToolbarOptions).GetProperties()[i];

                if (prop.PropertyType == typeof(bool))
                {

                    if (prop.Name == "ShowRenameButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }

                    //ShowMoveButton;ShowFolderUpButton;ShowNewFolderButton
                    if (prop.Name == "ShowMoveButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                    if (prop.Name == "ShowFolderUpButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                    if (prop.Name == "ShowNewFolderButton")
                    {
                        prop.SetValue(FileManager1.ToolbarOptions, false, null);
                    }
                }
            }
        }
 private string GetRootFolderLargeImage(RootDirectory rootDir)
 {
     if (rootDir == null)
         return _defaultRootFolderLargeImage;
     if (rootDir.LargeImageUrl.Length > 0)
         return rootDir.LargeImageUrl;
     return _defaultRootFolderLargeImage;
 }
 public int Add(RootDirectory rootDirectory)
 {
     return(((IList)this).Add(rootDirectory));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) return;

            //读取的时候
            HttpCookie cookie2 = Request.Cookies["weiweixing"];

            if (cookie2 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string name = cookie2.Values["name"];
            if (name == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            string md5 = cookie2.Values["md5"];
            if (md5 == null)
            {
                Response.Redirect("login.aspx");
                return;
            }

            System.Globalization.CultureInfo culture = null;
            string langName = new System.Globalization.CultureInfo("zh-CN").NativeName;

            culture = new System.Globalization.CultureInfo("zh-CN");
            FileManager1.Culture = culture;

            FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Thumbnails;
            //Thumbnails

            FileManager1.RootDirectories.Clear();
            RootDirectory rootDirectory = new RootDirectory();
            rootDirectory.DirectoryPath = "~/user_dir/IMGUP";
            rootDirectory.Text = "上传图片管理";
            FileManager1.RootDirectories.Add(rootDirectory);

            FileManager1.HideEXT = true;
        }
 public bool Contains(RootDirectory rootDirectory)
 {
     return(((IList)this).Contains(rootDirectory));
 }
 public bool Contains(RootDirectory rootDirectory)
 {
     return ((IList) this).Contains (rootDirectory);
 }
 public int IndexOf(RootDirectory rootDirectory)
 {
     return(((IList)this).IndexOf(rootDirectory));
 }
 public int IndexOf(RootDirectory rootDirectory)
 {
     return ((IList) this).IndexOf (rootDirectory);
 }
 public void Insert(int index, RootDirectory rootDirectory)
 {
     ((IList)this).Insert(index, rootDirectory);
 }
 public void Remove(RootDirectory rootDirectory)
 {
     ((IList) this).Remove (rootDirectory);
 }
 public void Remove(RootDirectory rootDirectory)
 {
     ((IList)this).Remove(rootDirectory);
 }
Esempio n. 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ImageFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-imagefolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-imagefolder"] : "images");

            FlashFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-flashfolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-flashfolder"] : "flash");

            MediaFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-mediafolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-mediafolder"] : "media");

            FilesFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-filesfolder"]) ?
                    HF_FileBrowserConfig.Attributes["data-filesfolder"] : "files");

            string useCustomStr = String.IsNullOrEmpty(HF_CustomRoots.Attributes[USE_CUSTOMROOTS]) ? "" :  HF_CustomRoots.Attributes[USE_CUSTOMROOTS];
            string useDefaultStr = String.IsNullOrEmpty(HF_CustomRoots.Attributes[USE_DEFAULTROOTS]) ? "" :  HF_CustomRoots.Attributes[USE_DEFAULTROOTS];
            string hideCommandsStr = String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes[READONLY_HIDECOMMANDS]) ? "" : HF_FileBrowserConfig.Attributes[READONLY_HIDECOMMANDS];

            UseCustomRoots = useCustomStr.ToLower() != "false";
            UseDefaultRoots = useDefaultStr.ToLower() == "true";
            HideCommands = hideCommandsStr != "false";

            //if (Request.Url.Host.IndexOf("localhost") > -1)
            //    FileManager1.DefaultAccessMode = AccessMode.Write;

            CultureInfo culture;
            try
            {
                culture = new CultureInfo(Request["langCode"]);
            }
            catch (Exception)
            {
                culture = CultureInfo.CurrentCulture;
            }
            FileManager1.ShowAddressBar = false;
            FileManager1.AllowUpload = false;

            String cbReference =
                Page.ClientScript.GetCallbackEventReference(this,
                "arg", "ReceiveServerData", "context");
            String callbackScript;
            callbackScript = "function CallServer(arg, context)" +
                "{ " + cbReference + ";}";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
                "CallServer", callbackScript, true);

            if (!IsPostBack)
            {
                /**
                 * -------- Parameters --------------
                 * CKEDITOR automatically call FileManager service adding two custom parameters
                 * CKEditorFuncNum e type.
                 * First parameter allows you to pass choosen file url back to CKEDITOR
                 * through callback function
                 * Type paramete is used to restrict the file search to a
                 * specific folder
                 *
                 * Tiny MCE 4 use the type parameter and field parameter wich is
                 * the id of the field whose value must be set.
                 *
                 *
                 * Other recognized parameters
                 * caller:
                 *      allowed values: ckeditor, tinymce, parent, top
                 *      default: caller id defaulted to ckeditor if the CKEditor parameter is specified otherwise to parent
                 *      Idicates the object to wich the callback must be return
                 *
                 * fn:
                 *      allowed values: any string
                 *      default: null
                 *      Function name to be called.
                 *
                 * langCode:
                 *      allowed value: a standard language code
                 *      default: current language
                 *      CKEdito pass this paramenter automatically
                 *
                 */

                int fnumber = 0;
                string caller, fn;

                // the caller is CKEditor
                if (!string.IsNullOrEmpty(Request["CKEditor"]))
                {
                    caller = "ckeditor";
                }
                else
                    caller = (String.IsNullOrEmpty(Request["caller"]) ? "parent" : Request["caller"]);

                HF_Opener.Value = caller;

                fn = Request["fn"];

                if (!String.IsNullOrEmpty(fn))
                    HF_CallBack.Value = fn;

                if (int.TryParse(Request["CKEditorFuncNum"], out fnumber))
                    HF_CKEditorFunctionNumber.Value = fnumber.ToString();

                if (!String.IsNullOrEmpty(Request["field"]))
                    HF_Field.Value = Request["field"];

                string type = "";
                string mainRoot = "~/userfiles";

                if (FileManager1.Culture == null)
                    FileManager1.Culture = culture;

                HF_CurrentCulture.Value = FileManager1.Culture.Name;

                FileManager1.CustomToolbarButtons[0].Text = FileManager1.Controller.GetResourceString("View_file", "View File");
                Upload_button.InnerText = FileManager1.Controller.GetResourceString("Upload_file_click", "Click here to download a file");
                DND_message.InnerText = FileManager1.Controller.GetResourceString("Upload_dnd", "Or drag 'nd drop one or more files on the above area");

                if (!String.IsNullOrEmpty(FileManager1.MainDirectory))
                    mainRoot = FileManager1.MainDirectory;
                //mainRoot = ResolveClientUrl(mainRoot);
                if (!Directory.Exists(Server.MapPath(ResolveClientUrl(mainRoot))))
                    throw new Exception("User directory with write privileges is needed.");

                DirectoryInfo mainRootInfo = new DirectoryInfo(Server.MapPath(ResolveClientUrl(mainRoot)));

                if (!String.IsNullOrEmpty(Request["type"]))
                {
                    type = Request["type"];
                }

                RootDirectory images, flash, files, media;
                // Display text of root folders are localized using WebFileBrowser resources files
                // in "/App_GlobalResources/WebFileManager" and GetResoueceString method
                // of FileManager.Controller class

                FileManager1.RootDirectories.Clear();
                if (UseDefaultRoots)
                    {

                    mainRootInfo.CreateSubdirectory(ImageFolder);
                    mainRootInfo.CreateSubdirectory(FilesFolder);
                    mainRootInfo.CreateSubdirectory(FlashFolder);
                    mainRootInfo.CreateSubdirectory(MediaFolder);

                    switch (type)
                        {
                        case "images":
                        case "image":
                            FileManager1.RootDirectories.Clear();
                            images = new RootDirectory();
                            images.ShowRootIndex = false;
                            images.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + ImageFolder;
                            images.Text = FileManager1.Controller.GetResourceString("Root_Image", "Images");
                            images.LargeImageUrl = "~/FileBrowser/img/32/camera.png";
                            images.SmallImageUrl = "~/FileBrowser/img/16/camera.png";
                            FileManager1.RootDirectories.Add(images);
                            break;
                        case "flash":
                            FileManager1.RootDirectories.Clear();
                            flash = new RootDirectory();
                            flash.ShowRootIndex = false;
                            flash.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FlashFolder;
                            flash.LargeImageUrl = "~/FileBrowser/img/32/folder-flash.png";
                            flash.SmallImageUrl = "~/FileBrowser/img/16/folder-flash.png";
                            flash.Text = FileManager1.Controller.GetResourceString("Root_Flash", "Flash Movies");
                            FileManager1.RootDirectories.Add(flash);
                            break;
                        case "files":
                            FileManager1.RootDirectories.Clear();
                            files = new RootDirectory();
                            files.ShowRootIndex = false;
                            files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder;
                            files.LargeImageUrl = "~/FileBrowser/img/32/folder-document-alt.png";
                            files.SmallImageUrl = "~/FileBrowser/img/16/folder-document-alt.png";
                            files.Text = FileManager1.Controller.GetResourceString("Root_File", "Files");
                            FileManager1.RootDirectories.Add(files);
                            break;
                        case "media":
                            FileManager1.RootDirectories.Clear();
                            media = new RootDirectory();
                            media.ShowRootIndex = false;
                            media.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + MediaFolder;
                            media.LargeImageUrl = "~/FileBrowser/img/32/folder-video-alt.png";
                            media.SmallImageUrl = "~/FileBrowser/img/16/folder-video-alt.png";
                            media.Text = FileManager1.Controller.GetResourceString("Root_Media", "Media");
                            FileManager1.RootDirectories.Add(media);
                            break;
                        default:
                            FileManager1.RootDirectories.Clear();
                            files = new RootDirectory();
                            files.ShowRootIndex = false;
                            files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder;
                            files.LargeImageUrl = "~/FileBrowser/img/32/folder-document-alt.png";
                            files.SmallImageUrl = "~/FileBrowser/img/16/folder-document-alt.png";
                            // Display text of root folders are localized using WebFileBrowser resources files
                            // in "/App_GlobalResources/WebFileManager" and GetResoueceString method
                            // of FileManager.Controller class
                            files.Text = FileManager1.Controller.GetResourceString("Root_File", "Files");
                            FileManager1.RootDirectories.Add(files);

                            flash = new RootDirectory();
                            flash.ShowRootIndex = false;
                            flash.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FlashFolder;
                            flash.LargeImageUrl = "~/FileBrowser/img/32/folder-flash.png";
                            flash.SmallImageUrl = "~/FileBrowser/img/16/folder-flash.png";
                            flash.Text = FileManager1.Controller.GetResourceString("Root_Flash", "Flash Movies");
                            FileManager1.RootDirectories.Add(flash);

                            images = new RootDirectory();
                            images.ShowRootIndex = false;
                            images.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + ImageFolder;
                            images.Text = FileManager1.Controller.GetResourceString("Root_Image", "Images");
                            images.LargeImageUrl = "~/FileBrowser/img/32/camera.png";
                            images.SmallImageUrl = "~/FileBrowser/img/16/camera.png";
                            FileManager1.RootDirectories.Add(images);

                            media = new RootDirectory();
                            media.ShowRootIndex = false;
                            media.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + MediaFolder;
                            media.LargeImageUrl = "~/FileBrowser/img/32/folder-video-alt.png";
                            media.SmallImageUrl = "~/FileBrowser/img/16/folder-video-alt.png";
                            media.Text = FileManager1.Controller.GetResourceString("Root_Media", "Media");
                            FileManager1.RootDirectories.Add(media);

                            break;
                    }
                }

                if (UseCustomRoots)
                {
                    // Memorizza il parametro querystring "cs" che consente di visualizzare una sola customroot
                    int selectedCustomRoot;
                    if (!int.TryParse(Request["cs"], out selectedCustomRoot))
                        selectedCustomRoot = -1;

                    // Folder containing custom roots icon images
                    string rootsImageFolder = String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_IMAGEFOLDER]) ? "" : HF_CustomRoots.Attributes[ROOTS_IMAGEFOLDER];

                    //Arrays: roots names, roots folders, small icons, large icons
                    string[] rootsNames, rootsFolders, rootsSmallImages, rootsLargeImages;

                    // Convert data-roots-names value in array
                    string temp = String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_NAMES]) ? "" : HF_CustomRoots.Attributes[ROOTS_NAMES];
                    if (temp == "")
                    {
                        return;
                    }
                    rootsNames = temp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    // Count of custom roots
                    int rootsCount = rootsNames.Length;

                    // If data-roots-folder is empty, will use root names
                    if (String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_FOLDERS]))
                    {
                        rootsFolders = temp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    else
                    {
                        rootsFolders = HF_CustomRoots.Attributes[ROOTS_FOLDERS].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    }

                    if (rootsCount > rootsFolders.Length)
                        rootsCount = rootsFolders.Length;

                    if (!String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_SMALLIMAGES]))
                    {
                        rootsSmallImages = HF_CustomRoots.Attributes[ROOTS_SMALLIMAGES].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        if (rootsCount > rootsSmallImages.Length)
                            rootsCount = rootsSmallImages.Length;
                    }
                    else
                    {
                        rootsSmallImages = new string [] {};
                        rootsCount = 0;

                    }

                    if (!String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_LARGEIMAGES]))
                    {
                        rootsLargeImages = HF_CustomRoots.Attributes[ROOTS_LARGEIMAGES].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        if (rootsCount > rootsLargeImages.Length)
                            rootsCount = rootsLargeImages.Length;
                    }
                    else
                    {
                        rootsLargeImages = new string[] { };
                        rootsCount = 0;

                    }

                    if (rootsCount == 0)
                    {
                        throw new Exception("If UseCustomRoots option is setted you must provide Custom Roots full info (Names, Folders, small an large images).");
                    }
                    else
                    {
                        if (selectedCustomRoot >= 0 && selectedCustomRoot < rootsCount)
                        {
                            mainRootInfo.CreateSubdirectory(rootsFolders[selectedCustomRoot]);
                            RootDirectory myCustomRoot = new RootDirectory();
                            myCustomRoot.ShowRootIndex = false;
                            myCustomRoot.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + rootsFolders[selectedCustomRoot];
                            myCustomRoot.LargeImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[selectedCustomRoot];
                            myCustomRoot.SmallImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[selectedCustomRoot];
                            myCustomRoot.Text = rootsNames[selectedCustomRoot];
                            FileManager1.RootDirectories.Add(myCustomRoot);
                        }
                        else
                        {
                            for (int i = 0; i < rootsCount; i++)
                            {
                                mainRootInfo.CreateSubdirectory(rootsFolders[i]);
                                RootDirectory myCustomRoot = new RootDirectory();
                                myCustomRoot.ShowRootIndex = false;
                                myCustomRoot.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + rootsFolders[i];
                                myCustomRoot.LargeImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[i];
                                myCustomRoot.SmallImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[i];
                                myCustomRoot.Text = rootsNames[i];
                                FileManager1.RootDirectories.Add(myCustomRoot);
                            }

                        }
                    }
                }
            }

            AccessMode fbAccessMode;
            if (MagicSession.Current.FileBrowserAccessMode == AccessMode.Default)
                fbAccessMode = FileManager1.DefaultAccessMode;
            else
                fbAccessMode = MagicSession.Current.FileBrowserAccessMode;

            Literal content;

            switch (fbAccessMode)
            {
                case AccessMode.Delete:
                    FileManager1.Visible = true;
                    Panel_upload.Visible = true;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = false;
                    FileManager1.AllowDelete = true;
                    FileManager1.AllowOverwrite = true;
                    break;
                case AccessMode.DenyAll:
                    FileManager1.Visible = false;
                    Panel_upload.Visible = false;
                    Panel_deny.Visible = true;
                    content = new Literal();
                    content.Text = "<h1>" + FileManager1.Controller.GetResourceString("Upload_Error_3", "User does not have sufficient privileges.") + "<br/>&nbsp;</h1>";
                    Panel_deny.Controls.Add(content);
                    break;
                case AccessMode.ReadOnly:
                case AccessMode.Default:
                    FileManager1.Visible = true;
                    Panel_upload.Visible = false;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = true;
                    if (HideCommands)
                    {
                        FileManager1.ShowToolBar = false;
                        FileManager1.EnableContextMenu = false;
                        Panel_upload.Visible = true;
                        Upload_button.Visible = false;
                        DND_message.InnerText = FileManager1.Controller.GetResourceString("No_Command_Help", "DoubleClick to open a folder. DoubleClick to download a file.");
                    }
                    break;
                case AccessMode.Write:
                    FileManager1.Visible = true;
                    Panel_upload.Visible = true;
                    Panel_deny.Visible = false;
                    FileManager1.ReadOnly = false;
                    FileManager1.AllowDelete = false;
                    FileManager1.AllowOverwrite = false;
                    break;
                default:
                    break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //CheckDir("USER_DIR\\SYSUSER\\Table\\"); // 表单文件夹
            //CheckDir("USER_DIR\\SYSUSER\\Table2\\"); // 表单结果收集文件夹 每个表单关键名称建立一个文件夹
            if (Page.IsPostBack) return;

            //读取的时候
            HttpCookie cookie2 = Request.Cookies["weiweixing"];

            if (cookie2 == null)
            {
            Response.Redirect("login.aspx");
            return;
            }

            string name = cookie2.Values["name"];
            if (name == null)
            {
            Response.Redirect("login.aspx");
            return;
            }

            string md5 = cookie2.Values["md5"];
            if (md5 == null)
            {
            Response.Redirect("login.aspx");
            return;
            }

            if (Page.IsPostBack) return;

            FileManager1.RootDirectories.Clear();
            RootDirectory rootDirectory = new RootDirectory();
            rootDirectory.DirectoryPath = "~/user_dir/sysuser/table/Table2";
            rootDirectory.Text = "表单结果收集";
            FileManager1.RootDirectories.Add(rootDirectory);

            System.Globalization.CultureInfo culture = null;
            string langName = new System.Globalization.CultureInfo("zh-CN").NativeName;

            culture = new System.Globalization.CultureInfo("zh-CN");
            FileManager1.Culture = culture;

            FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Details;

            FileManager1.HideEXT = true;

            for (int i = 0; i < typeof(ToolbarOptions).GetProperties().Length; i++)
            {
            PropertyInfo prop = typeof(ToolbarOptions).GetProperties()[i];

            if (prop.PropertyType == typeof(bool))
            {

                if (prop.Name == "ShowRenameButton")
                {
                    prop.SetValue(FileManager1.ToolbarOptions, false, null);
                }

                //ShowMoveButton;ShowFolderUpButton;ShowNewFolderButton
                if (prop.Name == "ShowMoveButton")
                {
                    prop.SetValue(FileManager1.ToolbarOptions, false, null);
                }
                if (prop.Name == "ShowFolderUpButton")
                {
                    prop.SetValue(FileManager1.ToolbarOptions, false, null);
                }
                if (prop.Name == "ShowNewFolderButton")
                {
                    prop.SetValue(FileManager1.ToolbarOptions, false, null);
                }
            }
            }
        }