Commit c04bf6c3eaefc8c89f8aec62a128be1c04235712

Authored by Gustavo
1 parent 7245b5d4

Modified reports template to display other log actions

webconference/templates/webconference/relatorios.html
1   -{% extends "subjects/view.html" %}
  1 +{% extends "webconference/view.html" %}
2 2  
3 3 {% load static i18n pagination permissions_tags subject_counter %}
4 4 {% load django_bootstrap_breadcrumbs %}
... ... @@ -11,7 +11,7 @@
11 11  
12 12 var array_history = [];
13 13 {%for data_json in json_history.data %}
14   - array_history.push(["{{data_json.0}}","{{data_json.1}}","{{view}}",{% if data_json.3 is not None %}new Date('{{data_json.3.isoformat}}'){% else%}null{% endif %}]);
  14 + array_history.push(["{{data_json.0}}","{{data_json.1}}","{% if data_json.2 == 'view' %} {{view}} {% elif data_json.2 == 'initwebconference' %} {{initwebconference}} {% else %} {{participate}} {% endif %}",{% if data_json.3 is not None %}new Date('{{data_json.3.isoformat}}'){% else%}null{% endif %}]);
15 15 {% endfor%}
16 16 var json_history = {"data":array_history};
17 17 var column_history = [{"string":'{% trans "User" %}'},{"string":'{% trans "Group" %}'},{"string":'{% trans "Action" %}'},{"date":'{% trans "Date of Action" %}'}];
... ... @@ -48,7 +48,7 @@
48 48 var options = {
49 49 title: '{{title_chart}}',
50 50 // legend: {position: 'right', maxLines: 1},
51   - bar: { groupWidth: '30%' },
  51 + bar: { groupWidth: '50%' },
52 52 chartArea:{width:"50%"},
53 53 titlePosition: 'out',
54 54 vAxis: {
... ... @@ -64,9 +64,87 @@
64 64  
65 65 function selectHandler() {
66 66 var selectedItem = chart.getSelection()[0];
  67 + var col = data.getColumnLabel(selectedItem.column);
67 68 if (selectedItem) {
68   - var col = data.getColumnLabel(selectedItem.column);
69   - if (col == "{{n_did_table}}"){
  69 + if (selectedItem.row == 0 && selectedItem.column == 1){
  70 + tabela_atual = true;
  71 + search = [];
  72 + var text = "{{view}}";
  73 + for (var i in json_history["data"]){
  74 + if (json_history["data"][i][2].toLowerCase().includes(text.toLowerCase())){
  75 + search.push([json_history["data"][i][0],json_history["data"][i][1],
  76 + json_history["data"][i][2],json_history["data"][i][3]]);
  77 + }
  78 + }
  79 + drawTable(column_history,pagination(search,1),true,3);
  80 + alterTitleTable(search.length);
  81 + putpagination(search,tabela_atual);
  82 + } else if(selectedItem.row == 0 && selectedItem.column == 2){
  83 + tabela_atual = false;
  84 + search = [];
  85 + var text = "{{view}}";
  86 + for (var i in json_n_did["data"]){
  87 + if (json_n_did["data"][i][3].toLowerCase().includes(text.toLowerCase())){
  88 + search.push([json_n_did["data"][i][0],json_n_did["data"][i][1],
  89 + json_n_did["data"][i][2],json_n_did["data"][i][3]]);
  90 + }
  91 + }
  92 + drawTable(column_n_did,pagination(search,1),false);
  93 + alterTitleTable(search.length);
  94 + putpagination(search,tabela_atual);
  95 + } else if (selectedItem.row == 1 && selectedItem.column == 1){
  96 + tabela_atual = true;
  97 + search = [];
  98 + var text = "{{initwebconference}}";
  99 + for (var i in json_history["data"]){
  100 + if (json_history["data"][i][2].toLowerCase().includes(text.toLowerCase())){
  101 + search.push([json_history["data"][i][0],json_history["data"][i][1],
  102 + json_history["data"][i][2],json_history["data"][i][3]]);
  103 + }
  104 + }
  105 + drawTable(column_history,pagination(search,1),true,3);
  106 + alterTitleTable(search.length);
  107 + putpagination(search,tabela_atual);
  108 + } else if(selectedItem.row == 1 && selectedItem.column == 2){
  109 + tabela_atual = false;
  110 + search = [];
  111 + var text = "{{initwebconference}}";
  112 + for (var i in json_n_did["data"]){
  113 + if (json_n_did["data"][i][3].toLowerCase().includes(text.toLowerCase())){
  114 + search.push([json_n_did["data"][i][0],json_n_did["data"][i][1],
  115 + json_n_did["data"][i][2],json_n_did["data"][i][3]]);
  116 + }
  117 + }
  118 + drawTable(column_n_did,pagination(search,1),false);
  119 + alterTitleTable(search.length);
  120 + putpagination(search,tabela_atual);
  121 + } else if (selectedItem.row == 2 && selectedItem.column == 1){
  122 + tabela_atual = true;
  123 + search = [];
  124 + var text = "{{participate}}";
  125 + for (var i in json_history["data"]){
  126 + if (json_history["data"][i][2].toLowerCase().includes(text.toLowerCase())){
  127 + search.push([json_history["data"][i][0],json_history["data"][i][1],
  128 + json_history["data"][i][2],json_history["data"][i][3]]);
  129 + }
  130 + }
  131 + drawTable(column_history,pagination(search,1),true,3);
  132 + alterTitleTable(search.length);
  133 + putpagination(search,tabela_atual);
  134 + } else if(selectedItem.row == 2 && selectedItem.column == 2){
  135 + tabela_atual = false;
  136 + search = [];
  137 + var text = "{{participate}}";
  138 + for (var i in json_n_did["data"]){
  139 + if (json_n_did["data"][i][3].toLowerCase().includes(text.toLowerCase())){
  140 + search.push([json_n_did["data"][i][0],json_n_did["data"][i][1],
  141 + json_n_did["data"][i][2],json_n_did["data"][i][3]]);
  142 + }
  143 + }
  144 + drawTable(column_n_did,pagination(search,1),false);
  145 + alterTitleTable(search.length);
  146 + putpagination(search,tabela_atual);
  147 + } else if (col == "{{n_did_table}}"){
70 148 tabela_atual = false;
71 149 search = [];
72 150 for (var i in json_n_did["data"]){
... ... @@ -149,9 +227,8 @@
149 227  
150 228 {% block breadcrumbs %}
151 229 {{ block.super }}
152   - {% breadcrumb webconference.topic 'subjects:topic_view' webconference.topic.subject.slug webconference.topic.slug %}
153 230 {% trans 'Reports' as bread %}
154   - {% breadcrumb bread webconference%}
  231 + {% breadcrumb bread webconference%}
155 232 {% endblock %}
156 233  
157 234 {% block content %}
... ... @@ -203,7 +280,7 @@
203 280 <ul>
204 281 </div>
205 282 </div>
206   -
  283 +
207 284 <div class="row">
208 285 <div class="col-md-10 col-md-offset-1">
209 286 <div id="chart_div" style="height: 500px; margin-top: -50px;"></div>
... ... @@ -231,10 +308,10 @@
231 308 <div id="table_div"></div>
232 309 </form>
233 310 <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12 text-center">
234   - <ul class="pagination">
  311 + <ul class="pagination">
235 312  
236   - </ul>
237   - </div>
  313 + </ul>
  314 + </div>
238 315 </div>
239 316 </div>
240 317 <div id="modal-message"></div>
... ... @@ -324,7 +401,7 @@
324 401 }
325 402 }
326 403 }
327   - console.log(search);
  404 +
328 405 if (!load_histoty){
329 406 drawTable(column_n_did,pagination(search,1),false);
330 407 } else {
... ... @@ -432,5 +509,8 @@
432 509 function scroll(to){
433 510 $("html, body").animate({ scrollTop: $(to).offset().top }, "slow");
434 511 }
  512 + function alterTitleTable (quant){
  513 + $("#title-table").text(quant + " {% trans 'record(s)' %}");
  514 + }
435 515 </script>
436 516 {% endblock %}
... ...