case 'update': $i = (int) $pro->update_category($_POST['id'], $_POST['category'], $_POST['parent_id'], $_POST['template_id']); if ($i == $pro->err_duplicate) { alert(sprintf($sc_Duplicate, $sc_category)); } if ($i == $pro->err_child_of_itsself) { alert($sc_ChildOfItsself); } break; case 'add': if ((int) $pro->add_category($_POST['category'], $_POST['parent_id'], $_POST['template_id']) == $pro->err_duplicate) { alert(sprintf($sc_Duplicate, $sc_category)); } break; case 'delete': if (!$pro->delete_category($_POST['id'])) { alert(sprintf($sc_CannotDelete, $_POST['txt_name'])); } break; case 'edit': $edit_id = $_POST['id']; $disabled = $_POST['close_win'] > 0 ? 'disabled' : ''; $pro->get_categories($edit_id, false); if ($pro->next_record()) { $edit_name = $pro->f('category_name'); $edit_parent = $pro->f('parent_id'); } $pro->get_attach_categories($edit_id, true); while ($pro->next_record()) { $att_arr[] = $pro->f('id'); }