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/RMourik/bassol.nl/CMS/CMSModules/PortalEngine/UI/WebParts/WebPartSelector.aspx.cs
using System;
using System.Web.UI.WebControls;

using CMS.ExtendedControls;
using CMS.Helpers;
using CMS.Membership;
using CMS.SiteProvider;
using CMS.UIControls;

public partial class CMSModules_PortalEngine_UI_WebParts_WebPartSelector : CMSModalDesignPage
{
	protected void Page_Load(object sender, EventArgs e)
	{
		// Check UI elements for web part zone
		var currentUser = MembershipContext.AuthenticatedUser;
		if (!currentUser.IsAuthorizedPerUIElement("CMS.Design", new string[] { "Design", "Design.AddWebParts" }, SiteContext.CurrentSiteName))
		{
			RedirectToUIElementAccessDenied("CMS.Design", "Design;Design.AddWebParts");
		}

		// Set dialog body class
		CurrentMaster.PanelBody.CssClass = "DialogPageBody";
		selectElem.ShowInheritedWebparts = true;
		selectElem.ShowUIWebparts = QueryHelper.GetBoolean("isui", false);

		// Proceeds the current item selection
		string javascript =
@"
function SelectCurrentWebPart() 
{
	SelectWebPart(selectedValue, selectedSkipDialog);
}
function SelectWebPart(value, skipDialog)
{
	if ((value != null) && (value != ''))
	{
		if (wopener.OnSelectWebPart)
		{
			wopener.OnSelectWebPart(value, skipDialog);
		}	  
		CloseDialog();          
	}
	else
	{
		alert(document.getElementById('" + hdnMessage.ClientID + @"').value);		    
	}                
}            
// Cancel action
function Cancel()
{
	CloseDialog();
} ";

		ScriptHelper.RegisterStartupScript(this, typeof(string), "WebPartSelector", ScriptHelper.GetScript(javascript));

		// Set name of selection function
		selectElem.SelectFunction = "SelectWebPart";

		bool wireframe = QueryHelper.GetBoolean("wireframe", false);
		selectElem.ShowWireframeOnlyWebparts = wireframe;

		// Set the title and icon
		string title = GetString("portalengine-webpartselection.title");
		Page.Title = title;
		PageTitle.TitleText = title;
		CurrentMaster.PanelContent.RemoveCssClass("dialog-content");

		// Remove default css class
		if (CurrentMaster.PanelBody != null)
		{
			Panel pnl = CurrentMaster.PanelBody.FindControl("pnlContent") as Panel;
			if (pnl != null)
			{
				pnl.CssClass = String.Empty;
			}
		}

		SetSaveJavascript("SelectCurrentWebPart();return false;");
		SetSaveResourceString("general.select");
	}
}