Esempio n. 1
0
        public override string CopyDirectory(string path, string newPath)
        {
            try
            {
                string virtualPath            = FileSystemValidation.ToVirtualPath(path);
                string virtualNewPath         = FileSystemValidation.ToVirtualPath(newPath);
                string virtualDestinationPath = FileSystemValidation.GetDestinationFolder(virtualNewPath);

                string returnValue = DNNValidator.OnCopyFolder(virtualPath, virtualDestinationPath);
                if (!(string.IsNullOrEmpty(returnValue)))
                {
                    return(returnValue);
                }

                //Are all items visible to user?
                //todo: copy visible files and folders only?
                FolderInfo folder = DNNValidator.GetUserFolder(virtualPath);
                if (!(CheckAllChildrenVisible(ref folder)))
                {
                    return(DNNValidator.LogDetailError(ErrorCodes.CannotCopyFolder_ChildrenVisible));
                }

                returnValue = TelerikContent.CopyDirectory(virtualPath, virtualNewPath);

                if (string.IsNullOrEmpty(returnValue))
                {
                    //Sync to add new folder & files
                    FileSystemUtils.SynchronizeFolder(PortalSettings.PortalId, HttpContext.Current.Request.MapPath(virtualNewPath), FileSystemValidation.ToDBPath(virtualNewPath), true, true, true);
                }

                return(returnValue);
            }
            catch (Exception ex)
            {
                return(DNNValidator.LogUnknownError(ex, path, newPath));
            }
        }