From ca98adeda7f7ea44b55b8b895957eae1cb111eda Mon Sep 17 00:00:00 2001
From: satish <satish.dvnk@vtiger.com>
Date: Wed, 25 Oct 2017 19:12:11 +0530
Subject: [PATCH] Fixes #684 - Dashboard Tag Cloud - Only shows Tag's that are
 created by the User

---
 .../Vtiger/dashboards/TagCloudContents.tpl    | 12 +++++++-----
 layouts/v7/skins/contact/style.css            | 16 ++++++++++++++++
 layouts/v7/skins/inventory/style.css          | 16 ++++++++++++++++
 layouts/v7/skins/marketing/style.css          | 16 ++++++++++++++++
 .../v7/skins/marketing_and_sales/style.css    | 16 ++++++++++++++++
 layouts/v7/skins/project/style.css            | 16 ++++++++++++++++
 layouts/v7/skins/sales/style.css              | 16 ++++++++++++++++
 layouts/v7/skins/support/style.css            | 16 ++++++++++++++++
 layouts/v7/skins/tools/style.css              | 16 ++++++++++++++++
 layouts/v7/skins/vtiger/style.less            | 19 ++++++++++++++++++-
 modules/Vtiger/dashboards/TagCloud.php        |  2 +-
 11 files changed, 154 insertions(+), 7 deletions(-)

diff --git a/layouts/v7/modules/Vtiger/dashboards/TagCloudContents.tpl b/layouts/v7/modules/Vtiger/dashboards/TagCloudContents.tpl
index 1791bf8c..90e29347 100644
--- a/layouts/v7/modules/Vtiger/dashboards/TagCloudContents.tpl
+++ b/layouts/v7/modules/Vtiger/dashboards/TagCloudContents.tpl
@@ -7,11 +7,13 @@
  * All Rights Reserved.
  *************************************************************************************}
 {strip}
-    <div class="tagsContainer" id="tagCloud">
-		{foreach from=$TAGS[1] item=TAG_ID key=TAG_NAME}
-                    <div class=" textOverflowEllipsis col-sm-4" title="{$TAG_NAME}">
-			<a class="tagName cursorPointer" data-tagid="{$TAG_ID}" rel="{$TAGS[0][$TAG_NAME]}">{$TAG_NAME}</a>&nbsp;		
-                    </div>
+	<div class="tagsContainer" id="tagCloud">
+		{foreach item=TAG_MODEL from=$TAGS name=tagCounter}
+			{assign var=TAG_LABEL value=$TAG_MODEL->getName()}
+			{assign var=TAG_ID value=$TAG_MODEL->getId()}
+			<span class="tag" title="{$TAG_MODEL->getName()}" data-type="{$TAG_MODEL->getType()}" data-id="{$TAG_ID}">
+				<span class="tagName display-inline-block textOverflowEllipsis cursorPointer" data-tagid="{$TAG_ID}">{$TAG_MODEL->getName()}</span>
+			</span>
 		{/foreach}
 	</div>
 {/strip}	
\ No newline at end of file
diff --git a/layouts/v7/skins/contact/style.css b/layouts/v7/skins/contact/style.css
index ea321b08..4c34a8a9 100644
--- a/layouts/v7/skins/contact/style.css
+++ b/layouts/v7/skins/contact/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/inventory/style.css b/layouts/v7/skins/inventory/style.css
index 19afbb1d..5b177c0c 100644
--- a/layouts/v7/skins/inventory/style.css
+++ b/layouts/v7/skins/inventory/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/marketing/style.css b/layouts/v7/skins/marketing/style.css
index d1f1253a..5ad0f30e 100644
--- a/layouts/v7/skins/marketing/style.css
+++ b/layouts/v7/skins/marketing/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/marketing_and_sales/style.css b/layouts/v7/skins/marketing_and_sales/style.css
index ba6826af..0a5c6c0c 100644
--- a/layouts/v7/skins/marketing_and_sales/style.css
+++ b/layouts/v7/skins/marketing_and_sales/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/project/style.css b/layouts/v7/skins/project/style.css
index e7c08a32..c45bc18d 100644
--- a/layouts/v7/skins/project/style.css
+++ b/layouts/v7/skins/project/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/sales/style.css b/layouts/v7/skins/sales/style.css
index ef198b53..2fb98bb5 100644
--- a/layouts/v7/skins/sales/style.css
+++ b/layouts/v7/skins/sales/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/support/style.css b/layouts/v7/skins/support/style.css
index fbd8a0c5..2630094f 100644
--- a/layouts/v7/skins/support/style.css
+++ b/layouts/v7/skins/support/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/tools/style.css b/layouts/v7/skins/tools/style.css
index e029ed20..ef60ee9e 100644
--- a/layouts/v7/skins/tools/style.css
+++ b/layouts/v7/skins/tools/style.css
@@ -4402,6 +4402,22 @@ form[name="notification_settings"] .select2-choice {
   width: 100%;
   border: 1px solid #dcdcdc;
 }
+#tagCloud .tag {
+  color: #5ea9dd;
+  padding: 0px;
+  background-color: #FFFFFF;
+  border-color: #FFFFFF;
+  border-radius: 0px;
+  margin: 3px;
+}
+#tagCloud .tag[data-type="public"] {
+  color: #3cb878;
+}
+#tagCloud .tag .tagName {
+  margin: 3px;
+  max-width: 80px;
+  vertical-align: bottom;
+}
 #s2id_memberList li > div,
 .groupMembersColors li > div {
   margin-left: 10px;
diff --git a/layouts/v7/skins/vtiger/style.less b/layouts/v7/skins/vtiger/style.less
index 2e602184..1e320a8f 100644
--- a/layouts/v7/skins/vtiger/style.less
+++ b/layouts/v7/skins/vtiger/style.less
@@ -5109,7 +5109,24 @@ form[name="notification_settings"] .select2-choice {
             border : 1px solid #dcdcdc;
         }
     }
-} 
+}
+#tagCloud {
+	.tag {
+		background-color: @white;
+		border-color: @white;
+		border-radius: 0px;
+		color : #5ea9dd;
+		&[data-type="public"] {
+			color : #3cb878;
+		}
+		margin: 3px;
+		.tagName {
+			margin: 3px;
+			max-width: 80px;
+			vertical-align: bottom;
+		}
+	}
+}
 
 /******************************************* 
 ********** Groups view styles ********
diff --git a/modules/Vtiger/dashboards/TagCloud.php b/modules/Vtiger/dashboards/TagCloud.php
index 61910fd6..bff60fe3 100644
--- a/modules/Vtiger/dashboards/TagCloud.php
+++ b/modules/Vtiger/dashboards/TagCloud.php
@@ -34,7 +34,7 @@ class Vtiger_TagCloud_Dashboard extends Vtiger_IndexAjax_View {
 		
 		$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
 		
-		$tags = Vtiger_Tag_Model::getAll($currentUser->id);
+		$tags = Vtiger_Tag_Model::getAllUserTags($currentUser->getId());
 
 		//Include special script and css needed for this widget
 		$viewer->assign('SCRIPTS',$this->getHeaderScripts($request));
-- 
GitLab