ProcessReplaceFields() 정적인 개인적인 메소드

static private ProcessReplaceFields ( string s, Field>.Dictionary replaceFields, ISaveRequestHandler handler ) : string
s string
replaceFields Field>.Dictionary
handler ISaveRequestHandler
리턴 string
예제 #1
0
        private string CopyTemporaryFiles(ISaveRequestHandler handler,
                                          UploadedFile[] oldFileList, UploadedFile[] newFileList, FilesToDelete filesToDelete)
        {
            foreach (var file in newFileList)
            {
                var filename = file.Filename.Trim();
                if (oldFileList.Any(x => String.Compare(x.Filename.Trim(), filename, StringComparison.OrdinalIgnoreCase) == 0))
                {
                    continue;
                }

                if (!filename.ToLowerInvariant().StartsWith("temporary/"))
                {
                    throw new InvalidOperationException("For security reasons, only temporary files can be used in uploads!");
                }

                ImageUploadBehavior.CheckUploadedImageAndCreateThumbs(attr, ref filename);

                var idField    = (Field)(((IIdRow)handler.Row).IdField);
                var copyResult = uploadHelper.CopyTemporaryFile(filename, idField.AsObject(handler.Row), filesToDelete,
                                                                s => ImageUploadBehavior.ProcessReplaceFields(s, this.replaceFields, handler));

                if (!attr.SubFolder.IsEmptyOrNull())
                {
                    copyResult.DbFileName = copyResult.DbFileName.Substring(attr.SubFolder.Length + 1);
                }

                file.Filename = copyResult.DbFileName;
            }

            return(JSON.Stringify(newFileList));
        }
예제 #2
0
        private CopyTemporaryFileResult CopyTemporaryFile(ISaveRequestHandler handler, FilesToDelete filesToDelete)
        {
            var fileName    = (StringField)Target;
            var newFilename = fileName[handler.Row] = fileName[handler.Row].TrimToNull();

            CheckUploadedImageAndCreateThumbs(attr, ref newFilename);

            var idField = (Field)(((IIdRow)handler.Row).IdField);

            var copyResult = uploadHelper.CopyTemporaryFile(newFilename, idField.AsObject(handler.Row), filesToDelete,
                                                            s => ImageUploadBehavior.ProcessReplaceFields(s, this.replaceFields, handler.Row));

            if (!attr.SubFolder.IsEmptyOrNull())
            {
                copyResult.DbFileName = copyResult.DbFileName.Substring(attr.SubFolder.Length + 1);
            }

            return(copyResult);
        }