| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.7 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
| 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 | var childTag = "{/literal}{$loadjsTree}{literal}"; |
| 61 | if (childTag) { |
| 62 | //load js tree. |
| 63 | $("#tagtree").jstree({ |
| 64 | plugins : ["themes", "html_data"], |
| 65 | themes: { |
| 66 | "theme": 'classic', |
| 67 | "dots": false, |
| 68 | "icons": false, |
| 69 | "url": CRM.config.resourceBase + 'packages/jquery/plugins/jstree/themes/classic/style.css' |
| 70 | } |
| 71 | }); |
| 72 | } |
| 73 | {/literal} |
| 74 | {if !empty($permission) && $permission neq 'edit'} |
| 75 | {literal} |
| 76 | $("#tagtree input").prop('disabled', true); |
| 77 | {/literal} |
| 78 | {/if} |
| 79 | {literal} |
| 80 | }); |
| 81 | })(CRM.$, CRM._); |
| 82 | {/literal} |
| 83 | </script> |
| 84 | |
| 85 | {if $title} |
| 86 | <div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed"> |
| 87 | <div class="crm-accordion-header">{$title}</div> |
| 88 | <div class="crm-accordion-body" id="tagGroup"> |
| 89 | {/if} |
| 90 | <table class="form-layout-compressed{if $context EQ 'profile'} crm-profile-tagsandgroups{/if}"> |
| 91 | <tr> |
| 92 | {if !$type || $type eq 'group'} |
| 93 | <td> |
| 94 | {if $groupElementType eq 'select'} |
| 95 | <span class="label">{if $title}{$form.group.label}{/if}</span> |
| 96 | {/if} |
| 97 | {$form.group.html} |
| 98 | </td> |
| 99 | {/if} |
| 100 | {if (!$type || $type eq 'tag') && $tree} |
| 101 | <td width="70%">{if $title}<span class="label">{$form.tag.label}</span>{/if} |
| 102 | <div id="tagtree"> |
| 103 | {include file="CRM/Contact/Form/Edit/Tagtree.tpl" level=1} |
| 104 | </div> |
| 105 | </td> |
| 106 | <tr><td>{include file="CRM/common/Tagset.tpl"}</td></tr> |
| 107 | {/if} |
| 108 | </tr> |
| 109 | </table> |
| 110 | {if $title} |
| 111 | </div> |
| 112 | </div><!-- /.crm-accordion-wrapper --> |
| 113 | {/if} |