]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - channels/index.php
Apply fix a8d2da775b3e8a9991b3979d604f3a0218d66085 again
[irc/unrealircd/unrealircd-webpanel.git] / channels / index.php
1 <?php
2 require_once "../inc/common.php";
3 require_once "../inc/header.php";
4
5 if (!empty($_POST))
6 {
7 do_log($_POST);
8
9 /* Nothing being posted yet */
10
11 }
12
13 ?>
14 <h4>Channels Overview</h4><br>
15
16 <!-- The channel list -->
17 <table id="data_list" class="table-striped display responsive nowrap" style="width:100%">
18 <thead class="table-primary">
19 <th scope="col">Name</th>
20 <th scope="col">Users</th>
21 <th scope="col">Modes</th>
22 <th scope="col">Topic</th>
23 <th scope="col">Created</th>
24 </thead>
25 </table>
26
27 <script>
28 let data_list_table = null;
29
30 $(document).ready( function () {
31 args = {
32 'responsive': true,
33 'fixedHeader': {
34 header: true,
35 headerOffset: 53
36 },
37 'ajax': {
38 'url': '<?php echo get_config("base_url"); ?>api/channels.php',
39 dataSrc: ''
40 },
41 'pageLength':100,
42 'order':[[1,'desc']],
43 'columns': [
44 { 'data': 'Name', 'responsivePriority': 1, 'className':'virtuallink' },
45 { 'data': 'Users', 'responsivePriority': 2 },
46 { 'data': 'Modes', 'responsivePriority': 3 },
47 { 'data': 'Topic', 'responsivePriority': 5, 'className':'tdwrap' },
48 { 'data': 'Created', 'responsivePriority': 4 },
49 ],
50 };
51 /* Hide on mobile */
52 if (window.innerWidth > 8000)
53 {
54 args['dom'] = 'Pfrtip';
55 args['searchPanes'] = {
56 'initCollapsed': 'true',
57 'columns': [1,3],
58 'dtOpts': {
59 select: { style: 'multi'},
60 order: [[ 1, "desc" ]]
61 },
62 }
63 }
64
65 data_list_table = $('#data_list').DataTable(args);
66
67 $('#data_list').on( 'click', 'td', function () {
68 show_channel(this);
69 } );
70 } );
71
72 function show_channel(e)
73 {
74 /* The first column is the 'Select' column */
75 // not on this page, or not yet ;)
76 //if (data_list_table.cell(e).index().column == 0)
77 // return;
78
79 /* For all the other columns we show the view screen */
80 var data = data_list_table.row(e).data();
81 channel = data['Name'];
82 window.location = '<?php echo get_config('base_url'); ?>channels/details.php?chan=' +
83 encodeURIComponent(channel);
84 // not working: still expands on mobile: e.stopImmediatePropagation();
85 return true;
86 }
87
88 </script>
89
90 <?php require_once UPATH.'/inc/footer.php'; ?>