Rev 1306 | 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 | { |
||
485 | jmachado | 209 | objXmlHttp=new XMLHttpRequest(); |
210 | objXmlHttp.onload=handler; |
||
211 | objXmlHttp.onerror=handler; |
||
53 | jmachado | 212 | return objXmlHttp; |
213 | } |
||
214 | if (navigator.userAgent.indexOf("MSIE")>=0) |
||
215 | { |
||
216 | var strName="Msxml2.XMLHTTP"; |
||
217 | if (navigator.appVersion.indexOf("MSIE 5.5")>=0) |
||
1 | fvelez | 218 | { |
53 | jmachado | 219 | strName="Microsoft.XMLHTTP"; |
1 | fvelez | 220 | } |
53 | jmachado | 221 | try |
222 | { |
||
223 | objXmlHttp=new ActiveXObject(strName); |
||
224 | objXmlHttp.onreadystatechange=handler ; |
||
225 | return objXmlHttp; |
||
226 | } |
||
227 | catch(e) |
||
228 | { |
||
229 | alert("Error. Scripting for ActiveX might be disabled") ; |
||
230 | return objXmlHttp; |
||
231 | } |
||
232 | } |
||
233 | if (navigator.userAgent.indexOf("Mozilla")>=0) |
||
234 | { |
||
235 | objXmlHttp=new XMLHttpRequest(); |
||
236 | objXmlHttp.onload=handler; |
||
237 | objXmlHttp.onerror=handler; |
||
238 | return objXmlHttp; |
||
239 | } |
||
1 | fvelez | 240 | } |
241 | |||
53 | jmachado | 242 | /*************************************************** |
243 | TopFlashNews |
||
163 | jmachado | 244 | ***************************************************/ |
53 | jmachado | 245 | var xmlHttpTopFlashNews; |
246 | var getFlashNewsTimeout; |
||
247 | var getFlashNewsJsp; |
||
381 | jmachado | 248 | var semaphoreFlashNews = 0; |
1 | fvelez | 249 | |
53 | jmachado | 250 | function getFlashNews(jsp,timeout) |
48 | fvelez | 251 | { |
53 | jmachado | 252 | getFlashNewsJsp = jsp; |
253 | getFlashNewsTimeout = timeout; |
||
381 | jmachado | 254 | semaphoreFlashNews = 1; |
53 | jmachado | 255 | getFlashNewsTimeoutCall(); |
48 | fvelez | 256 | } |
53 | jmachado | 257 | function getFlashNewsTimeoutCall() |
48 | fvelez | 258 | { |
53 | jmachado | 259 | xmlHttpTopFlashNews=GetXmlHttpObject(stateChangedGetFlashNews); |
381 | jmachado | 260 | semaphoreFlashNews = 1; |
53 | jmachado | 261 | startRequest(xmlHttpTopFlashNews,"","flashTopNews",stateChangedGetFlashNews,"",getFlashNewsJsp) |
48 | fvelez | 262 | } |
263 | function stateChangedGetFlashNews() |
||
264 | { |
||
381 | jmachado | 265 | if (semaphoreFlashNews == 1 && (xmlHttpTopFlashNews.readyState==4 || xmlHttpTopFlashNews.readyState=="complete")) |
53 | jmachado | 266 | { |
267 | getObjectById("flashTopNews").innerHTML=xmlHttpTopFlashNews.responseText; |
||
268 | setTimeout(getFlashNewsTimeoutCall,getFlashNewsTimeout); |
||
381 | jmachado | 269 | semaphoreFlashNews = 0; |
53 | jmachado | 270 | } |
48 | fvelez | 271 | } |
1 | fvelez | 272 | |
273 | |||
92 | jmachado | 274 | /*************************************************** |
275 | Search |
||
163 | jmachado | 276 | ***************************************************/ |
92 | jmachado | 277 | var xmlHttpSearch; |
278 | var searchResultsDiv; |
||
1 | fvelez | 279 | |
92 | jmachado | 280 | function searchCall(div,query,searchType,page,module,action) |
281 | { |
||
282 | searchResultsDiv = div; |
||
283 | xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall); |
||
284 | startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module,"",stateChangedSearchCall,"",action); |
||
285 | } |
||
457 | jmachado | 286 | |
287 | function searchCall(div,query,searchType,page,module,moduleInternalKey,action) |
||
288 | { |
||
289 | searchResultsDiv = div; |
||
290 | xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall); |
||
291 | startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module + "&moduleInternalKey=" + moduleInternalKey,"",stateChangedSearchCall,"",action); |
||
292 | } |
||
92 | jmachado | 293 | function stateChangedSearchCall() |
294 | { |
||
295 | if (xmlHttpSearch.readyState==4 || xmlHttpSearch.readyState=="complete") |
||
296 | { |
||
297 | getObjectById(searchResultsDiv).innerHTML=xmlHttpSearch.responseText; |
||
298 | } |
||
299 | } |
||
1 | fvelez | 300 | |
301 | |||
159 | jmachado | 302 | /*************************************************** |
303 | Pop |
||
163 | jmachado | 304 | ***************************************************/ |
159 | jmachado | 305 | var xmlHttpPop; |
306 | var popDiv; |
||
1 | fvelez | 307 | |
159 | jmachado | 308 | function loadPop(div,action) |
309 | { |
||
310 | popDiv = div; |
||
311 | xmlHttpPop=GetXmlHttpObject(stateChangedPopCall); |
||
312 | startRequest(xmlHttpPop,"","",stateChangedPopCall,"",action); |
||
313 | } |
||
314 | function stateChangedPopCall() |
||
315 | { |
||
316 | if (xmlHttpPop.readyState==4 || xmlHttpPop.readyState=="complete") |
||
317 | { |
||
318 | getObjectById(popDiv).innerHTML=xmlHttpPop.responseText; |
||
319 | } |
||
320 | } |
||
1 | fvelez | 321 | |
163 | jmachado | 322 | /*************************************************** |
323 | Reminders |
||
324 | ***************************************************/ |
||
198 | jmachado | 325 | |
326 | var activeRemindersCounter = 0; |
||
327 | var expiredRemindersCounter = 0; |
||
381 | jmachado | 328 | var semaphoreReminder = 0; |
198 | jmachado | 329 | |
330 | function setActiveReminders(active) |
||
331 | { |
||
332 | activeRemindersCounter = active; |
||
333 | } |
||
334 | function setExpiredReminders(expired) |
||
335 | { |
||
336 | expiredRemindersCounter = expired; |
||
337 | } |
||
338 | |||
163 | jmachado | 339 | var xmlHttpReminder; |
340 | var newReminderId; |
||
341 | var reminderFormId; |
||
342 | var putMsgId; |
||
343 | var putOkMsg; |
||
344 | var putFailMsg; |
||
1 | fvelez | 345 | |
163 | jmachado | 346 | function putReminder(startDate,expireDate,text,newReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg) |
347 | { |
||
381 | jmachado | 348 | if(semaphoreReminder == 1) |
349 | { |
||
350 | getObjectById(putMsgId).innerHTML = "<div class=\"messages\">busy...</div>"; |
||
351 | } |
||
352 | else |
||
353 | { |
||
354 | semaphoreReminder = 1; |
||
355 | newReminderId = newReminderDiv; |
||
356 | reminderFormId = reminderFormDiv; |
||
357 | putMsgId = msgDiv; |
||
358 | putOkMsg = okMsg; |
||
359 | putFailMsg = failMsg; |
||
360 | getObjectById(putMsgId).innerHTML = waitMsg; |
||
361 | xmlHttpReminder=GetXmlHttpObject(stateChangedPutReminderCall); |
||
362 | startRequest(xmlHttpReminder,"dispatch=save&startDate="+startDate+"&expireDate="+expireDate+"&reminderView.text="+ text,"",stateChangedPutReminderCall,"",action); |
||
223 | jmachado | 363 | // hideOne(reminderFormId); |
381 | jmachado | 364 | showOne(putMsgId); |
365 | } |
||
163 | jmachado | 366 | } |
367 | function stateChangedPutReminderCall() |
||
368 | { |
||
369 | if (xmlHttpReminder.readyState==4 || xmlHttpReminder.readyState=="complete") |
||
370 | { |
||
371 | if(xmlHttpReminder.responseText.indexOf("<div class=\"messages\">") >= 0) |
||
372 | { |
||
373 | getObjectById(putMsgId).innerHTML = xmlHttpReminder.responseText; |
||
374 | } |
||
381 | jmachado | 375 | else if(semaphoreReminder == 1) |
163 | jmachado | 376 | { |
381 | jmachado | 377 | semaphoreReminder = 0; |
163 | jmachado | 378 | getObjectById(putMsgId).innerHTML = '<div class="statusOK">' + putOkMsg + '</div>'; |
223 | jmachado | 379 | activeRemindersCounter = activeRemindersCounter + 1; |
380 | showOne('activeReminders'); |
||
163 | jmachado | 381 | getObjectById(newReminderId).innerHTML = xmlHttpReminder.responseText + getObjectById(newReminderId).innerHTML; |
382 | } |
||
383 | } |
||
165 | jmachado | 384 | setTimeout(cleanReminderStatus,3000); |
163 | jmachado | 385 | } |
386 | function cleanReminderStatus() |
||
387 | { |
||
388 | getObjectById(putMsgId).innerHTML = ''; |
||
389 | } |
||
1 | fvelez | 390 | |
198 | jmachado | 391 | function deleteExpiredReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg) |
165 | jmachado | 392 | { |
198 | jmachado | 393 | deleteReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg,stateChangedDeleteExpiredReminderCall); |
394 | } |
||
395 | function deleteActiveReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg) |
||
396 | { |
||
397 | deleteReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg,stateChangedDeleteActiveReminderCall); |
||
398 | } |
||
399 | function deleteReminder(id,deleteReminderDiv,msgDiv,reminderFormDiv,action,waitMsg,okMsg,failMsg,callBack) |
||
400 | { |
||
165 | jmachado | 401 | newReminderId = deleteReminderDiv; |
402 | reminderFormId = reminderFormDiv; |
||
403 | putMsgId = msgDiv; |
||
404 | putOkMsg = okMsg; |
||
405 | putFailMsg = failMsg; |
||
406 | getObjectById(putMsgId).innerHTML = waitMsg; |
||
198 | jmachado | 407 | xmlHttpReminder=GetXmlHttpObject(callBack); |
408 | startRequest(xmlHttpReminder,"dispatch=delete&id="+id,"",callBack,"",action); |
||
223 | jmachado | 409 | //hideOne(reminderFormId); |
410 | showOne(putMsgId); |
||
165 | jmachado | 411 | } |
1 | fvelez | 412 | |
198 | jmachado | 413 | function stateChangedDeleteExpiredReminderCall() |
414 | { |
||
223 | jmachado | 415 | |
416 | stateChangedDeleteReminderCall("expired"); |
||
198 | jmachado | 417 | if(expiredRemindersCounter <= 0) |
418 | { |
||
223 | jmachado | 419 | hideOne('expiredReminders'); |
198 | jmachado | 420 | } |
421 | if(expiredRemindersCounter < 0) |
||
422 | expiredRemindersCounter = 0; |
||
423 | } |
||
424 | function stateChangedDeleteActiveReminderCall() |
||
425 | { |
||
223 | jmachado | 426 | stateChangedDeleteReminderCall("active"); |
198 | jmachado | 427 | |
428 | if(activeRemindersCounter <= 0) |
||
429 | { |
||
223 | jmachado | 430 | hideOne('activeReminders'); |
198 | jmachado | 431 | } |
432 | if(activeRemindersCounter < 0) |
||
433 | activeRemindersCounter = 0; |
||
434 | } |
||
223 | jmachado | 435 | function stateChangedDeleteReminderCall(type) |
165 | jmachado | 436 | { |
437 | if (xmlHttpReminder.readyState==4 || xmlHttpReminder.readyState=="complete") |
||
438 | { |
||
223 | jmachado | 439 | if(type == "active") |
440 | activeRemindersCounter--; |
||
441 | else |
||
442 | expiredRemindersCounter--; |
||
443 | |||
165 | jmachado | 444 | if(xmlHttpReminder.responseText.indexOf("<div class=\"messages\">") >= 0) |
445 | { |
||
446 | getObjectById(putMsgId).innerHTML = xmlHttpReminder.responseText; |
||
447 | } |
||
448 | else |
||
449 | { |
||
450 | getObjectById(putMsgId).innerHTML = '<div class="statusOK">' + putOkMsg + '</div>'; |
||
451 | getObjectById(newReminderId).innerHTML = ''; |
||
452 | } |
||
453 | } |
||
454 | setTimeout(cleanReminderStatus,3000); |
||
455 | } |
||
1 | fvelez | 456 | |
48 | fvelez | 457 | |
430 | jmachado | 458 | /****************************** |
459 | * Cotas de Impressao |
||
460 | ******************************/ |
||
461 | var quotasDiv; |
||
462 | var xmlHttpQuotas; |
||
463 | var quotasErrorMsg; |
||
464 | var impressorasMsg; |
||
465 | var quotasDisponiveisMsg; |
||
466 | var donaldPretoMsg; |
||
467 | var billCorMsg; |
||
48 | fvelez | 468 | |
430 | jmachado | 469 | function loadQuotas(div,action,_quotasErrorMsg, _impressorasMsg, _quotasDisponiveisMsg, _donaldPretoMsg, _billCorMsg) |
470 | { |
||
48 | fvelez | 471 | |
430 | jmachado | 472 | quotasDiv = div; |
473 | quotasErrorMsg = _quotasErrorMsg; |
||
474 | impressorasMsg = _impressorasMsg; |
||
475 | quotasDisponiveisMsg = _quotasDisponiveisMsg; |
||
476 | donaldPretoMsg = _donaldPretoMsg; |
||
477 | billCorMsg = _billCorMsg; |
||
478 | if(!xmlHttpQuotas) |
||
479 | xmlHttpQuotas = GetXmlHttpObject(stateChangedLoadQuotasCall); |
||
480 | startRequest(xmlHttpQuotas,"","",stateChangedLoadQuotasCall,"",action); |
||
481 | } |
||
482 | function stateChangedLoadQuotasCall() |
||
483 | { |
||
484 | if (xmlHttpQuotas.readyState==4 || xmlHttpQuotas.readyState=="complete") |
||
485 | { |
||
486 | putQuotasImpressao(xmlHttpQuotas.responseXML); |
||
487 | } |
||
488 | } |
||
48 | fvelez | 489 | |
430 | jmachado | 490 | function putQuotasImpressao(xmlData) |
491 | { |
||
492 | if(xmlData == null) |
||
493 | { |
||
494 | getObjectById(quotasDiv).innerHTML=quotasErrorMsg; |
||
495 | } |
||
496 | else |
||
497 | { |
||
498 | var pretoTr = xmlData.getElementsByTagName('preto')[0].getElementsByTagName("tr")[0]; |
||
499 | var corTr = xmlData.getElementsByTagName('cor')[0].getElementsByTagName("tr")[0]; |
||
500 | if(pretoTr == null || corTr == null) |
||
501 | { |
||
502 | getObjectById(quotasDiv).innerHTML=quotasErrorMsg; |
||
503 | } |
||
504 | else |
||
505 | { |
||
431 | jmachado | 506 | var copiasImpressasPreto = pretoTr.getElementsByTagName('td')[1].getElementsByTagName('font')[0].firstChild.nodeValue; |
507 | var copiasDisponiveisPreto = pretoTr.getElementsByTagName('td')[2].getElementsByTagName('font')[0].firstChild.nodeValue; |
||
508 | var copiasImpressasCor = corTr.getElementsByTagName('td')[1].getElementsByTagName('font')[0].firstChild.nodeValue; |
||
509 | var copiasDisponiveisCor = corTr.getElementsByTagName('td')[2].getElementsByTagName('font')[0].firstChild.nodeValue; |
||
430 | jmachado | 510 | var response = ""; |
511 | response += "<table class=\"dataTable\">\n"; |
||
512 | response += " <tr>\n"; |
||
513 | response += " <th>" + impressorasMsg + "</th>\n"; |
||
514 | response += " <th>" + quotasDisponiveisMsg + "</th>\n"; |
||
515 | response += " </tr>\n"; |
||
516 | response += " <tr>\n"; |
||
517 | response += " <th>" + donaldPretoMsg + "</th>\n"; |
||
518 | if(copiasDisponiveisPreto == '0') |
||
519 | response += "<td align=\"right\" style=\"color:red\">"+ copiasDisponiveisPreto +"</td>\n" |
||
520 | else |
||
521 | response += "<td align=\"right\" style=\"color:green\">"+ copiasDisponiveisPreto +"</td>\n" |
||
522 | response += " </tr>\n"; |
||
523 | response += " <tr>\n"; |
||
524 | response += " <th>" + billCorMsg + "</th>\n"; |
||
525 | if(copiasDisponiveisCor == '0') |
||
526 | response += "<td align=\"right\" style=\"color:red\">"+ copiasDisponiveisCor +"</td>\n" |
||
527 | else |
||
528 | response += "<td align=\"right\" style=\"color:green\">"+ copiasDisponiveisCor +"</td>\n" |
||
529 | response += " </tr>\n"; |
||
92 | jmachado | 530 | |
430 | jmachado | 531 | response += "</table>\n"; |
532 | getObjectById(quotasDiv).innerHTML=response; |
||
533 | } |
||
534 | } |
||
535 | } |
||
92 | jmachado | 536 | |
537 | |||
159 | jmachado | 538 | |
539 | |||
540 | |||
163 | jmachado | 541 | |
542 | |||
543 | |||
165 | jmachado | 544 | |
545 | |||
546 | |||
430 | jmachado | 547 | |
548 | |||
549 | |||
550 |