/[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 126 by dpavlin, Wed Sep 21 11:18:29 2005 UTC revision 128 by dpavlin, Thu Sep 22 13:31:04 2005 UTC
# Line 348  sub displayBackupsGrid() { Line 348  sub displayBackupsGrid() {
348                  $retHTML .= q{?action=burn>                  $retHTML .= q{?action=burn>
349          };          };
350    
351          $retHTML .= <<EOF3;          $retHTML .= <<'EOF3';
352    <style>
353    <!--
354    
355    div#fixedBox {
356            position: absolute;
357            bottom: 1em;
358            left: 0.5em;
359            padding: 0.5em;
360            width: 10em;
361            background: #e0f0e0;
362            border: 1px solid #00ff00;
363    }
364    @media screen {
365            div#fixedBox {
366                    position: fixed;
367            }
368            /* Don't do this at home */
369            * html {
370                    overflow-y: hidden;
371            }
372            * html body {
373                    overflow-y: auto;
374                    height: 100%;
375                    padding: 0 1em 0 12em;
376                    font-size: 100%;
377            }
378            * html div#fixedBox {
379                    position: absolute;    
380            }
381            /* All done. */
382    }
383    
384    #mContainer {
385            position: relative;
386            width: 100%;
387            height: 1.1em;
388            padding: 0px;
389            border: 1px solid #000000;
390    }
391    
392    #gradient {
393            position: absolute;
394            top: 0px;
395            left: 0px;
396            width: 100%;
397            height: 100%;
398            display: block;
399            background-color: #ffff00;
400    }
401    
402    #mask {
403            position: absolute;
404            top: 0px;
405            left: 0px;
406            width: 100%;
407            height: 100%;
408            display: block;
409            font-size: 1px;
410            background-color: #FFFFFF;
411            overflow: hidden;
412    }
413    
414    #progressIndicator {
415            position: absolute;
416            top: 0px;
417            left: 0px;
418            width: 100%;
419            height: 100%;
420            display: block;
421            font-weight: bold;
422            color: #404040;
423            font-size: 10pt;
424            text-align: center;
425    }
426    
427    -->
428    </style>
429  <script language="javascript" type="text/javascript">  <script language="javascript" type="text/javascript">
430  <!--  <!--
431    
432  var debug_div = null;  var debug_div = null;
433    var media_size = 4400 * 1024;
434    
435  function debug(msg) {  function debug(msg) {
436  //      return; // Disable debugging  //      return; // Disable debugging
# Line 388  function checkAll(location) { Line 466  function checkAll(location) {
466          for (var i = 0; i < len; i++) {          for (var i = 0; i < len; i++) {
467    
468                  var e = element_id('forma').elements[i];                  var e = element_id('forma').elements[i];
469                  if ((e.checked || !e.checked) && e.name != \'all\') {                  if ((e.checked || !e.checked) && e.name != 'all') {
470                          if (check_all.checked) {                          if (check_all.checked) {
471                                  e.checked = true;                                  e.checked = true;
472                          } else {                          } else {
# Line 414  function sumiraj(e) { Line 492  function sumiraj(e) {
492                  suma = 0;                  suma = 0;
493                  for (var i = 0; i < len; i++) {                  for (var i = 0; i < len; i++) {
494                          var e = element_id('forma').elements[i];                          var e = element_id('forma').elements[i];
495                          if (e.name != \'all\' && e.checked && e.name.substr(0,3) == 'fcb') {                          if (e.name != 'all' && e.checked && e.name.substr(0,3) == 'fcb') {
496                                  var el = element_id("fss" + e.name.substr(3));                                  var el = element_id("fss" + e.name.substr(3));
497                                  if (el && el.value) suma += parseInt(el.value) || 0;                                  if (el && el.value) suma += parseInt(el.value) || 0;
498                          }                          }
499                  }                  }
500          }          }
501          element_id('forma').totalsize.value = suma;          element_id('forma').totalsize.value = suma;
502            pbar_set(suma, media_size);
503          debug('total size: '+suma);          debug('total size: '+suma);
504          return suma;          return suma;
505  }  }
506    
507    /* progress bar */
508    
509    var _pbar_width = 0;
510    var _pbar_warn = 10;    // change color in last 10%
511    
512    function pbar_reset() {
513            element_id("mask").style.left = "0px";
514            _pbar_width = element_id("mContainer").offsetWidth - 2;
515            element_id("mask").style.width = _pbar_width + "px";
516            element_id("progressIndicator").style.zIndex  = 10;
517            element_id("mask").style.display = "block";
518            element_id("progressIndicator").innerHTML = "0";
519    }
520    
521    function dec2hex(d) {
522            var hch="0123456789ABCDEF";
523            var a=d%16;
524            var q=(d-a)/16;
525            return hch.charAt(q)+hch.charAt(a);
526    }
527    
528    
529    function pbar_set(amount, max) {
530    
531            debug('pbar_set( '+amount+' , '+max+' )');
532    
533            curWidth = parseInt(element_id("mask").offsetWidth);
534            curLeft = parseInt(element_id("mask").offsetLeft);
535    
536    
537            var pcnt = Math.floor( amount * 100 / max );
538            var p90 = 100 - _pbar_warn;
539            var pcol = pcnt - p90;
540            if (pcol < _pbar_warn) {
541                    if (pcol < 0) pcol = 0;
542                    var e = element_id("submitBurner");
543                    if (e && e.disabled) {
544                            debug('enable_button');
545                            var a = e.getAttributeNode('disabled') || null;
546                            if (a) e.removeAttributeNode(a);
547                    }
548            } else if (pcol > _pbar_warn) {
549                    debug('disable button');
550                    pcol = _pbar_warn;
551                    var e = element_id("submitBurner");
552                    if (! e.disabled) e.disabled = true;
553            }
554            var col_g = Math.floor( ( _pbar_warn - pcol ) * 255 / _pbar_warn );
555            var col = '#ff' + dec2hex( col_g ) + '00';
556    
557            //debug('pcol: '+pcol+' g:'+col_g+' _pbar_warn:'+ _pbar_warn + ' color: '+col);
558            element_id("gradient").style.backgroundColor = col;
559    
560            var size = parseInt( _pbar_width * amount / max );
561    
562            curWidth = _pbar_width - size;
563            curLeft = size ;
564    
565            //debug('size: '+size+' curWidth '+curWidth+' curLeft: '+curLeft);
566    
567            element_id("progressIndicator").innerHTML = pcnt + '%';
568            //element_id("progressIndicator").innerHTML = amount;
569    
570            if (curLeft > _pbar_width) {
571                    element_id("mask").style.display = "none";
572                    return;
573            } else {
574                    element_id("mask").style.display = "";
575            }
576    
577            //if(parseInt(element_id("mask").offsetWidth)>10)
578            element_id("mask").style.width = curWidth + "px";
579            element_id("mask").style.left = curLeft + "px";
580    
581    }
582    
583  if (!self.body) self.body = new Object();  if (!self.body) self.body = new Object();
584  self.onload = self.document.onload = self.body.onload = function() {  self.onload = self.document.onload = self.body.onload = function() {
585            pbar_reset();
586          sumiraj();          sumiraj();
587  }  }
588    
589  //-->  //-->
590  </script>  </script>
591  <div id="debug" style="position: absolute; top: 0; right: 0; width: 10em; border: 1px #ff0000 solid; background-color: #ffe0e0; -moz-opacity: 0.7;">  <div id="fixedBox">
592  Total size:  
593  <input type="text" name="totalsize" size="8">  Size:
594    <input type="text" name="totalsize" size="7" readonly>
595    
596    <div id="mContainer">
597            <div id="gradient"></div>
598            <div id="mask"></div>
599            <div id="progressIndicator">&nbsp;</div>
600    </div>
601    
602  <br/>  <br/>
603  Note:  Note:
604    <br/>
605  <textarea name="note" cols="10" rows="5">  <textarea name="note" cols="10" rows="5">
606  </textarea>  </textarea>
607  <br/>  <br/>
608  <input type="submit" value="Burn selected backups" name="submitBurner">  <input type="submit" id="submitBurner" value="Burn selected" name="submitBurner">
609    
610    </div>
611    <div id="debug" style="float: right; width: 10em; border: 1px #ff0000 solid; background-color: #ffe0e0; -moz-opacity: 0.7;">
612    no debug output yet
613  </div>  </div>
614  EOF3  EOF3
615          $retHTML .= q{          $retHTML .= q{
# Line 479  EOF3 Line 648  EOF3
648                          '<tr' . $color[$i %2 ] . '>                          '<tr' . $color[$i %2 ] . '>
649                          <td class="fview">';                          <td class="fview">';
650                  # FIXME                  # FIXME
651                  #$backup->{'fs_size'} = int($backup->{'size'} * 1024);                  $backup->{'fs_size'} = int($backup->{'size'} * 1024);
652                  if (($backup->{'fs_size'} || 0) > 0) {                  if (($backup->{'fs_size'} || 0) > 0) {
653                          $retHTML .= '                          $retHTML .= '
654                          <input type="checkbox" name="fcb' .                          <input type="checkbox" name="fcb' .

Legend:
Removed from v.126  
changed lines
  Added in v.128

  ViewVC Help
Powered by ViewVC 1.1.26