Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
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 | <div id="menu-container" style="display:none;"> | |
27 | <ul id="civicrm-menu"> | |
28 | {if call_user_func(array('CRM_Core_Permission','giveMeAllACLs'))} | |
29 | <li id="crm-qsearch" class="menumain crm-link-home"> | |
30 | <form action="{crmURL p='civicrm/contact/search/basic' h=0 }" name="search_block" id="id_search_block" method="post" onsubmit="getSearchURLValue( );"> | |
31 | <div id="quickSearch"> | |
32 | <input type="text" class="form-text" id="sort_name_navigation" placeholder="{ts}Find Contacts{/ts}" name="sort_name" style="width: 12em;" /> | |
33 | <input type="hidden" id="sort_contact_id" value="" /> | |
34 | <input type="hidden" name="qfKey" value="{crmKey name='CRM_Contact_Controller_Search' addSequence=1}" /> | |
35 | <input type="submit" value="{ts}Go{/ts}" name="_qf_Basic_refresh" class="form-submit default" style="display: none;" /> | |
36 | </div> | |
37 | </form> | |
38 | <ul> | |
39 | <li><label class="crm-quickSearchField"><input type="radio" checked="" data-tablename="cc" checked="checked" value="" name="quickSearchField">{ts}Name/Email{/ts}</label></li> | |
40 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="id" name="quickSearchField">{ts}CiviCRM ID{/ts}</label></li> | |
41 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="external_identifier" name="quickSearchField">{ts}External ID{/ts}</label></li> | |
42 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="first_name" name="quickSearchField">{ts}First Name{/ts}</label></li> | |
43 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="last_name" name="quickSearchField">{ts}Last Name{/ts}</label></li> | |
44 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="eml" value="email" name="quickSearchField">{ts}Email{/ts}</label></li> | |
45 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="phe" value="phone_numeric" name="quickSearchField">{ts}Phone{/ts}</label></li> | |
46 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="sts" value="street_address" name="quickSearchField">{ts}Street Address{/ts}</label></li> | |
47 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="sts" value="city" name="quickSearchField">{ts}City{/ts}</label></li> | |
48 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="sts" value="postal_code" name="quickSearchField">{ts}Postal Code{/ts}</label></li> | |
49 | <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="job_title" name="quickSearchField">{ts}Job Title{/ts}</label></li> | |
50 | </ul> | |
51 | </li> | |
52 | ||
53 | {/if} | |
54 | {$navigation} | |
55 | </ul> | |
56 | </div> | |
57 | ||
58 | {literal} | |
59 | <script type="text/javascript"> | |
60 | cj( document ).ready( function( ) { | |
61 | //CRM-6776, enter-to-submit functionality is broken for IE due to hidden field | |
62 | cj("#civicrm-menu >li").each(function(i){ | |
63 | cj(this).attr("tabIndex",i+2); | |
64 | }); | |
65 | var htmlContent = ''; | |
66 | if ( cj.browser.msie ) { | |
67 | if( cj.browser.version.substr( 0,1 ) == '7' ) { | |
68 | htmlContent = '<input type="submit" value="Go" name="_qf_Basic_refresh" class="form-submit default" style ="margin-right: -5px" />'; | |
69 | } else { | |
70 | htmlContent = '<input type="submit" value="Go" name="_qf_Basic_refresh" class="form-submit default" />'; | |
71 | } | |
72 | htmlContent += '<input type="text" class="form-text" id="sort_name_navigation" placeholder="{/literal}{ts escape='js'}Find Contacts{/ts}{literal}" name="sort_name" style="width: 12em; margin-left: -45px;" /><input type="text" id="sort_contact_id" style="display: none" />'; | |
73 | htmlContent += '<input type="hidden" name="qfKey" value="' + {/literal}'{crmKey name='CRM_Contact_Controller_Search' addSequence=1}'{literal} + '" />'; | |
74 | cj('#quickSearch').html(htmlContent); | |
75 | } | |
76 | ||
77 | cj( "#admin-menu>ul>li>a" ).each( function( ) { | |
78 | if ( cj( this ).html( ) == 'CiviCRM' ) { | |
79 | cj( this ).click ( function( ) { | |
80 | cj( "#civicrm-menu" ).toggle( ); | |
81 | return false; | |
82 | }); | |
83 | } | |
84 | }); | |
85 | ||
86 | var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=navigation' h=0 }"{literal}; | |
87 | ||
88 | cj( '#sort_name_navigation' ).autocomplete( contactUrl, { | |
89 | width: 200, | |
90 | selectFirst: false, | |
91 | minChars: 1, | |
92 | matchContains: true, | |
93 | delay: 400, | |
94 | max: CRM.config.search_autocomplete_count, | |
95 | extraParams:{ | |
96 | limit: CRM.config.search_autocomplete_count, | |
97 | fieldName:function () { | |
98 | return cj('input[name=quickSearchField]:checked').val(); | |
99 | }, | |
100 | tableName:function () { | |
101 | return cj('input[name=quickSearchField]:checked').attr("data-tablename"); | |
102 | } | |
103 | } | |
104 | }).result(function(event, data, formatted) { | |
105 | document.location={/literal}"{crmURL p='civicrm/contact/view' h=0 q='reset=1&cid='}"{literal}+data[1]; | |
106 | return false; | |
107 | }); | |
108 | cj('#sort_name_navigation').keydown(function() { | |
109 | cj.Menu.closeAll(); | |
110 | }); | |
111 | cj('.crm-quickSearchField').click(function() { | |
112 | var label = cj(this).text(); | |
113 | cj('#sort_name_navigation').attr('placeholder', label).flushCache().focus(); | |
114 | }); | |
115 | }); | |
116 | function getSearchURLValue( ) | |
117 | { | |
118 | var input = cj('#sort_name_navigation').val(); | |
119 | var contactId = cj( '#sort_contact_id' ).val(); | |
120 | if ( ! contactId || isNaN( contactId ) ) { | |
121 | var sortValue = cj( '#sort_name_navigation' ).val(); | |
122 | if ( sortValue ) { | |
123 | //using xmlhttprequest check if there is only one contact and redirect to view page | |
124 | var dataUrl = {/literal}"{crmURL p='civicrm/ajax/contact' h=0 q='name='}"{literal} + sortValue; | |
125 | ||
126 | var response = cj.ajax({ | |
127 | url: dataUrl, | |
128 | async: false | |
129 | }).responseText; | |
130 | ||
131 | contactId = response; | |
132 | } | |
133 | } | |
134 | ||
135 | if ( contactId && !isNaN(parseInt(contactId)) ) { | |
136 | var url = {/literal}"{crmURL p='civicrm/contact/view' h=0 q='reset=1&cid='}"{literal} + contactId; | |
137 | document.getElementById('id_search_block').action = url; | |
138 | } | |
139 | } | |
735c0c34 | 140 | {/literal}{if $config->userFramework neq 'Joomla'}{literal} |
6a488035 TO |
141 | cj('body').prepend( cj("#menu-container").html() ); |
142 | ||
143 | //Track Scrolling | |
144 | cj(window).scroll( function () { | |
145 | var scroll = document.documentElement.scrollTop || document.body.scrollTop; | |
146 | cj('#civicrm-menu').css({top: "scroll", position: "fixed", top: "0px"}); | |
147 | cj('div.sticky-header').css({ 'top' : "23px", position: "fixed" }); | |
148 | }); | |
149 | ||
150 | if ( cj('#edit-shortcuts').length > 0 ) { | |
151 | cj('#civicrm-menu').css({ 'width': '97%' }); | |
152 | } | |
735c0c34 CW |
153 | {/literal}{else}{* Special menu hacks for Joomla *}{literal} |
154 | cj('div#toolbar-box div.m').html(cj("#menu-container").html()); | |
155 | cj('#civicrm-menu').ready(function() { | |
156 | cj('#root-menu-div .outerbox').css({ 'margin-top': '6px'}); | |
157 | cj('#root-menu-div .outerbox').first().css({ 'margin-top': '20px'}); | |
158 | cj('#root-menu-div .menu-ul li').css({ 'padding-bottom' : '2px', 'margin-top' : '2px' }); | |
159 | cj('img.menu-item-arrow').css({ 'top' : '4px' }); | |
160 | }); | |
161 | {/literal}{/if}{literal} | |
6a488035 TO |
162 | cj('#civicrm-menu').menu( {arrowSrc: CRM.config.resourceBase + 'packages/jquery/css/images/arrow.png'} ); |
163 | </script> | |
164 | {/literal} |