/* -----------------------------------------------------------------------------------------Class			:	PortletParameters	:	pPortal		parent portaal						pName		unieke identificatie						pSkin		bibliotheek met afbeeldingen voor skin portlet (uit instyle)						pUri			inhoud (element of URI)						pLeft			links 						pTop			boven						pWidth		breedte						pHeight		hoogte						pMinimized, pMaximized, pHidden, pResizable = booleans met status infoMethods		:	minimize						maximize						restore						close						Properties	:		Titlebar						Content						Bottombar						Skin						Src						NameToelichting	:	Portlet class						member van Potal.PortletCollection----------------------------------------------------------------------------------------- */function Portlet(pPortal, pName, pSkin, pTitle, pUrl, pLeft, pTop, pWidth, pHeight, pMinimized, pMaximized, pHidden, pResizable) {		// Constructor	iPortal 					= pPortal;	iPortlet 					= document.createElement("span");	// Apply parameters	iPortlet.style.left 			= pLeft 		|| 0;	iPortlet.style.top 			= pTop 		|| 0;	iPortlet.style.width 		= pWidth 	|| 250;	iPortlet.style.height		= pHeight 	|| 250;	iPortlet.style.position 	= 'absolute'	iPortlet.Src					= pUrl 		|| null	iPortlet.Skin				= pSkin	 	|| "default"	iPortlet.Name			= pName;	iPortlet.id					= pName;	iPortlet.Title				= pTitle;	// Public Properties	iPortlet.Portal 			= iPortal;	// Public base properties	iPortlet.BaseZindex		= pPortal.PortletCollection.length	iPortlet.BaseLeft 			= pLeft 		|| 0;	iPortlet.BaseTop 			= pTop 		|| 0;	iPortlet.BaseWidth 			= pWidth 	|| 250;	iPortlet.BaseHeight		= pHeight 	|| 250;	iPortlet.BasePosition 		= 'absolute'	iPortlet.BaseSrc				= pUrl	 	|| null		// Method pointers	iPortlet.minimize			= minimize;	iPortlet.maximize 			= maximize;	iPortlet.restore 				= restore;	iPortlet.hide	 				= hide;	iPortlet.show 					= show;	iPortlet.onfocus 				= setFocus;	iPortlet.refresh				= refresh;		// Generieke variabelen	iImagePath = iPortal.SkinPath + "/" + "images" + "/" + iPortlet.Skin + "/$file/"	// Cre\u00EBer titel balk	iPortlet.Titlebar	= 	iPortlet.appendChild(createTitlebar());			// Cre\u00EBer inhoud	iPortlet.Content	= 	iPortlet.appendChild(createContent(pUrl));	// Cre\u00EBer voetbalk	iPortlet.Bottombar	=	iPortlet.appendChild(createBottombar());	// Bepaal de staat van het portal	if(pMinimized == true) 	iPortlet.minimize();	if(pMaximized == true) 	iPortlet.maximize();	if(pHidden == true) 		iPortlet.hide();		// Plaats portlet in body van document	document.body.appendChild(iPortlet)	// toevoegen dragdrop functionaliteit	ADD_DHTML(iPortlet.Name + CURSOR_MOVE)		// Retourneer de gecre\u00EBerde Portlet	return iPortlet;	/*---------------------------------------------------------------------------------	functie	:	createContent	param	:		doel		: 	toevoegen content, dit is een uri (dus iframe) of een intern element	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function createContent(pUrl) {			// Als er een element bestaat in dit document dan deze inhoud tonen, anders een URI		iContent = document.getElementById(pUrl)		if (iContent==null) {			// Cre\u00EBer iFrame met inhoud			iContent 		= document.createElement("iFrame")			// Properties van de de iFrame			iContent.Src	= pUrl;		}				// Content opmaken		iContent.style.width				= '100%'			iContent.style.height			= '100%'			iContent.style.position 		= "relative"		iContent.style.borderLeft 		= '1px solid gray'		iContent.style.borderRight 	= '1px solid gray'				return iContent;	}	/*---------------------------------------------------------------------------------	functie	:	createTitleBar	param	:		doel		: 	toevoegen titelbalk	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function createTitlebar() {			iTitlebar 			= document.createElement("span");		// Skin		iTitlebar.style.backgroundImage = 'url(' + iImagePath + 'title.gif' + ')';		iTitlebar.Portlet = iPortlet;				// Linker actions toevoegen				iTitlebar.Actionbar 	= iTitlebar.appendChild(createActionbar());		iTitlebar.Actionbar.Actionrow.appendChild(createAction("refresh","symbol.gif","refresh()"));				// Titel toevoegen		iTitleCell = iTitlebar.Actionbar.Actionrow.appendChild(document.createElement("td"))		iTitleCell.width					= "100%";		iTitleCell.style.verticalAlign	= "middle"		iTitleCell.style.color				= "white";		iTitleCell.innerHTML 			= iPortlet.Title;				// Rechter actions toevoegen		iTitlebar.Actionbar.Actionrow.appendChild(createAction("action_minimize","min.gif","minimize()"));		iTitlebar.Actionbar.Actionrow.appendChild(createAction("action_maximize","max.gif","maximize()"));		iTitlebar.Actionbar.Actionrow.appendChild(createAction("action_restore","restore.gif","restore()"));		iTitlebar.Actionbar.Actionrow.children("action_restore").style.display = 'none';		iTitlebar.Actionbar.Actionrow.appendChild(createAction("action_hide","close.gif","hide()"));		return iTitlebar;	}	/*---------------------------------------------------------------------------------	functie	:	createActionbar;	param	:		doel		: 	toevoegen actiebalk	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function createActionbar() {			iActionbar 							= document.createElement("table");		iActionbody						= document.createElement("tbody");		iActionbar.appendChild(iActionbody);						iActionrow 							= document.createElement("tr");		iActionbody.appendChild(iActionrow);						iActionbar.Actionrow 			= iActionrow;		iActionbar.cellPadding		= 0		iActionbar.cellSpacing		= 0								return iActionbar;	}		/*---------------------------------------------------------------------------------	functie	:	createAction	param	:	naam, afbeelding en functie	doel		: 	toevoegen actieknop	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function createAction(pName,pImage,pFunction) {		iAction 				= document.createElement("td");		iAction.Portlet		= iPortlet;		iAction.id			= pName		iAction.innerHTML = "<img src=" + iImagePath + pImage + " onclick='this.parentElement.Portlet." + pFunction  + "' style='cursor:hand'>";		return iAction;	}	/*---------------------------------------------------------------------------------	functie	:	createBottomBar	param	:		doel		: 	toevoegen voetbalk	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function createBottombar() {		iBottombar 			= document.createElement("span");		// Skin		iBottombar.style.backgroundImage = 'url(' + iImagePath + 'Bottom.gif' + ')';		iBottombar.Portlet = iPortlet;				// Linker actions toevoegen				iBottombar.Actionbar 	= iBottombar.appendChild(createActionbar());		iBottombar.Actionbar.Actionrow.appendChild(createAction("action_update","intern.gif","update()"));				// Voettext toevoegen		iBottomCell = iBottombar.Actionbar.Actionrow.appendChild(document.createElement("td"))		iBottomCell.width					= "100%";				// Rechter actions toevoegen		iBottombar.Actionbar.Actionrow.appendChild(createAction("action_resize","grip.gif","resize()"));		return iBottombar;	}		/*---------------------------------------------------------------------------------	functie	:	setFocus	param	:		doel		: 	Portlet krijgt focus	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function setFocus() {				iPortlet		= this;				iPortlet.Portal.ActivePortlet.style.zIndex = iPortlet.Portal.ActivePortlet.baseZindex;		iPortlet.Portal.ActivePortlet = iPortlet;		iPortlet.style.zIndex = 9999;		iPortlet.show();	}		/*---------------------------------------------------------------------------------	functie	:	minimize	param	:		doel		: 	minimaliseer portlet naar originele plaats	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function minimize() {				iPortlet = this;		if (iPortlet.isMinimized) {			iPortlet.Content.style.display	= 'inline';			iPortlet.isMinimized 				= false;			}		else {			iPortlet.Content.style.display	= 'none';			iPortlet.isMinimized 				= true;		}		return true;	}	/*---------------------------------------------------------------------------------	functie	:	restore	param	:		doel		: 	terugzetten portlet in vorige staat	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function restore() {		iPortlet = this;		iPortlet.style.cssText 									= iPortlet.previousStyle;		iPortlet.Content.style.display						= 'inline';		iPortlet.isMaximized									= false;		iPortlet.Titlebar.Actionbar.Actionrow.children("action_maximize").style.display	= 'inline'		iPortlet.Titlebar.Actionbar.Actionrow.children("action_restore").style.display		= 'none';		return true;			}	/*---------------------------------------------------------------------------------	functie	:	maximize	param	:		doel		: 	maximaliseren portlet naar inhoud van Portal	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function maximize() {		iPortlet = this;		// Veiligstellen originele stijlen		iPortlet.previousStyle = iPortlet.style.cssText;		iPortlet.Content.style.display	= 'inline'				// Positie en grootte van de Portlet		iPortlet.style.left				= 0;		iPortlet.style.top				= 0;		iPortlet.style.width			= iPortlet.parentElement.offsetWidth;		iPortlet.style.height			= iPortlet.parentElement.offsetHeight;		iPortlet.isMaximized		= true;		iPortlet.Titlebar.Actionbar.Actionrow.children("action_maximize").style.display="none"		iPortlet.Titlebar.Actionbar.Actionrow.children("action_restore").style.display="inline"		return true;	}		/*---------------------------------------------------------------------------------	functie	:	hide	param	:		doel		: 	verbergen van portlet	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function hide() {				iPortlet = this;		iPortlet.style.display="none"		return true;	}	/*---------------------------------------------------------------------------------	functie	:	show	param	:		doel		: 	tonen van portlet	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function show() {			iPortlet = this;		iPortlet.style.display="inline"		return true;	}	/*---------------------------------------------------------------------------------	functie	:	refresh	param	:		doel		: 	verversen van portlet	auteur	:	RonB	creatie	:	09-02-2005	---------------------------------------------------------------------------------*/	function refresh() {		iPortlet = this;		iPortlet.Content.Src = iPortlet.Content.Src;		return true;	}}