+ var volumes = parseInt( element_id("prt" + name).value);
+ debug('update_size('+name+','+checked+') suma: '+suma+' volumes: '+volumes);
+ if (volumes > 1) {
+ if (checked) {
+ element_id("volumes").innerHTML = "This will take "+volumes+" mediums!";
+ element_id("volumes").style.display = 'block';
+ suma = size;
+ update_sum(suma);
+ } else {
+ suma -= size;
+ element_id("volumes").style.display = 'none';
+ }
+ }
+
+ return suma;
+}
+
+function sumiraj(e) {
+ var suma = parseInt(element_id('forma').elements['totalsize'].value) || 0;
+ var len = element_id('forma').elements.length;
+ if (e) {
+ suma = update_size(e.name.substr(3), e.checked, suma);
+ if (suma < 0) suma = 0;
+ } else {
+ suma = 0;
+ for (var i = 0; i < len; i++) {
+ var fel = element_id('forma').elements[i];
+ if (fel.name != 'all' && fel.checked && fel.name.substr(0,3) == 'fcb') {
+ suma = update_size(fel.name.substr(3), fel.checked, suma);
+ }
+ }
+ }
+ update_sum(suma);
+ return suma;
+}
+
+/* progress bar */
+
+var _pbar_width = null;
+var _pbar_warn = 10; // change color in last 10%
+
+function pbar_reset() {
+ element_id("mask").style.left = "0px";
+ _pbar_width = element_id("mContainer").offsetWidth - 2;
+ element_id("mask").style.width = _pbar_width + "px";
+ element_id("mask").style.display = "block";
+ element_id("progressIndicator").style.zIndex = 10;
+ element_id("progressIndicator").innerHTML = "0";
+}
+
+function dec2hex(d) {
+ var hch = '0123456789ABCDEF';
+ var a = d % 16;
+ var q = (d - a) / 16;
+ return hch.charAt(q) + hch.charAt(a);
+}
+
+function pbar_set(amount, max) {
+ debug('pbar_set('+amount+', '+max+')');
+
+ if (_pbar_width == null) {
+ var _mc = element_id("mContainer");
+ if (_pbar_width == null) _pbar_width = parseInt(_mc.offsetWidth ? (_mc.offsetWidth - 2) : 0) || null;
+ if (_pbar_width == null) _pbar_width = parseInt(_mc.clientWidth ? (_mc.clientWidth + 2) : 0) || null;
+ if (_pbar_width == null) _pbar_width = 0;
+ }
+
+ var pcnt = Math.floor(amount * 100 / max);
+ var p90 = 100 - _pbar_warn;
+ var pcol = pcnt - p90;
+ if (Math.round(pcnt) <= 100) {
+ if (pcol < 0) pcol = 0;
+ var e = element_id("submitBurner");
+ debug('enable_button');
+ e.disabled = false;
+ var a = e.getAttributeNode('disabled') || null;
+ if (a) e.removeAttributeNode(a);
+ } else {
+ debug('disable button');
+ pcol = _pbar_warn;
+ var e = element_id("submitBurner");
+ if (!e.disabled) e.disabled = true;
+ }
+ var col_g = Math.floor((_pbar_warn - pcol) * 255 / _pbar_warn);
+ var col = '#FF' + dec2hex(col_g) + '00';
+
+ //debug('pcol: '+pcol+' g:'+col_g+' _pbar_warn:'+ _pbar_warn + ' color: '+col);
+ element_id("gradient").style.backgroundColor = col;
+
+ element_id("progressIndicator").innerHTML = pcnt + '%';
+ //element_id("progressIndicator").innerHTML = amount;
+
+ element_id("mask").style.clip = 'rect(' + Array(
+ '0px',
+ element_id("mask").offsetWidth + 'px',
+ element_id("mask").offsetHeight + 'px',
+ Math.round(_pbar_width * amount / max) + 'px'
+ ).join(' ') + ')';
+}
+
+if (!self.body) self.body = new Object();
+self.onload = self.document.onload = self.body.onload = function() {
+ //pbar_reset();
+ sumiraj();
+};
+
+// -->
+</script>
+<div id="fixedBox">
+
+<input type="hidden" name="totalsize"/>
+Size: <input type="text" name="totalsize_kb" size="7" readonly="readonly" style="text-align:right;" value="0" /> kB
+
+<div id="mContainer">
+ <div id="gradient"> </div>
+ <div id="mask"> </div>
+ <div id="progressIndicator">0%</div>
+</div>
+<br/>
+
+<div id="volumes"> </div>
+
+Note:
+<textarea name="note" cols="10" rows="5" id="note"></textarea>
+
+<input type="submit" id="submitBurner" value="Burn selected" name="submitBurner" />
+
+</div>
+<!--
+<div id="debug" style="float: right; width: 10em; border: 1px #ff0000 solid; background-color: #ffe0e0; -moz-opacity: 0.7;">
+no debug output yet
+</div>
+-->
+EOF3
+ $retHTML .= q{
+ <input type="hidden" value="burn" name="action">
+ <input type="hidden" value="results" name="search_results">
+ <table style="fview" border="0" cellspacing="0" cellpadding="2">
+ <tr class="tableheader">
+ <td class="tableheader">
+ <input type="checkbox" name="allFiles" id="allFiles" onClick="checkAll('allFiles');">
+ </td>
+ } .
+ sort_header($param, 'Share', 'share', 'center') .
+ sort_header($param, '#', 'num', 'center') .
+ qq{
+ <td align="center">Type</td>
+ } .
+ sort_header($param, 'Date', 'date', 'center') .
+ sort_header($param, 'Age/days', 'age', 'center') .
+ sort_header($param, 'Size/Mb', 'size', 'center') .
+ sort_header($param, 'gzip size/Kb', 'incsize', 'center') .
+ qq{
+ <td align="center">medias</td></tr>
+ };
+
+ my @color = (' bgcolor="#e0e0e0"', '');
+
+ my $i = 0;
+ my $host = '';
+
+ foreach my $backup ( getBackupsNotBurned($param) ) {
+
+ if ($host ne $backup->{'host'}) {
+ $i++;
+ $host = $backup->{'host'};
+ }
+ my $ftype = "";
+
+ my $checkbox_key = $backup->{'hostid'}. '_' .$backup->{'backupnum'} . '_' . $backup->{'id'};
+
+ $retHTML .=
+ '<tr' . $color[$i %2 ] . '>
+ <td class="fview">';
+
+ if (($backup->{'inc_size'} || 0) > 0) {
+ $retHTML .= '
+ <input type="checkbox" name="fcb' . $checkbox_key . '" value="' . $checkbox_key . '" onClick="sumiraj(this);">';
+ }