summaryrefslogtreecommitdiffstats
path: root/src/pfwbged/contact/table.pt
blob: f261432c0834a1c05d44214dae62a74b2ac5f72e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="pfwbged.contact">
<body>

<metal:main fill-slot="main">

    <h1 class="documentFirstHeading" tal:content="context/Title" />
    <div tal:replace="structure provider:plone.belowcontenttitle" />

    <div id="contact-table-view">
    <div class="metatypes">
     Que cherchez-vousĀ :
<label><input value="filter-all" name="contact-filter" checked="checked" type="radio">Tout</label>
<label><input value="filter-orgs" name="contact-filter" type="radio">Organisations</label>
<label><input value="filter-persons" name="contact-filter" type="radio">Personnes</label>
</div>

    <div class="criteria-content" style="display:block;">
        RechercherĀ : <input name="text-criteria-fulltext">
    </div>

    <div id="searchresults"/>


    </div>

<script>
$.querywidget.updateSearch = function () {
        var context_url = (function() {
            var baseUrl, pieces;
            baseUrl = $('base').attr('href');
            if (!baseUrl) {
                pieces = window.location.href.split('/');
                pieces.pop();
                baseUrl = pieces.join('/');
            }
            return baseUrl;
        })();
        var query = context_url + "/@@querybuilder_html_results?";
        query += "query.i:records=portal_type&query.o:records=plone.app.querystring.operation.selection.is&";
        var filter_val = $('input[name="contact-filter"]:checked').val();
        if (filter_val == "filter-all" || filter_val == "filter-orgs") {
            query += "query.v:records:list=organization&";
        }
        if (filter_val == "filter-all" || filter_val == "filter-persons") {
            query += "query.v:records:list=person&";
        }
        query += "query.i:records=SearchableText&query.o:records=plone.app.querystring.operation.string.contains&query.v:records=";
        query += $('input[name="text-criteria-fulltext"]').val();
        query += '&sort_on=sortable_title';
        $.querywidget.runQuery(query);
};

$(function() {
  $.querywidget.updateSearch();

  $('input[name="contact-filter"]').change(function() {
    $.querywidget.updateSearch();
  });

  $('input[name="text-criteria-fulltext"]').on('keyup', function() {
   $.querywidget.updateSearch();
  });

});
</script>
</metal:main>

</body>
</html>