Remove all the too long lines

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3266 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-12-08 14:56:34 +00:00
parent f3f3d9eaf7
commit ea54592f5b
9 changed files with 431 additions and 144 deletions

View File

@@ -296,10 +296,10 @@ $content .= "</li>\n";
/** Create the routes for REST pages and the associated actions */
public function routesREST ()
{
$route = new route ();
$route = new route ();
$route->debug = $this->debug;;
$route->allowSlashes=false;
$route->get ("rest/".$this->url_prefix."(\.{extension})?".
$route->get ("rest/".$this->url_prefix."(\.{extension})?".
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
function ($extension, $p1, $v1, $p2, $v2, $p3, $v3, $chain=null)
{
@@ -340,7 +340,7 @@ $content .= "</li>\n";
throw new Exception (dgettext("domframework","Extension not allowed"),
403);
$search = rawurldecode ($search);
$this->connect();
$this->connect();
$titles = $this->objectDB->titles ();
unset ($titles[$this->chainedForeign]);
$foreignSelect = null;
@@ -580,21 +580,21 @@ $content .= "</li>\n";
$this->url_prefix = $this->chained->url_prefix."/{chain}/".
$this->url_prefix;
}
/** Add HTML routes */
$route = new route ();
/** Add HTML routes */
$route = new route ();
$route->debug = $this->debug;;
$route->allowSlashes=false;
$route->get ($this->url_prefix."/", function ($chain=null) use ($route)
$route->get ($this->url_prefix."/", function ($chain=null) use ($route)
{
$route->redirect ("/".str_replace ("{chain}", $chain, $this->url_prefix),
"");
});
$route->get ($this->url_prefix.
$route->get ($this->url_prefix.
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
function ($p1, $v1, $p2, $v2, $p3, $v3, $chain=null) use ($route)
{
// List all the objects of the table
{
// List all the objects of the table
if ($this->chained !== null)
{
if ($this->chained->accessright ($this->authHTML["email"], $chain) !==
@@ -660,7 +660,7 @@ $content .= "</li>\n";
//echo "NUM=$num\n";
//echo "SEARCH=$search\n";
//$route->debug=$this->debug;
$this->connect();
$this->connect();
$csrf = new csrf ();
$token = $csrf->createToken ();
$titles = $this->objectDB->titles ();
@@ -762,44 +762,174 @@ $content .= "</li>\n";
if ($this->enableInternalCSS === true)
{
$content .= "<style type='text/css' scoped='scoped'>\n";
$content .= ".routeSQL { width:95%; margin-left:auto; margin-right:auto; }\n";
$content .= ".routeSQL a { text-decoration:none; }\n";
$content .= ".routeSQL .topBar { display: block; overflow: auto; }\n";
$content .= ".routeSQL .topBar .topleft { display: inline; float:left; }\n";
$content .= ".routeSQL .topBar .topright { display: inline; float:right; }\n";
$content .= ".routeSQL .bottomBar { display: block; overflow: auto; }\n";
$content .= ".routeSQL .bottomBar .bottomleft { display: inline; float:left; }\n";
$content .= ".routeSQL .bottomBar .bottomright { display: inline; float:right; }\n";
$content .= ".routeSQL .actionExtern { border:1px solid #ddd; border-radius:5px; padding:0px; margin:3px; float:left; }\n";
$content .= ".routeSQL .actionExtern a { display: block; padding : 9px; }\n";
$content .= ".routeSQL .numberEntryByDisplayArea { border:1px solid #ddd; border-radius:5px; padding:10px; margin:3px; float:left; }\n";
$content .= ".routeSQL .searchArea { border:1px solid #ddd; border-radius:5px; padding:10px; margin:3px; float:left; }\n";
$content .= ".routeSQL .searchArea form { margin:-1px; }\n";
$content .= ".routeSQL .numberEntryByDisplayArea form { margin:-3px; }\n";
$content .= ".routeSQL .informationArea { border:1px solid #ddd; border-radius:5px; padding:10px; margin:3px; float:left; }\n";
$content .= ".routeSQL div.paginatorArea { float:left; }\n";
$content .= ".routeSQL div.paginatorArea>ul>li>a { display: block; }\n";
$content .= ".routeSQL ul.paginatorArea { list-style-type:none; margin: 0px; padding:0px; border:1px solid #ddd; border-radius:5px; }\n";
$content .= ".routeSQL ul.paginatorArea li.selected { background-color: #04d; padding:0px;}\n";
$content .= ".routeSQL ul.paginatorArea li.selected:first-child { border-top-left-radius: 5px; border-bottom-left-radius: 5px;}\n";
$content .= ".routeSQL ul.paginatorArea li.selected:last-child { border-top-right-radius: 5px; border-bottom-right-radius: 5px;}\n";
$content .= ".routeSQL ul.paginatorArea li.selected a { padding : 10px;color:white; font-weight:bold; }\n";
$content .= ".routeSQL ul.paginatorArea li a { padding : 10px }\n";
$content .= ".routeSQL ul.paginatorArea li { display: inline-block; }\n";
$content .= ".routeSQL table { width:100%;overflow:auto; border-collapse:collapse; }\n";
$content .= ".routeSQL table tr { border-top:1px solid #ccc;}\n";
$content .= ".routeSQL table th { border-bottom:3px solid #ccc; border-top:1px solid #fff; padding:9px 5px 9px 1px; }\n";
$content .= ".routeSQL table td { empty-cells:true; padding:9px 5px 9px 1px; }\n";
$content .= ".routeSQL table .noentry { text-align:center; color:#c00; font-weight:bolder; }\n";
$content .= ".routeSQL table .action { text-align:left; padding-left: 8px; }\n";
$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 .= ".routeSQL {
width:95%;
margin-left:auto;
margin-right:auto;
}\n";
$content .= ".routeSQL a {
text-decoration:none;
}\n";
$content .= ".routeSQL .topBar {
display: block;
overflow: auto;
}\n";
$content .= ".routeSQL .topBar .topleft {
display: inline;
float:left;
}\n";
$content .= ".routeSQL .topBar .topright {
display: inline;
float:right;
}\n";
$content .= ".routeSQL .bottomBar {
display: block;
overflow: auto;
}\n";
$content .= ".routeSQL .bottomBar .bottomleft {
display: inline;
float:left;
}\n";
$content .= ".routeSQL .bottomBar .bottomright {
display: inline;
float:right;
}\n";
$content .= ".routeSQL .actionExtern {
border:1px solid #ddd;
border-radius:5px;
padding:0px;
margin:3px;
float:left;
}\n";
$content .= ".routeSQL .actionExtern a {
display: block;
padding : 9px;
}\n";
$content .= ".routeSQL .numberEntryByDisplayArea {
border:1px solid #ddd;
border-radius:5px;
padding:10px;
margin:3px;
float:left;
}\n";
$content .= ".routeSQL .searchArea {
border:1px solid #ddd;
border-radius:5px;
padding:10px;
margin:3px;
float:left;
}\n";
$content .= ".routeSQL .searchArea form {
margin:-1px;
}\n";
$content .= ".routeSQL .numberEntryByDisplayArea form {
margin:-3px;
}\n";
$content .= ".routeSQL .informationArea {
border:1px solid #ddd;
border-radius:5px;
padding:10px;
margin:3px;
float:left;
}\n";
$content .= ".routeSQL div.paginatorArea {
float:left;
}\n";
$content .= ".routeSQL div.paginatorArea>ul>li>a {
display: block;
}\n";
$content .= ".routeSQL ul.paginatorArea {
list-style-type:none;
margin: 0px;
padding:0px;
border:1px solid #ddd;
border-radius:5px;
}\n";
$content .= ".routeSQL ul.paginatorArea li.selected {
background-color: #04d;
padding:0px;
}\n";
$content .= ".routeSQL ul.paginatorArea li.selected:first-child {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}\n";
$content .= ".routeSQL ul.paginatorArea li.selected:last-child {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}\n";
$content .= ".routeSQL ul.paginatorArea li.selected a {
padding : 10px;
color:white;
font-weight:bold;
}\n";
$content .= ".routeSQL ul.paginatorArea li a {
padding : 10px
}\n";
$content .= ".routeSQL ul.paginatorArea li {
display: inline-block;
}\n";
$content .= ".routeSQL table {
width:100%;
overflow:auto;
border-collapse:collapse;
}\n";
$content .= ".routeSQL table tr {
border-top:1px solid #ccc;
}\n";
$content .= ".routeSQL table th {
border-bottom:3px solid #ccc;
border-top:1px solid #fff;
padding:9px 5px 9px 1px;
}\n";
$content .= ".routeSQL table td {
empty-cells:true;
padding:9px 5px 9px 1px;
}\n";
$content .= ".routeSQL table .noentry {
text-align:center;
color:#c00;
font-weight:bolder;
}\n";
$content .= ".routeSQL table .action {
text-align:left;
padding-left: 8px;
}\n";
$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";
@@ -920,12 +1050,12 @@ $content .= "</li>\n";
$content .= " </div>\n"; // End of bottomBar
$content .= "</div>\n";
$this->rendererhtml ($content);
});
});
$route->get ($this->url_prefix."/{id}/delete/{token}",
$route->get ($this->url_prefix."/{id}/delete/{token}",
function ($id, $token, $chain=null)
{
// Delete an existing object if the token is valid
{
// Delete an existing object if the token is valid
if ($this->chained !== null)
{
if ($this->chained->editright ($this->authHTML["email"], $chain) !==
@@ -961,7 +1091,7 @@ $content .= "</li>\n";
if ($this->readonly ($this->authHTML["email"], $id) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
$this->connect();
$this->connect();
$csrf = new csrf ();
$renderer = new renderer ();
$route = new route ();
@@ -982,10 +1112,10 @@ $content .= "</li>\n";
}
});
});
$route->get ($this->url_prefix."/add", function ($chain=null)
{
$route->get ($this->url_prefix."/add", function ($chain=null)
{
// Add a new entry : form to be filled by the user
if ($this->chained !== null)
{
@@ -1022,7 +1152,7 @@ $content .= "</li>\n";
if ($this->readonly ($this->authHTML["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
$this->connect();
$this->connect();
// Get the non mandatory foreign keys and display them instead of the
// unusable id
@@ -1076,29 +1206,101 @@ $content .= "</li>\n";
{
// CSS is in edit an id too !
$content .= "<style type='text/css' scoped='scoped'>\n";
$content .= "#form .col-sm-2 { float:left; width: 16.66666667%; padding-left:15px;padding-right:15px;};\n";
$content .= "#form .col-sm-10 {float:left; width: 83.33333333%; }\n";
$content .= "#form .col-sm-12 { width: 100%; }\n";
$content .= "#form input[type='submit'] { width:93%; margin-left:auto;margin-right:auto}\n";
$content .= "#form .btn-primary { color: #fff; background-color: #428bca; border-color: #357ebd; }\n";
$content .= ".help-block { margin-left:16.7%;display: block; color:#a94442;} \n";
$content .= "#form input[type='text'] { background-color:#fff;}\n";
$content .= "#form .has-error label { color:#a94442; }\n";
$content .= "#form .has-error .form-control { border-color:#a94442; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset; }\n";
$content .= ".form-group { margin-bottom: 15px; }\n";
$content .= ".form-horizontal .control-label { text-align: right; }\n";
$content .= "label { display: inline-block; font-weight: 700; }\n";
$content .= ".form-control { display: block; border-radius: 4px;padding-top: 6px; padding-right: 12px; padding-bottom: 6px; padding-left: 12px; width: 80%; }\n";
$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 .= "#form .col-sm-2 {
float:left;
width: 16.66666667%;
padding-left:15px;
padding-right:15px;
};\n";
$content .= "#form .col-sm-10 {
float:left;
width: 83.33333333%;
}\n";
$content .= "#form .col-sm-12 {
width: 100%;
}\n";
$content .= "#form input[type='submit'] {
width:93%;
margin-left:auto;
margin-right:auto
}\n";
$content .= "#form .btn-primary {
color: #fff;
background-color: #428bca;
border-color: #357ebd;
}\n";
$content .= ".help-block {
margin-left:16.7%;
display: block;
color:#a94442;
} \n";
$content .= "#form input[type='text'] {
background-color:#fff;
}\n";
$content .= "#form .has-error label {
color:#a94442;
}\n";
$content .= "#form .has-error .form-control {
border-color:#a94442;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
}\n";
$content .= ".form-group {
margin-bottom: 15px;
}\n";
$content .= ".form-horizontal .control-label {
text-align: right;
}\n";
$content .= "label {
display: inline-block;
font-weight: 700;
}\n";
$content .= ".form-control {
display: block;
border-radius: 4px;
padding-top: 6px;
padding-right: 12px;
padding-bottom: 6px;
padding-left: 12px;
width: 80%;
}\n";
$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 !
}
@@ -1141,10 +1343,10 @@ $content .= "</li>\n";
$f->fields ($fields);
$content .= $f->printHTML ("post", $values, $errors);
$this->rendererhtml ($content);
});
});
$route->post ($this->url_prefix."/add", function ($chain=null) use ($route)
{
$route->post ($this->url_prefix."/add", function ($chain=null) use ($route)
{
// Add a new entry : effective save of the data
if ($this->chained !== null)
{
@@ -1181,7 +1383,7 @@ $content .= "</li>\n";
if ($this->readonly ($this->authHTML["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
$this->connect();
$this->connect();
$f = new form ();
$values = $f->values ();
$errorsChain = array ();
@@ -1223,10 +1425,10 @@ $content .= "</li>\n";
$route->redirect ("/".str_replace("{chain}", $chain, $this->url_prefix).
"/add", "");
});
});
$route->get ($this->url_prefix."/{id}", function ($id, $chain=null)
{
$route->get ($this->url_prefix."/{id}", function ($id, $chain=null)
{
// List the details of one existing object
if ($this->chained !== null)
{
@@ -1261,7 +1463,7 @@ $content .= "</li>\n";
$id);
$readonly = $this->readonly ($this->authHTML["email"], $id);
$this->connect();
$this->connect();
// Get the non mandatory foreign keys and display them instead of the
// unusable id
$foreignData = array ();
@@ -1318,29 +1520,101 @@ $content .= "</li>\n";
{
// CSS is in add too !
$content .= "<style type='text/css' scoped='scoped'>\n";
$content .= "#form .col-sm-2 { float:left; width: 16.66666667%; padding-left:15px;padding-right:15px;};\n";
$content .= "#form .col-sm-10 {float:left; width: 83.33333333%; }\n";
$content .= "#form .col-sm-12 { width: 100%; }\n";
$content .= "#form input[type='submit'] { width:93%; margin-left:auto;margin-right:auto}\n";
$content .= "#form .btn-primary { color: #fff; background-color: #428bca; border-color: #357ebd; }\n";
$content .= ".help-block { margin-left:16.7%;display: block; color:#a94442;} \n";
$content .= "#form input[type='text'] { background-color:#fff;}\n";
$content .= "#form .has-error label { color:#a94442; }\n";
$content .= "#form .has-error .form-control { border-color:#a94442; box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset; }\n";
$content .= ".form-group { margin-bottom: 15px; }\n";
$content .= ".form-horizontal .control-label { text-align: right; }\n";
$content .= "label { display: inline-block; font-weight: 700; }\n";
$content .= ".form-control { display: block; border-radius: 4px;padding-top: 6px; padding-right: 12px; padding-bottom: 6px; padding-left: 12px; width: 80%; }\n";
$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 .= "#form .col-sm-2 {
float:left;
width: 16.66666667%;
padding-left:15px;
padding-right:15px;
};\n";
$content .= "#form .col-sm-10 {
float:left;
width: 83.33333333%;
}\n";
$content .= "#form .col-sm-12 {
width: 100%;
}\n";
$content .= "#form input[type='submit'] {
width:93%;
margin-left:auto;
margin-right:auto
}\n";
$content .= "#form .btn-primary {
color: #fff;
background-color: #428bca;
border-color: #357ebd;
}\n";
$content .= ".help-block {
margin-left:16.7%;
display: block;
color:#a94442;
} \n";
$content .= "#form input[type='text'] {
background-color:#fff;
}\n";
$content .= "#form .has-error label {
color:#a94442;
}\n";
$content .= "#form .has-error .form-control {
border-color:#a94442;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
}\n";
$content .= ".form-group {
margin-bottom: 15px;
}\n";
$content .= ".form-horizontal .control-label {
text-align: right;
}\n";
$content .= "label {
display: inline-block;
font-weight: 700;
}\n";
$content .= ".form-control {
display: block;
border-radius: 4px;
padding-top: 6px;
padding-right: 12px;
padding-bottom: 6px;
padding-left: 12px;
width: 80%;
}\n";
$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 !
}
@@ -1388,12 +1662,12 @@ $content .= "</li>\n";
$f->fields ($fields);
$content .= $f->printHTML ("post", $values, $errors);
$this->rendererhtml ($content);
});
});
$route->post ($this->url_prefix."/{id}", function ($id, $chain=null)
$route->post ($this->url_prefix."/{id}", function ($id, $chain=null)
use ($route)
{
// Save the details of one existing object
{
// Save the details of one existing object
if ($this->chained !== null)
{
if ($this->chained->editright ($this->authHTML["email"], $chain) !==
@@ -1479,7 +1753,7 @@ $content .= "</li>\n";
$_SESSION["domframework"]["routeSQL"]["values"] = $values;
$route->redirect ("/".str_replace ("{chain}", $chain, $this->url_prefix).
"/$id", "");
});
});
}
/** Authorization : Return TRUE if the user right allow to see the data