/[BackupPC]/trunk/lib/BackupPC/SearchLib.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/BackupPC/SearchLib.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 139 by iklaric, Thu Sep 29 08:46:13 2005 UTC revision 140 by ravilov, Fri Oct 7 07:59:28 2005 UTC
# Line 343  sub getBackupsNotBurned() { Line 343  sub getBackupsNotBurned() {
343  sub displayBackupsGrid() {  sub displayBackupsGrid() {
344    
345          my $retHTML .= q{          my $retHTML .= q{
346                  <form id="forma" method="POST" action=};                  <form id="forma" method="POST" action="}.$MyURL.q{?action=burn">
                 $retHTML .= "\"".$MyURL."\"";  
                 $retHTML .= q{?action=burn>  
347          };          };
348    
349          $retHTML .= <<'EOF3';          $retHTML .= <<'EOF3';
350  <style>  <style type="text/css">
351  <!--  <!--
352    DIV#fixedBox {
 div#fixedBox {  
353          position: absolute;          position: absolute;
354          bottom: 1em;          top: 50em;
355          left: 0.5em;          left: -24%;
356          padding: 0.5em;          padding: 0.5em;
357          width: 10em;          width: 20%;
358          background: #e0f0e0;          background-color: #E0F0E0;
359          border: 1px solid #00ff00;          border: 1px solid #00C000;
 }  
 @media screen {  
         div#fixedBox {  
                 position: fixed;  
         }  
         /* Don't do this at home */  
         * html {  
                 overflow-y: hidden;  
         }  
         * html body {  
                 overflow-y: auto;  
                 height: 100%;  
                 padding: 0 1em 0 12em;  
                 font-size: 100%;  
         }  
         * html div#fixedBox {  
                 position: absolute;      
         }  
         /* All done. */  
360  }  }
361    
362  #mContainer {  DIV#fixedBox, DIV#fixedBox INPUT, DIV#fixedBox TEXTAREA {
363          position: relative;          font-size: 10pt;
         width: 100%;  
         height: 1.1em;  
         padding: 0px;  
         border: 1px solid #000000;  
364  }  }
365    
366  #gradient {  FORM>DIV#fixedBox {
367          position: absolute;          position: fixed !important;
368          top: 0px;          left: 0.5em !important;
369          left: 0px;          top: auto !important;
370          width: 100%;          bottom: 1em !important;
371          height: 100%;          width: 15% !important;
372    }
373    
374    DIV#fixedBox INPUT[type=text], DIV#fixedBox TEXTAREA {
375            border: 1px solid #00C000;
376    }
377    
378    DIV#fixedBox #note {
379          display: block;          display: block;
380          background-color: #ffff00;          width: 100%;
381  }  }
382    
383  #mask {  DIV#fixedBox #submitBurner {
384          position: absolute;          display: block;
         top: 0px;  
         left: 0px;  
385          width: 100%;          width: 100%;
386            margin-top: 0.5em;
387            cursor: pointer;
388    }
389    
390    * HTML {
391            overflow-y: hidden;
392    }
393    
394    * HTML BODY {
395            overflow-y: auto;
396          height: 100%;          height: 100%;
397          display: block;          font-size: 100%;
         font-size: 1px;  
         background-color: #FFFFFF;  
         overflow: hidden;  
398  }  }
399    
400  #progressIndicator {  * HTML DIV#fixedBox {
401          position: absolute;          position: absolute;
402          top: 0px;  }
403          left: 0px;  
404          width: 100%;  #mContainer, #gradient, #mask, #progressIndicator {
         height: 100%;  
405          display: block;          display: block;
406          font-weight: bold;          width: 100%;
         color: #404040;  
407          font-size: 10pt;          font-size: 10pt;
408            font-weight: bold;
409          text-align: center;          text-align: center;
410            vertical-align: middle;
411            padding: 1px;
412  }  }
413    
414    #gradient, #mask, #progressIndicator {
415            left: 0;
416            border-width: 1px;
417            border-style: solid;
418            border-color: #000000;
419            color: #404040;
420            margin: 0.4em;
421            position: absolute;
422            margin-left: -1px;
423            margin-top: -1px;
424            margin-bottom: -1px;
425            overflow: hidden;
426    }
427    
428    #mContainer {
429            display: block;
430            position: relative;
431            padding: 0px;
432            margin-top: 0.4em;
433            margin-bottom: 0.5em;
434    }
435    
436    #gradient {
437            z-index: 1;
438            background-color: #FFFF00;
439    }
440    
441    #mask {
442            z-index: 2;
443            background-color: #FFFFFF;
444    }
445    
446    #progressIndicator {
447            z-index: 3;
448            background-color: transparent;
449    }
450  -->  -->
451  </style>  </style>
452  <script language="javascript" type="text/javascript">  <script type="text/javascript">
453  <!--  <!--
454    
455  var debug_div = null;  var debug_div = null;
# Line 496  function sumiraj(e) { Line 519  function sumiraj(e) {
519          var suma = parseInt(element_id('forma').totalsize.value) || 0;          var suma = parseInt(element_id('forma').totalsize.value) || 0;
520          var len = element_id('forma').elements.length;          var len = element_id('forma').elements.length;
521          if (e) {          if (e) {
522                  var size = parseInt( element_id("fss" + e.name.substr(3)).value );                  var size = parseInt( element_id("fss" + e.name.substr(3)).value);
523                  if (e.checked) {                  if (e.checked) {
524                          suma += size;                          suma += size;
525                  } else {                  } else {
# Line 518  function sumiraj(e) { Line 541  function sumiraj(e) {
541    
542  /* progress bar */  /* progress bar */
543    
544  var _pbar_width = 0;  var _pbar_width = null;
545  var _pbar_warn = 10;    // change color in last 10%  var _pbar_warn = 10;    // change color in last 10%
546    
547  function pbar_reset() {  function pbar_reset() {
548          element_id("mask").style.left = "0px";          element_id("mask").style.left = "0px";
549          _pbar_width = element_id("mContainer").offsetWidth - 2;          _pbar_width = element_id("mContainer").offsetWidth - 2;
550          element_id("mask").style.width = _pbar_width + "px";          element_id("mask").style.width = _pbar_width + "px";
         element_id("progressIndicator").style.zIndex  = 10;  
551          element_id("mask").style.display = "block";          element_id("mask").style.display = "block";
552            element_id("progressIndicator").style.zIndex  = 10;
553          element_id("progressIndicator").innerHTML = "0";          element_id("progressIndicator").innerHTML = "0";
554  }  }
555    
556  function dec2hex(d) {  function dec2hex(d) {
557          var hch="0123456789ABCDEF";          var hch = '0123456789ABCDEF';
558          var a=d%16;          var a = d % 16;
559          var q=(d-a)/16;          var q = (d - a) / 16;
560          return hch.charAt(q)+hch.charAt(a);          return hch.charAt(q) + hch.charAt(a);
561  }  }
562    
   
563  function pbar_set(amount, max) {  function pbar_set(amount, max) {
564            debug('pbar_set('+amount+', '+max+')');
565    
566          debug('pbar_set( '+amount+' , '+max+' )');          if (_pbar_width == null) {
567                    var _mc = element_id("mContainer");
568          curWidth = parseInt(element_id("mask").offsetWidth);                  if (_pbar_width == null) _pbar_width = parseInt(_mc.offsetWidth ? (_mc.offsetWidth - 2) : 0) || null;
569          curLeft = parseInt(element_id("mask").offsetLeft);                  if (_pbar_width == null) _pbar_width = parseInt(_mc.clientWidth ? (_mc.clientWidth + 2) : 0) || null;
570                    if (_pbar_width == null) _pbar_width = 0;
571            }
572    
573          var pcnt = Math.floor( amount * 100 / max );          var pcnt = Math.floor(amount * 100 / max);
574          var p90 = 100 - _pbar_warn;          var p90 = 100 - _pbar_warn;
575          var pcol = pcnt - p90;          var pcol = pcnt - p90;
576          if (pcol < _pbar_warn) {          if (Math.round(pcnt) <= 100) {
577                  if (pcol < 0) pcol = 0;                  if (pcol < 0) pcol = 0;
578                  var e = element_id("submitBurner");                  var e = element_id("submitBurner");
579                  if (e && e.disabled) {                  debug('enable_button');
580                          debug('enable_button');                  e.disabled = false;
581                          var a = e.getAttributeNode('disabled') || null;                  var a = e.getAttributeNode('disabled') || null;
582                          if (a) e.removeAttributeNode(a);                  if (a) e.removeAttributeNode(a);
583                  }          } else {
         } else if (pcol > _pbar_warn) {  
584                  debug('disable button');                  debug('disable button');
585                  pcol = _pbar_warn;                  pcol = _pbar_warn;
586                  var e = element_id("submitBurner");                  var e = element_id("submitBurner");
587                  if (! e.disabled) e.disabled = true;                  if (!e.disabled) e.disabled = true;
588          }          }
589          var col_g = Math.floor( ( _pbar_warn - pcol ) * 255 / _pbar_warn );          var col_g = Math.floor((_pbar_warn - pcol) * 255 / _pbar_warn);
590          var col = '#ff' + dec2hex( col_g ) + '00';          var col = '#FF' + dec2hex(col_g) + '00';
591    
592          //debug('pcol: '+pcol+' g:'+col_g+' _pbar_warn:'+ _pbar_warn + ' color: '+col);          //debug('pcol: '+pcol+' g:'+col_g+' _pbar_warn:'+ _pbar_warn + ' color: '+col);
593          element_id("gradient").style.backgroundColor = col;          element_id("gradient").style.backgroundColor = col;
594    
         var size = parseInt( _pbar_width * amount / max );  
   
         curWidth = _pbar_width - size;  
         curLeft = size ;  
   
         //debug('size: '+size+' curWidth '+curWidth+' curLeft: '+curLeft);  
   
595          element_id("progressIndicator").innerHTML = pcnt + '%';          element_id("progressIndicator").innerHTML = pcnt + '%';
596          //element_id("progressIndicator").innerHTML = amount;          //element_id("progressIndicator").innerHTML = amount;
597    
598          if (curLeft > _pbar_width) {          element_id("mask").style.clip = 'rect(' + Array(
599                  element_id("mask").style.display = "none";                  '0px',
600                  return;                  element_id("mask").offsetWidth + 'px',
601          } else {                  element_id("mask").offsetHeight + 'px',
602                  element_id("mask").style.display = "";                  Math.round(_pbar_width * amount / max) + 'px'
603          }          ).join(' ') + ')';
   
         //if(parseInt(element_id("mask").offsetWidth)>10)  
         element_id("mask").style.width = curWidth + "px";  
         element_id("mask").style.left = curLeft + "px";  
   
604  }  }
605    
606  if (!self.body) self.body = new Object();  if (!self.body) self.body = new Object();
607  self.onload = self.document.onload = self.body.onload = function() {  self.onload = self.document.onload = self.body.onload = function() {
608          pbar_reset();          //pbar_reset();
609          sumiraj();          sumiraj();
610  }  };
611    
612  //-->  // -->
613  </script>  </script>
614  <div id="fixedBox">  <div id="fixedBox">
615    
616  Size:  Size: <input type="text" name="totalsize" size="7" readonly="readonly" style="text-align:right;" value="0" /> kB
 <input type="text" name="totalsize" size="7" readonly>  
617    
618  <div id="mContainer">  <div id="mContainer">
619          <div id="gradient"></div>          <div id="gradient">&nbsp;</div>
620          <div id="mask"></div>          <div id="mask">&nbsp;</div>
621          <div id="progressIndicator">&nbsp;</div>          <div id="progressIndicator">0%</div>
622  </div>  </div>
   
623  <br/>  <br/>
624    
625  Note:  Note:
626  <br/>  <textarea name="note" cols="10" rows="5" id="note"></textarea>
627  <textarea name="note" cols="10" rows="5">  
628  </textarea>  <input type="submit" id="submitBurner" value="Burn selected" name="submitBurner" />
 <br/>  
 <input type="submit" id="submitBurner" value="Burn selected" name="submitBurner">  
629    
630  </div>  </div>
631    <!--
632  <div id="debug" style="float: right; width: 10em; border: 1px #ff0000 solid; background-color: #ffe0e0; -moz-opacity: 0.7;">  <div id="debug" style="float: right; width: 10em; border: 1px #ff0000 solid; background-color: #ffe0e0; -moz-opacity: 0.7;">
633  no debug output yet  no debug output yet
634  </div>  </div>
635    -->
636  EOF3  EOF3
637          $retHTML .= q{          $retHTML .= q{
638                          <input type="hidden" value="burn" name="action">                          <input type="hidden" value="burn" name="action">

Legend:
Removed from v.139  
changed lines
  Added in v.140

  ViewVC Help
Powered by ViewVC 1.1.26