Example #1
0
        public override XVar readWebValue(dynamic avalues, dynamic blobfields, dynamic _param_legacy1, dynamic _param_legacy2, dynamic filename_values)
        {
            #region pass-by-value parameters
            dynamic legacy1 = XVar.Clone(_param_legacy1);
            dynamic legacy2 = XVar.Clone(_param_legacy2);
            #endregion

            getPostValueAndType();
            if (XVar.Pack(MVCFunctions.FieldSubmitted((XVar)(MVCFunctions.Concat(this.goodFieldName, "_", this.id)))))
            {
                dynamic fileNameForPrepareFunc = null;
                fileNameForPrepareFunc = XVar.Clone(CommonFunctions.securityCheckFileName((XVar)(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("filename_", this.goodFieldName, "_", this.id))))));
                if (this.pageObject.pageType != Constants.PAGE_EDIT)
                {
                    this.webValue = XVar.Clone(MVCFunctions.prepare_upload((XVar)(this.field), new XVar("upload2"), (XVar)(fileNameForPrepareFunc), (XVar)(fileNameForPrepareFunc), new XVar(""), (XVar)(this.id), (XVar)(this.pageObject)));
                }
                else
                {
                    if (MVCFunctions.substr((XVar)(this.webType), new XVar(0), new XVar(4)) == "file")
                    {
                        dynamic prepearedFile = XVar.Array();
                        prepearedFile = XVar.Clone(MVCFunctions.prepare_file((XVar)(this.webValue), (XVar)(this.field), (XVar)(this.webType), (XVar)(fileNameForPrepareFunc), (XVar)(this.id)));
                        if (!XVar.Equals(XVar.Pack(prepearedFile), XVar.Pack(false)))
                        {
                            dynamic filename = null;
                            this.webValue = XVar.Clone(prepearedFile["value"]);
                            filename      = XVar.Clone(prepearedFile["filename"]);
                        }
                        else
                        {
                            this.webValue = new XVar(false);
                        }
                    }
                    else
                    {
                        if (MVCFunctions.substr((XVar)(this.webType), new XVar(0), new XVar(6)) == "upload")
                        {
                            if (XVar.Pack(fileNameForPrepareFunc))
                            {
                                this.webValue = XVar.Clone(fileNameForPrepareFunc);
                            }
                            if (this.webType == "upload1")
                            {
                                dynamic oldValues = XVar.Array();
                                oldValues = XVar.Clone(this.pageObject.getOldRecordData());
                                fileNameForPrepareFunc = XVar.Clone(oldValues[this.field]);
                            }
                            this.webValue = XVar.Clone(MVCFunctions.prepare_upload((XVar)(this.field), (XVar)(this.webType), (XVar)(fileNameForPrepareFunc), (XVar)(this.webValue), new XVar(""), (XVar)(this.id), (XVar)(this.pageObject)));
                        }
                    }
                }
            }
            else
            {
                this.webValue = new XVar(false);
            }
            if (XVar.Pack(!(XVar)(XVar.Equals(XVar.Pack(this.webValue), XVar.Pack(false)))))
            {
                if ((XVar)(this.webValue) && (XVar)(this.pageObject.pSetEdit.getCreateThumbnail((XVar)(this.field))))
                {
                    dynamic contents = null, ext = null, thumb = null;
                    contents = XVar.Clone(MVCFunctions.GetUploadedFileContents((XVar)(MVCFunctions.Concat("value_", this.goodFieldName, "_", this.id))));
                    ext      = XVar.Clone(CommonFunctions.CheckImageExtension((XVar)(MVCFunctions.GetUploadedFileName((XVar)(MVCFunctions.Concat("value_", this.goodFieldName, "_", this.id))))));
                    thumb    = XVar.Clone(MVCFunctions.CreateThumbnail((XVar)(contents), (XVar)(this.pageObject.pSetEdit.getThumbnailSize((XVar)(this.field))), (XVar)(ext)));
                    this.pageObject.filesToSave.InitAndSetArrayItem(new SaveFile((XVar)(thumb), (XVar)(MVCFunctions.Concat(this.pageObject.pSetEdit.getStrThumbnail((XVar)(this.field)), this.webValue)), (XVar)(this.pageObject.pSetEdit.getUploadFolder((XVar)(this.field))), (XVar)(this.pageObject.pSetEdit.isAbsolute((XVar)(this.field)))), null);
                }
                avalues.InitAndSetArrayItem(this.webValue, this.field);
            }
            return(null);
        }