Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-03-03-23-44-14
[civicrm-core.git] / templates / CRM / Contact / Form / Edit / TagsAndGroups.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 *}
26 {literal}
27 <style>
28 #tagtree .highlighted > span {
29 background-color: #fefca6;
30 }
31 #tagtree .helpicon ins {
32 display: none;
33 }
34 #tagtree ins.jstree-icon {
35 cursor: pointer;
36 }
37 </style>
38 <script type="text/javascript">
39 (function($, _){{/literal}
40 var entityID='{$entityID}',
41 entityTable='{$entityTable}',
42 $form = $('form.{$form.formClass}');
43 {literal}
44
45 $(function() {
46 function highlightSelected() {
47 $("ul input:not(:checked)", '#tagtree').each(function () {
48 $(this).closest("li").removeClass('highlighted');
49 });
50 $("ul input:checked", '#tagtree').each(function () {
51 $(this).parents("li[id^=tag]").addClass('highlighted');
52 });
53 }
54 highlightSelected();
55
56 $("#tagtree input").change(function(){
57 highlightSelected();
58 });
59
60 //load js tree.
61 $("#tagtree").jstree({
62 plugins : ["themes", "html_data"],
63 themes: {
64 "theme": 'classic',
65 "dots": false,
66 "icons": false,
67 "url": CRM.config.resourceBase + 'packages/jquery/plugins/jstree/themes/classic/style.css'
68 }
69 });
70
71 {/literal}
72 {if !empty($permission) && $permission neq 'edit'}
73 {literal}
74 $("#tagtree input").prop('disabled', true);
75 {/literal}
76 {/if}
77 {literal}
78 });
79 })(CRM.$, CRM._);
80 {/literal}
81 </script>
82
83 {if $title}
84 <div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed">
85 <div class="crm-accordion-header">{$title}</div>
86 <div class="crm-accordion-body" id="tagGroup">
87 {/if}
88 <table class="form-layout-compressed{if $context EQ 'profile'} crm-profile-tagsandgroups{/if}">
89 <tr>
90 {if !$type || $type eq 'group'}
91 <td>
92 {if $groupElementType eq 'select'}
93 <span class="label">{if $title}{$form.group.label}{/if}</span>
94 {/if}
95 {$form.group.html}
96 </td>
97 {/if}
98 </tr>
99
100 {if !$type || $type eq 'tag'}
101 <tr>
102 <td width="70%"><span class="label">{if $title}{$form.$key.label}{/if}</span>
103 <div id="tagtree">
104 {include file="CRM/Contact/Form/Edit/Tagtree.tpl" level=1}
105 </div>
106 </td>
107 </tr>
108 <tr><td>{include file="CRM/common/Tagset.tpl"}</td></tr>
109 {/if}
110 </table>
111 {if $title}
112 </div>
113 </div><!-- /.crm-accordion-wrapper -->
114 {/if}