4 <div id="contacts" class="generic-page-wrapper">
6 {{* The page heading with it's contacts counter *}}
7 <h2 class="heading">{{$header}} {{if $total}} ({{$total}}) {{/if}}</h2>
9 {{if $finding}}<h4>{{$finding}}</h4>{{/if}}
11 {{* The search input field to search for contacts *}}
12 <div id="contacts-search-wrapper">
13 <form id="contacts-search-form" class="navbar-form" role="search" action="{{$cmd}}" method="get" >
15 <div class="col-md-2"></div>
16 <div class="col-md-8 ">
17 <div class="form-group form-group-search">
18 <input type="text" name="search" id="contacts-search" class="search-input form-control form-search" onfocus="this.select();" value="{{$search|escape:'html'}}" placeholder="{{$desc}}"/>
19 <button class="btn btn-default btn-sm form-button-search" type="submit" id="contacts-search-submit">{{$submit}}</button>
22 <div class="col-md-2"></div>
28 <div id="contacts-search-end"></div>
30 {{* we need the form container to make batch actions work *}}
31 <form name="batch_actions_submit" action="{{$baseurl}}/contacts/batch/" method="POST">
33 {{* we put here a hidden input element. This is needed to transmit the batch actions with javascript*}}
34 <input type="hidden" class="batch-action no-input fakelist" name="batch_submit" value="{{$l|escape:'html'}}">
36 {{* We put the contact batch actions in a dropdown menu *}}
37 <ul class="nav nav-pills preferences">
38 <li class="dropdown pull-right">
39 <button type="button" class="btn-link btn-sm dropdown-toggle" id="BatchActionDropdownMenuTools" data-toggle="dropdown" aria-expanded="true">
40 <i class="fa fa-angle-down"></i> {{$h_batch_actions}}
42 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="BatchActionDropdownMenuTools">
43 {{foreach $batch_actions as $n=>$l}}
45 {{* call the js batch_submit_handler. Have a look at the buttom of this file *}}
46 <button type="button" class="btn-link" onclick="batch_submit_handler('{{$n}}', '{{$l}}')">{{$l}}</button>
52 <div class="clear"></div>
53 <div id="contact-list">
54 {{* format each contact with the contact_template.tpl *}}
55 <ul id="viewcontact_wrapper" class="viewcontact_wrapper media-list">
56 {{foreach $contacts as $contact}}
57 <li>{{include file="contact_template.tpl"}}</li>
61 <div id="contact-edit-end"></div>
68 $(document).ready(function() {
69 // javascript dialog to batch actions
70 $(".batch-action").click(function(e){
71 if (confirm($(this).attr('value')+" ?")) {
79 // add javascript confirm dialog to "drop" links. Plain html url have "?confirm=1" to show confirmation form, we need to remove it
80 $(".drop").each(function() {
81 $(this).attr('href', $(this).attr('href').replace("confirm=1","") );
82 $(this).click(function(e){
83 if (confirm("{{$contact_drop_confirm}}")) {
95 * @brief This function submits the form with the batch action values
97 * @param string name The name of the batch action
98 * @param string value If it isn't empty the action will be posted
100 function batch_submit_handler(name, value) {
101 // set the value of the hidden input element with the name batch_submit
102 document.batch_actions_submit.batch_submit.value=value;
103 // change the name of the input element from batch_submit according to the
104 // name which is transmitted to this function
105 document.batch_actions_submit.batch_submit.name=name;
107 document.batch_actions_submit.submit() ;