예제 #1
0
        /*private string CreateFolderPath(IMediaFileFolder folder)
         * {
         *  string folderName = this.GetBinding<string>("FolderName");
         *
         *  string folderPath = folder.Path;
         *
         *  if (folderPath == "/")
         *  {
         *      folderPath = folderPath + folderName;
         *  }
         *  else
         *  {
         *      folderPath = folderPath + "/" + folderName;
         *  }
         *
         *  folderPath = folderPath.Replace('\\', '/');
         *  while (folderPath.Contains("//"))
         *  {
         *      folderPath.Replace("//", "/");
         *  }
         *
         *  if ((folderPath != "/") && (folderPath.StartsWith("/")))
         *  {
         *      folderPath.Remove(0, 1);
         *  }
         *
         *  return folderPath;
         * }*/


        private void finalizeCodeActivity_ExecuteCode(object sender, EventArgs e)
        {
            AddNewTreeRefresher addNewTreeRefresher = this.CreateAddNewTreeRefresher(this.EntityToken);

            IMediaFileFolder folder       = this.GetBinding <IMediaFileFolder>("NewFolder");
            string           folderName   = this.GetBinding <string>("FolderName");
            string           providerName = this.GetBinding <string>("ProviderName");

            string folderPath = folder.CreateFolderPath(folderName);

            folder.Path = folderPath;

            if (folder.Title == string.Empty)
            {
                folder.Title = folderPath.GetFolderName('/');
            }

            CreateParentFolder(folder.GetParentFolderPath(), providerName);

            folder = DataFacade.AddNew <IMediaFileFolder>(folder, providerName);

            addNewTreeRefresher.PostRefreshMesseges(folder.GetDataEntityToken());

            SelectElement(folder.GetDataEntityToken());
        }
예제 #2
0
        private void ValidateInputs(object sender, ConditionalEventArgs e)
        {
            e.Result = true;

            IMediaFileFolder folder     = this.GetBinding <IMediaFileFolder>("NewFolder");
            string           folderName = this.GetBinding <string>("FolderName");
            string           folderPath = folder.CreateFolderPath(folderName);

            string tempFolderName = folderName.Replace('\\', '/').Trim();

            while (tempFolderName.Contains("//"))
            {
                tempFolderName = tempFolderName.Replace("//", "/");
            }

            if (tempFolderName == "/")
            {
                e.Result = false;
                ShowFieldMessage("FolderName", StringResourceSystemFacade.GetString("Composite.Management", "Website.Forms.Administrative.AddNewMediaFolder.FolderNotOnlySlash"));
                return;
            }

            if (DataFacade.GetData <IMediaFileFolder>().Any(f => string.Compare(f.Path, folderPath, StringComparison.InvariantCultureIgnoreCase) == 0))
            {
                e.Result = false;
                ShowFieldMessage("FolderName", StringResourceSystemFacade.GetString("Composite.Management", "Website.Forms.Administrative.AddNewMediaFolder.FolderNameAlreadyUsed"));
            }

            if (folderPath.Length > 2048)
            {
                e.Result = false;
                ShowFieldMessage("FolderName", StringResourceSystemFacade.GetString("Composite.Management", "Website.Forms.Administrative.AddNewMediaFolder.FolderNameTooLong"));
            }



            folderPath.IsCorrectFolderName('/');
        }