/// <summary> /// Returns parameters according to the upload mode. /// </summary> private string GetModeParameters() { string[] args; if (MediaLibraryID > 0) { // MediaLibrary mode args = new[] { "MediaLibraryID", MediaLibraryID.ToString(), "MediaFolderPath", MediaFolderPath, "MediaFileID", MediaFileID.ToString(), "IsMediaThumbnail", IsMediaThumbnail.ToString(), "MediaFileName", MediaFileName }; return("MediaLibraryArgs=" + GetArgumentsString(args, UploaderHelper.MEDIA_LIBRARY_ARGS_HASHING_PURPOSE)); } if (ObjectID > 0) { // MetaFile mode args = new[] { "MetaFileID", MetaFileID.ToString(), "ObjectID", ObjectID.ToString(), "SiteID", SiteID.ToString(), "ObjectType", ObjectType, "Category", Category }; return("MetaFileArgs=" + GetArgumentsString(args, UploaderHelper.META_FILE_ARGS_HASHING_PURPOSE)); } if ((DocumentID > 0) || (FormGUID != Guid.Empty)) { // Attachment mode args = new[] { "DocumentID", DocumentID.ToString(), "DocumentParentNodeID", DocumentParentNodeID.ToString(), "NodeClassName", NodeClassName, "AttachmentGUIDColumnName", AttachmentGUIDColumnName, "AttachmentGUID", AttachmentGUID.ToString(), "AttachmentGroupGUID", AttachmentGroupGUID.ToString(), "FormGUID", FormGUID.ToString(), "IsFieldAttachment", mIsFiledAttachment.ToString(), "FullRefresh", FullRefresh.ToString() }; return("AttachmentArgs=" + GetArgumentsString(args, UploaderHelper.ATTACHEMENT_ARGS_HASHING_PURPOSE)); } return(String.Empty); }
protected void img_PreRender(object sender, EventArgs e) { ImageButton img = (ImageButton)sender; if (CMSContext.CurrentUser.IsAuthenticated()) { if (!Enabled) { // Disable edit icon img.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/editdisabled.png"); img.Enabled = false; img.Style.Add("cursor", "default"); } else { string[] args = img.AlternateText.Split('|'); string strForm = (FormGUID == Guid.Empty) ? string.Empty : FormGUID.ToString(); string form = null; if (!String.IsNullOrEmpty(strForm)) { form = String.Format("&formguid={0}&parentid={1}", strForm, NodeParentNodeID); } else { if (Node != null) { form += "&siteid=" + Node.NodeSiteID; } } string isImage = ImageHelper.IsSupportedByImageEditor(args[0]) ? "true" : "false"; // Prepare parameters string parameters = String.Format("?attachmentGUID={0}&versionHistoryID={1}{2}&clientid={3}&refresh=1", args[1], VersionHistoryID, form, ClientID); // Create security hash string validationHash = QueryHelper.GetHash(parameters); img.Attributes.Add("onclick", String.Format("Edit_{0}('{1}', '{2}', '{3}', {4}, '{5}', {6});return false;", ClientID, args[1], strForm, VersionHistoryID, NodeParentNodeID, validationHash, isImage)); } img.AlternateText = GetString("general.edit"); } else { img.Visible = false; } }
protected void img_PreRender(object sender, EventArgs e) { ImageButton img = (ImageButton)sender; if (CMSContext.CurrentUser.IsAuthenticated()) { if (!Enabled) { // Disable edit icon img.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/editdisabled.png"); img.Enabled = false; img.Style.Add("cursor", "default"); } else { string strForm = (FormGUID == Guid.Empty) ? "" : FormGUID.ToString(); // Create security hash string form = null; if (!String.IsNullOrEmpty(strForm)) { form = "&formguid=" + strForm + "&parentid=" + NodeParentNodeID; } else if (Node != null) { form += "&siteid=" + Node.NodeSiteID; } string parameters = "?attachmentGUID=" + img.ToolTip + "&refresh=1&versionHistoryID=" + VersionHistoryID + form + "&clientid=" + ClientID; string validationHash = QueryHelper.GetHash(parameters); string isImage = ImageHelper.IsSupportedByImageEditor(img.AlternateText) ? "true" : "false"; img.Attributes.Add("onclick", "Edit_" + ClientID + "('" + img.ToolTip + "', '" + strForm + "', '" + VersionHistoryID + "', " + NodeParentNodeID + ", '" + validationHash + "', " + isImage + ");return false;"); } img.AlternateText = GetString("general.edit"); img.ToolTip = ""; } else { img.Visible = false; } }
protected void img_PreRender(object sender, EventArgs e) { var img = (CMSGridActionButton)sender; if (AuthenticationHelper.IsAuthenticated()) { if (!Enabled) { // Disable edit icon img.Enabled = false; } else { string strForm = (FormGUID == Guid.Empty) ? "" : FormGUID.ToString(); // Create security hash string form = null; if (!String.IsNullOrEmpty(strForm)) { form = $"&formguid={strForm}&parentid={NodeParentNodeID}"; } else if ((Node != null) && (Node.DocumentID > 0)) { form += "&siteid=" + Node.NodeSiteID; } string isImage = ImageHelper.IsSupportedByImageEditor(img.ScreenReaderDescription) ? "true" : "false"; string parameters = $"?attachmentGUID={img.ToolTip}&refresh=1&versionHistoryID={VersionHistoryID}{form}&clientid={ClientID}"; string validationHash = QueryHelper.GetHash(parameters); img.OnClientClick = $"Edit_{ClientID}('{img.ToolTip}', '{strForm}', '{VersionHistoryID}', {NodeParentNodeID}, '{validationHash}', {isImage});return false;"; } img.ToolTip = GetString("general.edit"); } else { img.Visible = false; } }
/// <summary> /// Returns parameters according to the upload mode. /// </summary> private string GetModeParameters() { string[] args = null; if (MediaLibraryID > 0) { // MediaLibrary mode args = new string[] { "MediaLibraryID", MediaLibraryID.ToString(), "MediaFolderPath", HttpUtility.UrlEncode(MediaFolderPath), "MediaFileID", MediaFileID.ToString(), "IsMediaThumbnail", IsMediaThumbnail.ToString(), "MediaFileName", HttpUtility.UrlEncode(MediaFileName) }; return("MediaLibraryArgs=" + GetArgumentsString(args)); } else { if ((NodeID > 0) && (SourceType == MediaSourceEnum.Content)) { // CMS.File mode args = new string[] { "NodeID", NodeID.ToString(), "DocumentCulture", DocumentCulture, "IncludeExtension", IncludeExtension.ToString(), "NodeGroupID", NodeGroupID.ToString() }; return("FileArgs=" + GetArgumentsString(args)); } else { if (ObjectID > 0) { // MetaFile mode args = new string[] { "MetaFileID", MetaFileID.ToString(), "ObjectID", ObjectID.ToString(), "SiteID", SiteID.ToString(), "ObjectType", ObjectType, "Category", Category }; return("MetaFileArgs=" + GetArgumentsString(args)); } else { if (PostForumID > 0) { // Forum attachment args = new string[] { "PostForumID", PostForumID.ToString(), "PostID", PostID.ToString() }; return("ForumArgs=" + GetArgumentsString(args)); } else { if ((DocumentID > 0) || (FormGUID != Guid.Empty)) { // Attachment mode args = new string[] { "DocumentID", DocumentID.ToString(), "DocumentParentNodeID", DocumentParentNodeID.ToString(), "NodeClassName", NodeClassName, "AttachmentGUIDColumnName", AttachmentGUIDColumnName, "AttachmentGUID", AttachmentGUID.ToString(), "AttachmentGroupGUID", AttachmentGroupGUID.ToString(), "FormGUID", FormGUID.ToString(), "IsFieldAttachment", mIsFiledAttachment.ToString() }; return("AttachmentArgs=" + GetArgumentsString(args)); } } } } } return(String.Empty); }