index.php
9.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?php
include_once(dirname(__FILE__)."/../../classesphp/pega_variaveis.php");
include_once(dirname(__FILE__)."/../../classesphp/class.palette.php");
$m = new palette();
$lista = implode(",",($m->listaColourRamps(dirname(__FILE__)."/../..")));
if(!isset($ncores))
{$ncores = 10;}
if(empty($locaplic)){
$locaplic = "../..";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript" src="<?php echo $locaplic;?>/classesjs/i3geo.js"></script>
<style>
body{
background-color:white;
padding:0;
}
#imagens {
border:1px solid #EBEBEB;
height:80px;
overflow:auto;
position:relative;
text-align:center;
width:250px;
left:8px;
}
#cores {
border:1px solid #EBEBEB;
height:80px;
overflow:auto;
position:relative;
text-align:center;
width:250px;
left:8px;
}
#imagens img{
width: 236px;
cursor:pointer;
left:10px;
height: 20px;
}
#demo_bg {
position: relative;
background: url(<?php echo $locaplic;?>/pacotes/yui290/build/slider/assets/dual_thumb_bg.gif) 0 5px no-repeat;
height: 28px;
width: 238px;
left: 8px;
}
#demo_bg div {
position: absolute;
cursor: default;
top: 4px;
}
/* Here's the highlight element */
#demo_bg span {
position: absolute;
background: url(<?php echo $locaplic;?>/pacotes/yui290/build/slider/assets/dual_thumb_highlight.gif) 0 0 repeat-x;
top: 10px;
left: 12px;
height: 13px;
width: 226px;
}
#demo_bg .caution {
background-position: 0 -13px;
}
#demo_bg .boom,
#demo_bg .danger {
background-position: 0 -26px;
}
/* We'll use the same class names for the status report region */
p .ok {
color: #3a3;
font-weight: bold;
text-transform: uppercase;
}
p .caution {
background: #ff3;
color: #770;
font-weight: bold;
font-style: italic;
padding: 0 1ex;
text-transform: uppercase;
}
p .danger {
color: #f33;
font-weight: bold;
text-decoration: blink;
text-transform: uppercase;
}
p .boom {
color: #fff;
background: #000;
padding: 0 1ex;
}
</style>
<title></title>
</head>
<body class=" yui-skin-sam" style="margin:0px;width:253px;" >
<p class=paragrafo style="position:relative;left:6px;width:100%;" >
Quantas cores você quer gerar? <input id=ncores type=text size=3 value=<?php echo $ncores; ?> /><br>
Clique para escolher o modelo de cores
</p>
<div id="imagens" ></div>
<div id="demo_bg" title="Range slider">
<span id="demo_highlight"></span>
<div id="demo_min_thumb"><img src="<?php echo $locaplic;?>/pacotes/yui290/build/slider/assets/l-thumb-round.gif"></div>
<div id="demo_max_thumb"><img src="<?php echo $locaplic;?>/pacotes/yui290/build/slider/assets/r-thumb-round.gif"></div>
</div>
<p style="text-align:center;width:250px"><span id="demo_range" >0-255</span></p>
<div id=cores ></div>
<p style="position:relative;left:6px;top:5px;text-align:left;" >
<input id=voltar size="22" type="button" value="Aplicar cores">
</p>
<div class="paragrafo" style="border:1px solid #EBEBEB;position:relative;top:0px;position:relative;left:6px;width:250px;height:80px;overflow:auto;" >
<b>Para atualizar a lista de cores geradas, clique novamente sobre a barra de cor.</b> Você pode também definir os limites inicial e final (use a barra deslizante) e alterar os valores obtidos editando diretamente o RGB
</div>
<script>
new YAHOO.widget.Button(
"voltar",
{onclick:{fn: function(){aplicarCores();}}}
);
$i("voltar-button").style.width = "250px"
var lista = "<?php echo $lista;?>";
lista = lista.split(",");
var n = lista.length;
var ins = "";
for(var i=0; i<n; i++){
ins += "<img title='"+lista[i]+" 'onclick='geracores(\""+lista[i]+"\")' src='<?php echo $locaplic;?>/symbols/colourramp/"+lista[i]+".gif' />";
}
$i("imagens").innerHTML = ins;
function geracores(codigo){
var onde = $i("cores");
if(onde.innerHTML == "Aguarde...")
{return;}
onde.innerHTML = "Aguarde..."
var temp = function(retorno){
onde.innerHTML = "";
var ins = "<table class=lista6 >",
n = retorno.data.length,
i,
cor;
for(i in retorno.data){
try{
if(retorno.data[i].r != undefined){
cor = retorno.data[i].r+","+retorno.data[i].g+","+retorno.data[i].b;
ins += "<tr><td style='width:10px'><img src='<?php echo $locaplic;?>/imagens/x.png' style='cursor:pointer;' title='excluir' onclick='javascript:$i(\"cor_"+cor+"\").style.display=\"none\";this.style.display=\"none\"' </td><td style='width:100%' ><p id='cor_"+cor+"' style='width:100%;heigth:10px;background-color:rgb("+cor+")'><input onchange='javascript:$i(\"cor_"+cor+"\").style.backgroundColor=this.value;' type=text size=17 value=\"rgb("+cor+")\"/></p></td></tr>";
}
}catch(e){}
}
onde.innerHTML = ins+"</table>";
};
var nobj = $i("ncores");
if(nobj.value > 255)
{nobj.value = 255;}
if(nobj.value > (slider.maxVal - slider.minVal))
{nobj.value = slider.maxVal - slider.minVal;}
var ncores = nobj.value;
var p = "<?php echo $locaplic;?>/classesphp/mapa_controle.php?funcao=geraCoresColourRamp&map_file=&g_sid=&codigo="+codigo+"&inicio="+slider.minVal+"&fim="+slider.maxVal+"&ncores="+ncores;
cpJSON.call(p,"foo",temp);
}
//
//utilize tipo para definir o tipo de cor de retorno
//
function aplicarCores()
{
navm = false; // IE
navn = false; // netscape
var app = navigator.appName.substring(0,1);
if (app=='N') navn=true; else navm=true;
try{
var doc = "<?php echo $doc; ?>";
if(doc != "")
{var doc = (navm) ? window.parent.frames(doc).document : window.parent.document.getElementById(doc).contentDocument;}
else
{var doc = window.parent.document;}
}
catch(e){var doc = window.parent.document;}
var elemento = "<?php echo $elemento; ?>";
var inputs = $i("cores").getElementsByTagName("input");
var n = inputs.length;
var i;
var listaRGB = [];
for(i=0;i<n;i++){
if(inputs[i].parentNode.style.display !== "none")
{listaRGB.push(inputs[i].value);}
}
doc.getElementById(elemento).value = listaRGB.join(";");
try{
doc.getElementById(elemento).onchange.call();
}
catch(e){}
window.parent.YAHOO.i3GEO.janela.manager.find("i3geo_janelaCorRamp").destroy();
}
(function () {
YAHOO.namespace('example');
var Dom = YAHOO.util.Dom;
// Slider has a range of 300 pixels
var range = 235;
// Set up 12 pixel ticks
var tickSize = 1;
// Some arbitrary ranges to cue status changes
var caution_range = 10,
danger_range = 5,
boom_range = 0;
YAHOO.util.Event.onDOMReady(function () {
var reportSpan = Dom.get("demo_range");
var calculatedSpan = Dom.get("demo_value");
// Create the DualSlider
slider = YAHOO.widget.Slider.getHorizDualSlider("demo_bg",
"demo_min_thumb", "demo_max_thumb",
range, tickSize);
// Decorate the DualSlider instance with some new properties and
// methods to maintain the highlight element
YAHOO.lang.augmentObject(slider, {
// The current status
_status : 'ok',
// The highlight element
_highlight : Dom.get("demo_highlight"),
// A simple getter method for the status
getStatus : function () { return this._status; },
// A method to update the status and update the highlight
updateHighlight : function () {
var delta = this.maxVal - this.minVal,
newStatus = 'ok';
if (delta < boom_range) {
newStatus = 'boom';
} else if (delta < danger_range) {
newStatus = 'danger';
} else if (delta < caution_range) {
newStatus = 'caution';
}
if (this._status !== newStatus) {
// Update the highlight class if status is changed
Dom.replaceClass(this._highlight,this._status,newStatus);
this._status = newStatus;
}
if (this.activeSlider === this.minSlider) {
// If the min thumb moved, move the highlight's left edge
Dom.setStyle(this._highlight,'left', (this.minVal + 12) + 'px');
}
// Adjust the width of the highlight to match inner boundary
Dom.setStyle(this._highlight,'width', Math.max(delta - 12,0) + 'px');
}
},true);
// Attach the highlight method to the slider's change event
slider.subscribe('change',slider.updateHighlight,slider,true);
// Create an event callback to update some display fields
var report = function () {
reportSpan.innerHTML = slider.minVal + ' - ' + slider.maxVal;
// Call our conversion function
calculatedSpan.innerHTML =
calculatedSpan.className = slider.getStatus();
};
// Subscribe to the slider's change event to report the status.
slider.subscribe('change',report);
// Attach the slider to the YAHOO.example namespace for public probing
YAHOO.example.slider = slider;
});
})();
</script>
</body>
</html>