BeepPadUI/Workflow/shared/messaging.js
// populate the list control with message titles
populate the list control with message titles
populate the list control with message titles
function lctrlInit()
{
	var sizeWidth = 0;
	var sizeHeight = 0;
	var elmMsgList = document.getElementById("msglist");
	var msgShown = 0;
	if(elmMsgList)
	{
		var elmDolly = document.getElementById("dolly");
		if(elmDolly)
		{
		    var nMessageCnt = aMessages.length;
			if(nMessageCnt > 0)
			{
				var strMsgTypeFilter = extractParam(""+document.location, "Category");
				var strMsgTypes = null;
				if (strMsgTypeFilter.length != 0)
				{
				    strMsgTypeFilter = strMsgTypeFilter.toLowerCase();
                    strMsgTypes = strMsgTypeFilter.split("|");
                }
                var strMsgIDListFilter = extractParam(""+document.location, "MsgIDList");
                var strMsgIDList = null;
				if (strMsgIDListFilter.length != 0)
				{
                    strMsgIDList = strMsgIDListFilter.split(",");
                }
				for( var itrMsg = 0 ; itrMsg < nMessageCnt ; itrMsg++ )
				{
					var strMsgType = aMessages[itrMsg].strType.toLowerCase();
					var strMsgSubTypeLevel1 = aMessages[itrMsg].strSubTypeLevel1;
                    var strMsgID = aMessages[itrMsg].id;
					if( IsMessageTypeMatches(strMsgTypes, strMsgType, strMsgSubTypeLevel1, strMsgIDList,strMsgID ) )
					{
						if (sizeWidth < aMessages[itrMsg].strMessageWidth) {
						    sizeWidth = aMessages[itrMsg].strMessageWidth;
						}
						if (sizeHeight < aMessages[itrMsg].strMessageHeight) {
						    sizeHeight = aMessages[itrMsg].strMessageHeight;
						}
						var elmClone = elmDolly.cloneNode(true);
						if(elmClone)
						{
							elmClone.id = aMessages[itrMsg].id;
							elmClone.onclick = function(){lctrlSelectItem(this);};
							elmClone.className = "";
							elmClone.innerText = aMessages[itrMsg].strTitle;
							if(! aMessages[itrMsg].bViewed)
							{
								elmClone.style.fontWeight = "bold";
							}
							elmMsgList.appendChild(elmClone);
							msgShown += 1;
						}
					}
				}
                if (sizeHeight > 0 && sizeWidth > 0) {
                    sizeControls(sizeWidth, sizeHeight);
                }
			}
			if (msgShown == 0)
			{
				noMessages();
			}
		}
	}
	var elmLstCtrl = document.getElementById("listctrl");
	if(elmLstCtrl)
	{
		elmLstCtrl.focus();
	}
	lctrlSelectFirst();
}
function lctrlInit ( ) { var sizeWidth = 0 ; var sizeHeight = 0 ; var elmMsgList = document . getElementById ( "msglist" ) ; var msgShown = 0 ; if ( elmMsgList ) { var elmDolly = document . getElementById ( "dolly" ) ; if ( elmDolly ) { var nMessageCnt = aMessages . length ; if ( nMessageCnt > 0 ) { var strMsgTypeFilter = extractParam ( "" + document . location , "Category" ) ; var strMsgTypes = null ; if ( strMsgTypeFilter . length != 0 ) { strMsgTypeFilter = strMsgTypeFilter . toLowerCase ( ) ; strMsgTypes = strMsgTypeFilter . split ( "|" ) ; } var strMsgIDListFilter = extractParam ( "" + document . location , "MsgIDList" ) ; var strMsgIDList = null ; if ( strMsgIDListFilter . length != 0 ) { strMsgIDList = strMsgIDListFilter . split ( "," ) ; } for ( var itrMsg = 0 ; itrMsg < nMessageCnt ; itrMsg ++ ) { var strMsgType = aMessages [ itrMsg ] . strType . toLowerCase ( ) ; var strMsgSubTypeLevel1 = aMessages [ itrMsg ] . strSubTypeLevel1 ; var strMsgID = aMessages [ itrMsg ] . id ; if ( IsMessageTypeMatches ( strMsgTypes , strMsgType , strMsgSubTypeLevel1 , strMsgIDList , strMsgID ) ) { if ( sizeWidth < aMessages [ itrMsg ] . strMessageWidth ) { sizeWidth = aMessages [ itrMsg ] . strMessageWidth ; } if ( sizeHeight < aMessages [ itrMsg ] . strMessageHeight ) { sizeHeight = aMessages [ itrMsg ] . strMessageHeight ; } var elmClone = elmDolly . cloneNode ( true ) ; if ( elmClone ) { elmClone . id = aMessages [ itrMsg ] . id ; elmClone . onclick = function ( ) { lctrlSelectItem ( this ) ; } ; elmClone . className = "" ; elmClone . innerText = aMessages [ itrMsg ] . strTitle ; if ( ! aMessages [ itrMsg ] . bViewed ) { elmClone . style . fontWeight = "bold" ; } elmMsgList . appendChild ( elmClone ) ; msgShown += 1 ; } } } if ( sizeHeight > 0 && sizeWidth > 0 ) { sizeControls ( sizeWidth , sizeHeight ) ; } } if ( msgShown == 0 ) { noMessages ( ) ; } } } var elmLstCtrl = document . getElementById ( "listctrl" ) ; if ( elmLstCtrl ) { elmLstCtrl . focus ( ) ; } lctrlSelectFirst ( ) ; }
populate the list control with message titles
populate the list control with message titles
// populate the list control // for each message insert an item into the list control // we will not display the message in the case that a message filter has been applied // if the message type is not available we will assume it should be displayed // display the message if there is no filter or the filter matches the type // place focus on the list control // select the proper item in the list control