Click here to Skip to main content
15,894,017 members
Articles / Programming Languages / Visual Basic

RestrictedUI: A .NET Library for restricting a user interface based on a security policy

Rate me:
Please Sign up or sign in to vote.
4.30/5 (17 votes)
26 May 2010MPL21 min read 26.8K   1.3K   69  
How to control the user interface using a policy established in a declaratively way, based on user roles and application status.
function closeMe()
{
	window.close();
}

function ChangeViewCodeIcon(key)
{
	var i;
	var imageElements = document.getElementsByName("vcImage");
	for(i=0; i<imageElements.length; ++i)
	{
		if(imageElements[i].parentElement == key)
		{
			if(imageElements[i].src == viewImage.src)
				imageElements[i].src = viewHoverImage.src;
			else
				imageElements[i].src = viewImage.src;
		}
	}
}

function ChangeDownloadCodeIcon(key)
{
	var i;
	var imageElements = document.getElementsByName("dcImage");
	for(i=0; i<imageElements.length; ++i)
	{
		if(imageElements[i].parentElement == key)
		{
			if(imageElements[i].src == downloadImage.src)
				imageElements[i].src = downloadHoverImage.src;
			else
				imageElements[i].src = downloadImage.src;
		}
	}
}

function ViewSampleSource(name)
{
	// variables
	var wConfig;
	var oSelectBox = document.all.item(name);
	var url;
	var sIndex;
	
	// Get the selectedIndex
	sIndex = oSelectBox.selectedIndex;
	
	if (sIndex >= 0)
	{
		// Get the URL to the file
		url = oSelectBox.options[sIndex].value;

		// Set the configuration
		wConfig += 'directories=0,';
		wConfig += 'location=0,';
		wConfig += 'menubar=0,';
		wConfig += 'resizable=1,';
		wConfig += 'scrollbars=1,';
		wConfig += 'status=0,';
		wConfig += 'toolbar=0';

		// Launch the window
		window.open(url, 'ViewSampleSource', wConfig);
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Mozilla Public License 1.1 (MPL 1.1)


Written By
Spain Spain
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions