private void PopulateTree(int searchValue) { FileController fileCtrl = new FileController(); FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(PortalId) as List<FileConfiguration>; if (configs.Count > 0) { //check for root shared folder var rootFolder = fileCtrl.GetRootPortalFolder(PortalId, UserId); //if none exists, create if (rootFolder == null) { rootFolder = fileCtrl.CreateRootSharedFolder(UserId, PortalId); } configs[0].RootSharedFolderID = rootFolder.ID; //check root users folder if (configs[0].RootUsersFolderID == 0) { //if none exists, create configs[0].RootUsersFolderID = fileCtrl.CreateRootUsersFolder(UserId, PortalId).ID; } //check root groups folder if (configs[0].RootGroupsFolderID == 0) { //if none exists, create configs[0].RootGroupsFolderID = fileCtrl.CreateRootGroupsFolder(UserId, PortalId).ID; } //update config ctrlConfig.Update(configs[0]); } File rootFile = new File(); rootFile.ID = -1; rootFile.Name = "QuickDocsPro"; List<File> listFiles = fileCtrl.GetItemsByParent(rootFile.ID, UserId, PortalId, PortalSettings.AdministratorRoleId, "Asc") as List<File>; System.Web.UI.WebControls.TreeNode rootNode = new System.Web.UI.WebControls.TreeNode(rootFile.Name, rootFile.ID.ToString(), "images/window_16_hot.png"); rootNode.Expanded = false; treeFolders.Nodes.Add(rootNode); populateChildren(rootNode, searchValue, configs[0]); if (rootNode.Value == searchValue.ToString()) { rootNode.Selected = true; } }
private int GetModuleRootFolderID(string strFilesMode) { int rootFolderID = -1; FileController ctrlFiles = new FileController(); File rootFile = null; switch (strFilesMode) { case "SharedFiles": try { if (Settings["ModuleRootFolderID"] != null) { rootFolderID = Convert.ToInt32(Settings["ModuleRootFolderID"].ToString()); } else { rootFile = ctrlFiles.GetRootPortalFolder(PortalId, UserId); // GetDefaultPortalFolder(UserId, PortalId); } } catch {} break; case "UserFiles": if (this.Request.QueryString["UserID"] != null) { rootFile = GetDefaultUserFolder(Convert.ToInt32(this.Request.QueryString["UserID"].ToString())); } break; case "GroupFiles": if (this.Request.QueryString["GroupID"] != null) { rootFile = GetDefaultGroupFolder(Convert.ToInt32(this.Request.QueryString["GroupID"].ToString())); } break; } if (rootFile != null) { rootFolderID = rootFile.ID; } return rootFolderID; }
public override void UpdateSettings() { try { ModuleController objModules = new ModuleController(); switch (cmbFilesMode.SelectedValue.ToString()) { case "UserFiles": objModules.UpdateTabModuleSetting(TabModuleId, "ModuleRootFolderID", "-1"); break; case "GroupFiles": objModules.UpdateTabModuleSetting(TabModuleId, "ModuleRootFolderID", "-1"); break; default: //can't select root folder or no folder: show error if (treeFolders.SelectedNode == null || treeFolders.SelectedValue == "-1") { FileController ctrlFiles = new FileController(); File rootSiteFolder = ctrlFiles.GetRootPortalFolder(UserId, PortalId); //.GetDefaultPortalFolder(UserId, PortalId); objModules.UpdateTabModuleSetting(TabModuleId, "ModuleRootFolderID", rootSiteFolder.ID.ToString()); } else { objModules.UpdateTabModuleSetting(TabModuleId, "ModuleRootFolderID", treeFolders.SelectedValue); } break; } objModules.UpdateTabModuleSetting(TabModuleId, "FilesMode", cmbFilesMode.SelectedValue); objModules.UpdateTabModuleSetting(TabModuleId, "Theme", cmbTheme.SelectedValue); objModules.UpdateTabModuleSetting(TabModuleId, "ShowAuditHistory", chkShowAuditHistory.Checked.ToString()); } catch (Exception exc) { //Module failed to load Exceptions.ProcessModuleLoadException(this, exc); } }