コード例 #1
0
        public virtual 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)))))
            {
                this.webValue = XVar.Clone(CommonFunctions.prepare_for_db((XVar)(this.field), (XVar)(this.webValue), (XVar)(this.webType)));
            }
            else
            {
                this.webValue = new XVar(false);
            }
            if ((XVar)(this.pageObject.pageType == Constants.PAGE_EDIT) && (XVar)(this.pageObject.pSetEdit.isReadonly((XVar)(this.field))))
            {
                if (XVar.Pack(this.pageObject.pSetEdit.getAutoUpdateValue((XVar)(this.field))))
                {
                    this.webValue = XVar.Clone(this.pageObject.pSetEdit.getAutoUpdateValue((XVar)(this.field)));
                }
                else
                {
                    if (this.pageObject.pSetEdit.getOwnerTable((XVar)(this.field)) != this.pageObject.pSetEdit.getStrOriginalTableName())
                    {
                        this.webValue = new XVar(false);
                    }
                }
            }
            if (XVar.Pack(!(XVar)(XVar.Equals(XVar.Pack(this.webValue), XVar.Pack(false)))))
            {
                if (this.connection.dbType == Constants.nDATABASE_Informix)
                {
                    if (XVar.Pack(CommonFunctions.IsTextType((XVar)(this.pageObject.pSetEdit.getFieldType((XVar)(this.field))))))
                    {
                        blobfields.InitAndSetArrayItem(this.field, null);
                    }
                }
                avalues.InitAndSetArrayItem(this.webValue, this.field);
            }
            return(null);
        }
コード例 #2
0
ファイル: FileFieldSingle.cs プロジェクト: kurtrad/ABCVote
        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);
        }
コード例 #3
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();
            this.formStamp = XVar.Clone(MVCFunctions.postvalue((XVar)(MVCFunctions.Concat("formStamp_", this.goodFieldName, "_", this.id))));
            if ((XVar)(MVCFunctions.FieldSubmitted((XVar)(MVCFunctions.Concat(this.goodFieldName, "_", this.id)))) && (XVar)(this.formStamp != ""))
            {
                dynamic filesArray = XVar.Array();
                filesArray = XVar.Clone(MVCFunctions.my_json_decode((XVar)(this.webValue)));
                if ((XVar)(!(XVar)(MVCFunctions.is_array((XVar)(filesArray)))) || (XVar)(MVCFunctions.count(filesArray) == 0))
                {
                    this.webValue = new XVar("");
                }
                else
                {
                    dynamic result = XVar.Array(), searchStr = null, uploadDir = null;
                    if (0 < MVCFunctions.count(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)]))
                    {
                        foreach (KeyValuePair <XVar, dynamic> fileArray in XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].GetEnumerator())
                        {
                            fileArray.Value.InitAndSetArrayItem(true, "deleted");
                        }
                    }
                    result    = XVar.Clone(XVar.Array());
                    uploadDir = XVar.Clone(this.pageObject.pSetEdit.getLinkPrefix((XVar)(this.field)));
                    searchStr = new XVar("");
                    foreach (KeyValuePair <XVar, dynamic> file in filesArray.GetEnumerator())
                    {
                        if (XVar.Pack(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)].KeyExists(file.Value["name"])))
                        {
                            dynamic sessionFile = XVar.Array();
                            sessionFile = XVar.Clone(XSession.Session[MVCFunctions.Concat("mupload_", this.formStamp)][file.Value["name"]]["file"]);
                            searchStr   = MVCFunctions.Concat(searchStr, file.Value["name"], ",!");
                            result.InitAndSetArrayItem(new XVar("name", sessionFile["name"], "usrName", file.Value["name"], "size", sessionFile["size"], "type", sessionFile["type"]), null);
                            if ((XVar)(this.pageObject.pSetEdit.getCreateThumbnail((XVar)(this.field))) && (XVar)(sessionFile["thumbnail"] != ""))
                            {
                                dynamic lastIndex = null;
                                lastIndex = XVar.Clone(MVCFunctions.count(result) - 1);
                                result.InitAndSetArrayItem(sessionFile["thumbnail"], lastIndex, "thumbnail");
                                result.InitAndSetArrayItem(sessionFile["thumbnail_type"], lastIndex, "thumbnail_type");
                                result.InitAndSetArrayItem(sessionFile["thumbnail_size"], lastIndex, "thumbnail_size");
                            }
                            XSession.Session.InitAndSetArrayItem(false, MVCFunctions.Concat("mupload_", this.formStamp), file.Value["name"], "deleted");
                        }
                    }
                    if (0 < MVCFunctions.count(result))
                    {
                        result.InitAndSetArrayItem(MVCFunctions.Concat(searchStr, ":sStrEnd"), 0, "searchStr");
                        this.webValue = XVar.Clone(MVCFunctions.my_json_encode_unescaped_unicode((XVar)(result)));
                    }
                    else
                    {
                        this.webValue = new XVar("");
                    }
                }
            }
            else
            {
                this.webValue = new XVar(false);
            }
            if (XVar.Pack(!(XVar)(XVar.Equals(XVar.Pack(this.webValue), XVar.Pack(false)))))
            {
                if (this.connection.dbType == Constants.nDATABASE_Informix)
                {
                    if (XVar.Pack(CommonFunctions.IsTextType((XVar)(this.pageObject.pSetEdit.getFieldType((XVar)(this.field))))))
                    {
                        blobfields.InitAndSetArrayItem(this.field, null);
                    }
                }
                avalues.InitAndSetArrayItem(this.webValue, this.field);
            }
            return(null);
        }