Advertisement
TeNNoX

TagsAndGroups.tpl

Aug 28th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Smarty 5.51 KB | None | 0 0
  1. {*
  2.  +--------------------------------------------------------------------+
  3.  | CiviCRM version 4.4                                                |
  4.  +--------------------------------------------------------------------+
  5.  | Copyright CiviCRM LLC (c) 2004-2013                                |
  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. <style>
  27.   .hit {ldelim}padding-left:10px;{rdelim}
  28.   .tree li {ldelim}padding-left:10px;{rdelim}
  29.   #Tag .tree .collapsable .hit {ldelim}background:url('{$config->resourceBase}i/menu-expanded.png') no-repeat left 8px;padding-left: 9px;cursor:pointer{rdelim}
  30.   #Tag .tree .expandable .hit {ldelim}background:url('{$config->resourceBase}i/menu-collapsed.png') no-repeat left 6px;padding-left: 9px;cursor:pointer{rdelim}
  31.   #Tag #crm-tagListWrap .highlighted {ldelim}background-color:lightgrey;{rdelim}
  32. </style>
  33. {*crmScript ext=civicrm.jquery.plugins.jstree file=jquery.jstree.js*}
  34. <script type="text/javascript">
  35.   (function($){ldelim}
  36.     var entityID={$entityID};
  37.     var entityTable='{$entityTable}';
  38.     {literal}
  39.     $(function() {
  40.       $("#crm-tagListWrap input").removeAttr("disabled");
  41.       //unobsctructive elements are there to provide the function to those not having javascript, no need for the others
  42.       $(".unobstructive").hide();
  43.  
  44.       $("#crm-tagListWrap ul input:checked").each(function(){
  45.         $(this).parents("li").children(".jstree-icon").addClass('highlighted');
  46.       });
  47.  
  48.       //load js tree.
  49.       $("#crm-tagListWrap").jstree({
  50.         "plugins" : ["themes", "html_data"],
  51.         "themes": {"url": CRM.config.resourceBase + 'packages/jquery/plugins/jstree/themes/default/style.css'}
  52.       });
  53.     });
  54.   })(cj);
  55.   {/literal}
  56. </script>
  57.  
  58. {if $title}
  59. <div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed">
  60.   <div class="crm-accordion-header">{$title}</div>
  61.   <div class="crm-accordion-body" id="tagGroup">
  62. {/if}
  63.     <table class="form-layout-compressed{if $context EQ 'profile'} crm-profile-tagsandgroups{/if}">
  64.       <tr>
  65.        {if $groupElementType eq 'crmasmSelect'}
  66.           <td><span class="label">{if $title}{$form.group.label}{/if}</span>
  67.             {$form.group.html}
  68.             {literal}
  69.             <script type="text/javascript">
  70.              cj(function(){
  71.                cj("select#group").crmasmSelect({
  72.                  respectParents: true
  73.                });
  74.              });
  75.              </script>
  76.              {/literal}
  77.           </td>
  78.       {/if}
  79.      
  80.       <td width="70%"><span class="label">{if $title}{$form.$key.label}{/if}</span>
  81.         <div id="crm-tagListWrap">
  82.             <ul class="tree">
  83.             {foreach from=$tree item="node" key="id"}
  84.               <li id="crm-tagRow{$id}">
  85.                 {if !$node.children}<input name="tag[{$id}]" id="tag_{$id}" type="checkbox" class="form-checkbox" value="1" {if $tagged[$id]}checked="checked"{/if}/>{/if}
  86.                 {if $node.children}<input name="tag[{$id}]" id="tag_{$id}" type="checkbox" class="form-checkbox" value="1" {if $tagged[$id]}checked="checked"{/if}/>{/if}
  87.                 {if $node.children} <span class="hit"></span> {/if} <label for="tag_{$id}">{$node.name}</label>
  88.                 {if $node.children}
  89.                   <ul>
  90.                     {foreach from=$node.children item="subnode" key="subid"}
  91.                       <li id="crm-tagRow{$subid}">
  92.                         <input id="tag_{$subid}" name="tag[{$subid}]" type="checkbox" class="form-checkbox" value="1" {if $tagged[$subid]}checked="checked"{/if}/>
  93.                         {if $subnode.children} <span class="hit"></span> {/if} <label for="tag_{$subid}">{$subnode.name}</label>
  94.                         {if $subnode.children}
  95.                           <ul>
  96.                             {foreach from=$subnode.children item="subsubnode" key="subsubid"}
  97.                               <li id="crm-tagRow{$subsubid}">
  98.                                 <input id="tag_{$subsubid}" name="tag[{$subsubid}]" type="checkbox" class="form-checkbox" value="1" {if $tagged[$subsubid]}checked="checked"{/if}/>
  99.                                 <label for="tag_{$subsubid}">{$subsubnode.name}</label>
  100.                               </li>
  101.                             {/foreach}
  102.                           </ul>
  103.                         {/if}
  104.                       </li>
  105.                     {/foreach}
  106.                   </ul>
  107.                 {/if}
  108.               </li>
  109.             {/foreach}
  110.             </ul>
  111.         </div>
  112.       </td>
  113.     </tr>
  114.     {if !$type || $type eq 'tag'}
  115.       <tr><td>{include file="CRM/common/Tag.tpl"}</td></tr>
  116.     {/if}
  117.   </table>
  118. {if $title}
  119.   </div>
  120. </div><!-- /.crm-accordion-wrapper -->
  121. {/if}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement