[OpenLayers-Commits] r7530 - sandbox/architect/scripts
commits at openlayers.org
commits at openlayers.org
Wed Jul 16 17:02:20 EDT 2008
Author: architect
Date: 2008-07-16 17:02:20 -0400 (Wed, 16 Jul 2008)
New Revision: 7530
Modified:
sandbox/architect/scripts/controlConfig.js
sandbox/architect/scripts/layerConfig.js
sandbox/architect/scripts/panelConfig.js
Log:
Controls and panels are working more in harmony
Modified: sandbox/architect/scripts/controlConfig.js
===================================================================
--- sandbox/architect/scripts/controlConfig.js 2008-07-16 20:14:37 UTC (rev 7529)
+++ sandbox/architect/scripts/controlConfig.js 2008-07-16 21:02:20 UTC (rev 7530)
@@ -1,6 +1,17 @@
/*
+TO DO
+Reattach events
+enable control switching between panels
+
+*/
+
+
+
+
+/*
+Controls -
Attribution
Button
DragFeature
@@ -25,7 +36,8 @@
- /*
+Loop through properties of a function
+--------------
var properties = [];
var functions = [];
for(var name in OpenLayers.Control.prototype) {
@@ -39,7 +51,6 @@
console.log(properties)
console.log(functions)
*/
-
/*=======================
| createBaseLayerConfig
=========================*/
@@ -89,38 +100,34 @@
});
/*=======================
-| addDelEditOptionsToLayerListItem
+| addDelEditOptionsToControlListItem
=========================*/
function addDelEditOptionsToControlListItem(ID){
/*edit function*/
$('tb1Control' + ID).innerHTML += "<div id='tbControlOptionContainer'>"
- +" <div id='tbControlEditDiv" + ID + "Edit' class='tbControlEditDiv' >Edit</div>"
- +" <div class='tbControlDeleteDiv' ><img id='tb1Control" + ID + "Delete' src='images/close.png' alt='Delete control'/></div>"
+ +" <div id='tbControlEditDiv" + ID + "Edit' class='tbControlEditDiv' onclick='editControlOption(" + ID + ");'>Edit</div>"
+ +" <div class='tbControlDeleteDiv' onclick='deleteControlOption(" + ID + ");' ><img id='tb1Control" + ID + "Delete' src='images/close.png' alt='Delete control'/></div>"
+" </div>";
- var curEdit = 'tbControlEditDiv' + ID + 'Edit';
- var curListItem = "tb1Control" + ID;
- console.log(curEdit)
- $(curEdit).addEvent('click', function(e) {
- $('tb1Control' + ID).highlight('#bcb8ad');
- editControl(ID); //The title contains the value of controlsLength, i.e. the number used in the Element's ID to uniquly identify it
- });
-
- /*delete function*/
+ /*Because the panelConfig edits the innerHTML, we cannot attach events to elements that will be overridden. Instead, we'll just call a function when it is pressed*/
+}
+
+function editControlOption(ID) {
+ $('tb1Control' + ID).highlight('#bcb8ad');
+ editControl(ID); //The title contains the value of controlsLength, i.e. the number used in the Element's ID to uniquly identify it
+}
+function deleteControlOption(ID) {
var curDelete = 'tb1Control' + ID + 'Delete';
var curListItem = "tb1Control" + ID;
- $(curDelete).addEvent('click', function(e) {
- var elName = $('controlListItems').get('title')
- if(elName == "editMode")
- $('toolBox2Content').innerHTML = getEmptyToolBox2HTML("none", "Control"); //hide the toolbox
- $(curListItem).dispose(); //Remove the current LI element
- numActiveControls--; //Decrease the number of active controls by 1
- map.controls[ID] = null; // empty the current control object
- controlToggle.show(); //update the height
- });
+ var elName = $('controlListItems').get('title')
+ if(elName == "editMode")
+ $('toolBox2Content').innerHTML = getEmptyToolBox2HTML("none", "Control"); //hide the toolbox
+ $(curListItem).dispose(); //Remove the current LI element
+ numActiveControls--; //Decrease the number of active controls by 1
+ map.controls[ID] = null; // empty the current control object
+ controlToggle.show(); //update the height
}
-
/*=======================
| createBaseControlConfig
|
@@ -138,7 +145,8 @@
var ID = controlsLength;
/*add the current layer id to the map.layer object*/
eval("var curControl = {'id':'" + ID + "'};");
- map.controls.push(curControl); //add the current layer id to map.layers
+ if(map.controls[ID] == null || map.controls[ID] == undefined)
+ map.controls.push(curControl); //add the current layer id to map.layers
map.controls[ID].CLASS_NAME = 'OpenLayers.Control.' + tb1SelectedControl.value
@@ -159,7 +167,9 @@
/*Populate ToolBox 2's layer options with the layer selected in ToolBox 1's layer list dropdown - call changeLayer and pass in the controlList from toolbox1*/
//controlListelement, id, name, isControlNew
changeControl(tb1SelectedControl, ID, tb1SelectedControl.value, true);
-
+ if($(tb1SelectedPanel) != null || $(tb1SelectedPanel) != undefined)
+ $('tb2ControlListPanelDropdown').selectedIndex = tb1SelectedPanel.selectedIndex
+
/*set the Delete div's name to newMode, which means don't delete toolbox 2's content if the layer delete button has been pressed*/
$('controlListItems').set('title', 'newMode');
}
@@ -192,7 +202,6 @@
$('tb2ControlListDropdown').value = tb1SelectedControl.value;
- console.log(controlTitle);
eval("loadControl" + controlTitle + "();"); //Call the loadLayerConfig function;
//pass in the ID and false (don't get values from openlayers)
populateControlValues(ID, controlTitle, false); //get data from the map object and fill in the inp
@@ -212,7 +221,7 @@
|
|called when the save button is pressed
|
-|ID is the id of the current layer - an integer - an integer
+|ID is the id of the current control - an integer - an integer
|isControlNew is either "new" or "edit" - new, if the new layer button has been clicked; edit, if a layer is going to be modified
=========================*/
function saveControlConfig(ID, isControlNew){
@@ -224,22 +233,11 @@
isControlNew = true;
- //Get the value of the text input.
- var valName = $('layoutControlConfigTitle').value;
- console.log(valName);
- /*The code here will execute if the input is empty.
- Create a new <li> to hold all our content.
- Set the title of the LI to the current layersLength value*/
- if(isControlNew == true){
- var li = new Element('li', {id: 'tb1Control'+ID, title:'Control ' + valName,'class':'drag'}); //onclick=\"editLayer('" + ID + "')\"
-
- //Add the <li> to our list.
- $('controlListItems').adopt(li);
- //We have to add the list item to our Sortable object so it's sortable.
- sort.addItems(li);
- //We put the new order inside of the data div. Function defined in sortable.js
- showNewOrder();
- }
+ /*Get the value of the text input for the title*/
+ var valName = $('layoutControlConfigTitle').value;
+
+ /*SAVE THE CHANGED VALUES*/
+
/*loop through options, get by class listValueUpdated and valueUpdated
saved all the changed class options*/
map.controls[ID].title = valName; //Set the name in the map object to the value of toolbox 2's name form
@@ -256,8 +254,55 @@
/*Update the name and layer type*/
map.controls[ID].title = valName
map.controls[ID].CLASS_NAME = 'OpenLayers.Control.' + $('tb2ControlListDropdown').value
+
+ //Get the Panel's ID if it exists
+ if($('tb2ControlListPanelDropdown') != null || $('tb2ControlListPanelDropdown') != undefined)
+ var panelID = $('tb2ControlListPanelDropdown').options[$('tb2ControlListPanelDropdown').selectedIndex].id;
+
+ /*Not all controls have panels, so set the panelID to null if a control does not have a panel*/
+ if(panelID == null || panelID == undefined)
+ panelID = null
+ else
+ panelID = panelID.replace("panel","");
+
+ map.controls[ID].panelID = panelID
+ /*
+ |---------------|
+ |If the control is new (If it is being edited, do not create another LI element)
+ |Create the draggable control item representation. Put it in either the control configuration, or panel
+ |----------------|
+ The code here will execute if the input is empty.
+ Create a new <li> to hold all our content.
+ Set the title of the LI to the current layersLength value*/
+ if(isControlNew == true){
+ //Create the LI element
+ var li = new Element('li', {id: 'tb1Control'+ID, title:'Control ' + valName,'class':'drag'}); //onclick=\"editLayer('" + ID + "')\"
+ //Check if there is a panel selected
+ //----If the selected panel does not exist, create it. Add the control to the selected panel
+ if ($('tb1ControlListPanelDropdown') != null || $('tb1ControlListPanelDropdown') != undefined){
+ //Call GetPanels to repopulate the drop down list. If this isn't done, then the default panel id will not change, which will cause a problem if a panel was deleted and the control hasn't been changed (i.e. the panel list has not been refreshed)
+ $('tb1NewControlSelects').innerHTML = createSelectList('tb1ControlListPanelDropdown', 'Control Picklist', '', getPanels());
+ //Check to see if the selected panel exists
+ if ($('tb1Panel' + panelID + 'Container') == null || $('tb1Panel' + panelID + 'Container') == undefined){
+ savePanelConfig(panelID, true, true);
+ }
+ $('panel' + panelID + 'ListItems').adopt(li);
+ }
+ else{
+ //Add the <li> to the control config list
+ $('controlListItems').adopt(li);
+
+ }
+ //We have to add the list item to our Sortable object so it's sortable.
+ sort.addItems(li);
+ //We put the new order inside of the data div. Function defined in sortable.js
+ showNewOrder();
+ }
+ else {
+
+ }
/*Clear the layer editing options*/
//add the empty html to the toolbox
$('toolBox2Content').innerHTML = getEmptyToolBox2HTML("none", "Control");
@@ -276,6 +321,7 @@
$('tb1Control' + ID).set('text',controlName + controlTitle);
$('tb1Control' + ID).set('title','Control - ' + map.controls[ID].title);
+
if(isControlNew == true){
/*If a new layer is being added, do not clear the HTML when the delete button is pressed*/
controlsLength++; //A layer has been created, so add 1 to the layersLength (global var to keep track of number of layers
@@ -286,7 +332,7 @@
addDelEditOptionsToControlListItem(ID);
/*Update the height*/
- layerToggle.show();
+ controlToggle.show()
}
@@ -327,11 +373,6 @@
//By default, set the value to nothing. If something exists, override the null value
tempNode.value = '';
/*Get the map name value*/
- /*Check the DEFAULT_PARAMS and everything else*/
- if (OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS != null){
- if(OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name] != null)
- tempNode.value = OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name];
- }
if(OpenLayers.Control[curDropDownVal].prototype[tempNode.name] != null){
tempNode.value = OpenLayers.Control[curDropDownVal].prototype[tempNode.name];
}
@@ -341,33 +382,6 @@
else if(tempNode.type == "select-one" ){
//By default, set the value to 0. Override the value is necessary
tempNode.selectedIndex = 0;
- if (OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS != null || OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS != undefined){
- if(OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name] != null){
- var olVal = OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name];
- /*check for True / False lists*/
- if(tempNode.options[0].value == "True" || tempNode.options[0].value == "False"){
- if( Boolean(tempNode.options[0].name) == olVal)
- tempNode.selectedIndex = 0;
- if( Boolean(tempNode.options[1].name) == olVal)
- tempNode.selectedIndex = 1;
- }
- /*check for Jpg / Gif / Png, and other type of lists*/
- else{
- if(tempNode.options[0].value == olVal)
- tempNode.selectedIndex = 0;
- if(tempNode.options[1].value == olVal)
- tempNode.selectedIndex = 1;
- if(tempNode.options[2]){
- if(tempNode.options[2].value == olVal)
- tempNode.selectedIndex = 2;
- }
- if(tempNode.options[3]){
- if(tempNode.options[3].value == olVal)
- tempNode.selectedIndex = 3;
- }
- }
- }
- }
if(OpenLayers.Control[curDropDownVal].prototype[tempNode.name] != null){
var olVal = OpenLayers.Control[curDropDownVal].prototype[tempNode.name];
/*check for True / False lists*/
@@ -408,11 +422,6 @@
//By default, set the value to nothing. If something exists, override the null value
tempNode.value = '';
/*Get the map name value*/
- /*Check the DEFAULT_PARAMS and everything else*/
- if (OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS != null){
- if(OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name] != null)
- tempNode.value = OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name];
- }
if(OpenLayers.Control[curDropDownVal].prototype[tempNode.name] != null){
tempNode.value = OpenLayers.Control[curDropDownVal].prototype[tempNode.name];
@@ -424,33 +433,6 @@
else if(tempNode.type == "select-one" ){
//By default, set the value to 0. Override the value is necessary
tempNode.selectedIndex = 0;
- if (OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS != null || OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS != undefined){
- if(OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name] != null){
- var olVal = OpenLayers.Control[curDropDownVal].prototype.DEFAULT_PARAMS[tempNode.name];
- /*check for True / False lists*/
- if(tempNode.options[0].value == "True" || tempNode.options[0].value == "False"){
- if( Boolean(tempNode.options[0].name) == olVal)
- tempNode.selectedIndex = 0;
- if( Boolean(tempNode.options[1].name) == olVal)
- tempNode.selectedIndex = 1;
- }
- /*check for Jpg / Gif / Png, and other type of lists*/
- else{
- if(tempNode.options[0].value == olVal)
- tempNode.selectedIndex = 0;
- if(tempNode.options[1].value == olVal)
- tempNode.selectedIndex = 1;
- if(tempNode.options[2]){
- if(tempNode.options[2].value == olVal)
- tempNode.selectedIndex = 2;
- }
- if(tempNode.options[3]){
- if(tempNode.options[3].value == olVal)
- tempNode.selectedIndex = 3;
- }
- }
- }
- }
if(OpenLayers.Control[curDropDownVal].prototype[tempNode.name] != null){
var olVal = OpenLayers.Control[curDropDownVal].prototype[tempNode.name];
/*check for True / False lists*/
Modified: sandbox/architect/scripts/layerConfig.js
===================================================================
--- sandbox/architect/scripts/layerConfig.js 2008-07-16 20:14:37 UTC (rev 7529)
+++ sandbox/architect/scripts/layerConfig.js 2008-07-16 21:02:20 UTC (rev 7530)
@@ -116,7 +116,8 @@
/*add the current layer id to the map.layer object*/
eval("var curLayer = {'id':'" + ID + "'};");
- map.layers.push(curLayer); //add the current layer id to map.layers
+ if(map.layers[ID] == null || map.layers[ID] == undefined)
+ map.layers.push(curLayer); //add the current layer id to map.layers
map.layers[ID].name = tb1formName.value
map.layers[ID].CLASS_NAME = 'OpenLayers.Layer.' + tb1LayerList.value
Modified: sandbox/architect/scripts/panelConfig.js
===================================================================
--- sandbox/architect/scripts/panelConfig.js 2008-07-16 20:14:37 UTC (rev 7529)
+++ sandbox/architect/scripts/panelConfig.js 2008-07-16 21:02:20 UTC (rev 7530)
@@ -1,3 +1,12 @@
+/*
+
+TO DO
+Reattach events
+
+*/
+
+
+
var panelsLength = 0;
var numActivePanels = 0;
var panels = { "panels": [] }; //contains all the panel objects
@@ -43,7 +52,7 @@
var panelList = [];
if(numActivePanels < 1){
/*id, title, value, text*/
- panelList = [[['panel0'],['Default Panel'],['Default Panel'],['Default Panel']]];
+ panelList = [[['panel' + panelsLength],['Default Panel'],['Default Panel'],['Default Panel']]];
return panelList;
}
if(numActivePanels >= 1){
@@ -77,7 +86,8 @@
var ID = panelsLength;
/*add the current layer id to the map.layer object*/
eval("var curPanel = {'id':'" + ID + "'};");
- panels.panels.push(curPanel); //add the current layer id to map.layers
+ if(panels.panels[ID] == null || panels.panels[ID] == undefined)
+ panels.panels.push(curPanel); //add the current layer id to map.layers
panels.panels[ID].CLASS_NAME = 'OpenLayers.Control.Panel'
@@ -94,7 +104,7 @@
/*Populate ToolBox 2's layer options with the layer selected in ToolBox 1's layer list dropdown - call changeLayer and pass in the controlList from toolbox1*/
//name, id
- populatePanel(tb1PanelName, ID);
+ populatePanel(tb1PanelName.value, ID);
/*set the Delete div's name to newMode, which means don't delete toolbox 2's content if the layer delete button has been pressed*/
$('tb1Panels').set('title', 'newMode');
@@ -108,53 +118,89 @@
|
|sets up a new layer in the global map object and populates toolbox 2 with empty input boxes
=========================*/
-function populatePanel(pName, ID){
+function populatePanel(pName, ID, isNew){
$('tb2blcCommon').innerHTML += "<br /> Display Panel In Map " + createSelectList('layoutPanelConfigInMap', 'div', '', getTrueMenu());
$('tb2blcCommon').innerHTML += "<br /> Allow Selection " + createSelectList('layoutPanelConfigAllowSelection', 'allowSelection', '', getFalseMenu());
- $('tb2blcCommon').innerHTML += "<br />Title " + createInputTextBox('layoutPanelConfigTitle','title', pName.value, 30);
+ $('tb2blcCommon').innerHTML += "<br />Title " + createInputTextBox('layoutPanelConfigTitle','title', pName, 30);
+ $('tb2blcCommon').innerHTML += "<br /><br /><strong>Size</strong> - Width: " + createInputTextBox('layoutPanelConfigWidth','width', '', 5) + " Height: " + createInputTextBox('layoutPanelConfigHeight','height', '', 5);
+ $('tb2blcCommon').innerHTML += "<br /><strong>Position</strong> - X: " + createInputTextBox('layoutPanelConfigPosX','posx', '', 5) + " Y: " + createInputTextBox('layoutPanelConfigPosY','posy', '', 5);
}
/*=======================
-| savePanelConfig(ID, isPanelNew)
+| savePanelConfig(ID, isPanelNew,calledFromControl)
|
|called when the save button is pressed
|
|ID is the id of the current layer - an integer - an integer
|isPanelNew is either "new" or "edit" - new, if the new layer button has been clicked; edit, if a layer is going to be modified
+|calledFromControl (bool) - specifies if this was called from the control config, if so then create a panel with default values
=========================*/
-function savePanelConfig(ID, isPanelNew){
+function savePanelConfig(ID, isPanelNew,calledFromControl){
/*if no isPanelNew is defined, assume it is a new layer*/
- if ( isPanelNew == null || isPanelNew == undefined)
+ if (isPanelNew == null || isPanelNew == undefined)
isPanelNew = true;
- var panelName = $('layoutPanelConfigTitle').value;
+ if($('layoutPanelConfigTitle') != null || $('layoutPanelConfigTitle') != undefined)
+ var panelName = $('layoutPanelConfigTitle').value;
+ else
+ var panelName = 'Default Panel'
//Get the value of the text input.
if (panelName == ''){
- panelName = "Panel " + panelsLength;
+ panelName = "Panel " + ID;
}
/*The code here will execute if the input is empty.
Create a new <li> to hold all our content.
Set the title of the LI to the current layersLength value*/
if(isPanelNew == true){
- $('tb1Panels').innerHTML += "<div id='tb1Panel" + panelsLength + "Container'>"
- +" <div id='tb1Panel" + panelsLength + "Header' class='tb1PanelHeader'>"
- +" <div id='tb1Panel" + panelsLength + "HeaderTitle'> " + panelName + "</div>"
- +" <div id='tb1PanelEditDiv" + panelsLength + "' class='tb1PanelEditDiv' onclick='panelEdit(" + panelsLength + ");'>Edit</div>"
- +" <div id='tb1PanelDeleteDiv" + panelsLength + "' class='tb1PanelDeleteDiv' onclick='panelDelete(" + panelsLength + ");' >D</div>"
+
+
+
+ var divPanelContainer = new Element('div', {id:'tb1Panel' + ID + 'Container'});
+ var divPanelHeader = new Element('div', {id:'tb1Panel' + ID + 'Header', class:'tb1PanelHeader'});
+ var divPanelHeaderTitle = new Element('div', {id:'tb1Panel' + ID + 'HeaderTitle'});
+ var divPanelEdit = new Element('div', {id:'tb1PanelEditDiv' + ID, class:'tb1PanelEditDiv'});
+ var divPanelDelete = new Element('div', {id:'tb1PanelDeleteDiv' + ID, class:'tb1PanelDeleteDiv'});
+ var divListArea = new Element('div', {id:'tb1Panel' + ID + 'ListArea', class:'tb1PanelListArea'});
+ var olEl = new Element('ol', {id: 'panel' + ID + 'ListItems', class:'PanelListItems' });
+
+
+ divPanelHeader.adopt(divPanelHeaderTitle, divPanelEdit, divPanelDelete);
+ divListArea.adopt(olEl);
+ divPanelContainer.adopt(divPanelHeader, divListArea);
+ $('tb1Panels').adopt(divPanelContainer);
+
+ /* OLD, BUSTED WAY - Removes events :(
+ $('tb1Panels').innerHTML += "<div id='tb1Panel" + ID + "Container'>"
+ +" <div id='tb1Panel" + ID + "Header' class='tb1PanelHeader'>"
+ +" <div id='tb1Panel" + ID + "HeaderTitle'> " + panelName + "</div>"
+ +" <div id='tb1PanelEditDiv" + ID + "' class='tb1PanelEditDiv' onclick='panelEditOption(" + panelsLength + ");'>Edit</div>"
+ +" <div id='tb1PanelDeleteDiv" + ID + "' class='tb1PanelDeleteDiv' onclick='panelDelete(" + panelsLength + ");' >D</div>"
+" </div>"
- +" <div id='tb1Panel" + panelsLength + "ListArea' class='tb1PanelListArea'>"
- +" <ol class='PanelListItems'>"
+ +" <div id='tb1Panel" + ID + "ListArea' class='tb1PanelListArea'>"
+ +" <ol id='panel" + ID + "ListItems' class='PanelListItems'>"
+" </ol>"
+" </div>"
+" </div>";
/*Create the delete text and edit button*/
+
}
+
+ if(calledFromControl == true){
+ /*set the ID to the current current control*/
+ var ID = panelsLength;
+ /*add the current layer id to the map.layer object*/
+ eval("var curPanel = {'id':'" + ID + "'};");
+ panels.panels.push(curPanel); //add the current layer id to map.layers
+
+ panels.panels[ID].CLASS_NAME = 'OpenLayers.Control.Panel'
+ }
+
/*loop through options, get by class listValueUpdated and valueUpdated
saved all the changed class options*/
panels.panels[ID].title = panelName; //Set the name in the map object to the value of toolbox 2's name form
@@ -167,7 +213,6 @@
var val = updatedLists[i].value; //The current item is a text box
panels.panels[ID][list] = val //Add the properties to the current map layer
}
-
/*Update the name and layer type*/
panels.panels[ID].title = panelName
panels.panels[ID].CLASS_NAME = 'OpenLayers.Control.Panel'
@@ -179,7 +224,7 @@
/*Highlist the layer in the layer list that was saved*/
$('tb1Panel' + ID + 'Container').highlight('#bcb8ad');
- $("tb1Panel" + panelsLength + "HeaderTitle").innerHTML = panelName;
+ $("tb1Panel" + ID + "HeaderTitle").innerHTML = panelName;
if(isPanelNew == true){
/*If a new layer is being added, do not clear the HTML when the delete button is pressed*/
@@ -198,19 +243,56 @@
}
/*Update the height*/
- layerToggle.show();
+ controlToggle.show();
}
+
/*Because we use innerHTML, do not attach events to the divs - instead, use onclick to fire these events*/
-function panelEdit(ID){
+function panelEditOption(ID){
var curEdit = "tb1PanelEditDiv" + ID;
$('tb1Panel' + ID + 'Header').highlight('#bcb8ad');
- //editPanel(ID); //The title contains the value of layersLength, i.e. the number used in the Element's ID to uniquly identify it
+ editPanel(ID); //The title contains the value of layersLength, i.e. the number used in the Element's ID to uniquly identify it
+
}
function panelDelete(ID){
/*delete function*/
var curDelete = "tb1PanelDeleteDiv" + ID;
$('tb1Panel' + ID + 'Container').dispose(); //Remove the current LI element
panels.panels[ID] = null; // empty the current layer object
- layerToggle.show(); //update the height
+ controlToggle.show(); //update the height
numActivePanels--;
+ $('tb1NewControlSelects').innerHTML = createSelectList('tb1ControlListPanelDropdown', 'Control Picklist', '', getPanels());
}
+
+/*=======================
+| editPanel(ID)
+|
+|called when the control is going to be edited
+|
+|ID is the id of the current panel - an integer - an integer
+=========================*/
+function editPanel(ID){
+
+/*store the toolbox div in tbid (toolboxid)*/
+ var tbid = $('toolBox2Content');
+
+/*get title*/
+ var panelTitle = panels.panels[ID].title;
+ if(panelTitle == undefined || panelTitle == null){
+ panelTitle = "Panel " + ID;
+ }
+
+/*add the html to the toolbox*/
+ tbid.innerHTML = getEmptyToolBox2HTML("block", "Panel");
+
+//pass in the ID and false (don't get values from openlayers)
+ populatePanel(ID, panelTitle, false); //get data from the map object and fill in the inp
+
+ $('layoutPanelConfigTitle').value = panelTitle;
+
+ /*Create the save and reset buttons*/
+ $('tb2blcButtons').innerHTML += "<br /><br /><input id='saveButton' type='button' class='" + ID + "' value='Save' onclick='savePanelConfig(" + ID + ", false);'><br />"; //Save Button
+
+ /*Set the the name to "editMode", this allows us to determine if we should clear toolbox2's content or not. If the name = editMode, then we should clear toolbox2 once the layer delete button has been pressed*/
+ $('tb1Panels').set('title', 'editMode');
+
+}
More information about the Commits
mailing list