-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
637cec7
commit 770850f
Showing
17 changed files
with
443 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<?php | ||
/** | ||
* admin_page.php | ||
* Interface permettant à l'administrateur la configuration de certains paramètres généraux | ||
* Ce script fait partie de l'application GRR. | ||
* Dernière modification : $Date: 2024-12-14 12:05$ | ||
* @author JeromeB | ||
* @copyright Copyright 2003-2024 Team DEVOME - JeromeB | ||
* @link http://www.gnu.org/licenses/licenses.html | ||
* | ||
* This file is part of GRR. | ||
* | ||
* GRR is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
$grr_script_name = "admin_page.php"; | ||
|
||
$trad = $vocab; | ||
|
||
check_access(6, $back); | ||
|
||
if (isset($_POST["action"])) | ||
$action = $_POST["action"]; | ||
else | ||
$action = "default"; | ||
|
||
// | ||
if ($action == "add") | ||
{ | ||
|
||
if (isset($_POST["titre"])) | ||
$titre = $_POST["titre"]; | ||
else | ||
$titre = ""; | ||
|
||
if (isset($_POST["statutmini"])) | ||
$statutmini = $_POST["statutmini"]; | ||
else | ||
$statutmini = ""; | ||
|
||
if (isset($_POST["lien"])) | ||
$lien = $_POST["lien"]; | ||
else | ||
$lien = ""; | ||
|
||
if (isset($_POST["nouveauonglet"])) | ||
$nouveauonglet = intval($_POST["nouveauonglet"]); | ||
else | ||
$nouveauonglet = 1; | ||
|
||
if (isset($_POST["ordre"])) | ||
$ordre = intval($_POST["ordre"]); | ||
else | ||
$ordre = 0; | ||
|
||
|
||
if (isset($_POST["emplacement"])) | ||
$emplacement = intval($_POST["emplacement"]); | ||
else | ||
$emplacement = 0; | ||
|
||
$sql = "INSERT INTO ".TABLE_PREFIX."_page (nom, titre, systeme, statutmini, lien, nouveauonglet, ordre, emplacement) VALUES ('".uniqid()."', '".protect_data_sql($titre)."', 0, '".protect_data_sql($statutmini)."', '".protect_data_sql($lien)."', $nouveauonglet, $ordre, '".protect_data_sql($emplacement)."');"; | ||
if (grr_sql_command($sql) < 0) | ||
fatal_error(0, "$sql \n\n" . grr_sql_error()); | ||
} | ||
elseif ($action == "change") | ||
{ | ||
$arearight = false ; | ||
if (isset($_POST["nom"])) | ||
$nom = $_POST["nom"]; | ||
else | ||
$nom = ""; | ||
|
||
if (isset($_POST["titre"])) | ||
$titre = $_POST["titre"]; | ||
else | ||
$titre = ""; | ||
|
||
if (isset($_POST["statutmini"])) | ||
$statutmini = $_POST["statutmini"]; | ||
else | ||
$statutmini = ""; | ||
|
||
if (isset($_POST["lien"])) | ||
$lien = $_POST["lien"]; | ||
else | ||
$lien = ""; | ||
|
||
if (isset($_POST["nouveauonglet"])) | ||
$nouveauonglet = $_POST["nouveauonglet"]; | ||
else | ||
$nouveauonglet = "0"; | ||
|
||
if (isset($_POST["ordre"])) | ||
$ordre = $_POST["ordre"]; | ||
else | ||
$ordre = "0"; | ||
|
||
|
||
|
||
$sql = "UPDATE ".TABLE_PREFIX."_page SET | ||
titre='".protect_data_sql($titre)."', | ||
statutmini='".protect_data_sql($statutmini)."', | ||
lien='".$lien."', | ||
nouveauonglet='".$nouveauonglet."', | ||
ordre='".$ordre."' | ||
WHERE nom='".$nom."';"; | ||
if (grr_sql_command($sql) < 0) | ||
fatal_error(0, "$sql \n\n" . grr_sql_error()); | ||
|
||
} | ||
elseif ($action == "delete") | ||
{ | ||
if (isset($_POST["nom"])) | ||
{ | ||
$nom = $_POST["nom"]; | ||
|
||
$sql = "DELETE FROM ".TABLE_PREFIX."_page WHERE nom='".$nom."';"; | ||
if (grr_sql_command($sql) < 0) | ||
fatal_error(0, "$sql \n\n" . grr_sql_error()); | ||
} | ||
} | ||
|
||
|
||
|
||
// Si pas de problème, message de confirmation | ||
if (isset($_POST['ok'])) { | ||
$_SESSION['displ_msg'] = 'yes'; | ||
if ($msg == '') { | ||
$d['enregistrement'] = 1; | ||
} else{ | ||
$d['enregistrement'] = $msg; | ||
} | ||
} | ||
if ((isset($_GET['msg'])) && isset($_SESSION['displ_msg']) && ($_SESSION['displ_msg'] == 'yes')) { | ||
$msg = $_GET['msg']; | ||
} else { | ||
$msg = ''; | ||
} | ||
//affiche_pop_up($msg, 'admin'); | ||
|
||
|
||
get_vocab_admin('cgu_titre'); | ||
get_vocab_admin('cgu_grr'); | ||
get_vocab_admin('save'); | ||
get_vocab_admin('message_records'); | ||
|
||
|
||
$res = grr_sql_query("SELECT nom, titre, valeur, systeme, statutmini, lien, nouveauonglet, ordre, emplacement FROM ".TABLE_PREFIX."_page WHERE emplacement > 0 ORDER BY ordre ASC;"); | ||
if (!$res) | ||
fatal_error(0, grr_sql_error()); | ||
|
||
if (grr_sql_count($res) != 0) | ||
{ | ||
for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) | ||
{ | ||
$lesPages[] = array('nom' => $row[0], 'titre' => $row[1], 'valeur' => $row[2], 'systeme' => $row[3], 'statutmini' => $row[4], 'lien' => $row[5], 'nouveauonglet' => $row[6], 'ordre' => $row[7], 'emplacement' => $row[8]); | ||
} | ||
} | ||
|
||
echo $twig->render($page.'.twig', array('liensMenu' => $menuAdminT, 'liensMenuN2' => $menuAdminTN2, 'd' => $d, 'trad' => $trad, 'settings' => $AllSettings, 'lesPages' => $lesPages)); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
{% extends 'layout.twig' %} | ||
|
||
{% import 'messagesysteme.twig' as msgSyst %} | ||
{% import 'champs.twig' as form %} | ||
|
||
{% block css %} | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="row"> | ||
<div class="col col-xs-12"> | ||
<h4>Menu haut droit</h4> | ||
|
||
<table class="table table-striped"> | ||
<tr> | ||
<th>{{trad.fieldname}}</th> | ||
<th>Statut</th> | ||
<th>{{trad.link}}</th> | ||
<th>Un autre onglet</th> | ||
<th>Ordre</th> | ||
<th colspan="2">{{trad.action}}</th> | ||
</tr> | ||
|
||
<form method="post" action="admin.php?p=admin_page" > | ||
<input type="hidden" name="p" value="admin_page" /> | ||
<input type="hidden" name="action" value="add" /> | ||
<input type="hidden" name="emplacement" value="1" /> | ||
<tr> | ||
<td><input type="text" name="titre" size="30" class="form-control" /></td> | ||
<td> | ||
<select name="statutmini" id="select_auth_mode" class="form-control" size="1"> | ||
<option value="nc">{{ trad.statut_non_connecte }}</option> | ||
<option value="visiteur" selected>{{ trad.statut_visitor }}</option> | ||
<option value="utilisateur">{{ trad.statut_user }}</option> | ||
<option value="gestionnaire_utilisateur">{{ trad.statut_user_administrator }}</option> | ||
<option value="administrateur">{{ trad.statut_administrator }}</option> | ||
</select> | ||
</td> | ||
<td><input type="text" name="lien" size="30" class="form-control" /></td> | ||
<td><input type="checkbox" id="nouveauonglet" name="nouveauonglet" value="1" checked /></td> | ||
<td><input type="number" name="ordre" size="3" value ="0" class="form-control" /></td> | ||
<td colspan="2"><input type="submit" name="submit" value="{{ trad.add }}" class="btn bg-green" /></td> | ||
</tr> | ||
</form> | ||
|
||
{% for page in lesPages %} | ||
{% if page.emplacement == 1 %} | ||
<tr> | ||
<form method="post" action="?p=admin_page"> | ||
<input type="hidden" name="p" value="admin_overload" /> | ||
<input type="hidden" name="nom" value="{{page.nom}}" /> | ||
<input type="hidden" name="action" value="change" /> | ||
|
||
<td><input type="text" name="titre" value="{{ page.titre }}" class="form-control"></td> | ||
<td> | ||
<select name="statutmini" class="form-control" size="1"> | ||
<option value="nc" {% if page.statutmini == 'nc' %} selected {% endif %}>{{ trad.statut_non_connecte }}</option> | ||
<option value="visiteur" {% if page.statutmini == 'visiteur' %} selected {% endif %}>{{ trad.statut_visitor }}</option> | ||
<option value="utilisateur" {% if page.statutmini == 'utilisateur' %} selected {% endif %}>{{ trad.statut_user }}</option> | ||
<option value="gestionnaire_utilisateur" {% if page.statutmini == 'gestionnaire_utilisateur' %} selected {% endif %}>{{ trad.statut_user_administrator }}</option> | ||
<option value="administrateur" {% if page.statutmini == 'administrateur' %} selected {% endif %}>{{ trad.statut_administrator }}</option> | ||
</select> | ||
</td> | ||
<td><input type="text" name="lien" value="{{ page.lien }}" class="form-control"></td> | ||
|
||
<td><input type="checkbox" id="nouveauonglet" name="nouveauonglet" value="1" {% if page.nouveauonglet == 1 %} checked {% endif %}></td> | ||
<td><div><input type="number" name="ordre" size="2" value="{{ page.ordre }}" class="form-control" /></div></td> | ||
<td><button type="submit" class="btn btn-info btn-md"><i class="icon fa fa-check"></i></button></td> | ||
</form> | ||
<form method="post" id="supPage{{page.nom}}" action="?p=admin_page"> | ||
<input type="hidden" name="p" value="admin_page" /> | ||
<input type="hidden" name="nom" value="{{page.nom}}" /> | ||
<input type="hidden" name="action" value="delete" /> | ||
<td><button type="button" class="btn btn-danger btn-md" data-bs-toggle="modal" data-bs-target="#modal-warning" data-texte="{{trad.confirm_del}} : {{page.titre}}" data-idsup="{{ page.nom }}"><i class="icon fa fa-trash"></i></button></td> | ||
</form> | ||
</tr> | ||
{% endif %} | ||
{% endfor %} | ||
</table> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="row"> | ||
<div class="col col-xs-12"> | ||
<h4>Page de connexion</h4> | ||
|
||
<table class="table table-striped"> | ||
<tr> | ||
<th>{{trad.fieldname}}</th> | ||
<th>Statut</th> | ||
<th>{{trad.link}}</th> | ||
<th>Un autre onglet</th> | ||
<th>Ordre</th> | ||
<th colspan="2">{{trad.action}}</th> | ||
</tr> | ||
|
||
<form method="post" action="admin.php?p=admin_page" > | ||
<input type="hidden" name="p" value="admin_page" /> | ||
<input type="hidden" name="action" value="add" /> | ||
<input type="hidden" name="emplacement" value="2" /> | ||
<tr> | ||
<td><input type="text" name="titre" size="30" class="form-control" /></td> | ||
<td> | ||
<select name="statutmini" id="select_auth_mode" class="form-control" size="1"> | ||
<option value="nc" selected>{{ trad.statut_non_connecte }}</option> | ||
<!--<option value="visiteur" >{{ trad.statut_visitor }}</option> | ||
<option value="utilisateur">{{ trad.statut_user }}</option> | ||
<option value="gestionnaire_utilisateur">{{ trad.statut_user_administrator }}</option> | ||
<option value="administrateur">{{ trad.statut_administrator }}</option>--> | ||
</select> | ||
</td> | ||
<td><input type="text" name="lien" size="30" class="form-control" /></td> | ||
<td><input type="checkbox" id="nouveauonglet" name="nouveauonglet" value="1" checked /></td> | ||
<td><input type="number" name="ordre" size="3" value ="0" class="form-control" /></td> | ||
<td colspan="2"><input type="submit" name="submit" value="{{ trad.add }}" class="btn bg-green" /></td> | ||
</tr> | ||
</form> | ||
|
||
{% for page in lesPages %} | ||
{% if page.emplacement == 2 %} | ||
<tr> | ||
<form method="post" action="?p=admin_page"> | ||
<input type="hidden" name="p" value="admin_overload" /> | ||
<input type="hidden" name="nom" value="{{page.nom}}" /> | ||
<input type="hidden" name="action" value="change" /> | ||
|
||
<td><input type="text" name="titre" value="{{ page.titre }}" class="form-control"></td> | ||
<td> | ||
<select name="statutmini" class="form-control" size="1"> | ||
<option value="nc" {% if page.statutmini == 'nc' %} selected {% endif %}>{{ trad.statut_non_connecte }}</option> | ||
<!--<option value="visiteur" {% if page.statutmini == 'visiteur' %} selected {% endif %}>{{ trad.statut_visitor }}</option> | ||
<option value="utilisateur" {% if page.statutmini == 'utilisateur' %} selected {% endif %}>{{ trad.statut_user }}</option> | ||
<option value="gestionnaire_utilisateur" {% if page.statutmini == 'gestionnaire_utilisateur' %} selected {% endif %}>{{ trad.statut_user_administrator }}</option> | ||
<option value="administrateur" {% if page.statutmini == 'administrateur' %} selected {% endif %}>{{ trad.statut_administrator }}</option>--> | ||
</select> | ||
</td> | ||
<td><input type="text" name="lien" value="{{ page.lien }}" class="form-control"></td> | ||
|
||
<td><input type="checkbox" id="nouveauonglet" name="nouveauonglet" value="1" {% if page.nouveauonglet == 1 %} checked {% endif %}></td> | ||
<td><div><input type="number" name="ordre" size="2" value="{{ page.ordre }}" class="form-control" /></div></td> | ||
<td><button type="submit" class="btn btn-info btn-md"><i class="icon fa fa-check"></i></button></td> | ||
</form> | ||
<form method="post" id="supPage{{page.nom}}" action="?p=admin_page"> | ||
<input type="hidden" name="p" value="admin_page" /> | ||
<input type="hidden" name="nom" value="{{page.nom}}" /> | ||
<input type="hidden" name="action" value="delete" /> | ||
<td><button type="button" class="btn btn-danger btn-md" data-bs-toggle="modal" data-bs-target="#modal-warning" data-texte="{{trad.confirm_del}} : {{page.titre}}" data-idsup="{{ page.nom }}"><i class="icon fa fa-trash"></i></button></td> | ||
</form> | ||
</tr> | ||
{% endif %} | ||
{% endfor %} | ||
</table> | ||
</div> | ||
</div> | ||
|
||
|
||
<!-- popup modal --> | ||
<div class="modal fade" id="modal-warning" style="display: none;" aria-hidden="true"> | ||
<form action="?p=admin_page" id="formmodal"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content bg-warning"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title">{{trad.confirm_del}}</h4> | ||
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<span class="modaltexte" id="modaltexte"></span><span class="modalidsup" id="modalidsup" hidden></span> | ||
</div> | ||
<div class="modal-footer justify-content-between"> | ||
<button type="button" class="btn btn-outline-dark" data-bs-dismiss="modal">{{trad.NO}}</button> | ||
<button type="submit" id="liensup" class="btn btn-outline-dark">{{trad.YES}}</button> | ||
</div> | ||
</div><!-- /.modal-content --> | ||
</div><!-- /.modal-dialog --> | ||
</form> | ||
</div><!-- /.modal --> | ||
|
||
{% endblock %} | ||
|
||
{% block javascript %} | ||
<script> | ||
// Modal | ||
$('#modal-warning').on('show.bs.modal', function (event) { | ||
var button = $(event.relatedTarget) // Button that triggered the modal | ||
var idasup = button.data('idsup')// Extract info from data-* attributes | ||
var texte = button.data('texte') | ||
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback). | ||
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. | ||
var modal = $(this) | ||
modal.find('.modalidsup').text(idasup) | ||
modal.find('.modaltexte').text(texte) | ||
}) | ||
$(function(){ | ||
$('#formmodal').submit(function(e) { | ||
e.preventDefault() | ||
var $form = $(this) | ||
var v=document.getElementById('modalidsup').innerHTML | ||
$.post($form.attr('action'), $form.serialize()) | ||
.done(function(data) { | ||
$('#html').html(data); | ||
$('#modal-warning').modal('hide'); | ||
//document.location.href='?p=admin_overload&action=delete&id_overload='+v+'; | ||
document.getElementById("supPage"+v).submit(); | ||
}) | ||
.fail(function() { | ||
alert('Une erreur est survenue : GRRJS') | ||
}) | ||
}) | ||
}) | ||
</script> | ||
{% endblock %} |
Oops, something went wrong.
770850f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonjour,
dans maj.php, ne serait-ce pas plutôt grr_page que grr_room qui devrait être modifiée ?
Cordialement,
YN