2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
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/advanced' 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="text" id="sort_contact_id" style="display: none" />
34 <input type="hidden" name="hidden_location" value="1" />
35 <input type="hidden" name="qfKey" value="{crmKey name='CRM_Contact_Controller_Search' addSequence=1}" />
36 <div style="height:1px; overflow:hidden;"><input type="submit" value="{ts}Go{/ts}" name="_qf_Advanced_refresh" class="form-submit default" /></div>
40 <li><label class="crm-quickSearchField"><input type="radio" checked="" data-tablename="cc" checked="checked" value="" name="quickSearchField">{ts}Name/Email{/ts}</label></li>
41 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="id" name="quickSearchField">{ts}CiviCRM ID{/ts}</label></li>
42 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="external_identifier" name="quickSearchField">{ts}External ID{/ts}</label></li>
43 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="first_name" name="quickSearchField">{ts}First Name{/ts}</label></li>
44 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="last_name" name="quickSearchField">{ts}Last Name{/ts}</label></li>
45 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="eml" value="email" name="quickSearchField">{ts}Email{/ts}</label></li>
46 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="phe" value="phone_numeric" name="quickSearchField">{ts}Phone{/ts}</label></li>
47 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="sts" value="street_address" name="quickSearchField">{ts}Street Address{/ts}</label></li>
48 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="sts" value="city" name="quickSearchField">{ts}City{/ts}</label></li>
49 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="sts" value="postal_code" name="quickSearchField">{ts}Postal Code{/ts}</label></li>
50 <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="job_title" name="quickSearchField">{ts}Job Title{/ts}</label></li>
60 <script type="text/javascript">
62 cj("#civicrm-menu >li").each(function(i){
63 cj(this).attr("tabIndex",i+2);
66 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=navigation' h=0 }"{literal};
68 cj( '#sort_name_navigation' ).autocomplete( contactUrl, {
74 max: CRM.config.search_autocomplete_count,
76 limit: CRM.config.search_autocomplete_count,
77 fieldName:function () {
78 return cj('input[name=quickSearchField]:checked').val();
80 tableName:function () {
81 return cj('input[name=quickSearchField]:checked').attr("data-tablename");
84 }).result(function(event, data, formatted) {
85 document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: data[1]});
88 cj('#sort_name_navigation').keydown(function() {
91 cj('.crm-quickSearchField').click(function() {
92 var label = cj(this).text();
93 var value = cj('input', this).val();
94 // These fields are not supported by advanced search
95 if (value === 'first_name' || value === 'last_name') {
98 cj('#sort_name_navigation').attr({name: value, placeholder: label}).flushCache().focus();
101 function getSearchURLValue( )
103 var input = cj('#sort_name_navigation').val();
104 var contactId = cj( '#sort_contact_id' ).val();
105 if ( ! contactId || isNaN( contactId ) ) {
106 var sortValue = cj( '#sort_name_navigation' ).val();
108 //using xmlhttprequest check if there is only one contact and redirect to view page
109 var dataUrl = {/literal}"{crmURL p='civicrm/ajax/contact' h=0 q='name='}"{literal} + sortValue;
111 var response = cj.ajax({
116 contactId = response;
120 if ( contactId && !isNaN(parseInt(contactId)) ) {
121 var url = {/literal}"{crmURL p='civicrm/contact/view' h=0 q='reset=1&cid='}"{literal} + contactId;
122 document.getElementById('id_search_block').action = url;
125 {/literal}{if $config->userFramework neq 'Joomla'}{literal}
126 cj('body').prepend( cj("#menu-container").html() );
129 cj(window).scroll( function () {
130 var scroll = document.documentElement.scrollTop || document.body.scrollTop;
131 cj('#civicrm-menu').css({top: "scroll", position: "fixed", top: "0px"});
132 cj('div.sticky-header').css({ 'top' : "23px", position: "fixed" });
135 if ( cj('#edit-shortcuts').length > 0 ) {
136 cj('#civicrm-menu').css({ 'width': '97%' });
138 {/literal}{else}{* Special menu hacks for Joomla *}{literal}
139 cj('div#toolbar-box div.m').html(cj("#menu-container").html());
140 cj('#civicrm-menu').ready(function() {
141 cj('#root-menu-div .outerbox').css({ 'margin-top': '6px'});
142 cj('#root-menu-div .outerbox').first().css({ 'margin-top': '20px'});
143 cj('#root-menu-div .menu-ul li').css({ 'padding-bottom' : '2px', 'margin-top' : '2px' });
144 cj('img.menu-item-arrow').css({ 'top' : '4px' });
146 {/literal}{/if}{literal}
147 cj('#civicrm-menu').menu( {arrowSrc: CRM.config.resourceBase + 'packages/jquery/css/images/arrow.png'} );