function deleteRow() { setFuncMessages(__FUNCTION__, array('OK' => 7, 'UMOUNT' => 58)); $row_id = assertUIntArg('row_id'); $rowData = spotEntity('row', $row_id); $unmounted = getRowMountsCount($row_id); commitDeleteRow($row_id); if ($unmounted) { showFuncMessage(__FUNCTION__, 'UMOUNT', array($unmounted)); } showFuncMessage(__FUNCTION__, 'OK', array($rowData['name'])); return buildRedirectURL('rackspace', 'editrows'); }
function renderRackspaceRowEditor() { function printNewItemTR() { printOpFormIntro('addRow'); echo '<tr><td>'; printImageHREF('create', 'Add new row', TRUE); echo '</td><td> '; echo '</td><td> '; echo '</td><td><select name=location_id>'; renderLocationSelectTree(); echo '</td><td><input type=text name=name></td><td>'; printImageHREF('create', 'Add new row', TRUE); echo '</td></tr></form>'; } startPortlet('Rows'); echo "<table border=0 cellspacing=0 cellpadding=5 align=center class=widetable>\n"; echo "<tr><th> </th><th># Racks</th><th># Devices</th><th>Location</th><th>Name</th><th> </th><th>Row link</th></tr>\n"; if (getConfigVar('ADDNEW_AT_TOP') == 'yes') { printNewItemTR(); } foreach (listCells('row') as $row_id => $rowInfo) { echo '<tr><td>'; $rc = $rowInfo['rackc']; $delete_racks_str = $rc ? " and {$rc} rack(s)" : ''; echo getOpLink(array('op' => 'deleteRow', 'row_id' => $row_id), '', 'destroy', 'Delete row' . $delete_racks_str, 'need-confirmation'); printOpFormIntro('updateRow', array('row_id' => $row_id)); echo '</td><td>'; echo $rc; echo '</td><td>'; echo getRowMountsCount($row_id); echo '</td><td>'; echo '<select name=location_id>'; renderLocationSelectTree($rowInfo['location_id']); echo "</td><td><input type=text name=name value='{$rowInfo['name']}'></td><td>"; printImageHREF('save', 'Save changes', TRUE); echo "</form></td>"; echo "<td>" . mkCellA($rowInfo) . "</td>"; echo "</tr>\n"; } if (getConfigVar('ADDNEW_AT_TOP') != 'yes') { printNewItemTR(); } echo "</table><br>\n"; finishPortlet(); }