[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 09/11: CCARD : remove category card with conf
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 09/11: CCARD : remove category card with confirm, remove dead code |
Date: |
Thu, 8 Aug 2024 14:52:17 -0400 (EDT) |
sparkyx pushed a commit to branch unstable
in repository noalyss.
commit ff510f6989b2273220ad34d35abc891fb4aa458b
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Aug 7 18:25:43 2024 +0200
CCARD : remove category card with confirm, remove dead code
---
html/js/card.js | 20 ++++++++--------
include/cfgfiche.inc.php | 50 +--------------------------------------
include/class/fiche_def.class.php | 7 +++++-
3 files changed, 17 insertions(+), 60 deletions(-)
diff --git a/html/js/card.js b/html/js/card.js
index 37211d80e..a61b4cd29 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -1440,6 +1440,7 @@ var CategoryCardDefinition = function (dossier_id,
fiche_def_id) {
CategoryCardDefinition.prototype.save = function () {
try {
+ var here = this;
var aAttribut=Sortable.serialize(this.existing_list);
var queryString = {
gDossier: this.dossier_id,
@@ -1462,8 +1463,7 @@ CategoryCardDefinition.prototype.save = function () {
if ( req.responseText == 'OK') {
smoke.signal('Sauvé',function(e){},{duration:500});
}
- // if successfull add id on existing_list and remove from
available_list
- console.debug(here);
+
}
}
@@ -1477,10 +1477,10 @@ CategoryCardDefinition.prototype.save = function () {
* @param attribut_id {int} attr_def.ad_id , ad_id of attribute
*/
CategoryCardDefinition.prototype.add_attribut = function (attribut_id) {
- var here = this;
- console.debug(`add ${attribut_id}`);
- try {
+
+ try {
+ var here = this;
var queryString = {
gDossier: this.dossier_id,
fiche_def_id: this.fiche_def_id,
@@ -1501,18 +1501,18 @@ CategoryCardDefinition.prototype.add_attribut =
function (attribut_id) {
}
// if successfull add id on existing_list and remove from
available_list
- console.debug(here);
+
// remove from available_list
$('avail_attr_' + attribut_id).remove();
- alternate_row_color_list(here.available_list);
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText,
'text/html');
- $(here.existing_list).appendChild(element.body.firstChild);
+
$(here.existing_list).appendChild(element.body.firstChild);
new Effect.Highlight('existing_attr_' + attribut_id, {
startcolor: '#FAD4D4',
endcolor: '#F78082'
});
Sortable.create('attribut_card', {tag: 'li'});
+ alternate_row_color_list(here.available_list);
}
}
);
@@ -1525,7 +1525,7 @@ CategoryCardDefinition.prototype.add_attribut = function
(attribut_id) {
* @param attribut_id {int} attr_def.ad_id , ad_id of attribute
*/
CategoryCardDefinition.prototype.remove_attribut = function (attribut_id) {
- console.debug(`remove ${attribut_id}`);
+
var here = this;
try {
@@ -1549,7 +1549,7 @@ CategoryCardDefinition.prototype.remove_attribut =
function (attribut_id) {
}
// if successfull add id on existing_list and remove from
available_list
- console.debug(here);
+
// remove from available_list
$('existing_attr_' + attribut_id).remove();
var parser = new DOMParser();
diff --git a/include/cfgfiche.inc.php b/include/cfgfiche.inc.php
index da3468b4f..ddbd84f8f 100644
--- a/include/cfgfiche.inc.php
+++ b/include/cfgfiche.inc.php
@@ -28,43 +28,6 @@ global $http;
$retour=HtmlInput::button_anchor("Retour à la liste",
HtmlInput::get_to_string(array("gDossier","ac")));
$action=$http->post('action',"string", '');
/*******************************************************************************************/
-// Add an attribut
-/*******************************************************************************************/
-if ( $action == 'add_line')
-{
- $fd_id=$http->request("fd_id","number");
- $ad_id=$http->request("ad_id","number");
- $fiche_def=new Fiche_Def($cn,$fd_id);
- $fiche_def->InsertAttribut($ad_id);
- echo $fiche_def->input_detail();
- echo $retour;
- return;
-}
-/*******************************************************************************************/
-// Remove an attribut
-/*******************************************************************************************/
-if ( $action == 'remove_line' )
-{
- $fd_id=$http->request("fd_id","number");
- $fiche_def=new Fiche_Def($cn,$fd_id);
- try
- {
- $ck_remove=$http->request('chk_remove');
- $fiche_def->RemoveAttribut($ck_remove);
- }
- catch (Exception $exc)
- {
- throw new Exception(_("Vous devez choisir au moins une ligne"));
- }
- finally
- {
- echo $fiche_def->input_detail();
- echo $retour;
- return;
- }
-
-}
-/*******************************************************************************************/
// Try to remove a category
/*******************************************************************************************/
if ( $action == 'remove_cat' )
@@ -107,18 +70,7 @@ if ( isset ($_POST['change_name']))
echo $retour;
return;
}
-/*******************************************************************************************/
-// Save order of the attributes
-/*******************************************************************************************/
-if ( $action == 'save_line' )
-{
- $fd_id=$http->request("fd_id","number");
- $fiche_def=new Fiche_Def($cn,$fd_id);
- $fiche_def->save_order($_POST);
- echo $fiche_def->input_detail();
- echo $retour;
- return;
-}
+
/*******************************************************************************************/
// Save a new category of card
/*******************************************************************************************/
diff --git a/include/class/fiche_def.class.php
b/include/class/fiche_def.class.php
index 864b02af5..965f9159d 100644
--- a/include/class/fiche_def.class.php
+++ b/include/class/fiche_def.class.php
@@ -770,13 +770,18 @@ $order
$fd_description->heigh=4;
$fd_description->style='class="itextarea form-control input_text"
style="margin-left:0px;vertical-align:text-top"';
$fd_description->value=$this->fd_description;
- $r.='<form method="post">';
+ $r.='<form method="post" style="display:inline">';
$r.=\HtmlInput::hidden('fd_id',$this->id);
ob_start();
require_once NOALYSS_TEMPLATE.'/fiche_def_input.php';
$r.=ob_get_contents();
ob_clean();
$r.=HtmlInput::submit('change_name', _('Sauver'));
+ $r.='</form>';
+ $r.='<form method="post" style="display:inline" id="catcard_remove"
onsubmit="return confirm_box(this,\'Effacer?\')">';
+ $r.=HtmlInput::hidden("action", "remove_cat");
+ $r.=HtmlInput::hidden('fd_id',$this->id);
+ $r.=HtmlInput::submit('remove_cat', _('Effacer'));
$r.='</form>';
require NOALYSS_TEMPLATE.'/fiche_def-input_detail.php';
- [Noalyss-commit] [noalyss] branch unstable updated (65dd4e31c -> 451b9cb7c), dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 03/11: GESTION : operation add receipt number, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 11/11: documentation, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 01/11: Documentation, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 07/11: CCARD : rewrite, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 04/11: CCARD : rewriting interface, code cleanup, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 08/11: new function alternate_row_color_list, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 09/11: CCARD : remove category card with confirm, remove dead code,
dwm <=
- [Noalyss-commit] [noalyss] 05/11: Javascript : documentation avec JSDOC, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 06/11: Cosmetic h1.legend, legend & fieldset, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 10/11: Fix : retrieve label from tva_code, dwm, 2024/08/08
- [Noalyss-commit] [noalyss] 02/11: Bug : fix create event from AGENDA, dwm, 2024/08/08