Changeset 7709
- Timestamp:
- 08/07/08 11:44:42 (3 weeks ago)
- Files:
-
- sandbox/architect/index.php (modified) (2 diffs)
- sandbox/architect/scripts/controlConfig.js (modified) (1 diff)
- sandbox/architect/scripts/dragdrop.js (modified) (5 diffs)
- sandbox/architect/scripts/layerConfig.js (modified) (1 diff)
- sandbox/architect/scripts/mapConfig.js (modified) (9 diffs)
- sandbox/architect/scripts/panelConfig.js (modified) (1 diff)
- sandbox/architect/style.css (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/architect/index.php
r7698 r7709 23 23 <script type="text/javascript" src="scripts/panelConfig.js"></script> 24 24 <script type="text/javascript" src="scripts/controlConfig.js"></script> 25 <script type="text/javascript" src="scripts/saveMap.js"></script> 25 26 26 27 <title>OL Architect - Open Layers Map Creation Application</title> … … 184 185 185 186 </div> 187 <div id="mapFunctions"> 188 <div class="padding5px alignRight"> 189 <form action="index.php" method="post"> 190 <input id="saveMapButton" type="button" value="Save and Create Map" /> 191 </form> 192 </div> 193 </div> 186 194 </div> 187 195 </div> sandbox/architect/scripts/controlConfig.js
r7698 r7709 71 71 /*If false is returned, then the validation in the function failed*/ 72 72 if($('tb1ControlListDropdown').selectedIndex == 0){ 73 alert("A control must be selected"); 73 $('siteAlerts').setStyle('display', 'block'); 74 $('siteAlerts').setStyle('opacity',0); 75 $('siteAlerts').fade(1); 76 $('siteAlerts').innerHTML = "A control must be selected"; 74 77 return; 78 } 79 if( $('siteAlerts').getStyle('opacity') > 0 ){ 80 $('siteAlerts').fade(0); 75 81 } 76 82 //populate toolbox2 sandbox/architect/scripts/dragdrop.js
r7698 r7709 57 57 /*Create the HTML*/ 58 58 /*create the draggable box*/ 59 if(panelCreated == true){ 60 $('mapContainer').innerHTML = "<div id='draggableDiv'>Drag</div>" 61 +"<div id='draggableDivContainer'>" 62 +" <div id='draggableDivResize'></div>" 59 if(panelCreated == true){ //create html for the panel 60 $('mapContainer').innerHTML = "<div id='draggableDiv'>Drag</div>" 61 +"<div id='draggableDivContainer'>" 62 +" <div id='draggableDivResize'></div>" 63 +" <div id='draggableDivTitle'>" + theName + "</div>" 64 +"</div>"; 65 $('draggableDivResize').addEvent('click', function(event){ 66 if( $('siteAlerts').getStyle('opacity') > 0 ){ 67 $('siteAlerts').fade(0); 68 } 69 }); 70 } 71 else if(panelCreated == false){ //create html for the control 72 $('mapContainer').innerHTML = "<div id='draggableDivContainer'>" 63 73 +" <div id='draggableDivTitle'>" + theName + "</div>" 64 74 +"</div>"; 65 75 } 66 else if(panelCreated == false){ 67 $('mapContainer').innerHTML = "<div id='draggableDivContainer'>" 68 +" <div id='draggableDivTitle'>" + theName + "</div>" 69 +"</div>"; 70 } 76 71 77 var boxID; 72 78 var exists = false; 73 79 var boxStyle = []; 74 /*load data, if it exists */80 /*load data, if it exists - only looking for panel here*/ 75 81 for(var i = 0; i < divs.div.length; i++){ 76 82 if(divs.div[i].pID == pID){ … … 78 84 exists = true; 79 85 } 80 /*if(divs.div[i].cID == cID && cID != 'z'){81 boxID = i;82 exists = true;83 }*/84 86 } 85 87 //console.log("pID: " + pID + " | cID:" + cID + " | boxID: " + boxID); … … 182 184 } 183 185 }); 186 }//end if panel created 187 if(panelCreated == false){ 188 var controlExists = false; 189 $('draggableDivTitle').fade(.2); //fade the panel name 190 var controlBox = new Element('div', {'id':'curControlBox' + cID, 'class':'controlBox'}); //store the controlBox div in a variable 191 $('draggableDivContainer').adopt(controlBox); //add the controlbox to the panel container 192 for(var i = 0; i < divs.div.length; i++){ //see if a control already exists 193 if(divs.div[i].cID == cID && cID != 'z'){ 194 boxID = i; 195 controlExists = true 196 } 197 } 198 if(controlExists == true){ 199 /*for(var i = 0; i < divs.div.length; i++){ //see if a control already exists 200 if(divs.div[i].cID != 'z'){ 201 var curControlBoxID = 'curControlBox' + i; 202 $(curControlBoxID).setStyle('left', divs.div[boxID].xPos + "px"); 203 $(curControlBoxID).setStyle('top', divs.div[boxID].yPos + "px"); 204 $(curControlBoxID).setStyle('width', divs.div[boxID].width + "px"); 205 $(curControlBoxID).setStyle('height', divs.div[boxID].height + "px"); 206 $(curControlBoxID).innerHTML = divs.div[boxID].name; 207 } 208 }*/ 209 210 var curControlBoxID = 'curControlBox' + cID; 211 $(curControlBoxID).setStyle('left', divs.div[boxID].xPos + "px"); 212 $(curControlBoxID).setStyle('top', divs.div[boxID].yPos + "px"); 213 $(curControlBoxID).setStyle('width', divs.div[boxID].width + "px"); 214 $(curControlBoxID).setStyle('height', divs.div[boxID].height + "px"); 215 $(curControlBoxID).innerHTML = divs.div[boxID].name; 216 } 217 populateMapControls(controlExists, boxID, true); //create the inputs for the control box 218 184 219 } 185 220 }; 186 221 222 223 /*======================= 224 | editElementConfig() 225 | 226 | handles the input text boxes that configure the x,y,width, and height of a dragbox 227 | 228 =========================*/ 187 229 function editElementConfig(){ 188 230 /*calculate the limits to ensure the draggable box remains within the mapContainer*/ … … 217 259 function emptyMapControls() { 218 260 $('mapControls').innerHTML = ""; 219 } 220 function populateMapControls(exists, boxID){ 261 $('mapControls').setStyle('border', 'none'); 262 263 var mapFuncPos = $('mapControls').offsetTop + $('mapControls').offsetHeight; 264 $('mapFunctions').setStyle('top', mapFuncPos - 10); 265 } 266 function populateMapControls(exists, boxID, control){ 221 267 $('mapControls').innerHTML = "<form id='mapControlsForm'>" 222 268 +" X Position:<input id='elementX' type='text' value='0' size='3'>" … … 228 274 +" <input id='editElement' onclick='editElementConfig();' type='button' value='Save' />" 229 275 +"</form>"; 276 $('mapControls').setStyle('border', '1px solid #415e69'); 277 278 var mapFuncPos = $('mapControls').offsetTop + $('mapControls').offsetHeight; 279 $('mapFunctions').setStyle('top', mapFuncPos); 280 281 if(control == true){ //if a control was created 282 $('elementWidth').value = 26; 283 $('elementHeight').value = 26; 284 } 230 285 if(exists == true){ 231 286 $('elementX').value = divs.div[boxID].xPos; sandbox/architect/scripts/layerConfig.js
r7548 r7709 16 16 /*If false is returned, then the validation in the function failed*/ 17 17 if ($('tb1LayerListDropdown').selectedIndex == 0){ 18 alert("A layer service must be selected"); 18 $('siteAlerts').setStyle('display', 'block'); 19 $('siteAlerts').setStyle('opacity',0); 20 $('siteAlerts').fade(1); 21 $('siteAlerts').innerHTML = "A layer service must be selected"; 19 22 return; 20 23 } 21 if ($('tb1NewLayerForm').value == ""){ 22 alert("A valid name must be entered"); 24 25 /*override the trim function*/ 26 String.prototype.trim = function() { 27 return this.replace(/^\s+|\s+$/g,""); 28 } 29 /*store the trimmed name*/ 30 var trimedLayerName = $('tb1NewLayerForm').value.trim(); 31 32 /*if nothing but spaces were entered*/ 33 if (trimedLayerName == ""){ 34 $('siteAlerts').setStyle('display', 'block'); 35 $('siteAlerts').setStyle('opacity',0); 36 $('siteAlerts').fade(1); 37 $('siteAlerts').innerHTML = "A valid name must be entered"; 23 38 return; 24 39 } 40 41 /*something went right!*/ 42 if( $('siteAlerts').getStyle('opacity') > 0 ){ 43 $('siteAlerts').fade(0); 44 } 45 //If a control or panel is in the map area, clear it out 46 emptyMapDrag(); 47 emptyMapControls(); 25 48 createBaseLayerConfig(); 26 49 /*When the save button is clicked when the layer is first added, add a list item to the layer list in toolbox1*/ sandbox/architect/scripts/mapConfig.js
r7561 r7709 1 1 /*When everything is loaded, attach events to elements*/ 2 var isMapNew = true; 3 2 4 window.addEvent('domready', function() { 3 5 /*control*/ … … 5 7 /*When the new control button is clicked, populate toolbox2. */ 6 8 //populate toolbox2 7 createBaseMapConfig(); 9 createBaseMapConfig(isMapNew); 10 if( $('siteAlerts').getStyle('opacity') > 0 ){ 11 $('siteAlerts').fade(0); 12 } 13 //If a control or panel is in the map area, clear it out 14 emptyMapDrag(); 15 emptyMapControls(); 8 16 $('saveButton').addEvent('click', function(e) { 9 17 e.stop(); … … 24 32 | populates configuration options 25 33 =========================*/ 26 function createBaseMapConfig( ){34 function createBaseMapConfig(isNew){ 27 35 /*store the toolbox div in tbid (toolboxid)*/ 28 36 var tbid = $('toolBox2Content'); … … 44 52 /*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*/ 45 53 //name, id 46 populateMap(tb1MapName.value );54 populateMap(tb1MapName.value, isNew); 47 55 } 48 56 … … 52 60 | populates the map with empty settings 53 61 =========================*/ 54 function populateMap(mName ){62 function populateMap(mName, isNew){ 55 63 $('tb2blcCommon').innerHTML += "Map Name: " + createInputTextBox('layoutMapConfigTitle','title', mName, 30); 56 64 $('tb2blcCommon').innerHTML += "<br /> Theme " + createSelectList('layoutMapConfigTheme', 'theme', '', getThemeMenu()); … … 65 73 $('tb2blcCommon').innerHTML +="<br/>Projection " + createInputTextBox('layoutMapConfigProjection','projection', '', 15); 66 74 67 $('tb2blcCommon').innerHTML += "<br/><br/><strong>Center</strong><br/> Lon" + createInputTextBox('layoutMapConfigLon','lon', '', 2) + " Lat" + createInputTextBox('layoutMapConfigLat','lat', '', 2) + "<br /> Zoom" + createInputTextBox('layoutMapConfigZoom','zoom', '', 2) + " Dragging" + createSelectList('layoutControlConfigDragging', 'dragging', '', get NullMenu());75 $('tb2blcCommon').innerHTML += "<br/><br/><strong>Center</strong><br/> Lon" + createInputTextBox('layoutMapConfigLon','lon', '', 2) + " Lat" + createInputTextBox('layoutMapConfigLat','lat', '', 2) + "<br /> Zoom" + createInputTextBox('layoutMapConfigZoom','zoom', '', 2) + " Dragging" + createSelectList('layoutControlConfigDragging', 'dragging', '', getFalseMenu()); 68 76 69 77 $('tb2blcCommon').innerHTML += "<br/><br/><strong>Extents</strong><br/><strong>Max Extent</strong><br/> MinX" + createInputTextBox('layoutMapConfigMaxExtenMinX','MaxExtentMinX', '', 2) + " MinY" + createInputTextBox('layoutMapConfigMaxExtentMinY','MaxExtentMinY', '', 2) + "<br/>MaxX" + createInputTextBox('layoutMapConfigMaxExtentMaxX','MaxExtentMaxX', '', 2) + " MaxY" + createInputTextBox('layoutMapConfigMaxExtentMaxY','MaxExtentMaxY', '', 2); … … 74 82 $('tb2blcCommon').innerHTML +="<br/><br/>Units " + createSelectList('layoutMapConfigUnits','units', "", getUnits()); 75 83 76 $('tb2blcCommon').innerHTML +="<br/><br/>Max Resolution " + createInputTextBox('layoutMapConfigMaxResolution','maxResolution', '', 2);77 $('tb2blcCommon').innerHTML +="<br/>Min Resolution " + createInputTextBox('layoutMapConfigMinResolution','minResolution', '', 2);84 $('tb2blcCommon').innerHTML +="<br/><br/>Max Resolution " + createInputTextBox('layoutMapConfigMaxResolution','maxResolution', '', 7); 85 $('tb2blcCommon').innerHTML +="<br/>Min Resolution " + createInputTextBox('layoutMapConfigMinResolution','minResolution', '', 7); 78 86 $('tb2blcCommon').innerHTML +="<br/>Resolutions " + createInputTextBox('layoutMapConfigResolutions','resolutions', '', 30); 79 87 … … 84 92 85 93 $('tb2blcCommon').innerHTML +="<br/><br/>Fall Through " + createSelectList('mapConfigFallthrough', 'fallThrough', '', getTrueMenu()); 94 $('tb2blcCommon').innerHTML +="<br/><br/>Fractional Zoom" + createSelectList('mapConfigFractionalZoom', 'fractionalZoom', '', getTrueMenu()); 95 96 populateMapValues(isNew); 86 97 } 87 98 … … 125 136 /*Highlist the layer in the layer list that was saved*/ 126 137 $('tb1NewMap').highlight('#567D8C', '#9D9483'); 127 } 138 139 isMapNew = false; 140 } 141 142 143 144 /*======================= 145 | populateControlValues(ID, controlName, isControlNew) 146 | 147 |used to fill in default values from OpenLayers.prototype or values stored in the map object, if the layer already exists 148 | 149 |ID is the id of the current layer - an integer 150 |controlName is the name of the layer service which coresponds with OpenLayers.Control.controlName.prototype 151 |isControlNew determines if the layer is a newly created one or already exists 152 =========================*/ 153 /*Warning:Confusion follows*/ 154 /*Because some values in OL are set as 'false' by default we check to see if the prototype != null*/ 155 function populateMapValues(isNew){ 156 /*by default, we assuse the isControlNew is "new"*/ 157 if(isNew == undefined || isNew == null) 158 isNew = true; 159 160 /*pull values from OpenLayers*/ 161 /*Loop through the common values*/ 162 // theme - var curDropDownVal = $('tb2ControlListDropdown').value; 163 for (var i = 0; i < $('tb2blcCommon').childNodes.length; i++){ 164 /*set a variable equal to the current node*/ 165 var tempNode = $('tb2blcCommon').childNodes[i]; 166 /*if the childnode has an ID, then it is an input which we will get a value from to put in the map object*/ 167 if (tempNode.type == "text"){ 168 //By default, set the value to nothing. If something exists, override the null value 169 tempNode.value = ''; 170 /*Get the map name value*/ 171 if(OpenLayers.Map.prototype[tempNode.name] != null){ 172 tempNode.value = OpenLayers.Map.prototype[tempNode.name]; 173 } 174 $(tempNode).erase('class'); //clear the ValueUpdated class - it won't think the value is updated 175 } 176 /* SELECT LIST*/ 177 else if(tempNode.type == "select-one" ){ 178 //By default, set the value to 0. Override the value is necessary 179 tempNode.selectedIndex = 0; 180 if(OpenLayers.Map.prototype[tempNode.name] != null){ 181 var olVal = OpenLayers.Map.prototype[tempNode.name]; 182 /*check for True / False lists*/ 183 if(tempNode.options[0].value == "True" || tempNode.options[0].value == ''){ 184 if( Boolean(tempNode.options[0].name) == olVal){ 185 tempNode.selectedIndex = 0; 186 } 187 if( Boolean(tempNode.options[1].name) == olVal){ 188 tempNode.selectedIndex = 1; 189 } 190 } 191 /*check for Jpg / Gif / Png, and other type of lists*/ 192 else{ 193 if(tempNode.options[0].value == olVal) 194 tempNode.selectedIndex = 0; 195 if(tempNode.options[1].value == olVal) 196 tempNode.selectedIndex = 1; 197 if(tempNode.options[2]){ 198 if(tempNode.options[2].value == olVal) 199 tempNode.selectedIndex = 2; 200 } 201 if(tempNode.options[3]){ 202 if(tempNode.options[3].value == olVal) 203 tempNode.selectedIndex = 3; 204 } 205 } 206 $(tempNode).erase('class'); //clear the ValueUpdated class - it won't think the value is updated 207 } 208 } 209 } 210 211 212 /*If the layer is not new, grab values from the map object*/ 213 if(isNew == false){ 214 /*Loop through the common values*/ 215 for (var i = 0; i < $('tb2blcCommon').childNodes.length; i++){ 216 /*set a variable equal to the current node*/ 217 var tempNode = $('tb2blcCommon').childNodes[i]; 218 /*if the childnode has an ID, then it is an input which we will get a value from to put in the map object*/ 219 if (tempNode.type == "text" || tempNode.type == "select-one" ){ 220 /*Get the map name value*/ 221 var mapLayerVal = map[tempNode.name]; 222 /*If there is valid data, fill in the current form*/ 223 if(mapLayerVal != undefined || mapLayerVal != null){ 224 tempNode.value = map[tempNode.name]; 225 } 226 else{ 227 //tempNode.value = ''; 228 if(tempNode.type == "select-one" ) 229 tempNode.selectedIndex = 0; 230 $(tempNode).erase('class'); //clear the class - it won't think the value is updated 231 } 232 } 233 } 234 } 235 236 //Set the selected panel in the toolbox2 equal to the selected panel in toolbox1 237 //$('tb2ControlListPanelDropdown').selectedIndex = $('tb1ControlListPanelDropdown').selectedIndex; 238 //pID = $('tb2ControlListPanelDropdown').options[$('tb2ControlListPanelDropdown').selectedIndex].id; 239 //createDragBox(ID, pID, controlName); 240 } sandbox/architect/scripts/panelConfig.js
r7697 r7709 41 41 /*If false is returned, then the validation in the function failed*/ 42 42 if($('tb1NewPanelForm').value == ''){ 43 alert("A name must be entered."); 43 $('siteAlerts').setStyle('display', 'block'); 44 $('siteAlerts').setStyle('opacity',0); 45 $('siteAlerts').fade(1); 46 $('siteAlerts').innerHTML = "A panel name must be entered"; 44 47 return; 48 } 49 if( $('siteAlerts').getStyle('opacity') > 0 ){ 50 $('siteAlerts').fade(0); 45 51 } 46 52 //populate toolbox2 sandbox/architect/style.css
r7698 r7709 463 463 #mapControls { 464 464 background-color:#8C8372; 465 left:370px; 466 margin-top:10px; 467 position:absolute; 468 top:510px; 469 width:630px; 470 } 471 #mapFunctions { 472 background-color:#8C8372; 465 473 border:1px solid #415e69; 466 474 left:370px; … … 483 491 width:250px; 484 492 } 493 /*======================= 494 | Draggable Boxes 495 =========================*/ 496 #draggableDivContainer { 497 background-color:#504B42; 498 height:80px; 499 left:0px; 500 /*overflow:hidden*/ 501 position:relative; 502 top:0px; 503 width:100px; 504 z-index:1; 505 } 506 507 #draggableDiv { 508 background:#628D9D; 509 border:1px solid #415E69; 510 cursor:move; 511 height:25px; 512 left:-2px; 513 position:absolute; 514 text-align:center; 515 top:-25px; 516 width:100%; 517 z-index:6; 518 } 519 520 #draggableDivResize { 521 background:#efefef url(images/resize.png); 522 bottom:0px; 523 cursor:se-resize; 524 height:15px; 525 position:absolute; 526 right:0px; 527 width:15px; 528 z-index:999; 529 } 530 #draggableDivTitle { 531 background:#567D8C; 532 font-size:.9em; 533 margin:0px auto; 534 left:20%; 535 padding:5px; 536 position:absolute; 537 text-align:center; 538 top:40%; 539 z-index:4; 540 } 541 .controlBox { 542 background-color:#567D8C; 543 font-size:.9em; 544 height:26px; 545 float:left; 546 width:26px; 547 } 485 548 /*======================= 486 549 | Bottom … … 497 560 | 498 561 --------------------------------------------------------------------*/ 499 /*=======================500 | Div Classes501 =========================*/502 #draggableDivContainer {503 background-color:#504B42;504 height:80px;505 left:0px;506 /*overflow:hidden*/507 position:relative;508 top:0px;509 width:100px;510 z-index:1;511 }512 513 #draggableDiv {514 background:#628D9D;515 border:1px solid #415E69;516 cursor:move;517 height:25px;518 left:-2px;519 position:absolute;520 text-align:center;521 top:-25px;522 width:100%;523 z-index:6;524 }525 526 #draggableDivResize {527 background:#efefef url(images/resize.png);528 bottom:0px;529 cursor:se-resize;530 height:15px;531 position:absolute;532 right:0px;533 width:15px;534 z-index:999;535 }536 #draggableDivTitle {537 background:#567D8C;538 margin:0px auto;539 left:20%;540 padding:5px;541 position:absolute;542 text-align:center;543 top:40%;544 z-index:4;545 }546 562 547 563 /*======================= … … 674 690 padding:5px; 675 691 } 676 .paddingtop5px {677 padding:5px;678 }679 692 .padding10px { 680 693 padding:10px;
