Exemple #1
0
        public ActionResult SearchTags(String virtualPath, String tagName)
        {
            FileModel fileModel = new FileModel(virtualPath, "");

            fileModel.IsRootDir      = true;
            fileModel.IsSearchResult = true;
            DocumentsOperations docOps = new DocumentsOperations();
            AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations();

            String[]         usersPath           = docOps.GetAllUsersFolderInArray(UtilityOperations.GetDockerRootPath() + "/");
            List <FileModel> searchCurrentResult = new List <FileModel>();
            List <FileModel> searchCommonResult  = new List <FileModel>();

            foreach (String vPath in docOps.GetVirtualPathsByTagName(aNaOps.GetUserIDByUserName(HttpContext.User.Identity.Name), tagName))
            {
                FileModel file = null;
                if (vPath.StartsWith(UtilityOperations.GetDockerCommonFolderPath()))
                {
                    file = (new FileModel()).GetFolderOrFile(vPath);
                    file.IsCommonFolder = true;
                    if (usersPath.Contains(file.VirtualPath))
                    {
                        file.IsUserFolder = true;
                    }
                    searchCommonResult.Add(file);
                }
                else
                {
                    file = (new FileModel()).GetFolderOrFile(vPath);
                    if (usersPath.Contains(file.VirtualPath))
                    {
                        file.IsUserFolder = true;
                    }
                    searchCurrentResult.Add(file);
                }
            }
            fileModel.CurrentFolderFiles = searchCurrentResult;
            fileModel.CommonFolderFiles  = searchCommonResult;
            fileModel.Tags = new List <String>();
            return(View(fileModel));
        }