/* wizard.js
Version Date 7 Developer Notes
1.0 23. Dec 2002 Nicolai Lyng Als (NL) Initial version supported by IE 5.5 and 6.0 (Not tested on Mac IE).
1.1 3. Jan 2003 Nicolai Lyng Als (NL) Added keyboard control of stepsmenu using arrows up and down or/and tab key.
1.2 5. Feb 2003 Nicolai Lyng Als (NL) Added multible steps in one HTML page by using toggleWizard function.
1.21 11. Mar 2003 Nicolai Lyng Als (NL) Added support for homepage frameset.
1.22 2. Apr 2003 Nicolai Lyng Als (NL) Additional support and bugfixes of homepage imagefile structure.
1.3 3. Apr 2003 Nicolai Lyng Als (NL) Added language support.
1.31 21. Maj 2003 Claus Witt (CWI) Changes to reflex moving dnbnetstyr to top
1.32 25. Jun 2003 Nicolai Lyng Als (NL) Moving js to topframe and implementing proxy in top.logo.
1.40 1. Jul 2003 Nicolai Lyng Als (NL) Added support for removing the helparea on intranet applications.
1.41 17. Okt 2003 Nicolai Lyng Als (NL) Added disable '?' functionality, Tooltip on numbers and up to 15 steps on intranet.
1.50 1. Sep 2004 Nicolai Lyng Als (NL) Support for altenate browsers Mozilla, Netscape, Safari, Opera + userbility.
wizard.js is a frontend javascript/dhtml component, which generates a wizard dialogframework, for the developers in Danske Bank.
This dialogframework is optimized for use in applikation, which need controlled steps and a posibility for getting imiate help.
For each step, it is possible to specify whereto the user can navigate, thus controlling the workflow.
Navigation is done via javascript or specifying Objects and Actions in Netstyr.
The component uses following frameset-functions and variables:
Function/variable Description
getBrand(); function in top.logo (intranet-portal), which returns brand string ex. BG or DB.
brand function in top (internetframeset), which contains brand string ex. BG or DB.
framesetpath variable in top (internetframeset), which contains full current framesetpath.
gsBrand function in top (homepageframeset), which contains brand string ex. BG or DB.
domain_domino variable in top (homepageframeset), which contains server path.
jsframe variable in dnbnetstyr.js/usfkb1.js which contains path to dnbnetstyr frame.
ImgPath variable in dnbnetstyr.js/usfkb1.js which contains path to image lib.
*/
// Global variables
var glWizardTargetFrame;
var glWizardMainArray;
var glWizardSize;
var glWizardSubLevel;
var glWizardEndPage;
var glWizardStepsMenuItemArray=new Array();
var glWizardStepsMenuAvailableItemsArray=new Array();
var glWizardBrandPath;
var glWizardLastCreated;
var glWizardHelpArea;
var glWizardTabToNext;
// Wizard object top
function wizardObjBegin(wizardId,wizardSize,wizardHeadline,wizardHelpString,wizardMainArray,wizardSubLevel,wizardEndPage,wizardTarget,wizardHelpArea,wizardeLearningLink){
// getting brand from frameset, to use in inserting correct image paths.
if ("" + top.brand == "undefined" && "" + top.gsBrand == "undefined"){
// intranet portal
wizardBrand = top.logo.getBrand();
}
else if ("" + top.brand == "undefined") {
// homepage frameset
wizardBrand = top.gsBrand;
}
else {
// netbank frameset
wizardBrand = top.brand;
}
glWizardBrandPath = wizardBrand.toUpperCase();
// preparing wizard for working in different frames/iframes.
if ("" + wizardTarget == "undefined" || "" + wizardTarget == ""){
wizardTarget = "" + targetFrame;
}
else {
wizardTarget = wizardTarget + ".";
}
setWizardTargetFrame(wizardTarget);
// setting incoming wizardMainArray in global variable for use in wizardObjEnd()
setWizardMainArray(wizardMainArray);
// setting incoming wizardSize in global variable for use in wizardObjEnd()
setWizardSize(wizardSize);
// setting incoming wizardSubLevel in global variable for use in wizardSubLevel()
if ("" + wizardSubLevel == "undefined" || "" + wizardSubLevel == ""){
setWizardSubLevel(false);
}
else if (wizardSubLevel == true || wizardSubLevel == false){
setWizardSubLevel(wizardSubLevel);
}
else {
alert("Invalid parameter - wizardSubLevel");
}
// setting incoming wizardEndPage in global variable for use in wizardEndPage()
if ("" + wizardEndPage == "undefined" || "" + wizardEndPage == ""){
setWizardEndPage(false);
}
else if (wizardEndPage == true || wizardEndPage == false){
setWizardEndPage(wizardEndPage);
}
else {
alert("Invalid parameter - wizardEndPage");
}
// setting incoming wizardHelpArea in global variable for use in wizardHelpArea()
if ("" + wizardHelpArea == "undefined" || "" + wizardHelpArea == ""){
setWizardHelpArea(true);
}
else if (wizardHelpArea == true || wizardHelpArea == false){
setWizardHelpArea(wizardHelpArea);
}
else {
alert("Invalid parameter - wizardHelpArea");
}
// checking for invalid wizardHelpArea parameter
if (getWizardHelpArea()==false && getWizardEndPage()== true){
alert("Invalid parameter - wizardHelpArea - Help Area must be added on confirmation page");
}
// setting document attribute to simulate IE document.activeElement in other browsers
eval("" + getWizardTargetFrame() + "document.body.setAttribute('activeElement','undefined')");
// preparing and setting first wizard active/displayed if multible steps on one page,
// attaching event to document . Done only once a page.
glWizardLastCreated = wizardId;
eval("wizardAttr = " + getWizardTargetFrame() + "document.body.getAttribute('glWizardActive')");
if("" + wizardAttr == "undefined" || "" + wizardAttr == "null" || "" + wizardAttr == "" ){
// setting global variable glWizardActive to active wizard step.
eval("" + getWizardTargetFrame() + "document.body.setAttribute('glWizardActive','" + wizardId + "')");
// IE - attaching event to document to close stepsmenu on click and scroll.
/* SVEKN Changed from try catch sentence to a if sentence */
if(document.attachEvent)
{
eval(getWizardTargetFrame() + "document.attachEvent('onmouseup'," + jsframe + "closeWizardStepsMenu);");
eval(getWizardTargetFrame() + "window.attachEvent('onscroll'," + jsframe + "closeWizardStepsMenu);");
// IE - attaching event to document to tap stepsmenu on arrowkeys.
eval(getWizardTargetFrame() + "document.attachEvent('onkeyup'," + jsframe + "keybControllWizardStepsMenu);");
}
else
{
// attaching event to document to close stepsmenu on click and scroll.
eval(getWizardTargetFrame() + "document.addEventListener('click', " + jsframe + "closeWizardStepsMenu, true);");
eval(getWizardTargetFrame() + "window.addEventListener('scroll'," + jsframe + "closeWizardStepsMenu, false);");
// attaching event to document to tap stepsmenu on arrowkeys.
eval(getWizardTargetFrame() + "document.addEventListener('keyup'," + jsframe + "keybControllWizardStepsMenu, false);");
}
/* SVEKN Changed from try catch sentence to a if sentence */
// setting attribute to prevent further event attachment and display on next wizardsteps.
wizardAttr = wizardId;
}
else {
}
// creating wizardHelpArray for use in CreateRubrikObj
if ("" + wizardHelpString == "undefined" || "" + wizardHelpString == ""){
wizardHelpArray = "";
}
else {
wizardHelpArray = new Array("Hjælp","H",wizardHelpString,"");
}
// creating toggle span start
str = "
";
if (wizardAttr == wizardId){
if (getWizardHelpArea()){
str += "";
}
else {
str += "";
}
}
else {
if (getWizardHelpArea()){
str += "";
}
else {
str += "";
}
}
if (wizardSize==3){
str += "";
}
else {
str += "";
}
// creating paragraph/rubrik.
if (wizardeLearningLink)
eLearning = true;
else
eLearning = false;
if (wizardSize==3){
eval("" + wizardId + " = new " + jsframe + "CreateRubrikObj('" + wizardId + "',4,wizardHeadline,wizardHelpArray,true,'N','',1,'',false,'','',"+eLearning+");");
str += eval("" + wizardId + ".RubrikBegin()");
}
else {
eval("" + wizardId + " = new " + jsframe + "CreateRubrikObj('" + wizardId + "',3,wizardHeadline,wizardHelpArray,true,'N','',1,'',false,'','',"+eLearning+");");
str += eval("" + wizardId + ".RubrikBegin()");
}
// creating wizardcontent framework
if (wizardSize==3){
str += "";
str += "";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " ";
str += "";
if (wizardEndPage){
str += "| ";
}
else {
if (getWizardHelpArea()){
str += " | ";
}
else {
str += " | ";
}
}
}
else{
str += "";
str += "";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " | ";
str += " ";
str += "";
if (wizardEndPage){
if (wizardSize==2){
str += "| ";
}
else {
str += " | ";
}
}
else {
if (getWizardHelpArea()){
if (wizardSize==2){
str += " | ";
}
else {
str += " | ";
}
}
else {
if (wizardSize==2){
str += " | ";
}
else {
str += " | ";
}
}
}
}
// returns sting to document.write()
return str;
}
// Wizard object bottom
function wizardObjEnd(obj){
// declaration and variable setting
var wizardIsCurrentLast;
var wizardId = glWizardLastCreated;
// getting array from global variable set by wizardObjBegin()'s incoming wizardMainArray.
var wizardMainArray = getWizardMainArray();
// getting size(int) from global variable set by wizardObjBegin()'s incoming wizardSize.
var wizardSize = getWizardSize();
// getting sublevel(boolean) from global variable set by wizardObjBegin()'s incoming wizardSubLevel.
var wizardSubLevel = getWizardSubLevel();
// getting endpage(boolean) from global variable set by wizardObjBegin()'s incoming wizardEndPage.
var wizardEndPage = getWizardEndPage();
// creating wizard bottom.
if (getWizardHelpArea()){
str = " | | | | ";
}
else {
str = "";
}
str += "";
if (wizardSize == 3){
if (wizardEndPage){
str += " | | ";
}
else{
str += " | ";
}
str += " ";
str += "";
str += "";
str += "";
str += "";
str += "";
str += "";
str += "";
str += " | ";
if (wizardSubLevel){
str += " " + getWizardActionText('BACK') + " | ";
}
else {
if (wizardMainArray[1]=="A" || wizardMainArray[1]=="a"){
str += " " + getWizardActionText('BACK') + " | ";
}
else {
if (wizardMainArray[1]=="F" || wizardMainArray[1]=="f"){
str += " " + getWizardActionText('BACK') + " | ";
}
else {
str += " " + getWizardActionText('BACK') + " | ";
}
}
}
}
else{
if (wizardEndPage){
str += " | ";
}
else{
str += " | | ";
}
str += " ";
str += "";
str += "";
str += "";
str += "";
str += "";
str += "";
str += "";
str += " | ";
if (wizardSubLevel){
str += " " + getWizardActionText('BACK') + " | ";
}
else {
if (wizardMainArray[1]=="A" || wizardMainArray[1]=="a"){
str += " " + getWizardActionText('BACK') + " | ";
}
else {
if (wizardMainArray[1]=="F" || wizardMainArray[1]=="f"){
str += " " + getWizardActionText('BACK') + " | ";
}
else {
str += " " + getWizardActionText('BACK') + " | ";
}
}
}
}
str += " ";
str += " ";
str += " | ";
str += "";
str += "";
str += " | ";
str += " ";
str += " ";
str += " | ";
str += " + ) | ";
str += "";
str += "";
str += "";
str += " | ";
// inserting stepsmenu link in bottom right hand corner.
if (wizardSubLevel){
str += "" + getWizardActionText('STEP') + " | ";
}
else {
str += " | ";
}
str += " | ";
// inserting exit link in bottom right hand corner.
if (wizardMainArray[9]=="A" || wizardMainArray[9]=="a"){
str += "" + getWizardActionText('CANC') + " | "
}
else if (wizardMainArray[9]=="F" || wizardMainArray[9]=="f"){
str += "" + getWizardActionText('CANC') + " | "
}
else {
str += "" + getWizardActionText('CANC') + " | ";
}
// ending wizard bottom
str += " | ";
str += " ";
str += " ";
str += " | ";
str += " ";
str += " ";
// adding paragraph/rubrik bottom.
str += eval("" + obj + ".RubrikEnd();");
// adding toggle span end
str += " | ";
str += " ";
str += "";
str += " | ";
// creating stepsmenu
createWizardStepsMenu(wizardMainArray,wizardId);
// returns string to document.write().
return str;
}
// Wizard object dotted vertical separator
function wizardObjMiddle(){
// declaration of varables
var wizardId = glWizardLastCreated;
// creating wizard dotted separator in html
str = "";
str += " | ";
str += "";
str += "";
str += "";
str += " | | ";
str += " | | ";
// returns sting to document.write().
return str;
}
// Wizard object dotted horizontal separator of helparea
function wizardObjHelpMiddle(){
// creating wizard dotted separator in html
str = " | | | ";
str += "";
str += "";
str += "";
str += " | | ";
str += " | ";
str += " | ";
str += "";
// returns sting to document.write().
return str;
}
// Creating wizard objects stepsmenu
function createWizardStepsMenu(wizardMainArray,wizardId){
// declaration of variables.
var stepsMenuHeight=0;
var wizardStepMenuNoHelpLineSpan = (wizardMainArray.length-12)/4 + 2;
eval("var wizardStepsMenuItemArray= new Array()");
// getting size(int) from global variable set by wizardObjBegin()'s incoming wizardSize.
var wizardSize = getWizardSize();
// generating stepsmenu top html.
var returnStr = "";
if (getWizardHelpArea()==false){
returnStr += "";
}
return returnStr;
}
function toggleExpandArrow(fieldObj,expandArrowTargetFrame,scrollToView){
if ("" + expandArrowTargetFrame == "undefined" || expandArrowTargetFrame== "" ){
expandArrowTargetFrame = "" + targetFrame;
}
else {
var newStr = "" + expandArrowTargetFrame;
if (newStr.lastIndexOf(".") != newStr.length-1){
expandArrowTargetFrame = expandArrowTargetFrame + ".";
}
}
var imgObj=eval(expandArrowTargetFrame + "document.getElementById('" + fieldObj + "ArrowImg')");
fieldObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj)");
if (fieldObj.style.display=="none"){
imgObj.src= getExpandArrowImgPath() + "arrow_red_down.gif";
fieldObj.style.display="block";
if (scrollToView == true)
imgObj.scrollIntoView();
}
else {
imgObj.src= getExpandArrowImgPath() + "arrow_red_right.gif";
fieldObj.style.display="none";
}
}
function showExpandArrow(fieldObj,expandArrowTargetFrame){
if ("" + expandArrowTargetFrame == "undefined"){
expandArrowTargetFrame = "" + targetFrame;
}
else {
newStr = "" + expandArrowTargetFrame;
if (newStr.lastIndexOf(".") != newStr.length-1){
expandArrowTargetFrame = expandArrowTargetFrame + ".";
}
}
if (typeof(fieldObj)!='object'){
var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj + 'ArrowImg')");
fieldObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj)");
}
else {
var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj.id + 'ArrowImg')");
}
imgObj.src= getExpandArrowImgPath() + "arrow_red_down.gif";
fieldObj.style.display="block";
}
function hideExpandArrow(fieldObj,expandArrowTargetFrame){
if ("" + expandArrowTargetFrame == "undefined"){
expandArrowTargetFrame = "" + targetFrame;
}
else {
newStr = "" + expandArrowTargetFrame;
if (newStr.lastIndexOf(".") != newStr.length-1){
expandArrowTargetFrame = expandArrowTargetFrame + ".";
}
}
if (typeof(fieldObj)!='object'){
var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj + 'ArrowImg')");
fieldObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj)");
}
else {
var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj.id + 'ArrowImg')");
}
imgObj.src= getExpandArrowImgPath() + "arrow_red_right.gif";
fieldObj.style.display="none";
}
// Internal funktion for getting expandArrow image path
function getExpandArrowImgPath(){
if (top.ishomepage){
return getGeneralImgPath() + "usfke1_" + glExpandArrowBrandPath.toLowerCase() + "/$File/";
}
else if (top.indhold){
return getGeneralImgPath() + glExpandArrowBrandPath + "/expandarrow/";
}
else if(top.appcontent){
return getGeneralImgPath() + glExpandArrowBrandPath + "/expandarrow/";
}
}
/*
general functions for use in usfke1
*/
// General funktion for getting general image path
function getGeneralImgPath(){
if (top.ishomepage){
return location.protocol + "//" + top.domain_domino + "/image/"
}
else if (top.indhold){
return location.protocol + "//" + location.host + "/img/";
}
else if(top.appcontent){
return ImgPath;
}
}
// General funktion for getting general image path
function getBlankImgPath(){
if (top.ishomepage){
return location.protocol + "//" + top.domain_domino + "/link/space/$File/";
}
else if (top.indhold){
return location.protocol + "//" + location.host + "/img/";
}
else if(top.appcontent){
return ImgPath;
}
}
// Generel funktionality for getting unique ID in all browsers.
// Global variable for unique ID
var gsUniqueCounter=0;
function getgsUniqueID(){
gsUniqueCounter++;
var gsUniqueID = "gsUniqueID" + gsUniqueCounter
return gsUniqueID;
}
/*
markError
Version Date Developer Notes
1.0 9. April 2002 Morten Schou Larsen (MLAR) Initial version
1.01 15. April 2003 Claus Witt-Jespersen (CWI) Bugfixing and cleanup
fejlmarkeringsfunktion, kan markere om et felt er fejl udfyldt eller ej
to metoder kan kaldes :
markError() markerer fejl, tager objektet som skal fejlmarkeres som parameter
unMarkError() Fjerner fejlmarkering, tager objektet som skal have fjernet fejlmarkering som parameter
*/
function markError() {
for(i=0;i');
obj.insertAdjacentElement('afterEnd',oEle);
oEle.style.position='relative';
oEle.style.top='1px';
obj.style.top=(oEle.offsetTop-1)+'px';
} else if(obj.tagName=="INPUT"&&(obj.type=="text"||obj.type=="password")) {
obj.error="true";
obj.oldClassName=obj.className;
obj.className="error";
if(obj.currentStyle.height!="auto") obj.style.pixelHeight=obj.clientHeight;
if(obj.currentStyle.width!="auto") obj.style.pixelWidth=obj.clientWidth;
} else if(obj.tagName=="TEXTAREA") {
obj.error="true";
obj.oldClassName=obj.className;
obj.className="error";
if(obj.currentStyle.height!="auto") obj.style.pixelHeight=obj.clientHeight;
if(obj.currentStyle.width!="auto") obj.style.pixelWidth=obj.clientWidth+13;
}
} //end for
} // end function
function unMarkError() {
for(i=0;i | |
|