[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 87/323: task #0001533: Possibilité d'activer
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 87/323: task #0001533: Possibilité d'activer ou désactiver des étiquettes |
Date: |
Wed, 14 Mar 2018 17:38:28 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 31e3f754303104d25ecc42b693aa1a0c608e79a1
Author: Dany De Bontridder <address@hidden>
Date: Thu Jan 25 15:13:05 2018 +0100
task #0001533: Possibilité d'activer ou désactiver des étiquettes
---
html/ajax_misc.php | 3 +++
html/js/scripts.js | 25 +++++++++++++++++++--
include/ajax/ajax_tag_save.php | 45 +++++++++++++++++++++++++++++++++++---
include/class/tag.class.php | 7 +++---
include/database/tag_sql.class.php | 2 ++
include/template/tag_detail.php | 9 ++++++++
include/template/tag_list.php | 15 +++++++++++++
sql/upgrade.sql | 9 +++++++-
8 files changed, 106 insertions(+), 9 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 3c4e80e..2b6b3be 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -158,12 +158,15 @@ $path = array(
"navigator"=>"ajax_navigator",
"preference"=>"ajax_preference",
"bookmark"=>"ajax_bookmark",
+ // Tag
"tag_detail"=>"ajax_tag_detail",
"tag_save"=>"ajax_tag_save",
"tag_list"=>"ajax_tag_list",
"tag_add"=>"ajax_tag_add_action",
"tag_remove"=>"ajax_tag_remove_action",
"tag_choose"=>"ajax_tag_choose",
+ "tag_activate"=>"ajax_tag_save",
+ // search
"search_display_tag"=>"ajax_search_display_tag",
"search_add_tag"=>"ajax_search_add_tag",
"search_clear_tag"=>"ajax_search_clear_tag",
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 8d2c307..6334279 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -2392,7 +2392,8 @@ function show_tag(p_dossier, p_ac, p_tag_id, p_post)
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
remove_waiting_box();
- add_div({id: 'tag_div', cssclass: 'inner_box', drag:
1});
+ var posy=calcy(250);
+ add_div({id: 'tag_div', cssclass: 'inner_box', drag:
0,style:"position:fixed;top:"+posy+"px"});
$('tag_div').innerHTML = code_html;
try
{
@@ -2551,7 +2552,27 @@ function action_tag_remove(p_dossier, ag_id, t_id)
});
}
-
+/**
+ * Activate a tag
+ * @param int p_dossier
+ * @param int p_tag_id
+ */
+function activate_tag(p_dossier, p_tag_id) {
+ waiting_box();
+ new Ajax.Request("ajax_misc.php",
+ {
+ method:"get",
+ parameters:{gDossier:p_dossier,op:'tag_activate',t_id:p_tag_id},
+ onSuccess:function(req) {
+ remove_waiting_box();
+ var answer=req.responseText.evalJSON();
+ var tagId="tag_onoff"+p_tag_id;
+ $(tagId).update(answer.code);
+ $(tagId).setStyle(answer.style);
+ remove_waiting_box();
+ }
+ })
+}
/**
* Display a div with available tags, this div can update the cell
* tag_choose_td
diff --git a/include/ajax/ajax_tag_save.php b/include/ajax/ajax_tag_save.php
index 439c668..d8b8e1e 100644
--- a/include/ajax/ajax_tag_save.php
+++ b/include/ajax/ajax_tag_save.php
@@ -3,13 +3,52 @@
//see licence.txt
/**
address@hidden
- address@hidden save a new tag
+ address@hidden save a new tag or disable / enable the tag
address@hidden Tag
*/
if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+$http=new HttpInput();
+$op=$http->request("op");
+global $g_user;
+$nDossier=Dossier::id();
+///check security
+if ( $g_user->check_module('CFGTAG')==0)
+{
+ die(_("non permis"));
+}
+
require_once NOALYSS_INCLUDE.'/class/tag.class.php';
-$tag=new Tag($cn);
-$tag->save($_GET);
+//Save a tag
+if ($op=='ajax_tag_save')
+{
+ $tag=new Tag($cn);
+ $tag->save($_GET);
+ return;
+}
+//---------------------------------------------------------------------
+// Enable or disable a tag
+//---------------------------------------------------------------------
+if ( $op == "tag_activate")
+{
+ $tag_id=$http->get("t_id");
+ $tag=new Tag($cn, $tag_id);
+ $return=array();
+ $id=sprintf("tag_onoff%d",$tag_id);
+ if ( $tag->data->getp('t_actif') == 'Y')
+ {
+ $tag->data->t_actif='N';
+ $tag->data->save();
+ $return['code']='';
+ $return['style']='color:red';
+ } else {
+ $tag->data->t_actif='Y';
+ $tag->data->save();
+ $return['code']='';
+ $return['style']='color:green';
+ }
+ header("Content-type: text/json; charset: utf8",true);
+ echo json_encode($return);
+}
?>
diff --git a/include/class/tag.class.php b/include/class/tag.class.php
index afd19e5..a6a6855 100644
--- a/include/class/tag.class.php
+++ b/include/class/tag.class.php
@@ -41,7 +41,7 @@ class Tag
*/
function select()
{
- $ret=$this->data->seek(' order by t_tag');
+ $ret=$this->data->seek("where t_actif='Y' order by t_tag");
require_once NOALYSS_TEMPLATE.'/tag_select.php';
}
/**
@@ -57,7 +57,7 @@ class Tag
*/
function show_form_add()
{
- echo '<h2>'.' Ajout d\'un dossier (ou tag)'.'</h2>';
+ echo h2(_("Ajout d'un dossier (ou tag)"));
$this->form_add();
}
@@ -67,6 +67,7 @@ class Tag
$this->data->t_id=$p_array['t_id'];
$this->data->t_tag= strip_tags($p_array['t_tag']);
$this->data->t_description=strip_tags($p_array['t_description']);
+ $this->data->t_actif=$p_array['t_actif'];
$this->data->save();
}
function remove($p_array)
@@ -81,7 +82,7 @@ class Tag
static function button_search($p_prefix)
{
$r="";
- $r.=HtmlInput::button("choose_tag", "Etiquette",
'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\')"',
"smallbutton");
+ $r.=HtmlInput::button("choose_tag", _("Etiquette"),
'onclick="search_display_tag('.Dossier::id().',\''.$p_prefix.'\')"',
"smallbutton");
return $r;
}
/**
diff --git a/include/database/tag_sql.class.php
b/include/database/tag_sql.class.php
index 07a9398..f66e9bc 100644
--- a/include/database/tag_sql.class.php
+++ b/include/database/tag_sql.class.php
@@ -36,11 +36,13 @@ class Tag_SQL extends Noalyss_SQL
"t_id" => "t_id"
, "t_tag" => "t_tag"
, "t_description" => "t_description"
+ ,'t_actif'=>'t_actif'
);
$this->type = array(
"t_id" => "numeric"
, "t_tag" => "text"
, "t_description" => "text"
+ ,'t_actif'=>"text"
);
$this->default = array(
"t_id" => "auto",
diff --git a/include/template/tag_detail.php b/include/template/tag_detail.php
index 6ca82c7..a9cf26e 100644
--- a/include/template/tag_detail.php
+++ b/include/template/tag_detail.php
@@ -10,6 +10,12 @@ echo $uos->hidden();
$t_tag=new IText('t_tag',$data->t_tag);
$t_description=new ITextarea('t_description',$data->t_description);
$t_description->style=' class="itextarea" style="height:5em;vertical-align:
top;"';
+$t_actif=new ISelect("t_actif");
+$t_actif->value=[
+ ['label'=>_('Actif'),'value'=>'Y'],
+ ['label'=>_('Non actif'),'value'=>'N']
+ ];
+$t_actif->selected=$data->t_actif;
?>
<p>
<?php echo _("Etiquette (tag)")?> : <?php echo $t_tag->input(); ?>
@@ -17,6 +23,9 @@ $t_description->style=' class="itextarea"
style="height:5em;vertical-align: top;
<p>
<?php echo _("Description")?> : <?php echo $t_description->input(); ?>
</p>
+<p>
+ <?=_("Tag actif") ?><?=$t_actif->input()?>
+</p>
<?php
// If exist you can remove it
if ( $data->t_id != '-1') :
diff --git a/include/template/tag_list.php b/include/template/tag_list.php
index 8b02aed..962e3ab 100644
--- a/include/template/tag_list.php
+++ b/include/template/tag_list.php
@@ -4,6 +4,7 @@
?><?php
$max=$this->cn->count($ret);
echo HtmlInput::filter_table("tag_tb", '0,1', '1');
+$nDossier=Dossier::id();
?>
<table id="tag_tb">
<tr>
@@ -32,6 +33,20 @@ $ac=$_REQUEST['ac'];
echo $row['t_description'];
?>
</td>
+ <td>
+ <?php
+ $id=sprintf("tag_onoff%d",$row['t_id']);
+ // Activate button
+ if ( $row['t_actif'] == "Y") {
+ $js=sprintf("activate_tag('%s','%s')",$nDossier,$row['t_id']);
+ echo Icon_Action::iconon($id, $js);
+ } else {
+ $js=sprintf("activate_tag('%s','%s')",$nDossier,$row['t_id']);
+ echo Icon_Action::iconoff($id, $js);
+
+ }
+ ?>
+ </td>
</tr>
<?php
endfor;
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index d74f0ae..eebd134 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -99,4 +99,11 @@ comment on column jrn.jr_optype is 'Type of operation , NOR
= NORMAL , OPE openi
update jrn set jr_optype='NOR';
-- update quant_sold set qs_vat_sided=round(qs_vat_sided,2);
--- update quant_purchase set qp_vat_sided=round(qp_vat_sided,2);
\ No newline at end of file
+-- update quant_purchase set qp_vat_sided=round(qp_vat_sided,2);
+
+alter table tags add column t_actif char(1);
+update tags set t_actif='Y';
+ALTER TABLE tags ADD CONSTRAINT tags_check CHECK (t_actif in ('N','Y')) ;
+alter table tags alter t_actif set default 'Y';
+COMMENT ON COLUMN tags.t_actif is 'Y if the tag is activate and can be used ';
+
- [Noalyss-commit] [noalyss] 89/323: task #0001533: Possibilité d'activer ou désactiver des étiquettes Cache ou montre les tags inactifs dans recherche, (continued)
- [Noalyss-commit] [noalyss] 89/323: task #0001533: Possibilité d'activer ou désactiver des étiquettes Cache ou montre les tags inactifs dans recherche, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 52/323: Task #1457 & 1281 : operation ouverture séparée, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 74/323: Task #0001530: Réécriture PRINTJRN : export CSV, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 95/323: git bug created by the merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 99/323: correct bug created by the merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 92/323: Icon_Action : add the icon trashbin, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 86/323: cosmetique :tags on one line in the action search box, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 67/323: Task #0001530: Réécriture PRINTJRN Rename file template/acc_history_ledger_sale_oneline.php to template/acc_ledger_history_sale_oneline.php Manage PURCHASE - oneline,detailled , extended and accounting Adapt test file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 98/323: correct bug created by the merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 96/323: correct bug created by the merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 87/323: task #0001533: Possibilité d'activer ou désactiver des étiquettes,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 97/323: Correction esthétique PERIODE par journaux, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 101/323: Fix bug from merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 104/323: remove debug, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 102/323: correct bug created by the merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 94/323: Merge branch 'dev-6919.8', Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 108/323: Remove grant / revoke command, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 107/323: Add licence + template name, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 106/323: fix: cannot create new folder due to a typo error, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 91/323: FollowUp : improve esthetic, use inplace_edit for commenting on files, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 112/323: Change theme : corner for menu2 , no more border-radius for menu1, Dany De Bontridder, 2018/03/14