[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 06/13: Tag : add color to tags
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 06/13: Tag : add color to tags |
Date: |
Wed, 11 Nov 2020 10:23:42 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 656ab45372893f6274326f86839caefdd0b4e882
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Nov 10 13:54:43 2020 +0100
Tag : add color to tags
---
html/js/scripts.js | 15 +++++++
html/style-classic.css | 86 +++++++++++++++++++++++++++++++++++
html/style-classic7.css | 86 +++++++++++++++++++++++++++++++++++
html/style-light.css | 87 ++++++++++++++++++++++++++++++++++++
include/ajax/ajax_tag_add_action.php | 2 +-
include/ajax/ajax_tag_detail.php | 20 ++++++---
include/class/follow_up.class.php | 21 +++++++--
include/class/tag.class.php | 19 ++++++--
include/database/tag_sql.class.php | 2 +
include/template/tag_detail.php | 26 ++++++++++-
include/template/tag_list.php | 2 +-
include/template/tag_select.php | 2 +-
12 files changed, 350 insertions(+), 18 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 25307b8..69c6116 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3804,3 +3804,18 @@ function json_concat(p_json1,p_json2)
return result;
}
+/**
+ * this function unchecks other checkbox , it mimics the way a radio behaves
+ * @param string p_click is the DOM id of the checkbox you clicked
+ * @param string p_name is the name of all the checkbox to uncheck
+ */
+function uncheck_other(p_click,p_name)
+{
+ var aCheckbox=document.getElementsByName(p_name);
+ if (aCheckbox.length == 0) return;
+ var i=0;
+ for (i=0;i<aCheckbox.length;i++) {
+ aCheckbox[i].checked=false;
+ }
+ p_click.checked=true;
+}
\ No newline at end of file
diff --git a/html/style-classic.css b/html/style-classic.css
index 95be139..4a65fad 100644
--- a/html/style-classic.css
+++ b/html/style-classic.css
@@ -2451,4 +2451,90 @@ span.tagcell {
#action_add_action2_list {
height:15rem;
overflow: auto;
+}
+/*********************************************************************************************************************
+ * Color for tag
+
********************************************************************************************************************/
+.tagcell-color1 {
+ /* Nothing no color */
+}
+.tagcell-color2 {
+ background-color: #002ba3 !important;
+ color : white !important;
+
+}
+.tagcell-color3 {
+ background-color: #336699 !important;
+ color: white !important;
+}
+.tagcell-color4 {
+ background-color: #5d90cd !important;
+ color: white !important;
+}
+.tagcell-color5 {
+ background-color: #C2E3FC !important;
+ color: #002ba3 !important;
+}
+.tagcell-color6 {
+ background-color: #006318 !important;
+ color : white !important;
+}
+.tagcell-color7 {
+ background-color: #008000 !important;
+ color : white !important;
+
+}
+.tagcell-color8 {
+ background-color: #00D000 !important;
+ color : white !important;
+}
+.tagcell-color9 {
+ background-color: #87D087 !important;
+ color: white !important;
+}
+.tagcell-color10 {
+ background-color: #C8EEC8 !important;
+ color: #006318 !important;
+
+}
+.tagcell-color11 {
+ background-color: red !important;
+ color: #edeff4 !important;
+}
+.tagcell-color12 {
+ background-color: #9D0244 !important;
+ color:#edeff4 !important;
+}
+.tagcell-color13 {
+ background-color: #C14064 !important;
+ color: #edeff4 !important;
+}
+.tagcell-color14 {
+ background-color: #F07396 !important;
+ color: #edeff4 !important;
+}
+.tagcell-color15 {
+ background-color: #F2AABE !important;
+ color: red !important;
+}
+
+.tagcell-color16 {
+ background-color: #77420A !important;
+ color: #edeff4 !important;
+}
+.tagcell-color17 {
+ background-color: #B06F2A !important;
+ color: #edeff4 !important;
+}
+.tagcell-color18 {
+ background-color: orange !important;
+ color: #edeff4 !important;
+}
+.tagcell-color19 {
+ background-color: #F2CFAA !important;
+ color: red !important;
+}
+.tagcell-color20 {
+ background-color: yellow !important;
+ color: orangered !important;
}
\ No newline at end of file
diff --git a/html/style-classic7.css b/html/style-classic7.css
index c85e87c..c4e12cf 100644
--- a/html/style-classic7.css
+++ b/html/style-classic7.css
@@ -2497,3 +2497,89 @@ span.tagcell {
height:15rem;
overflow: auto;
}
+/*********************************************************************************************************************
+ * Color for tag
+
********************************************************************************************************************/
+.tagcell-color1 {
+ /* Nothing no color */
+}
+.tagcell-color2 {
+ background-color: #002ba3 !important;
+ color : white !important;
+
+}
+.tagcell-color3 {
+ background-color: #336699 !important;
+ color: white !important;
+}
+.tagcell-color4 {
+ background-color: #5d90cd !important;
+ color: white !important;
+}
+.tagcell-color5 {
+ background-color: #C2E3FC !important;
+ color: #002ba3 !important;
+}
+.tagcell-color6 {
+ background-color: #006318 !important;
+ color : white !important;
+}
+.tagcell-color7 {
+ background-color: #008000 !important;
+ color : white !important;
+
+}
+.tagcell-color8 {
+ background-color: #00D000 !important;
+ color : white !important;
+}
+.tagcell-color9 {
+ background-color: #87D087 !important;
+ color: white !important;
+}
+.tagcell-color10 {
+ background-color: #C8EEC8 !important;
+ color: #006318 !important;
+
+}
+.tagcell-color11 {
+ background-color: red !important;
+ color: #edeff4 !important;
+}
+.tagcell-color12 {
+ background-color: #9D0244 !important;
+ color:#edeff4 !important;
+}
+.tagcell-color13 {
+ background-color: #C14064 !important;
+ color: #edeff4 !important;
+}
+.tagcell-color14 {
+ background-color: #F07396 !important;
+ color: #edeff4 !important;
+}
+.tagcell-color15 {
+ background-color: #F2AABE !important;
+ color: red !important;
+}
+
+.tagcell-color16 {
+ background-color: #77420A !important;
+ color: #edeff4 !important;
+}
+.tagcell-color17 {
+ background-color: #B06F2A !important;
+ color: #edeff4 !important;
+}
+.tagcell-color18 {
+ background-color: orange !important;
+ color: #edeff4 !important;
+}
+.tagcell-color19 {
+ background-color: #F2CFAA !important;
+ color: red !important;
+}
+.tagcell-color20 {
+ background-color: yellow !important;
+ color: orangered !important;
+}
\ No newline at end of file
diff --git a/html/style-light.css b/html/style-light.css
index 096ffc1..c624db4 100644
--- a/html/style-light.css
+++ b/html/style-light.css
@@ -2384,4 +2384,91 @@ span.tagcell {
#action_add_action2_list {
height:15rem;
overflow: auto;
+}
+
+/*********************************************************************************************************************
+ * Color for tag
+
********************************************************************************************************************/
+.tagcell-color1 {
+ /* Nothing no color */
+}
+.tagcell-color2 {
+ background-color: #002ba3 !important;
+ color : white !important;
+
+}
+.tagcell-color3 {
+ background-color: #336699 !important;
+ color: white !important;
+}
+.tagcell-color4 {
+ background-color: #5d90cd !important;
+ color: white !important;
+}
+.tagcell-color5 {
+ background-color: #C2E3FC !important;
+ color: #002ba3 !important;
+}
+.tagcell-color6 {
+ background-color: #006318 !important;
+ color : white !important;
+}
+.tagcell-color7 {
+ background-color: #008000 !important;
+ color : white !important;
+
+}
+.tagcell-color8 {
+ background-color: #00D000 !important;
+ color : white !important;
+}
+.tagcell-color9 {
+ background-color: #87D087 !important;
+ color: white !important;
+}
+.tagcell-color10 {
+ background-color: #C8EEC8 !important;
+ color: #006318 !important;
+
+}
+.tagcell-color11 {
+ background-color: red !important;
+ color: #edeff4 !important;
+}
+.tagcell-color12 {
+ background-color: #9D0244 !important;
+ color:#edeff4 !important;
+}
+.tagcell-color13 {
+ background-color: #C14064 !important;
+ color: #edeff4 !important;
+}
+.tagcell-color14 {
+ background-color: #F07396 !important;
+ color: #edeff4 !important;
+}
+.tagcell-color15 {
+ background-color: #F2AABE !important;
+ color: red !important;
+}
+
+.tagcell-color16 {
+ background-color: #77420A !important;
+ color: #edeff4 !important;
+}
+.tagcell-color17 {
+ background-color: #B06F2A !important;
+ color: #edeff4 !important;
+}
+.tagcell-color18 {
+ background-color: orange !important;
+ color: #edeff4 !important;
+}
+.tagcell-color19 {
+ background-color: #F2CFAA !important;
+ color: red !important;
+}
+.tagcell-color20 {
+ background-color: yellow !important;
+ color: orangered !important;
}
\ No newline at end of file
diff --git a/include/ajax/ajax_tag_add_action.php
b/include/ajax/ajax_tag_add_action.php
index 890966c..c6b44af 100644
--- a/include/ajax/ajax_tag_add_action.php
+++ b/include/ajax/ajax_tag_add_action.php
@@ -36,7 +36,7 @@ if ( $http->request("isgroup") == 't') {
$fl->tag_add($http->request('t_id',"number"));
} else {
// Add all the tag from the group
- $aTag=$cn->get_array("select t_id,t_tag from jnt_tag_group_tag jtgt join
tags on (tag_id=t_id) where tag_group_id=$1 order by 2
",[$http->request("t_id","number")]);
+ $aTag=$cn->get_array("select t_id,t_tag ,t_color from jnt_tag_group_tag
jtgt join tags on (tag_id=t_id) where tag_group_id=$1 order by 2
",[$http->request("t_id","number")]);
$nb_atag=count($aTag);
if ( $nb_atag > 0) {
for ($i=0;$i<$nb_atag;$i++){
diff --git a/include/ajax/ajax_tag_detail.php b/include/ajax/ajax_tag_detail.php
index 2004300..5e12c7b 100644
--- a/include/ajax/ajax_tag_detail.php
+++ b/include/ajax/ajax_tag_detail.php
@@ -12,9 +12,10 @@ require_once NOALYSS_INCLUDE.'/class/tag.class.php';
ob_start();
$tag=new Tag($cn);
$http=new HttpInput();
-$tag->data->t_id=$http->get("tag","number");
-if ($tag->data->t_id == -1 && $g_user->check_action(TAGADD) == 0 ) return;
-$tag->data->load();
+$data=$tag->get_data();
+$data->t_id=$http->get("tag","number");
+if ($data->t_id == -1 && $g_user->check_action(TAGADD) == 0 ) return;
+$data->load();
echo HtmlInput::title_box(_("Détail du dossier ou étiquette"),
"tag_div","close","","y");
?>
@@ -32,9 +33,10 @@ else :
<?php endif; ?>
<?php
echo dossier::hidden();
- echo HtmlInput::hidden('t_id', $_GET['tag']);
- echo HtmlInput::hidden('ac',$_GET['ac']);
- $data=$tag->data;
+ echo HtmlInput::hidden('t_id', $http->get('tag') );
+ echo HtmlInput::hidden('ac',$http->get('ac'));
+
+
require_once NOALYSS_TEMPLATE.'/tag_detail.php';
echo HtmlInput::submit("save_tag_sb", "Valider");
echo HtmlInput::button_close("tag_div");
@@ -43,8 +45,12 @@ else :
</form>
<?php
$response= ob_get_clean();
- $html=escape_xml($response);
+if (headers_sent() && DEBUG ) {
+ echo $response;
+}else {
header('Content-type: text/xml; charset=UTF-8');
+}
+ $html=escape_xml($response);
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
diff --git a/include/class/follow_up.class.php
b/include/class/follow_up.class.php
index 380743a..e674ee1 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -663,7 +663,8 @@ class Follow_Up
ag_title,dt_value,ag_ref, ag_priority,ag_state,
coalesce((select p_name from profile where
p_id=ag_dest),'Aucun groupe') as dest,
(select ad_value from fiche_Detail where f_id=ag.f_id_dest and
ad_id=1) as name,
- array_to_string((select array_agg(t1.t_tag) from action_tags
as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as
tags
+ array_to_string((select array_agg(t1.t_tag) from action_tags
as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as
tags,
+ array_to_string((select array_agg(t1.t_color) from action_tags
as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as
tags_color
from action_gestion as ag
join document_type on (ag_type=dt_id)
join document_state on (ag_state=s_id)
@@ -769,7 +770,19 @@ class Follow_Up
$r.='<td>'.$href.
h($row['ag_title'])."</A></td>";
$r.="<td>".$row['s_value']."</td>";
- $r.="<td>".$href."<span
style=\"font-size:75%\">".h($row['tags']).'</span>'.'</a>'."</td>";
+ $r.="<td>";
+ if ($row['tags']!=""){
+ $r.=$href;
+ $aColor=explode(",", $row["tags_color"]);
+ $aTags=explode(",", $row["tags"]);
+ $nb_tag=count($aTags);
+ for ( $x=0;$x<$nb_tag;$x++) {
+ $r.=sprintf('<span style="font-size:75%%"
class="tagcell-color%s">%s</span>',$aColor[$x],$aTags[$x]);
+ $r.=" ";
+ } // end loop $x
+ $r.='</a>';
+ }
+ $r.="</td>";
$r.="<td>".$href.h($row['dest']).'</a>'."</td>";
@@ -1488,7 +1501,7 @@ class Follow_Up
{
if ($this->ag_id==0)
return;
- $sql='select b.ag_id,b.t_id,b.at_id,a.t_tag'
+ $sql='select b.ag_id,b.t_id,b.at_id,a.t_tag,a.t_color'
.' from '
.' tags as a join action_tags as b on (a.t_id=b.t_id)'
.' where ag_id=$1 '
@@ -1537,7 +1550,7 @@ class Follow_Up
$c=count($a_tag);
for ($e=0; $e<$c; $e++)
{
- echo '<span class="tagcell">';
+ echo '<span class="tagcell
tagcell-color'.$a_tag[$e]['t_color'].'">';
echo $a_tag[$e]['t_tag'];
if ($g_user->can_write_action($this->ag_id)==true && $p_view !=
'READ')
{
diff --git a/include/class/tag.class.php b/include/class/tag.class.php
index 2f3b0a1..aacd777 100644
--- a/include/class/tag.class.php
+++ b/include/class/tag.class.php
@@ -21,12 +21,24 @@ require_once NOALYSS_INCLUDE.'/database/tag_sql.class.php';
class Tag
{
+ private $data; //<! Tag_SQL
function __construct($p_cn,$id=-1)
{
$this->cn=$p_cn;
$this->data=new Tag_SQL($p_cn,$id);
}
- /**
+ public function get_data()
+ {
+ return $this->data;
+ }
+
+ public function set_data($data)
+ {
+ $this->data=$data;
+ return $this;
+ }
+
+ /**
* Show the list of available tag
* @return HTML
*/
@@ -42,11 +54,11 @@ class Tag
function select()
{
$ret=$this->data->seek("where t_actif='Y' order by t_tag");
- $ret=$this->cn->exec_sql(" select t_id,t_tag,t_description,'t' as
tag_type
+ $ret=$this->cn->exec_sql(" select t_id,t_tag,t_description,'t' as
tag_type ,t_color
from tags
where t_actif='Y'
union all
- select tg_id,tg_name ,'G','g' from tag_group order by 2");
+ select tg_id,tg_name ,'G','g' ,1 from tag_group order by 2");
require_once NOALYSS_TEMPLATE.'/tag_select.php';
}
/**
@@ -73,6 +85,7 @@ class Tag
$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->t_color=$p_array['tagcell_color'];
$this->data->save();
}
function remove($p_array)
diff --git a/include/database/tag_sql.class.php
b/include/database/tag_sql.class.php
index 13698f1..9876b9c 100644
--- a/include/database/tag_sql.class.php
+++ b/include/database/tag_sql.class.php
@@ -37,12 +37,14 @@ class Tag_SQL extends Noalyss_SQL
, "t_tag" => "t_tag"
, "t_description" => "t_description"
,'t_actif'=>'t_actif'
+ ,'t_color'=>'t_color'
);
$this->type = array(
"t_id" => "numeric"
, "t_tag" => "text"
, "t_description" => "text"
,'t_actif'=>"text"
+ ,'t_color'=>"numeric"
);
$this->default = array(
"t_id" => "auto",
diff --git a/include/template/tag_detail.php b/include/template/tag_detail.php
index d2be03e..a2a9847 100644
--- a/include/template/tag_detail.php
+++ b/include/template/tag_detail.php
@@ -16,6 +16,8 @@ $t_actif->value=[
['label'=>_('Non actif'),'value'=>'N']
];
$t_actif->selected=$data->t_actif;
+$icheckbox=new ICheckBox("tagcell_color");
+$icheckbox->javascript='onclick="uncheck_other(this,\'tagcell_color\');"';
?>
<p>
<?php echo _("Etiquette (tag)")?> : <?php echo $t_tag->input(); ?>
@@ -24,7 +26,29 @@ $t_actif->selected=$data->t_actif;
<?php echo _("Description")?> : <?php echo $t_description->input(); ?>
</p>
<p>
- <?=_("Etiquette(tag) actif") ?><?=$t_actif->input()?>
+ <?=_("Couleur")?>
+</p>
+<?php
+if ( $data->t_id == '-1') $data->t_color=1;
+$nb_color=20;
+
+for ($i=1 ; $i != $nb_color+1 ; $i++ ) {
+?>
+ <span class="tagcell <?="tagcell-color".$i?>">
+ <?=_("Exemple").$i ?>
+ <?php $icheckbox->value=$i;
+ if ( $data->t_color==$i) { $icheckbox->set_check($i);} else
{$icheckbox->selected=false;}
+ echo $icheckbox->input();
+ ?>
+ </span>
+ <?php if ( $i % 5 == 0 ) echo '<br>';?>
+<?php
+
+} // end loop $i
+?>
+
+<p>
+ <?=_("Etiquette actif") ?><?=$t_actif->input()?>
</p>
<?php
// If exist you can remove it
diff --git a/include/template/tag_list.php b/include/template/tag_list.php
index fb4802a..3a25dca 100644
--- a/include/template/tag_list.php
+++ b/include/template/tag_list.php
@@ -29,7 +29,7 @@ $ac=$http->request('ac');
$row=Database::fetch_array($ret, $i);
?>
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
- <td>
+ <td class="tagcell-color<?=$row['t_color']?>">
<?php
$js=sprintf("show_tag('%s','%s','%s','p')",$gDossier,$ac,$row['t_id']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
diff --git a/include/template/tag_select.php b/include/template/tag_select.php
index f166662..59732c3 100644
--- a/include/template/tag_select.php
+++ b/include/template/tag_select.php
@@ -33,7 +33,7 @@ if (isNumber($ag_id) == 0 ) die ('ERROR : parameters
invalid');
$row=Database::fetch_array($ret, $i);
?>
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
- <td>
+ <td class="tagcell-color<?=$row['t_color']?>">
<?php
$js=sprintf("action_tag_add('%s','%s','%s','%s')",$gDossier,$ag_id,$row['t_id'],$row['tag_type']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
- [Noalyss-commit] [noalyss] branch master updated (9d5d626 -> 8bd9ba4), Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 02/13: HtmlInput::anchor, needs a javascript:void(0), Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 01/13: Cosmetic : use H2, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 03/13: Compatibility edge, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 04/13: Minor : remove warning and typo, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 05/13: Follow_Up : other card, change presentation, use a button instead of displaying a lot of cells , one per card, the button calls a dialog box with the list of other cards, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 11/13: Bug : error end-of-file, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 09/13: Export FollowUp option doesn't work, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 12/13: Bug : followup detail operation: price Purchase or Sale, amount_from_type lost when searching , because exists in double, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 08/13: Tag sorted alphabetically, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 06/13: Tag : add color to tags,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 10/13: Bug : display unused other card options, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 13/13: minor changes : remove commented code, add new color for tags, Dany De Bontridder, 2020/11/11
- [Noalyss-commit] [noalyss] 07/13: task #0001697: Extension usage des étiquettes , tag on operation + export CSV + filter, Dany De Bontridder, 2020/11/11