0); // echo "for startRow==\${startRow} and template==(\${template[0]}, \${template[1]}, \${template[2]}) height==\${height}
\n"; return \$height; } // This function marks atoms to be avoided by rectHeight() and assigns rowspan/colspan // attributes. function markSpan (&\$rackData, \$startRow, \$maxheight, \$template_idx) { global \$template, \$templateWidth; \$colspan = 0; for (\$height = 0; \$height < \$maxheight; \$height++) { for (\$locidx = 0; \$locidx < 3; \$locidx++) { if (\$template[\$template_idx][\$locidx]) { // Add colspan/rowspan to the first row met and mark the following ones to skip. if (\$colspan != 0) \$rackData[\$startRow - \$height][\$locidx]['skipped'] = TRUE; else { \$colspan = \$templateWidth[\$template_idx]; if (\$colspan > 1) \$rackData[\$startRow - \$height][\$locidx]['colspan'] = \$colspan; if (\$maxheight > 1) \$rackData[\$startRow - \$height][\$locidx]['rowspan'] = \$maxheight; } } } } return; } // This function finds rowspan/solspan/skipped atom attributes for renderRack() // What we actually have to do is to find all possible rectangles for each objects // and then find the widest of those with the maximal square. function markAllSpans (&\$rackData = NULL) { if (\$rackData == NULL) { showError ('Invalid rackData in markupAllSpans()'); return; } for (\$i = \$rackData['height']; \$i > 0; \$i--) { // calculate height of 6 possible span templates (array is presorted by width descending) global \$template; for (\$j = 0; \$j < 6; \$j++) \$height[\$j] = rectHeight (\$rackData, \$i, \$j); // find the widest rectangle of those with maximal height \$maxheight = max (\$height); if (\$maxheight > 0) { \$best_template_index = 0; for (\$j = 0; \$j < 6; \$j++) if (\$height[\$j] == \$maxheight) { \$best_template_index = \$j; break; } // distribute span marks markSpan (\$rackData, \$i, \$maxheight, \$best_template_index); } } } function delRow (\$row_id = 0) { if (\$row_id == 0) { showError ('Not all required args to delRow() are present.'); return; } if (!isset (\$_REQUEST['confirmed']) || \$_REQUEST['confirmed'] != 'true') { echo "Press here to confirm rack row deletion."; return; } global \$dbxlink; echo 'Deleting rack row information: '; \$result = \$dbxlink->query ("update RackRow set deleted = 'yes' where id=\${row_id} limit 1"); if (\$result->rowCount() != 1) { showError ('Marked ' . \$result.rowCount() . ' rows as deleted, but expected 1'); return; } echo 'OK
'; recordHistory ('RackRow', "id = \${row_id}"); echo "Information was deleted. You may return to rack row list."; } function delRack (\$rack_id = 0) { if (\$rack_id == 0) { showError ('Not all required args to delRack() are present.'); return; } if (!isset (\$_REQUEST['confirmed']) || \$_REQUEST['confirmed'] != 'true') { echo "Press here to confirm rack deletion."; return; } global \$dbxlink; echo 'Deleting rack information: '; \$result = \$dbxlink->query ("update Rack set deleted = 'yes' where id=\${rack_id} limit 1"); if (\$result->rowCount() != 1) { showError ('Marked ' . \$result.rowCount() . ' rows as deleted, but expected 1'); return; } echo 'OK
'; recordHistory ('Rack', "id = \${rack_id}"); echo "Information was deleted. You may return to rack list."; } function delObject (\$object_id = 0) { if (\$object_id == 0) { showError ('Not all required args to delObject() are present.'); return; } if (!isset (\$_REQUEST['confirmed']) || \$_REQUEST['confirmed'] != 'true') { echo "Press here to confirm object deletion."; return; } global \$dbxlink; echo 'Deleting object information: '; \$result = \$dbxlink->query ("update RackObject set deleted = 'yes' where id=\${object_id} limit 1"); if (\$result->rowCount() != 1) { showError ('Marked ' . \$result.rowCount() . ' rows as deleted, but expected 1'); return; } echo 'OK