HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/CMSModules/Objects/Controls/Locking/Comment.ascx.cs
using System;
using System.Text;

using CMS.ExtendedControls;
using CMS.FormControls;
using CMS.Helpers;
using CMS.Base;
using CMS.UIControls;

public partial class CMSModules_Objects_Controls_Locking_Comment : CMSUserControl
{
    #region "Properties"

    /// <summary>
    /// Action
    /// </summary>
    protected string Action
    {
        get
        {
            return QueryHelper.GetString("acname", null);
        }
    }


    /// <summary>
    /// Menu ID
    /// </summary>
    protected string MenuID
    {
        get
        {
            return QueryHelper.GetString("menuid", null);
        }
    }

    #endregion


    #region "Methods"

    protected void Page_Load(object sender, EventArgs e)
    {
        // Check permissions
        if (objectManager.IsActionAllowed(Action))
        {
            RegisterActionScript();
        }
        else
        {
            Visible = false;
        }
    }


    private void RegisterActionScript()
    {
        // Get js functions
        string checkinStr = "CheckIn_" + ValidationHelper.GetIdentifier(MenuID);
        string consStr = "CheckConsistency_" + ValidationHelper.GetIdentifier(MenuID);
        
        StringBuilder sb = new StringBuilder();
        sb.Append(@"
function ProcessAction(action) { 
    var comment = document.getElementById('", txtComment.ClientID, @"').value;
    switch(action) {
        case '", DocumentComponentEvents.CHECKIN, @"':
            if(wopener.", checkinStr, @") { wopener.", checkinStr, @"(comment); } else { ", consStr, @"(); }
        break;
    }
}"
);
        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "action", sb.ToString(), true);
    }

    #endregion
}