Remember payment processor during form reload, fix notices CRM-12149
[civicrm-core.git] / templates / CRM / common / Navigation.tpl
CommitLineData
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">
e0f7ceee 28 {if call_user_func(array('CRM_Core_Permission','giveMeAllACLs'))}
6a488035 29 <li id="crm-qsearch" class="menumain crm-link-home">
e0f7ceee 30 <form action="{crmURL p='civicrm/contact/search/advanced' h=0 }" name="search_block" id="id_search_block" method="post">
6a488035
TO
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;" />
81aa6678
CW
33 <input type="text" id="sort_contact_id" style="display: none" />
34 <input type="hidden" name="hidden_location" value="1" />
6a488035 35 <input type="hidden" name="qfKey" value="{crmKey name='CRM_Contact_Controller_Search' addSequence=1}" />
81aa6678 36 <div style="height:1px; overflow:hidden;"><input type="submit" value="{ts}Go{/ts}" name="_qf_Advanced_refresh" class="form-submit default" /></div>
6a488035
TO
37 </div>
38 </form>
39 <ul>
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>
51 </ul>
52 </li>
e0f7ceee
CW
53 {/if}
54 {$navigation}
6a488035
TO
55 </ul>
56</div>
57
58{literal}
59<script type="text/javascript">
81aa6678 60cj(function( ) {
6a488035
TO
61 cj("#civicrm-menu >li").each(function(i){
62 cj(this).attr("tabIndex",i+2);
63 });
6a488035
TO
64
65 var contactUrl = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=navigation' h=0 }"{literal};
66
67 cj( '#sort_name_navigation' ).autocomplete( contactUrl, {
68 width: 200,
69 selectFirst: false,
70 minChars: 1,
71 matchContains: true,
72 delay: 400,
73 max: CRM.config.search_autocomplete_count,
74 extraParams:{
75 limit: CRM.config.search_autocomplete_count,
76 fieldName:function () {
77 return cj('input[name=quickSearchField]:checked').val();
78 },
79 tableName:function () {
80 return cj('input[name=quickSearchField]:checked').attr("data-tablename");
81 }
82 }
83 }).result(function(event, data, formatted) {
81aa6678 84 document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: data[1]});
6a488035
TO
85 return false;
86 });
87 cj('#sort_name_navigation').keydown(function() {
88 cj.Menu.closeAll();
89 });
90 cj('.crm-quickSearchField').click(function() {
91 var label = cj(this).text();
81aa6678
CW
92 var value = cj('input', this).val();
93 // These fields are not supported by advanced search
94 if (value === 'first_name' || value === 'last_name') {
95 value = 'sort_name';
96 }
97 cj('#sort_name_navigation').attr({name: value, placeholder: label}).flushCache().focus();
6a488035 98 });
e0f7ceee
CW
99 // check if there is only one contact and redirect to view page
100 cj('#id_search_block').on('submit', function() {
101 var contactId, sortValue = cj('#sort_name_navigation').val();
102 if (sortValue && cj('#sort_name_navigation').attr('name') == 'sort_name') {
103 {/literal}{*
104 // FIXME: async:false == bad,
105 // we should just check the autocomplete results instead of firing a new request
106 // when we fix this, the civicrm/ajax/contact server-side callback can be removed as well
107 // also that would fix the fact that this only works with sort_name search
108 // (and we can remove the above conditional)
109 *}{literal}
110 var dataUrl = {/literal}"{crmURL p='civicrm/ajax/contact' h=0 q='name='}"{literal} + sortValue;
111 contactId = cj.ajax({
112 url: dataUrl,
113 async: false
114 }).responseText;
6a488035 115 }
e0f7ceee
CW
116 if (contactId && !isNaN(parseInt(contactId))) {
117 var url = {/literal}"{crmURL p='civicrm/contact/view' h=0 q='reset=1&cid='}"{literal} + contactId;
118 this.action = url;
6a488035 119 }
e0f7ceee
CW
120 });
121});
122
735c0c34 123{/literal}{if $config->userFramework neq 'Joomla'}{literal}
6a488035
TO
124 cj('body').prepend( cj("#menu-container").html() );
125
126 //Track Scrolling
127 cj(window).scroll( function () {
128 var scroll = document.documentElement.scrollTop || document.body.scrollTop;
129 cj('#civicrm-menu').css({top: "scroll", position: "fixed", top: "0px"});
130 cj('div.sticky-header').css({ 'top' : "23px", position: "fixed" });
131 });
132
133 if ( cj('#edit-shortcuts').length > 0 ) {
134 cj('#civicrm-menu').css({ 'width': '97%' });
135 }
735c0c34
CW
136{/literal}{else}{* Special menu hacks for Joomla *}{literal}
137 cj('div#toolbar-box div.m').html(cj("#menu-container").html());
138 cj('#civicrm-menu').ready(function() {
139 cj('#root-menu-div .outerbox').css({ 'margin-top': '6px'});
140 cj('#root-menu-div .outerbox').first().css({ 'margin-top': '20px'});
141 cj('#root-menu-div .menu-ul li').css({ 'padding-bottom' : '2px', 'margin-top' : '2px' });
142 cj('img.menu-item-arrow').css({ 'top' : '4px' });
143 });
144{/literal}{/if}{literal}
6a488035
TO
145 cj('#civicrm-menu').menu( {arrowSrc: CRM.config.resourceBase + 'packages/jquery/css/images/arrow.png'} );
146</script>
147{/literal}