Rev 432 | Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
53 | jmachado | 1 | /** |
163 | jmachado | 2 | * |
3 | * AJAX Functions |
||
4 | * |
||
5 | * This code is protected under GNU LGPL License |
||
6 | * |
||
7 | * @author Jorge Machado |
||
8 | * @date April 2008 |
||
9 | **/ |
||
1 | fvelez | 10 | |
53 | jmachado | 11 | /** |
12 | * Starts XMLHTTP Ajax request |
||
13 | * |
||
14 | * @author Jorge Machado |
||
15 | * @date April 2008 |
||
16 | * |
||
17 | * params: |
||
18 | * @params HTTP GET Parameters for query string |
||
19 | * @xmlHttpRequest request |
||
20 | * @id target element |
||
21 | * @stateChanged target function |
||
22 | * @innerPhrase to put while waiting for response |
||
23 | * @navjsp requested jsp |
||
24 | */ |
||
25 | function startRequest(xmlHttpRequest,params,id,stateChanged,innerPhrase,navjsp) |
||
26 | { |
||
165 | jmachado | 27 | var contentType = "application/x-www-form-urlencoded; charset=UTF-8"; |
53 | jmachado | 28 | if(innerPhrase != '') |
29 | getObjectById(id).innerHTML = innerPhrase; |
||
30 | if (xmlHttpRequest==null) |
||
31 | { |
||
32 | alert ("Browser does not support HTTP Request"); |
||
33 | return; |
||
34 | } |
||
165 | jmachado | 35 | var finalParams = ""; |
430 | jmachado | 36 | var url = location.href.substring(0,location.href.indexOf('/',location.href.indexOf("://")+3)) + navjsp; |
53 | jmachado | 37 | if(params != null && params.length > 0) |
38 | { |
||
165 | jmachado | 39 | //url=url+"?"+ params; |
40 | //url=url+"&sid="+Math.random(); |
||
41 | url=url+"?sid="+Math.random(); |
||
42 | var paramsArray = params.split("&"); |
||
43 | var i; |
||
44 | var union = ''; |
||
430 | jmachado | 45 | for(i = 0; i < paramsArray.length; i++) |
46 | { |
||
165 | jmachado | 47 | var parameter = paramsArray[i].split("="); |
48 | if(parameter.length == 2) |
||
49 | { |
||
50 | finalParams += union + parameter[0] + '=' + encodeURIComponent(parameter[1]); |
||
51 | union = '&'; |
||
52 | } |
||
53 | } |
||
53 | jmachado | 54 | } |
55 | else |
||
56 | { |
||
57 | url=url+"?sid="+Math.random(); |
||
58 | } |
||
165 | jmachado | 59 | |
53 | jmachado | 60 | xmlHttpRequest.onreadystatechange=stateChanged; |
165 | jmachado | 61 | xmlHttpRequest.open("POST",url,true); |
62 | xmlHttpRequest.setRequestHeader("Content-Type", contentType); |
||
63 | xmlHttpRequest.send(finalParams); |
||
53 | jmachado | 64 | } |
1 | fvelez | 65 | |
53 | jmachado | 66 | /** |
67 | * Return an HTML element given ID |
||
68 | * |
||
69 | * @author Jorge Machado |
||
70 | * @date April 2008 |
||
71 | * |
||
72 | * params: |
||
73 | * @objectId required object |
||
74 | */ |
||
75 | function getObjectById(objectId) |
||
76 | { |
||
77 | // cross-browser function to get an object's style object given its id |
||
78 | try |
||
79 | { |
||
80 | if(document.getElementById && document.getElementById(objectId)) |
||
1 | fvelez | 81 | { |
82 | // W3C DOM |
||
53 | jmachado | 83 | return document.getElementById(objectId); |
84 | } |
||
85 | else if (document.all(objectId)) |
||
86 | { |
||
1 | fvelez | 87 | // MSIE 4 DOM |
53 | jmachado | 88 | return document.all(objectId); |
89 | } |
||
90 | else if (document.layers && document.layers[objectId]) |
||
91 | { |
||
1 | fvelez | 92 | // NN 4 DOM.. note: this won't find nested layers |
53 | jmachado | 93 | return document.layers[objectId]; |
1 | fvelez | 94 | } |
53 | jmachado | 95 | else |
1 | fvelez | 96 | { |
97 | return false; |
||
98 | } |
||
53 | jmachado | 99 | } |
100 | catch(e) |
||
101 | { |
||
102 | return false; |
||
103 | } |
||
1 | fvelez | 104 | } |
105 | |||
406 | jmachado | 106 | |
107 | function getObjectByStartId(objectId) |
||
108 | { |
||
109 | // cross-browser function to get an object's style object given its id |
||
110 | try |
||
111 | { |
||
112 | for(var element in document.elements) |
||
113 | { |
||
114 | alert(element.value); |
||
115 | } |
||
116 | // if(document.getElementById && document.getElementById(objectId)) |
||
117 | // { |
||
118 | // // W3C DOM |
||
119 | // return document.getElementById(objectId); |
||
120 | // } |
||
121 | // else if (document.all(objectId)) |
||
122 | // { |
||
123 | // // MSIE 4 DOM |
||
124 | // return document.all(objectId); |
||
125 | // } |
||
126 | // else if (document.layers && document.layers[objectId]) |
||
127 | // { |
||
128 | // // NN 4 DOM.. note: this won't find nested layers |
||
129 | // return document.layers[objectId]; |
||
130 | // } |
||
131 | // else |
||
132 | // { |
||
133 | // return false; |
||
134 | // } |
||
135 | } |
||
136 | catch(e) |
||
137 | { |
||
138 | return false; |
||
139 | } |
||
140 | } |
||
141 | |||
92 | jmachado | 142 | function hide(id,showId) |
143 | { |
||
223 | jmachado | 144 | hideOne(id); |
145 | showOne(showId); |
||
92 | jmachado | 146 | } |
147 | function show(id,hideId) |
||
148 | { |
||
223 | jmachado | 149 | hideOne(hideId); |
150 | showOne(id); |
||
92 | jmachado | 151 | } |
223 | jmachado | 152 | |
153 | function hideOne(id) |
||
159 | jmachado | 154 | { |
223 | jmachado | 155 | // getObjectById(id).style.visibility='hidden'; |
156 | // getObjectById(id).style.position='absolute'; |
||
157 | getObjectById(id).style.display='none'; |
||
159 | jmachado | 158 | } |
223 | jmachado | 159 | |
160 | function showOne(id) |
||
159 | jmachado | 161 | { |
223 | jmachado | 162 | // getObjectById(id).style.visibility='visible'; |
163 | // getObjectById(id).style.position='relative'; |
||
164 | getObjectById(id).style.display=''; |
||
165 | } |
||
166 | function showOrHideOne(id) |
||
167 | { |
||
168 | if(getObjectById(id).style.display == 'none') |
||
169 | showOne(id); |
||
159 | jmachado | 170 | else |
223 | jmachado | 171 | hideOne(id); |
159 | jmachado | 172 | } |
163 | jmachado | 173 | |
406 | jmachado | 174 | function showOrHideOneWithStartId(id) |
175 | { |
||
176 | for(var i = 1; getObjectById(id + i) != '' && getObjectById(id + i) != null && getObjectById(id + i) != 'undefined'; i++) |
||
177 | { |
||
178 | showOrHideOne(id + i); |
||
179 | } |
||
180 | } |
||
181 | |||
163 | jmachado | 182 | function showOrHide(id,hideValue,showValue) |
183 | { |
||
223 | jmachado | 184 | if(getObjectById(id).style.display == 'none') |
163 | jmachado | 185 | { |
223 | jmachado | 186 | showOne(id); |
163 | jmachado | 187 | return showValue; |
188 | } |
||
189 | else |
||
190 | { |
||
223 | jmachado | 191 | hideOne(id); |
163 | jmachado | 192 | return hideValue; |
193 | } |
||
194 | } |
||
92 | jmachado | 195 | |
1 | fvelez | 196 | /** |
53 | jmachado | 197 | * Creates a new XmlHttpObject |
198 | * @author Jorge Machado |
||
199 | * @date April 2008 |
||
1 | fvelez | 200 | * |
53 | jmachado | 201 | * params: |
202 | * @handler target xmlHttpObject function |
||
1 | fvelez | 203 | */ |
53 | jmachado | 204 | function GetXmlHttpObject(handler) |
1 | fvelez | 205 | { |
53 | jmachado | 206 | var objXmlHttp = null; |
207 | if (navigator.userAgent.indexOf("Opera")>=0) |
||
208 | { |
||
209 | alert("This example doesn't work in Opera") ; |
||
210 | return objXmlHttp; |
||
211 | } |
||
212 | if (navigator.userAgent.indexOf("MSIE")>=0) |
||
213 | { |
||
214 | var strName="Msxml2.XMLHTTP"; |
||
215 | if (navigator.appVersion.indexOf("MSIE 5.5")>=0) |
||
1 | fvelez | 216 | { |
53 | jmachado | 217 | strName="Microsoft.XMLHTTP"; |
1 | fvelez | 218 | } |
53 | jmachado | 219 | try |
220 | { |
||
221 | objXmlHttp=new ActiveXObject(strName); |
||
222 | objXmlHttp.onreadystatechange=handler ; |
||
223 | return objXmlHttp; |
||
224 | } |
||
225 | catch(e) |
||
226 | { |
||
227 | alert("Error. Scripting for ActiveX might be disabled") ; |
||
228 | return objXmlHttp; |
||
229 | } |
||
230 | } |
||
231 | if (navigator.userAgent.indexOf("Mozilla")>=0) |
||
232 | { |
||
233 | objXmlHttp=new XMLHttpRequest(); |
||
234 | objXmlHttp.onload=handler; |
||
235 | objXmlHttp.onerror=handler; |
||
236 | return objXmlHttp; |
||
237 | } |
||
1 | fvelez | 238 | } |
239 | |||
53 | jmachado | 240 | /*************************************************** |
241 | TopFlashNews |
||
163 | jmachado | 242 | ***************************************************/ |
53 | jmachado | 243 | var xmlHttpTopFlashNews; |
244 | var getFlashNewsTimeout; |
||
245 | var getFlashNewsJsp; |
||
381 | jmachado | 246 | var semaphoreFlashNews = 0; |
1 | fvelez | 247 | |
53 | jmachado | 248 | function getFlashNews(jsp,timeout) |
48 | fvelez | 249 | { |
53 | jmachado | 250 | getFlashNewsJsp = jsp; |
251 | getFlashNewsTimeout = timeout; |
||
381 | jmachado | 252 | semaphoreFlashNews = 1; |
53 | jmachado | 253 | getFlashNewsTimeoutCall(); |
48 | fvelez | 254 | } |
53 | jmachado | 255 | function getFlashNewsTimeoutCall() |
48 | fvelez | 256 | { |
53 | jmachado | 257 | xmlHttpTopFlashNews=GetXmlHttpObject(stateChangedGetFlashNews); |
381 | jmachado | 258 | semaphoreFlashNews = 1; |
53 | jmachado | 259 | startRequest(xmlHttpTopFlashNews,"","flashTopNews",stateChangedGetFlashNews,"",getFlashNewsJsp) |
48 | fvelez | 260 | } |
261 | function stateChangedGetFlashNews() |
||
262 | { |
||
381 | jmachado | 263 | if (semaphoreFlashNews == 1 && (xmlHttpTopFlashNews.readyState==4 || xmlHttpTopFlashNews.readyState=="complete")) |
53 | jmachado | 264 | { |
265 | getObjectById("flashTopNews").innerHTML=xmlHttpTopFlashNews.responseText; |
||
266 | setTimeout(getFlashNewsTimeoutCall,getFlashNewsTimeout); |
||
381 | jmachado | 267 | semaphoreFlashNews = 0; |
53 | jmachado | 268 | } |
48 | fvelez | 269 | } |
1 | fvelez | 270 | |
271 | |||
92 | jmachado | 272 | /*************************************************** |
273 | Search |
||
163 | jmachado | 274 | ***************************************************/ |
92 | jmachado | 275 | var xmlHttpSearch; |
276 | var searchResultsDiv; |
||
1 | fvelez | 277 | |
92 | jmachado | 278 | function searchCall(div,query,searchType,page,module,action) |
279 | { |
||
280 | searchResultsDiv = div; |
||
281 | xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall); |
||
282 | startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module,"",stateChangedSearchCall,"",action); |
||
283 | } |
||
457 | jmachado | 284 | |
285 | function searchCall(div,query,searchType,page,module,moduleInternalKey,action) |
||
286 | { |
||
287 | searchResultsDiv = div; |
||
288 | xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall); |
||
289 | startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module + "&moduleInternalKey=" + moduleInternalKey,"",stateChangedSearchCall,"",action); |
||
290 | } |
||
92 | jmachado | 291 | function stateChangedSearchCall() |
292 | { |
||
293 | if (xmlHttpSearch.readyState==4 || xmlHttpSearch.readyState=="complete") |
||
294 | { |
||
295 | getObjectById(searchResultsDiv).innerHTML=xmlHttpSearch.responseText; |
||
296 | } |
||
297 | } |
||
1 | fvelez | 298 | |
299 | |||
159 | jmachado | 300 | /*************************************************** |
301 | Pop |
||
163 | jmachado | 302 | ***************************************************/ |
159 | jmachado | 303 | var xmlHttpPop; |
304 | var popDiv; |
||
1 | fvelez | 305 | |
159 | jmachado | 306 | function loadPop(div,action) |
307 | { |
||
308 | popDiv = div; |
||
309 | xmlHttpPop=GetXmlHttpObject(stateChangedPopCall); |
||
310 | startRequest(xmlHttpPop,"","",stateChangedPopCall,"",action); |
||
311 | } |
||
312 | function stateChangedPopCall() |
||
313 | { |
||
314 | if (xmlHttpPop.readyState==4 || xmlHttpPop.readyState=="complete") |
||
315 | { |
||
316 | getObjectById(popDiv).innerHTML=xmlHttpPop.responseText; |
||
317 | } |
||
318 | } |
||
1 | fvelez | 319 | |
163 | jmachado | 320 | /*************************************************** |
321 | Reminders |
||
322 | ***************************************************/ |
||
198 | jmachado | 323 | |
324 | var activeRemindersCounter = 0; |
||
325 | var expiredRemindersCounter = 0; |
||
381 | jmachado | 326 | var semaphoreReminder = 0; |
198 | jmachado | 327 | |
328 | function setActiveReminders(active) |
||
329 | { |
||
330 | activeRemindersCounter = active; |
||
331 | } |
||
332 | function setExpiredReminders(expired) |
||
333 | { |
||
334 | expiredRemindersCounter = expired; |
||
335 | } |
||
336 | |||
163 | jmachado | 337 | var xmlHttpReminder; |
338 | var newReminderId; |
||
339 | var reminderFormId; |
||
340 | var putMsgId; |
||
341 | var putOkMsg; |
||
342 | var putFailMsg; |
||
1 | fvelez | 343 | |
163 | jmachado | 344 | function putReminder(startDate,expireDate,text,newReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg) |
345 | { |
||
381 | jmachado | 346 | if(semaphoreReminder == 1) |
347 | { |
||
348 | getObjectById(putMsgId).innerHTML = "<div class=\"messages\">busy...</div>"; |
||
349 | } |
||
350 | else |
||
351 | { |
||
352 | semaphoreReminder = 1; |
||
353 | newReminderId = newReminderDiv; |
||
354 | reminderFormId = reminderFormDiv; |
||
355 | putMsgId = msgDiv; |
||
356 | putOkMsg = okMsg; |
||
357 | putFailMsg = failMsg; |
||
358 | getObjectById(putMsgId).innerHTML = waitMsg; |
||
359 | xmlHttpReminder=GetXmlHttpObject(stateChangedPutReminderCall); |
||
360 | startRequest(xmlHttpReminder,"dispatch=save&startDate="+startDate+"&expireDate="+expireDate+"&reminderView.text="+ text,"",stateChangedPutReminderCall,"",action); |
||
223 | jmachado | 361 | // hideOne(reminderFormId); |
381 | jmachado | 362 | showOne(putMsgId); |
363 | } |
||
163 | jmachado | 364 | } |
365 | function stateChangedPutReminderCall() |
||
366 | { |
||
367 | if (xmlHttpReminder.readyState==4 || xmlHttpReminder.readyState=="complete") |
||
368 | { |
||
369 | if(xmlHttpReminder.responseText.indexOf("<div class=\"messages\">") >= 0) |
||
370 | { |
||
371 | getObjectById(putMsgId).innerHTML = xmlHttpReminder.responseText; |
||
372 | } |
||
381 | jmachado | 373 | else if(semaphoreReminder == 1) |
163 | jmachado | 374 | { |
381 | jmachado | 375 | semaphoreReminder = 0; |
163 | jmachado | 376 | getObjectById(putMsgId).innerHTML = '<div class="statusOK">' + putOkMsg + '</div>'; |
223 | jmachado | 377 | activeRemindersCounter = activeRemindersCounter + 1; |
378 | showOne('activeReminders'); |
||
163 | jmachado | 379 | getObjectById(newReminderId).innerHTML = xmlHttpReminder.responseText + getObjectById(newReminderId).innerHTML; |
380 | } |
||
381 | } |
||
165 | jmachado | 382 | setTimeout(cleanReminderStatus,3000); |
163 | jmachado | 383 | } |
384 | function cleanReminderStatus() |
||
385 | { |
||
386 | getObjectById(putMsgId).innerHTML = ''; |
||
387 | } |
||
1 | fvelez | 388 | |
198 | jmachado | 389 | function deleteExpiredReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg) |
165 | jmachado | 390 | { |
198 | jmachado | 391 | deleteReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg,stateChangedDeleteExpiredReminderCall); |
392 | } |
||
393 | function deleteActiveReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg) |
||
394 | { |
||
395 | deleteReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg,stateChangedDeleteActiveReminderCall); |
||
396 | } |
||
397 | function deleteReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg,callBack) |
||
398 | { |
||
165 | jmachado | 399 | newReminderId = deleteReminderDiv; |
400 | reminderFormId = reminderFormDiv; |
||
401 | putMsgId = msgDiv; |
||
402 | putOkMsg = okMsg; |
||
403 | putFailMsg = failMsg; |
||
404 | getObjectById(putMsgId).innerHTML = waitMsg; |
||
198 | jmachado | 405 | xmlHttpReminder=GetXmlHttpObject(callBack); |
406 | startRequest(xmlHttpReminder,"dispatch=delete&id="+id,"",callBack,"",action); |
||
223 | jmachado | 407 | //hideOne(reminderFormId); |
408 | showOne(putMsgId); |
||
165 | jmachado | 409 | } |
1 | fvelez | 410 | |
198 | jmachado | 411 | function stateChangedDeleteExpiredReminderCall() |
412 | { |
||
223 | jmachado | 413 | |
414 | stateChangedDeleteReminderCall("expired"); |
||
198 | jmachado | 415 | if(expiredRemindersCounter <= 0) |
416 | { |
||
223 | jmachado | 417 | hideOne('expiredReminders'); |
198 | jmachado | 418 | } |
419 | if(expiredRemindersCounter < 0) |
||
420 | expiredRemindersCounter = 0; |
||
421 | } |
||
422 | function stateChangedDeleteActiveReminderCall() |
||
423 | { |
||
223 | jmachado | 424 | stateChangedDeleteReminderCall("active"); |
198 | jmachado | 425 | |
426 | if(activeRemindersCounter <= 0) |
||
427 | { |
||
223 | jmachado | 428 | hideOne('activeReminders'); |
198 | jmachado | 429 | } |
430 | if(activeRemindersCounter < 0) |
||
431 | activeRemindersCounter = 0; |
||
432 | } |
||
223 | jmachado | 433 | function stateChangedDeleteReminderCall(type) |
165 | jmachado | 434 | { |
435 | if (xmlHttpReminder.readyState==4 || xmlHttpReminder.readyState=="complete") |
||
436 | { |
||
223 | jmachado | 437 | if(type == "active") |
438 | activeRemindersCounter--; |
||
439 | else |
||
440 | expiredRemindersCounter--; |
||
441 | |||
165 | jmachado | 442 | if(xmlHttpReminder.responseText.indexOf("<div class=\"messages\">") >= 0) |
443 | { |
||
444 | getObjectById(putMsgId).innerHTML = xmlHttpReminder.responseText; |
||
445 | } |
||
446 | else |
||
447 | { |
||
448 | getObjectById(putMsgId).innerHTML = '<div class="statusOK">' + putOkMsg + '</div>'; |
||
449 | getObjectById(newReminderId).innerHTML = ''; |
||
450 | } |
||
451 | } |
||
452 | setTimeout(cleanReminderStatus,3000); |
||
453 | } |
||
1 | fvelez | 454 | |
48 | fvelez | 455 | |
430 | jmachado | 456 | /****************************** |
457 | * Cotas de Impressao |
||
458 | ******************************/ |
||
459 | var quotasDiv; |
||
460 | var xmlHttpQuotas; |
||
461 | var quotasErrorMsg; |
||
462 | var impressorasMsg; |
||
463 | var quotasDisponiveisMsg; |
||
464 | var donaldPretoMsg; |
||
465 | var billCorMsg; |
||
48 | fvelez | 466 | |
430 | jmachado | 467 | function loadQuotas(div,action,_quotasErrorMsg, _impressorasMsg, _quotasDisponiveisMsg, _donaldPretoMsg, _billCorMsg) |
468 | { |
||
48 | fvelez | 469 | |
430 | jmachado | 470 | quotasDiv = div; |
471 | quotasErrorMsg = _quotasErrorMsg; |
||
472 | impressorasMsg = _impressorasMsg; |
||
473 | quotasDisponiveisMsg = _quotasDisponiveisMsg; |
||
474 | donaldPretoMsg = _donaldPretoMsg; |
||
475 | billCorMsg = _billCorMsg; |
||
476 | if(!xmlHttpQuotas) |
||
477 | xmlHttpQuotas = GetXmlHttpObject(stateChangedLoadQuotasCall); |
||
478 | startRequest(xmlHttpQuotas,"","",stateChangedLoadQuotasCall,"",action); |
||
479 | } |
||
480 | function stateChangedLoadQuotasCall() |
||
481 | { |
||
482 | if (xmlHttpQuotas.readyState==4 || xmlHttpQuotas.readyState=="complete") |
||
483 | { |
||
484 | putQuotasImpressao(xmlHttpQuotas.responseXML); |
||
485 | } |
||
486 | } |
||
48 | fvelez | 487 | |
430 | jmachado | 488 | function putQuotasImpressao(xmlData) |
489 | { |
||
490 | if(xmlData == null) |
||
491 | { |
||
492 | getObjectById(quotasDiv).innerHTML=quotasErrorMsg; |
||
493 | } |
||
494 | else |
||
495 | { |
||
496 | var pretoTr = xmlData.getElementsByTagName('preto')[0].getElementsByTagName("tr")[0]; |
||
497 | var corTr = xmlData.getElementsByTagName('cor')[0].getElementsByTagName("tr")[0]; |
||
498 | if(pretoTr == null || corTr == null) |
||
499 | { |
||
500 | getObjectById(quotasDiv).innerHTML=quotasErrorMsg; |
||
501 | } |
||
502 | else |
||
503 | { |
||
431 | jmachado | 504 | var copiasImpressasPreto = pretoTr.getElementsByTagName('td')[1].getElementsByTagName('font')[0].firstChild.nodeValue; |
505 | var copiasDisponiveisPreto = pretoTr.getElementsByTagName('td')[2].getElementsByTagName('font')[0].firstChild.nodeValue; |
||
506 | var copiasImpressasCor = corTr.getElementsByTagName('td')[1].getElementsByTagName('font')[0].firstChild.nodeValue; |
||
507 | var copiasDisponiveisCor = corTr.getElementsByTagName('td')[2].getElementsByTagName('font')[0].firstChild.nodeValue; |
||
430 | jmachado | 508 | var response = ""; |
509 | response += "<table class=\"dataTable\">\n"; |
||
510 | response += " <tr>\n"; |
||
511 | response += " <th>" + impressorasMsg + "</th>\n"; |
||
512 | response += " <th>" + quotasDisponiveisMsg + "</th>\n"; |
||
513 | response += " </tr>\n"; |
||
514 | response += " <tr>\n"; |
||
515 | response += " <th>" + donaldPretoMsg + "</th>\n"; |
||
516 | if(copiasDisponiveisPreto == '0') |
||
517 | response += "<td align=\"right\" style=\"color:red\">"+ copiasDisponiveisPreto +"</td>\n" |
||
518 | else |
||
519 | response += "<td align=\"right\" style=\"color:green\">"+ copiasDisponiveisPreto +"</td>\n" |
||
520 | response += " </tr>\n"; |
||
521 | response += " <tr>\n"; |
||
522 | response += " <th>" + billCorMsg + "</th>\n"; |
||
523 | if(copiasDisponiveisCor == '0') |
||
524 | response += "<td align=\"right\" style=\"color:red\">"+ copiasDisponiveisCor +"</td>\n" |
||
525 | else |
||
526 | response += "<td align=\"right\" style=\"color:green\">"+ copiasDisponiveisCor +"</td>\n" |
||
527 | response += " </tr>\n"; |
||
92 | jmachado | 528 | |
430 | jmachado | 529 | response += "</table>\n"; |
530 | getObjectById(quotasDiv).innerHTML=response; |
||
531 | } |
||
532 | } |
||
533 | } |
||
92 | jmachado | 534 | |
535 | |||
159 | jmachado | 536 | |
537 | |||
538 | |||
163 | jmachado | 539 | |
540 | |||
541 | |||
165 | jmachado | 542 | |
543 | |||
544 | |||
430 | jmachado | 545 | |
546 | |||
547 | |||
548 |