routeSQL : Color the alert boxes

routeSQL : Don't display the errors coming from the displayed field in the alert box


git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2061 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-03-23 15:31:56 +00:00
parent 98bbcdd1a6
commit eaf052d047

View File

@@ -772,6 +772,11 @@ class routeSQL
$content .= ".routeSQL table .action .edit { color:#222; font-weight:bolder;}\n";
$content .= ".routeSQL table .action .delete { color:#c00; font-weight:bolder; }\n";
$content .= ".routeSQL table .odd { background-color:#f9f9f9; }\n";
$content .= ".routeSQL .alert { border-radius: 4px ; border-width: 1px; padding:10px; }\n";
$content .= ".routeSQL .alert-success { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d}\n";
$content .= ".routeSQL .alert-info { border-color: #bce8f1; background-color: #d9edf7; color: #31708f;}\n";
$content .= ".routeSQL .alert-warning { border-color: #faebcc; background-color: #fcf8e3; color: #8a6d3b;}\n";
$content .= ".routeSQL .alert-danger { border-color: #ebccd1; background-color: #f2dede; color: #a94442; }\n";
$content .= "</style>\n";
}
$content .= "<div class='routeSQL'>\n";
@@ -1066,6 +1071,11 @@ class routeSQL
$content .= "* { box-sizing: border-box;}\n";
$content .= "button, input, optgroup, select, textarea { margin:0px 0px 0px 0px; }\n";
$content .= "#form .form-control[disabled], #form .form-control[readonly], #form fieldset[disabled] .form-control { cursor: not-allowed; background-color: #eee; opacity: 1; }\n";
$content .= ".alert { border-radius: 4px ; border-width: 1px; padding:10px; }\n";
$content .= ".alert-success { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d}\n";
$content .= ".alert-info { border-color: #bce8f1; background-color: #d9edf7; color: #31708f;}\n";
$content .= ".alert-warning { border-color: #faebcc; background-color: #fcf8e3; color: #8a6d3b;}\n";
$content .= ".alert-danger { border-color: #ebccd1; background-color: #f2dede; color: #a94442; }\n";
$content .= "</style>\n";
// CSS is in edit an id too !
}
@@ -1151,8 +1161,15 @@ class routeSQL
$this->connect();
$f = new form ();
$values = $f->values ();
$errorsChain = array ();
if ($this->chainedForeign !== null &&
isset ($values[$this->chainedForeign]) &&
$values[$this->chainedForeign] !== $chain)
$errorsChain[$this->chainedForeign] =
array ("error", dgettext("domframework",
"Can not change the external key"));
$errors = $this->objectDB->verify ($values);
if (count ($errors) == 0)
if (count ($errors) == 0 && count ($errorsChain) == 0)
{
try
{
@@ -1173,7 +1190,7 @@ class routeSQL
else
{
$renderer = new renderer ();
foreach ($errors as $error)
foreach ($errorsChain as $error)
$renderer->flash (strtoupper ($error[0]), $error[1]);
}
// If errors : save them and redirect to the page of editing to be
@@ -1296,6 +1313,11 @@ class routeSQL
$content .= "* { box-sizing: border-box;}\n";
$content .= "button, input, optgroup, select, textarea { margin:0px 0px 0px 0px; }\n";
$content .= "#form .form-control[disabled], #form .form-control[readonly], #form fieldset[disabled] .form-control { cursor: not-allowed; background-color: #eee; opacity: 1; }\n";
$content .= ".alert { border-radius: 4px ; border-width: 1px; padding:10px; }\n";
$content .= ".alert-success { border-color: #d6e9c6; background-color: #dff0d8; color: #3c763d}\n";
$content .= ".alert-info { border-color: #bce8f1; background-color: #d9edf7; color: #31708f;}\n";
$content .= ".alert-warning { border-color: #faebcc; background-color: #fcf8e3; color: #8a6d3b;}\n";
$content .= ".alert-danger { border-color: #ebccd1; background-color: #f2dede; color: #a94442; }\n";
$content .= "</style>\n";
// CSS is in add too !
}
@@ -1425,8 +1447,6 @@ class routeSQL
else
{
$renderer = new renderer ();
foreach ($errors as $error)
$renderer->flash (strtoupper ($error[0]), $error[1]);
foreach ($errorsChain as $error)
$renderer->flash (strtoupper ($error[0]), $error[1]);
}