public override XVar getPdfValue(dynamic data, dynamic _param_keylink = null) { #region default values if (_param_keylink as Object == null) { _param_keylink = new XVar(""); } #endregion #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); #endregion dynamic imageType = null, width = null; if (XVar.Pack(!(XVar)(data[this.field]))) { return("\"\""); } width = XVar.Clone(this.container.pSet.getImageWidth((XVar)(this.field))); if (XVar.Pack(!(XVar)(width))) { width = new XVar(100); if (XVar.Equals(XVar.Pack(this.container.pageType), XVar.Pack(Constants.PAGE_VIEW))) { width = new XVar(300); } } imageType = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(data[this.field]))); if ((XVar)(imageType == "image/jpeg") || (XVar)(imageType == "image/png")) { return(MVCFunctions.Concat("{ \r\n\t\t\t\timage: \"", CommonFunctions.jsreplace((XVar)(MVCFunctions.Concat("data:", imageType, ";base64,", MVCFunctions.base64_encode((XVar)(data[this.field]))))), "\",\r\n\t\t\t\twidth: ", width, ", \r\n\t\t\t\theight: ", this.container.pSet.getImageHeight((XVar)(this.field)), " \r\n\t\t\t}")); } return("\"\""); }
public override XVar getPdfValue(dynamic data, dynamic _param_keylink = null) { #region default values if (_param_keylink as Object == null) { _param_keylink = new XVar(""); } #endregion #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); #endregion dynamic defWidth = null, filesArray = XVar.Array(), resultValues = XVar.Array(), thumbWidth = null, width = null; if (XVar.Pack(!(XVar)(data[this.field]))) { return("\"\""); } defWidth = new XVar(100); if (XVar.Equals(XVar.Pack(this.container.pageType), XVar.Pack(Constants.PAGE_VIEW))) { defWidth = new XVar(300); } width = XVar.Clone((XVar.Pack(this.imageWidth) ? XVar.Pack(this.imageWidth) : XVar.Pack(defWidth))); thumbWidth = XVar.Clone((XVar.Pack(this.thumbWidth) ? XVar.Pack(this.thumbWidth) : XVar.Pack(72))); if (XVar.Pack(this.isImageURL)) { return(MVCFunctions.Concat("{ \r\n\t\t\t\timage:\"", data[this.field], "\",\r\n\t\t\t\twidth: ", width, ", \r\n\t\t\t\theight: ", this.imageHeight, " \t\t\t\r\n\t\t\t}")); } this.upload_handler.tkeys = XVar.Clone(keylink); resultValues = XVar.Clone(XVar.Array()); filesArray = XVar.Clone(getFilesArray((XVar)(data[this.field]))); foreach (KeyValuePair <XVar, dynamic> imageFile in filesArray.GetEnumerator()) { dynamic content = null, hasBigImage = null, hasThumbnail = null, imagePath = null, imageType = null, thumbPath = null, userFile = null; userFile = XVar.Clone(this.upload_handler.buildUserFile((XVar)(imageFile.Value))); if (XVar.Pack(!(XVar)(CommonFunctions.CheckImageExtension((XVar)(imageFile.Value["name"]))))) { resultValues.InitAndSetArrayItem("\"\"", null); continue; } imagePath = XVar.Clone(getImagePath((XVar)(imageFile.Value["name"]))); hasBigImage = XVar.Clone(MVCFunctions.myfile_exists((XVar)(imagePath))); if (XVar.Pack(!(XVar)(hasBigImage))) { continue; } if (XVar.Pack(!(XVar)(this.showThumbnails))) { content = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(imagePath))); imageType = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(content))); if ((XVar)(imageType == "image/jpeg") || (XVar)(imageType == "image/png")) { resultValues.InitAndSetArrayItem(MVCFunctions.Concat("{ \r\n\t\t\t\t\t\timage: \"", CommonFunctions.jsreplace((XVar)(MVCFunctions.Concat("data:", imageType, ";base64,", MVCFunctions.base64_encode((XVar)(content))))), "\",\r\n\t\t\t\t\t\twidth: ", width, ", \r\n\t\t\t\t\t\theight: ", this.imageHeight, " \r\n\t\t\t\t\t}"), null); } continue; } thumbPath = XVar.Clone(getImagePath((XVar)(imageFile.Value["thumbnail"]))); hasThumbnail = XVar.Clone(MVCFunctions.myfile_exists((XVar)(thumbPath))); if (XVar.Pack(hasThumbnail)) { content = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(thumbPath))); imageType = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(content))); if ((XVar)(imageType == "image/jpeg") || (XVar)(imageType == "image/png")) { resultValues.InitAndSetArrayItem(MVCFunctions.Concat("{ \r\n\t\t\t\t\t\timage: \"", CommonFunctions.jsreplace((XVar)(MVCFunctions.Concat("data:", imageType, ";base64,", MVCFunctions.base64_encode((XVar)(content))))), "\",\r\n\t\t\t\t\t\twidth: ", thumbWidth, ", \r\n\t\t\t\t\t\theight: ", this.thumbHeight, " \r\n\t\t\t\t\t}"), null); } } else { content = XVar.Clone(MVCFunctions.myfile_get_contents((XVar)(imagePath))); imageType = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(content))); if ((XVar)(imageType == "image/jpeg") || (XVar)(imageType == "image/png")) { resultValues.InitAndSetArrayItem(MVCFunctions.Concat("{ \r\n\t\t\t\t\t\timage: \"", CommonFunctions.jsreplace((XVar)(MVCFunctions.Concat("data:", imageType, ";base64,", MVCFunctions.base64_encode((XVar)(content))))), "\",\r\n\t\t\t\t\t\twidth: ", thumbWidth, ", \r\n\t\t\t\t\t\theight: ", this.thumbHeight, " \r\n\t\t\t\t\t}"), null); } } } if (0 < MVCFunctions.count(resultValues)) { return(MVCFunctions.Concat("[", MVCFunctions.implode(new XVar(","), (XVar)(resultValues)), "]")); } return("\"\""); }
public override XVar getPdfValue(dynamic data, dynamic _param_keylink = null) { #region default values if (_param_keylink as Object == null) { _param_keylink = new XVar(""); } #endregion #region pass-by-value parameters dynamic keylink = XVar.Clone(_param_keylink); #endregion dynamic content = null, imageType = null, location = null, mapData = XVar.Array(), staticUrl = null; mapData = XVar.Clone(this.pageObject.addGoogleMapData((XVar)(this.field), (XVar)(data))); location = XVar.Clone(getLocation((XVar)(mapData["markers"][0]))); staticUrl = XVar.Clone(getStaticMapURL((XVar)(location), (XVar)(mapData["zoom"]), (XVar)(mapData["markers"][0]["mapIcon"]))); content = XVar.Clone(MVCFunctions.myurl_get_contents_binary((XVar)(staticUrl))); imageType = XVar.Clone(MVCFunctions.SupposeImageType((XVar)(content))); if ((XVar)(imageType == "image/jpeg") || (XVar)(imageType == "image/png")) { return(MVCFunctions.Concat("{ \r\n\t\t\t\timage: \"", CommonFunctions.jsreplace((XVar)(MVCFunctions.Concat("data:", imageType, ";base64,", MVCFunctions.base64_encode((XVar)(content))))), "\",\r\n\t\t\t}")); } return("\"\""); }