2 <div id="contacts" class="standard-page">
6 {{* The page headding with it's contacts counter *}}
7 <h2 class="headding">{{$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" action="{{$cmd}}" method="get" >
14 <label for="contacts-search" class="contacts-search-desc">{{$desc}}</label><br/>
15 <div class="input-group">
16 <input type="text" name="search" id="contacts-search" class="search-input form-control" onfocus="this.select();" value="{{$search|escape:'html'}}" />
17 <div class="input-group-btn">
18 <button class="btn btn-default" type="submit" name="submit" id="contacts-search-submit" value="{{$submit|escape:'html'}}"><i class="fa fa-search"></i></button>
25 <div id="contacts-search-end"></div>
27 {{* we need the form container to make batch actions work *}}
28 <form name="batch_actions_submit" action="{{$baseurl}}/contacts/batch/" method="POST">
30 {{* we put here a hidden input element. This is needed to transmit the batch actions with javascript*}}
31 <input type="hidden" class="batch-action no-input fakelist" name="batch_submit" value="{{$l|escape:'html'}}">
33 {{* We put the contact batch actions in a dropdown menu *}}
34 <ul class="nav nav-pills preferences">
35 <li class="dropdown pull-right">
36 <a class="btn btn-link dropdown-toggle" type="button" id="BatchActionDropdownMenuTools" data-toggle="dropdown" aria-expanded="true">
37 <i class="fa fa-angle-down"></i>
39 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="BatchActionDropdownMenuTools">
40 {{foreach $batch_actions as $n=>$l}}
42 {{* call the js batch_submit_handler. Have a look at the buttom of this file *}}
43 <a onclick="batch_submit_handler('{{$n}}', '{{$l}}')">{{$l}}</a>
51 {{* format each contact with the contact_template.tpl *}}
52 <ul id="viewcontact_wrapper" class="viewcontact_wrapper media-list">
53 {{foreach $contacts as $contact}}
54 <li>{{include file="contact_template.tpl"}}</li>
57 <div id="contact-edit-end"></div>
64 $(document).ready(function() {
65 // javascript dialog to batch actions
66 $(".batch-action").click(function(e){
67 if (confirm($(this).attr('value')+" ?")) {
75 // add javascript confirm dialog to "drop" links. Plain html url have "?confirm=1" to show confirmation form, we need to remove it
76 $(".drop").each(function() {
77 $(this).attr('href', $(this).attr('href').replace("confirm=1","") );
78 $(this).click(function(e){
79 if (confirm("{{$contact_drop_confirm}}")) {
91 * @brief This function submits the form with the batch action values
93 * @param string name The name of the batch action
94 * @param string value If it isn't empty the action will be posted
96 function batch_submit_handler(name, value) {
97 // set the value of the hidden input element with the name batch_submit
98 document.batch_actions_submit.batch_submit.value=value;
99 // change the name of the input element from batch_submit according to the
100 // name which is transmitted to this function
101 document.batch_actions_submit.batch_submit.name=name;
103 document.batch_actions_submit.submit() ;