Example #1
0
/**
 * Confirm and then actually add a CHECK constraint
 */
function addCheck($confirm, $msg = '')
{
    global $data, $misc;
    global $lang;
    if (!isset($_POST['name'])) {
        $_POST['name'] = '';
    }
    if (!isset($_POST['definition'])) {
        $_POST['definition'] = '';
    }
    if ($confirm) {
        $misc->printTrail('domain');
        $misc->printTitle($lang['straddcheck'], 'pg.constraint.check');
        $misc->printMsg($msg);
        echo "<form action=\"domains.php\" method=\"post\">\n";
        echo "<table>\n";
        echo "<tr><th class=\"data\">{$lang['strname']}</th>\n";
        echo "<th class=\"data required\">{$lang['strdefinition']}</th></tr>\n";
        echo "<tr><td class=\"data1\"><input name=\"name\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_POST['name']), "\" /></td>\n";
        echo "<td class=\"data1\">(<input name=\"definition\" size=\"32\" value=\"", htmlspecialchars($_POST['definition']), "\" />)</td></tr>\n";
        echo "</table>\n";
        echo "<p><input type=\"hidden\" name=\"action\" value=\"save_add_check\" />\n";
        echo "<input type=\"hidden\" name=\"domain\" value=\"", htmlspecialchars($_REQUEST['domain']), "\" />\n";
        echo $misc->form;
        echo "<input type=\"submit\" name=\"add\" value=\"{$lang['stradd']}\" />\n";
        echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
        echo "</form>\n";
    } else {
        if (trim($_POST['definition']) == '') {
            addCheck(true, $lang['strcheckneedsdefinition']);
        } else {
            $status = $data->addDomainCheckConstraint($_POST['domain'], $_POST['definition'], $_POST['name']);
            if ($status == 0) {
                doProperties($lang['strcheckadded']);
            } else {
                addCheck(true, $lang['strcheckaddedbad']);
            }
        }
    }
}
Example #2
0
    deleteTemplate();
} elseif ($_GET['action'] == "list_checks") {
    displayAllChecks();
} elseif ($_GET['action'] == "showCheck") {
    displayCheck();
} elseif ($_GET['action'] == "editCheck") {
    if (isset($_POST['updateCheck'])) {
        updateCheck();
    } else {
        editCheck();
    }
} elseif ($_GET['action'] == "addCheck") {
    if (isset($_POST['insertCheck'])) {
        insertCheck();
    } else {
        addCheck();
    }
} elseif ($_GET['action'] == "deleteCheck") {
    deleteCheck();
} elseif ($_GET['action'] == "renderCheckReport") {
    renderCheckReport();
} elseif ($_GET['action'] == "renderCheckReportForm") {
    renderCheckReportForm();
} elseif ($_GET['action'] == "list_ReportProfiles") {
    displayAllReportProfiles();
} elseif ($_GET['action'] == "addReportProfile") {
    if (isset($_POST['insertProfile'])) {
        insertReportProfile();
    } else {
        addReportProfile();
    }