Merge pull request #4520 from jitendrapurohit/CRM-15545
[civicrm-core.git] / templates / CRM / Tag / Form / Search.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
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 {* this template is used for adding/editing tags *}
27
28 <script type="text/javascript" src="{$config->resourceBase}packages/jquery/jquery.js"></script>
29 <script type="text/javascript" src="{$config->resourceBase}packages/jquery/plugins/jquery.treeview.min.js"></script>
30 <style>
31 .hit {ldelim}padding-left:10px;{rdelim}
32 .tree li {ldelim}padding-left:10px;{rdelim}
33 #crm-container #Tag ul#tagtree {ldelim}margin-left:-10px;{rdelim}
34 #crm-container td #Tag ul {ldelim}margin:0 0 0.5em;padding:0{rdelim}
35 #crm-container td #Tag li {ldelim}padding-bottom:0;margin:0 0 0 0.5em;{rdelim}
36
37 #Tag .tree .expandable .hit {ldelim}background:url('{$config->resourceBase}i/expandable.gif') no-repeat left 3px;cursor:pointer{rdelim}
38 #Tag .tree .collapsable .hit {ldelim}background:url('{$config->resourceBase}i/collapsable.gif') no-repeat left 3px;cursor:pointer{rdelim}
39 #Tag #tagtree .highlighted {ldelim}background-color:lightgrey;{rdelim}
40 </style>
41 <script type="text/javascript">
42 {literal}
43
44 jQuery(document).ready(function(){initTagTree()});
45 function initTagTree() {
46 $("#tagtree").treeview({
47 animated: "fast",
48 collapsed: true,
49 unique: true
50 });
51 $('#tagtree>li:odd').addClass('odd-row');
52 $('#tagtree>li:even').addClass('even-row');
53 $("#tagtree ul input:checked").each (function(){
54 $(this).parents("li").children(".hit").addClass('highlighted');
55 });
56 };
57 {/literal}
58 </script>
59 <ul id="tagtree" class="tree">
60 {foreach from=$tree item="node" key="id"}
61 <li id="tag_{$id}">
62 {if ! $node.children}<input name="tag[{$id}]" type="checkbox" />{/if}
63 {if $node.children}<input name="tag[{$id}]" id="check_{$id}" type="checkbox" />{/if}
64 <span {if $node.children}class="hit"{/if}>{$node.name}</span>
65 {if $node.children}<ul>
66 {foreach from=$node.children item="subnode" key="subid"}
67 <li id="tag_{$subid}">
68 <input id="check_{$subid}" name="tag[{$subid}]" type="checkbox" />
69 <span {if $subnode.children}class="hit"{/if}>{$subnode.name}</span>
70 {if $subnode.children}<ul>
71 {foreach from=$subnode.children item="subsubnode" key="subsubid"}
72 <li id="tag_{$subsubid}"><span><input id="check_{$subsubid}" name="tag[{$subsubid}]" type="checkbox" />{$subsubnode.name}</span></li>
73 {/foreach}
74 </ul>{/if}
75 </li>
76 {/foreach}
77 </ul>{/if}
78 </li>
79 {/foreach}
80 </ul>