addBarLayer.html

<HTML>

<HEAD>

<script>var dFrameFilePath = '../../../../../dFrame/'</script>

<script language="Javascript" src="../../../../../dFrame/dFrame/lib/DFrameAPI.js"></script>

 

<script language="Javascript">

     //Global

     var baseAll

     //Style

     DFrameAPI.include('dFrame/styles/colors/styleColors.js')

    

     DFrameAPI.onLoad = function(){

          baseAll = new DFrame([5, 5, 95, 95], 'addBarLayer.html', dFrameStyle)

 

          var bar = baseAll.addBar()

          bar.addButton('Open a dFrame with a document', 'createDFrame("./addBarLayer/document.html")')

          bar.addButton('Open a dFrame with a form', 'createDFrame("./addBarLayer/form.html")')

 

          var bar = baseAll.addBar()

          bar.addButton('Open a dFrame with document 1', 'createDFrame("./addBarLayer/page1.html")')

          bar.addButton('Open a dFrame with document 2', 'createDFrame("./addBarLayer/page2.html")')

          baseAll.addText('Each DFrame is created with all barLayers for all type of inserted documents.<br>The correct barLayer is selected in the onLoadDframe function of each document.', null, [3, 3])

          baseAll.show()

     }

     function createDFrame(url) {

          dFrameStyle.setIndentX(50)

          dFrameStyle.setIndentY(50)

          var dFrame = new DFrame([10, 15, 50, 50], 'Test for addBarLayer', dFrameStyle, baseAll)

 

          //Each DFrame will have all barLayers for all type of inserted documents

          //Create BarLayer 1: For documents

          var barLayer1 = dFrame.addBarLayer()

          barLayer1.addButton('Close the document', 'alert("Should close the document")')

          //Set the BarLayer as the one to be shown if there is no forn in the document

          barLayer1.setStdBarLayer('READ')

 

          //Create BarLayer 2: For forms

          var barLayer2 = dFrame.addBarLayer()

          barLayer2.addButton('Submit the form', 'alert("Should submit the form")')

          //Set the BarLayer as the one to be shown if there is a forn in the document

          barLayer2.setStdBarLayer('EDIT')

         

          //BarLayer 3 and 4 will be choosen by the onLoadDFrame function in page1 and page2.html

          //Create BarLayer 3: For document 1

          dFrame.barLayer3 = dFrame.addBarLayer()

          dFrame.barLayer3.addButton('Action for document 1', 'alert("Action for document 1")')

 

          //Create BarLayer 4: For document 2

          dFrame.barLayer4 = dFrame.addBarLayer()

          dFrame.barLayer4.addButton('Action for document 2', 'alert("action for document 2")')

 

          dFrame.setURL(url)

     }

</script>

document.html

<HTML>

<BODY>

This is a document

</BODY>

form.html

<HTML>

<BODY>

<form Method=post Action="null action for this form">

<input type=text value="This is a form"></form>

</BODY>

page1.html

<HTML>

<script>

     function onLoadDFrame() {

          thisDFrame.barLayer3.show()

          thisDFrame.setTitle('page1.html')

     }

</script>

<BODY>

This is document 1

</BODY>

page2.html

<HTML>

<script>

     function onLoadDFrame() {

          thisDFrame.barLayer4.show(true)

          thisDFrame.setTitle('page2.html')

     }

</script>

<BODY>

This is document 2

</BODY>