home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 March / Chip_2011.03_CD.iso / Tools / modules / infobar.js < prev    next >
Encoding:
Text File  |  2010-12-14  |  3.9 KB  |  132 lines

  1. ∩╗┐function infobar(title,text,color,button,img){
  2.     var infobar_color = document.getElementById('infobar_color');
  3.     var infobar_img = document.getElementById('infobar_img');
  4.  
  5.     if (color == 'green') {
  6.         infobar_color.style.backgroundImage = "url(./tools/ico/infobar/green.png)";
  7.         infobar_img.src = "./tools/ico/infobar/greenImg.png";
  8.         infobar_color.style.backgroundColor = "#c4fb9c";
  9.     }
  10.     else if (color == 'yelow') {
  11.         infobar_color.style.backgroundImage = "url(./tools/ico/infobar/yelow.png)";
  12.         infobar_img.src = "./tools/ico/infobar/yelowImg.png";
  13.         infobar_color.style.backgroundColor = "#ffda75";
  14.     }
  15.     else if (color == 'red') {
  16.         infobar_color.style.backgroundImage = "url(./tools/ico/infobar/red.png)";
  17.         infobar_img.src = "./tools/ico/infobar/redImg.png";
  18.         infobar_color.style.backgroundColor = "#ff7575";
  19.     }
  20.  
  21.     text += '<br><LABEL style="float:left; margin:5px; margin-left:0px; font-size:11px;"><input type="checkbox" name="hideDetail" id="hideDetail" value="a2" onclick="hideDetails(this.checked)"' + (document.getElementById('drv_lists').style.display=='none'?' checked':'') + '> '+infobar_hideDetails+'</LABEL>';
  22.  
  23.     if (button == 'InstAll')
  24.         text += "<button class='infobar_button' onclick='chkManual(\"driver_available\"); facebox_dialog();'>"+infobar_buttonInstAll+"</button>";
  25.     if (button == 'UpdAll')
  26.         text += "<button class='infobar_button' onclick='chkManual(\"driver_new\"); facebox_dialog();'>"+infobar_buttonUpdAll+"</button>";
  27.     if (img)
  28.         infobar_img.src = "./tools/ico/infobar/"+img+".png";
  29.  
  30.     document.getElementById('infobar_title').innerHTML = title;
  31.     document.getElementById('infobar_info').innerHTML = text;
  32. }
  33.  
  34. function chkManual(div){
  35.     ClearChk();
  36.     for (var i = 0; i < buttonCount; i++) {
  37.         var checkbox = document.getElementById('chk'+i);
  38.         var divname = document.getElementById('type'+i).value;
  39.  
  40.         if (divname == div) { checkbox.checked="true"; ChangeChkCount(1); }
  41.         else { checkbox.checked=""; }
  42.     }
  43. }
  44.  
  45. function infobar_update(){
  46.     if (doc_num['driver_available'] > 0) {
  47.         infobar_drvAvailable();
  48.     }
  49.     else if (doc_num['no_driver'] > 0) {
  50.         infobar_drvNone();
  51.     }
  52.     else if (doc_num['driver_new'] > 0) {
  53.         infobar_drvNew();
  54.     }
  55.     else {
  56.         infobar_drvAllOk();
  57.     }
  58. }
  59.  
  60. function infobar_drvAvailable(){
  61.     infobar(
  62.             infobar_titleDriverAvailable,
  63.             '<b>'+doc_num['driver_available']+'</b> - '+morfolog('infobar_infoDriverAvailable',doc_num['driver_available']),
  64.             'red',
  65.             'InstAll'
  66.         );
  67.     if (doc_num['driver_available']==0) infobar_drvAllOk();
  68.     setTab('tab-install');
  69. }
  70. function infobar_drvNew(){
  71.     infobar(
  72.             infobar_titleDriverNew,
  73.             '<b>'+doc_num['driver_new']+'</b> - '+morfolog('infobar_infoDriverNew',doc_num['driver_new']),
  74.             'yelow',
  75.             'UpdAll'
  76.         );
  77.     if (doc_num['driver_new']==0) {
  78.         infobar(
  79.             infobar_titleAllUpd,
  80.             infobar_infoAllUpd,
  81.             'green'
  82.         );
  83.         setTimeout("document.getElementById('infobar_img').src = './tools/ico/infobar/update.png';",0);
  84.     }
  85.     setTab('tab-update');
  86. }
  87. function infobar_drvNone(){
  88.     infobar(
  89.             infobar_titleNoDriver,
  90.             '<b>'+doc_num['no_driver']+'</b> - '+morfolog('infobar_infoNoDriver',doc_num['no_driver'])+infobar_urls,
  91.             'red'
  92.         );
  93.     if (doc_num['no_driver']==0) infobar_drvAllOk();
  94.     setTab('tab-search');
  95.     modeTab('tab-search');
  96. }
  97. function infobar_drvAllOk(){
  98.     infobar(
  99.             infobar_titleAllInst,
  100.             infobar_infoAllInst,
  101.             'green'
  102.         );
  103.     setTab('tab-install');
  104. }
  105.  
  106.  
  107.  
  108. function infobar_loading(){
  109.     infobar(
  110.         infobar_titleLoading,
  111.         infobar_infoLoading,
  112.         'yelow',
  113.         '',
  114.         'loading'
  115.     );
  116. }
  117.  
  118. infobar_update();
  119.  
  120.  
  121. function setTab(tab){
  122.     document.getElementById('tab-install').setAttribute('className','');
  123.     document.getElementById('tab-update').setAttribute('className','');
  124.     document.getElementById('tab-search').setAttribute('className','');
  125.     
  126.     if (tab) document.getElementById(tab).setAttribute('className','active');
  127. }
  128. function modeTab(tab,mode){
  129.     mode = mode || '';
  130.     if (tab) document.getElementById(tab).style.visibility=mode;
  131. }
  132.