Merge branch 'master' into onion_crawler

This commit is contained in:
Terrtia 2018-09-28 15:29:24 +02:00
commit 3dd20af4d1
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
26 changed files with 245 additions and 171 deletions

View file

@ -296,6 +296,11 @@ def submit():
submitted_tag = 'infoleak:submission="manual"' submitted_tag = 'infoleak:submission="manual"'
#active taxonomies
active_taxonomies = r_serv_tags.smembers('active_taxonomies')
#active galaxies
active_galaxies = r_serv_tags.smembers('active_galaxies')
if ltags or ltagsgalaxies: if ltags or ltagsgalaxies:
if not addTagsVerification(ltags, ltagsgalaxies): if not addTagsVerification(ltags, ltagsgalaxies):
content = 'INVALID TAGS' content = 'INVALID TAGS'
@ -343,6 +348,8 @@ def submit():
launch_submit(ltags, ltagsgalaxies, paste_content, UUID, password ,True) launch_submit(ltags, ltagsgalaxies, paste_content, UUID, password ,True)
return render_template("submiting.html", return render_template("submiting.html",
active_taxonomies = active_taxonomies,
active_galaxies = active_galaxies,
UUID = UUID) UUID = UUID)
else: else:
@ -363,6 +370,8 @@ def submit():
launch_submit(ltags, ltagsgalaxies, paste_content, UUID, password) launch_submit(ltags, ltagsgalaxies, paste_content, UUID, password)
return render_template("submiting.html", return render_template("submiting.html",
active_taxonomies = active_taxonomies,
active_galaxies = active_galaxies,
UUID = UUID) UUID = UUID)
else: else:

View file

@ -20,7 +20,7 @@
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
<script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script>
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/tags.js') }}"></script> <script src="{{ url_for('static', filename='js/tags.js') }}"></script>
</head> </head>
@ -32,9 +32,9 @@
<div class="row"> <div class="row">
<!-- /.col-lg-12 --> <!-- /.col-lg-12 -->
<form action="/PasteSubmit/submit" id="pasteSubmitForm" method="post" enctype=multipart/form-data onsubmit="submitPaste()">
<form action="{{ url_for('PasteSubmit.submit') }}" id="pasteSubmitForm" method="post" enctype=multipart/form-data onsubmit="submitPaste()">
<input type="hidden" id="tags_taxonomies" name="tags_taxonomies" value="test"> <input type="hidden" id="tags_taxonomies" name="tags_taxonomies" value="test">
<input type="hidden" id="tags_galaxies" name="tags_galaxies" value="test"> <input type="hidden" id="tags_galaxies" name="tags_galaxies" value="test">
@ -128,7 +128,7 @@
var ltagsgalaxies var ltagsgalaxies
$(document).ready(function(){ $(document).ready(function(){
$.getJSON('/Tags/get_all_tags_taxonomies', $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
function(data) { function(data) {
ltags = $('#ltags').tagSuggest({ ltags = $('#ltags').tagSuggest({
@ -138,7 +138,7 @@
}); });
}); });
$.getJSON('/Tags/get_all_tags_galaxies', $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
function(data) { function(data) {
ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({ ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({
@ -165,7 +165,7 @@ function submitPaste(){
<script> <script>
jQuery("#all-tags-taxonomies").click(function(e){ jQuery("#all-tags-taxonomies").click(function(e){
//change input tags list //change input tags list
$.getJSON('/Tags/get_all_tags_taxonomies', $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
function(data) { function(data) {
ltags.setData(data) ltags.setData(data)
}); });
@ -174,7 +174,7 @@ function submitPaste(){
</script> </script>
<script> <script>
jQuery("#all-tags-galaxies").click(function(e){ jQuery("#all-tags-galaxies").click(function(e){
$.getJSON('/Tags/get_all_tags_galaxies', $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
function(data) { function(data) {
ltagsgalaxies.setData(data) ltagsgalaxies.setData(data)
}); });
@ -182,7 +182,7 @@ function submitPaste(){
{% for taxo in active_taxonomies %} {% for taxo in active_taxonomies %}
jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){ jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){
$.getJSON('/Tags/get_tags_taxonomie?taxonomie={{ taxo }}', $.getJSON("{{ url_for('Tags.get_tags_taxonomie') }}?taxonomie={{ taxo }}",
function(data) { function(data) {
ltags.setData(data) ltags.setData(data)
}); });
@ -192,7 +192,7 @@ function submitPaste(){
<script> <script>
{% for galaxy in active_galaxies %} {% for galaxy in active_galaxies %}
jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){ jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){
$.getJSON('/Tags/get_tags_galaxy?galaxy={{ galaxy }}', $.getJSON("{{ url_for('Tags.get_tags_galaxy') }}?galaxy={{ galaxy }}",
function(data) { function(data) {
ltagsgalaxies.setData(data) ltagsgalaxies.setData(data)
}); });

View file

@ -12,13 +12,13 @@
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script> <script language="javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<style> <style>
.tooltip-inner { .tooltip-inner {
@ -134,7 +134,7 @@
</div> </div>
</div> </div>
<form action="/PasteSubmit/tag_export_edited" id="checkboxForm" method='post'> <form action="{{ url_for('PasteSubmit.tag_export_edited') }}" id="checkboxForm" method='post'>
<div class="container"> <div class="container">

View file

@ -20,7 +20,7 @@
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
<script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script>
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/tags.js') }}"></script> <script src="{{ url_for('static', filename='js/tags.js') }}"></script>
<style> <style>
@ -49,7 +49,7 @@
<div class="row"> <div class="row">
<!-- /.col-lg-12 --> <!-- /.col-lg-12 -->
<form action="/PasteSubmit/submit" id="pasteSubmitForm" method="post" enctype=multipart/form-data onsubmit="submitPaste()"> <form action="{{ url_for('PasteSubmit.submit') }}" id="pasteSubmitForm" method="post" enctype=multipart/form-data onsubmit="submitPaste()">
<input type="hidden" id="tags_taxonomies" name="tags_taxonomies" value="test"> <input type="hidden" id="tags_taxonomies" name="tags_taxonomies" value="test">
<input type="hidden" id="tags_galaxies" name="tags_galaxies" value="test"> <input type="hidden" id="tags_galaxies" name="tags_galaxies" value="test">
@ -205,7 +205,7 @@
var ltagsgalaxies var ltagsgalaxies
$(document).ready(function(){ $(document).ready(function(){
$.getJSON('/Tags/get_all_tags_taxonomies', $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
function(data) { function(data) {
ltags = $('#ltags').tagSuggest({ ltags = $('#ltags').tagSuggest({
@ -215,7 +215,7 @@
}); });
}); });
$.getJSON('/Tags/get_all_tags_galaxies', $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
function(data) { function(data) {
ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({ ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({
@ -242,7 +242,7 @@ function submitPaste(){
<script> <script>
jQuery("#all-tags-taxonomies").click(function(e){ jQuery("#all-tags-taxonomies").click(function(e){
//change input tags list //change input tags list
$.getJSON('/Tags/get_all_tags_taxonomies', $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
function(data) { function(data) {
ltags.setData(data) ltags.setData(data)
}); });
@ -251,7 +251,7 @@ function submitPaste(){
</script> </script>
<script> <script>
jQuery("#all-tags-galaxies").click(function(e){ jQuery("#all-tags-galaxies").click(function(e){
$.getJSON('/Tags/get_all_tags_galaxies', $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
function(data) { function(data) {
ltagsgalaxies.setData(data) ltagsgalaxies.setData(data)
}); });
@ -259,7 +259,7 @@ function submitPaste(){
{% for taxo in active_taxonomies %} {% for taxo in active_taxonomies %}
jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){ jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){
$.getJSON('/Tags/get_tags_taxonomie?taxonomie={{ taxo }}', $.getJSON("{{ url_for('Tags.get_tags_taxonomie') }}?taxonomie={{ taxo }}",
function(data) { function(data) {
ltags.setData(data) ltags.setData(data)
}); });
@ -269,7 +269,7 @@ function submitPaste(){
<script> <script>
{% for galaxy in active_galaxies %} {% for galaxy in active_galaxies %}
jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){ jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){
$.getJSON('/Tags/get_tags_galaxy?galaxy={{ galaxy }}', $.getJSON("{{ url_for('Tags.get_tags_galaxy') }}?galaxy={{ galaxy }}",
function(data) { function(data) {
ltagsgalaxies.setData(data) ltagsgalaxies.setData(data)
}); });
@ -283,7 +283,7 @@ function submitPaste(){
$(".progress-bar").css("width", i + "%").text(i + " %"); $(".progress-bar").css("width", i + "%").text(i + " %");
function makeProgress(){ function makeProgress(){
$.getJSON('/PasteSubmit/submit_status?UUID={{ UUID }}', $.getJSON("{{ url_for('PasteSubmit.submit_status') }}?UUID={{ UUID }}",
function(data) { function(data) {
var end = data.end; var end = data.end;

View file

@ -85,7 +85,7 @@
activePage = "page-Tags" activePage = "page-Tags"
$("#"+activePage).addClass("active"); $("#"+activePage).addClass("active");
$.getJSON('/Tags/get_all_tags', $.getJSON("{{ url_for('Tags.get_all_tags') }}",
function(data) { function(data) {
ltags = $('#ltags').tagSuggest({ ltags = $('#ltags').tagSuggest({

View file

@ -12,13 +12,13 @@
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script> <script language="javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<style> <style>
.tooltip-inner { .tooltip-inner {
@ -47,7 +47,7 @@
<div id="page-wrapper"> <div id="page-wrapper">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<a href="/Tags/galaxies" class="btn btn-light pull-left"> <a href="{{ url_for('Tags.galaxies') }}" class="btn btn-light pull-left">
<i class="fa fa-arrow-left fa"></i> List Galaxies <i class="fa fa-arrow-left fa"></i> List Galaxies
</a> </a>
</div> </div>
@ -83,7 +83,7 @@
</div> </div>
</div> </div>
<form action="/Tags/edit_galaxy_tag" id="checkboxForm"> <form action="{{ url_for('Tags.edit_galaxy_tag') }}" id="checkboxForm">
<input type="hidden" value="{{ id }}" name="galaxy" /> <input type="hidden" value="{{ id }}" name="galaxy" />

View file

@ -12,13 +12,13 @@
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script> <script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js')}}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js')}}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js')}}"></script>
<style> <style>
.tooltip-inner { .tooltip-inner {
@ -47,7 +47,7 @@
<div id="page-wrapper"> <div id="page-wrapper">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<a href="/Tags/taxonomies" class="btn btn-light pull-left"> <a href="{{ url_for('Tags.taxonomies') }}" class="btn btn-light pull-left">
<i class="fa fa-arrow-left fa"></i> List Taxonomies <i class="fa fa-arrow-left fa"></i> List Taxonomies
</a> </a>
</div> </div>
@ -83,7 +83,7 @@
</div> </div>
</div> </div>
<form action="/Tags/edit_taxonomie_tag" id="checkboxForm"> <form action="{{ url_for('Tags.edit_taxonomie_tag') }}" id="checkboxForm">
<input type="hidden" value="{{ id }}" name="taxonomie" /> <input type="hidden" value="{{ id }}" name="taxonomie" />

View file

@ -12,13 +12,13 @@
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script> <script language="javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<style> <style>
.tooltip-inner { .tooltip-inner {

View file

@ -12,13 +12,13 @@
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script> <script language="javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<style> <style>
.tooltip-inner { .tooltip-inner {

View file

@ -9,15 +9,15 @@
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}"> <link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
<!-- Core CSS --> <!-- Core CSS -->
<link href="/static//css/bootstrap.min.css" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="/static//font-awesome/css/font-awesome.css" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="/static//css/sb-admin-2.css" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ url_for('static', filename='css/tags.css') }}" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/tags.css') }}" rel="stylesheet" type="text/css" />
<script language="javascript" src="/static//js/jquery.js"></script> <script src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<script src="{{ url_for('static', filename='js/tags.js') }}"></script> <script src="{{ url_for('static', filename='js/tags.js') }}"></script>
<style> <style>
@ -128,7 +128,7 @@
<div id="div_stil_data"> <div id="div_stil_data">
<button id="load_more_json_button1" type="button" class="btn btn-default" onclick="add_entries(100)" style="display: True">Load 100 entries</button> <button id="load_more_json_button1" type="button" class="btn btn-default" onclick="add_entries(100)" style="display: True">Load 100 entries</button>
<button id="load_more_json_button2" type="button" class="btn btn-warning" onclick="add_entries(300)" style="display: True">Load 300 entries</button> <button id="load_more_json_button2" type="button" class="btn btn-warning" onclick="add_entries(300)" style="display: True">Load 300 entries</button>
<img id="loading_gif_browse" src="/static//image/loading.gif" heigt="20" width="20" style="margin: 2px;"></div> <img id="loading_gif_browse" src="{{url_for('static', filename='image/loading.gif') }}" heigt="20" width="20" style="margin: 2px;"></div>
</br> </br>
<div> <div>
@ -178,7 +178,7 @@ $(document).ready(function(){
$("#nbr_entry").hide(); $("#nbr_entry").hide();
$("#loading_gif_browse").hide(); $("#loading_gif_browse").hide();
$.getJSON('/Tags/get_all_tags', $.getJSON("{{ url_for('Tags.get_all_tags') }}",
function(data) { function(data) {
activePage = "page-Tags" activePage = "page-Tags"
$("#"+activePage).addClass("active"); $("#"+activePage).addClass("active");

View file

@ -12,13 +12,13 @@
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
<link href="/static//css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script> <script language="javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script src="/static//js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
<script src="/static//js/jquery.dataTables.min.js"></script> <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
<script src="/static//js/dataTables.bootstrap.js"></script> <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<style> <style>
.tooltip-inner { .tooltip-inner {

View file

@ -24,8 +24,7 @@
window.glob_tabvar = []; // Avoid undefined window.glob_tabvar = []; // Avoid undefined
window.threshold_stucked_module = {{ threshold_stucked_module }} window.threshold_stucked_module = {{ threshold_stucked_module }}
function update_values() { function update_values() {
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }}; $.getJSON("{{ url_for('dashboard.stuff') }}",
$.getJSON($SCRIPT_ROOT+"/_stuff",
function(data) { function(data) {
window.glob_tabvar = data; window.glob_tabvar = data;
}); });
@ -189,14 +188,16 @@
</div> </div>
<script> var url_showSavedPath = "{{ url_for('showsavedpastes.showsavedpaste') }}"; </script> <script> var url_showSavedPath = "{{ url_for('showsavedpastes.showsavedpaste') }}"; </script>
<script type="text/javascript" src="{{ url_for('static', filename='js/indexjavascript.js')}}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/indexjavascript.js')}}"
data-urlstuff="{{ url_for('dashboard.stuff') }}" data-urllog="{{ url_for('dashboard.logs') }}">
</script>
<script> <script>
activePage = "page-index"; activePage = "page-index";
$("#"+activePage).addClass("active"); $("#"+activePage).addClass("active");
var tableBody = document.getElementById('tab_body') var tableBody = document.getElementById('tab_body')
$.getJSON('/_get_last_logs_json', function(data) { $.getJSON("{{ url_for('dashboard.get_last_logs_json') }}", function(data) {
data.forEach(function (d) { data.forEach(function (d) {
var tr = document.createElement('TR') var tr = document.createElement('TR')
var time = document.createElement('TD') var time = document.createElement('TD')

View file

@ -1,5 +1,5 @@
<div class="input-group custom-search-form"> <div class="input-group custom-search-form">
<form action="/search" id="form-search" method=POST> <form action="{{ url_for('searches.search') }}" id="form-search" method=POST>
<input type="text" name="query" class="form-control" placeholder="Search Paste"> <input type="text" name="query" class="form-control" placeholder="Search Paste">
<input type="hidden" name="index_name" class="form-control" value="0" placeholder="Index Name"> <input type="hidden" name="index_name" class="form-control" value="0" placeholder="Index Name">
<span class="input-group-btn"> <span class="input-group-btn">

View file

@ -279,7 +279,7 @@ def showHash():
first_seen=first_seen, list_hash_decoder=list_hash_decoder, first_seen=first_seen, list_hash_decoder=list_hash_decoder,
last_seen=last_seen, nb_seen_in_all_pastes=nb_seen_in_all_pastes, sparkline_values=sparkline_values) last_seen=last_seen, nb_seen_in_all_pastes=nb_seen_in_all_pastes, sparkline_values=sparkline_values)
@app.route('/hashDecoded/downloadHash') @hashDecoded.route('/hashDecoded/downloadHash')
def downloadHash(): def downloadHash():
hash = request.args.get('hash') hash = request.args.get('hash')
# sanitize hash # sanitize hash

View file

@ -90,7 +90,7 @@
<div class="panel panel-info" style="text-align:center;"> <div class="panel panel-info" style="text-align:center;">
<div class="panel-heading"> <div class="panel-heading">
Select a date range : Select a date range :
<form action="/hashDecoded/all_hash_search" id="hash_selector_form" method='post'> <form action="{{ url_for('hashDecoded.all_hash_search') }}" id="hash_selector_form" method='post'>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar fa" aria-hidden="true"></i></span> <span class="input-group-addon"><i class="fa fa-calendar fa" aria-hidden="true"></i></span>
<input class="form-control" id="date-range-from" placeholder="yyyy-mm-dd" value="{{ date_from }}" name="date_from"> <input class="form-control" id="date-range-from" placeholder="yyyy-mm-dd" value="{{ date_from }}" name="date_from">
@ -244,11 +244,11 @@
}); });
{% if type %} {% if type %}
chart.stackBarChart =barchart_type_stack('/hashDecoded/hash_by_type_json?type={{type}}', 'id'); chart.stackBarChart =barchart_type_stack("{{ url_for('hashDecoded.hash_by_type_json') }}?type={{type}}", 'id');
{% elif daily_type_chart %} {% elif daily_type_chart %}
chart.stackBarChart =barchart_type_stack('/hashDecoded/range_type_json?date_from={{daily_date}}&date_to={{daily_date}}', 'id'); chart.stackBarChart =barchart_type_stack("{{ url_for('hashDecoded.range_type_json') }}?date_from={{daily_date}}&date_to={{daily_date}}", 'id');
{% else %} {% else %}
chart.stackBarChart = barchart_type_stack("/hashDecoded/range_type_json?date_from={{date_from}}&date_to={{date_to}}", 'id') chart.stackBarChart = barchart_type_stack("{{ url_for('hashDecoded.range_type_json') }}?date_from={{date_from}}&date_to={{date_to}}", 'id')
{% endif %} {% endif %}
chart.onResize(); chart.onResize();
@ -260,7 +260,7 @@
<script> <script>
function updateVTReport(hash) { function updateVTReport(hash) {
//updateReport //updateReport
$.getJSON('/hashDecoded/update_vt_result?hash='+hash, $.getJSON("{{ url_for('hashDecoded.update_vt_result') }}?hash="+hash,
function(data) { function(data) {
content = '<span class="glyphicon glyphicon-refresh"></span> ' +data['report_vt'] content = '<span class="glyphicon glyphicon-refresh"></span> ' +data['report_vt']
$( "#report_vt_"+hash ).html(content); $( "#report_vt_"+hash ).html(content);
@ -269,7 +269,7 @@
function sendFileToVT(hash) { function sendFileToVT(hash) {
//send file to vt //send file to vt
$.getJSON('/hashDecoded/send_file_to_vt_js?hash='+hash, $.getJSON("{{ url_for('hashDecoded.send_file_to_vt_js') }}?hash="+hash,
function(data) { function(data) {
var content = '<a id="submit_vt_'+hash+'" class="btn btn-primary" target="_blank" href="'+ data['vt_link'] +'"><i class="fa fa-link"> '+ ' VT Report' +'</i></a>'; var content = '<a id="submit_vt_'+hash+'" class="btn btn-primary" target="_blank" href="'+ data['vt_link'] +'"><i class="fa fa-link"> '+ ' VT Report' +'</i></a>';
$('#submit_vt_'+hash).remove(); $('#submit_vt_'+hash).remove();
@ -374,13 +374,13 @@ function barchart_type_stack(url, id) {
.selectAll("text") .selectAll("text")
.attr("class", "bar") .attr("class", "bar")
{% if date_from|string == date_to|string and type is none %} {% if date_from|string == date_to|string and type is none %}
.on("click", function (d) { window.location.href = '/hashDecoded/?date_from={{date_from}}&date_to={{date_to}}&type='+d }) .on("click", function (d) { window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}?date_from={{date_from}}&date_to={{date_to}}&type="+d })
.attr("transform", "rotate(-18)" ) .attr("transform", "rotate(-18)" )
{% elif date_from|string == date_to|string and type is not none %} {% elif date_from|string == date_to|string and type is not none %}
.on("click", function (d) { window.location.href = '/hashDecoded/?date_from='+d+'&date_to='+d }) .on("click", function (d) { window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}?date_from="+d+'&date_to='+d })
.attr("transform", "rotate(-18)" ) .attr("transform", "rotate(-18)" )
{% else %} {% else %}
.on("click", function (d) { window.location.href = '/hashDecoded/?date_from='+d+'&date_to='+d }) .on("click", function (d) { window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}?date_from="+d+'&date_to='+d })
.attr("transform", "rotate(-40)" ) .attr("transform", "rotate(-40)" )
{% endif %} {% endif %}
.style("text-anchor", "end"); .style("text-anchor", "end");
@ -412,11 +412,11 @@ function barchart_type_stack(url, id) {
.on("mouseover", function (d) { showPopover.call(this, d); }) .on("mouseover", function (d) { showPopover.call(this, d); })
.on("mouseout", function (d) { removePopovers(); }) .on("mouseout", function (d) { removePopovers(); })
{% if date_from|string == date_to|string and type is none %} {% if date_from|string == date_to|string and type is none %}
.on("click", function(d){ window.location.href = "/hashDecoded/" +'?date_from={{date_from}}&date_to={{date_to}}&type='+d.label+'&encoding='+d.name; }); .on("click", function(d){ window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}" +'?date_from={{date_from}}&date_to={{date_to}}&type='+d.label+'&encoding='+d.name; });
{% elif date_from|string == date_to|string and type is not none %} {% elif date_from|string == date_to|string and type is not none %}
.on("click", function(d){ window.location.href = "/hashDecoded/" +'?type={{type}}&date_from='+d.label+'&date_to='+d.label+'&encoding='+d.name; }); .on("click", function(d){ window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}" +'?type={{type}}&date_from='+d.label+'&date_to='+d.label+'&encoding='+d.name; });
{% else %} {% else %}
.on("click", function(d){ window.location.href = "/hashDecoded/" +'?type='+ d.name +'&date_from='+d.label+'&date_to='+d.label; }); .on("click", function(d){ window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}" +'?type='+ d.name +'&date_from='+d.label+'&date_to='+d.label; });
{% endif %} {% endif %}
data.forEach(function(d) { data.forEach(function(d) {
@ -424,15 +424,14 @@ function barchart_type_stack(url, id) {
svg.append("text") svg.append("text")
.attr("class", "bar") .attr("class", "bar")
.attr("dy", "-.35em") .attr("dy", "-.35em")
//.on("click", (window.location.href = "/hashDecoded/"+'?date_from='+d.date) )
.attr('x', x(d.date) + x.bandwidth()/2) .attr('x', x(d.date) + x.bandwidth()/2)
.attr('y', y(d.total)) .attr('y', y(d.total))
{% if date_from|string == date_to|string and type is none %} {% if date_from|string == date_to|string and type is none %}
.on("click", function () {window.location.href = "/hashDecoded/"+'?date_from={{date_from}}&date_to={{date_to}}&type='+d.date }) .on("click", function () {window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}"+'?date_from={{date_from}}&date_to={{date_to}}&type='+d.date })
{% elif date_from|string == date_to|string and type is not none %} {% elif date_from|string == date_to|string and type is not none %}
.on("click", function () {window.location.href = '/hashDecoded/?type={{type}}&date_from='+d.date+'&date_to='+d.date }) .on("click", function () {window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}?type={{type}}&date_from="+d.date+'&date_to='+d.date })
{% else %} {% else %}
.on("click", function () {window.location.href = "/hashDecoded/"+'?date_from='+d.date+'&date_to='+d.date }) .on("click", function () {window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}"+'?date_from='+d.date+'&date_to='+d.date })
{% endif %} {% endif %}
.style("text-anchor", "middle") .style("text-anchor", "middle")
.text(d.total); .text(d.total);
@ -528,7 +527,7 @@ var arc_pie = d3.arc()
.innerRadius(0) .innerRadius(0)
.outerRadius(radius_pie); .outerRadius(radius_pie);
d3.json("/hashDecoded/decoder_type_json?date_from={{date_from}}&date_to={{date_to}}&type={{type}}") d3.json("{{ url_for('hashDecoded.decoder_type_json') }}?date_from={{date_from}}&date_to={{date_to}}&type={{type}}")
.then(function(data){ .then(function(data){
var pie_pie = d3.pie() var pie_pie = d3.pie()
@ -545,7 +544,7 @@ d3.json("/hashDecoded/decoder_type_json?date_from={{date_from}}&date_to={{date_t
.attr('class', 'pie_path') .attr('class', 'pie_path')
.on("mouseover", mouseovered_pie) .on("mouseover", mouseovered_pie)
.on("mouseout", mouseouted_pie) .on("mouseout", mouseouted_pie)
.on("click", function (d) {window.location.href = '/hashDecoded/?date_from={{date_from}}&date_to={{date_to}}&type={{type}}&encoding='+d.data.name }) .on("click", function (d) {window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}?date_from={{date_from}}&date_to={{date_to}}&type={{type}}&encoding="+d.data.name })
.style('opacity', opacity_pie) .style('opacity', opacity_pie)
.style('stroke', 'white'); .style('stroke', 'white');
}); });
@ -626,7 +625,7 @@ function barchart_type(url, id) {
{% else %} {% else %}
.attr("transform", "rotate(-70)" ) .attr("transform", "rotate(-70)" )
.attr("class", "bar") .attr("class", "bar")
.on("click", function (d) { window.location.href = "/hashDecoded/"+'?date_from='+d+'&date_to='+d }); .on("click", function (d) { window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}"+'?date_from='+d+'&date_to='+d });
{% endif %} {% endif %}
svg.append("g") svg.append("g")
@ -649,10 +648,10 @@ function barchart_type(url, id) {
.attr("y", function(d) { return y(d.value); }) .attr("y", function(d) { return y(d.value); })
.attr("height", function(d) { return height - y(d.value); }) .attr("height", function(d) { return height - y(d.value); })
{% if type %} {% if type %}
.on("click", function(d){ window.location.href = "/hashDecoded/" +'?type={{type}}&date_from='+ d.date +'&date_to='+ d.date; }); .on("click", function(d){ window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}" +'?type={{type}}&date_from='+ d.date +'&date_to='+ d.date; });
{% endif %} {% endif %}
{% if daily_type_chart %} {% if daily_type_chart %}
.on("click", function(d){ window.location.href = "/hashDecoded/" +'?type='+d.date+'&date_from={{ daily_date }}&date_to={{ daily_date }}'; }); .on("click", function(d){ window.location.href = "{{ url_for('hashDecoded.hashDecoded_page') }}" +'?type='+d.date+'&date_from={{ daily_date }}&date_to={{ daily_date }}'; });
{% endif %} {% endif %}

View file

@ -151,7 +151,7 @@
Virus Total submission is disabled Virus Total submission is disabled
{% endif %} {% endif %}
<a href="/hashDecoded/downloadHash?hash={{hash}}" target="blank"> <a href="{{ url_for('hashDecoded.downloadHash') }}?hash={{hash}}" target="blank">
<button class='btn btn-info pull-right'><i id="flash-tld" class="glyphicon glyphicon-download-alt " flash-tld=""></i> Download Hashed file <button class='btn btn-info pull-right'><i id="flash-tld" class="glyphicon glyphicon-download-alt " flash-tld=""></i> Download Hashed file
</button> </button>
</a> </a>
@ -245,8 +245,8 @@
$(document).ready(function(){ $(document).ready(function(){
sparklines("sparkline", {{ sparkline_values }}) sparklines("sparkline", {{ sparkline_values }})
all_graph.node_graph = create_graph('/hashDecoded/hash_graph_node_json?hash={{hash}}'); all_graph.node_graph = create_graph("{{ url_for('hashDecoded.hash_graph_node_json') }}?hash={{hash}}");
all_graph.line_chart = create_line_chart('graph_line', '/hashDecoded/hash_graph_line_json?hash={{hash}}'); all_graph.line_chart = create_line_chart('graph_line', "{{ url_for('hashDecoded.hash_graph_line_json') }}?hash={{hash}}");
all_graph.onResize(); all_graph.onResize();
}); });
@ -257,7 +257,7 @@
<script> <script>
function sendFileToVT(hash) { function sendFileToVT(hash) {
//send file to vt //send file to vt
$.getJSON('/hashDecoded/send_file_to_vt_js?hash='+hash, $.getJSON("{{ url_for('hashDecoded.send_file_to_vt_js') }}?hash="+hash,
function(data) { function(data) {
var content = '<a id="submit_vt_b" class="btn btn-primary" target="_blank" href="'+ data['vt_link'] +'"><i class="fa fa-link"> '+ ' VT Report' +'</i></a>'; var content = '<a id="submit_vt_b" class="btn btn-primary" target="_blank" href="'+ data['vt_link'] +'"><i class="fa fa-link"> '+ ' VT Report' +'</i></a>';
$('#submit_vt_b').remove(); $('#submit_vt_b').remove();
@ -267,7 +267,7 @@
function updateVTReport(hash) { function updateVTReport(hash) {
//updateReport //updateReport
$.getJSON('/hashDecoded/update_vt_result?hash='+hash, $.getJSON("{{ url_for('hashDecoded.update_vt_result') }}?hash="+hash,
function(data) { function(data) {
var content = '<span class="glyphicon glyphicon-refresh"></span> ' +data['report_vt']; var content = '<span class="glyphicon glyphicon-refresh"></span> ' +data['report_vt'];
$( "#report_vt_b" ).html(content); $( "#report_vt_b" ).html(content);

View file

@ -127,7 +127,9 @@
$("#"+activePage).addClass("active"); $("#"+activePage).addClass("active");
}); });
</script> </script>
<script src="{{ url_for('static', filename='js/sentiment_plot.js') }}"></script> <script src="{{ url_for('static', filename='js/sentiment_plot.js') }}"
data-url_sentiment_analysis="{{ url_for('sentiments.sentiment_analysis_plot_tool_getdata') }}">
</script>
</body> </body>
</html> </html>

View file

@ -230,7 +230,9 @@
<!-- import graph function --> <!-- import graph function -->
<script src="{{ url_for('static', filename='js/sentiment_trending.js') }}"></script> <script src="{{ url_for('static', filename='js/sentiment_trending.js') }}"
data-url_sentiment_analysis_getplotdata="{{ url_for('sentiments.sentiment_analysis_getplotdata') }}">
</script>
<script> <script>
$("#LoadAll").hide(); $("#LoadAll").hide();

View file

@ -215,7 +215,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form method="post" action="/PasteSubmit/create_misp_event"target="_blank"> <form method="post" action="{{ url_for('PasteSubmit.create_misp_event') }}" target="_blank">
<div class="input select required"> <div class="input select required">
<label for="EventDistribution">Distribution</label> <label for="EventDistribution">Distribution</label>
@ -293,7 +293,7 @@
<div class="modal-body"> <div class="modal-body">
<form method="post" action="/PasteSubmit/create_hive_case" target="_blank"> <form method="post" action="{{ url_for('PasteSubmit.create_hive_case') }}" target="_blank">
<div class="input clear required"> <div class="input clear required">
<label for="EventThreatLevelId">Threat Level</label> <label for="EventThreatLevelId">Threat Level</label>
@ -483,7 +483,7 @@
var ltagsgalaxies var ltagsgalaxies
$(document).ready(function(){ $(document).ready(function(){
$.getJSON('/Tags/get_all_tags_taxonomies', $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
function(data) { function(data) {
ltags = $('#ltags').tagSuggest({ ltags = $('#ltags').tagSuggest({
@ -493,7 +493,7 @@
}); });
}); });
$.getJSON('/Tags/get_all_tags_galaxies', $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
function(data) { function(data) {
ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({ ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({
@ -515,7 +515,7 @@
<script> <script>
function updateVTReport(hash) { function updateVTReport(hash) {
//updateReport //updateReport
$.getJSON('/hashDecoded/update_vt_result?hash='+hash, $.getJSON("{{ url_for('hashDecoded.update_vt_result') }}?hash="+hash,
function(data) { function(data) {
content = '<span class="glyphicon glyphicon-refresh"></span> ' +data['report_vt'] content = '<span class="glyphicon glyphicon-refresh"></span> ' +data['report_vt']
$( "#report_vt_"+hash ).html(content); $( "#report_vt_"+hash ).html(content);
@ -524,7 +524,7 @@
function sendFileToVT(hash) { function sendFileToVT(hash) {
//send file to vt //send file to vt
$.getJSON('/hashDecoded/send_file_to_vt_js?hash='+hash, $.getJSON("{{ url_for('hashDecoded.send_file_to_vt_js') }}?hash="+hash,
function(data) { function(data) {
var content = '<a id="submit_vt_'+hash+'" class="btn btn-primary" target="_blank" href="'+ data['vt_link'] +'"><i class="fa fa-link"> '+ ' VT Report' +'</i></a>'; var content = '<a id="submit_vt_'+hash+'" class="btn btn-primary" target="_blank" href="'+ data['vt_link'] +'"><i class="fa fa-link"> '+ ' VT Report' +'</i></a>';
$('#submit_vt_'+hash).remove(); $('#submit_vt_'+hash).remove();
@ -537,7 +537,7 @@
<script> <script>
jQuery("#all-tags-taxonomies").click(function(e){ jQuery("#all-tags-taxonomies").click(function(e){
//change input tags list //change input tags list
$.getJSON('/Tags/get_all_tags_taxonomies', $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}",
function(data) { function(data) {
ltags.setData(data) ltags.setData(data)
}); });
@ -546,7 +546,7 @@
</script> </script>
<script> <script>
jQuery("#all-tags-galaxies").click(function(e){ jQuery("#all-tags-galaxies").click(function(e){
$.getJSON('/Tags/get_all_tags_galaxies', $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}",
function(data) { function(data) {
ltagsgalaxies.setData(data) ltagsgalaxies.setData(data)
}); });
@ -567,7 +567,7 @@
<script> <script>
{% for taxo in active_taxonomies %} {% for taxo in active_taxonomies %}
jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){ jQuery("#{{ taxo }}-id{{ loop.index0 }}").click(function(e){
$.getJSON('/Tags/get_tags_taxonomie?taxonomie={{ taxo }}', $.getJSON("{{ url_for('Tags.get_tags_taxonomie') }}?taxonomie={{ taxo }}",
function(data) { function(data) {
ltags.setData(data) ltags.setData(data)
}); });
@ -577,7 +577,7 @@
<script> <script>
{% for galaxy in active_galaxies %} {% for galaxy in active_galaxies %}
jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){ jQuery("#{{ galaxy }}-idgalax{{ loop.index0 }}").click(function(e){
$.getJSON('/Tags/get_tags_galaxy?galaxy={{ galaxy }}', $.getJSON("{{ url_for('Tags.get_tags_galaxy') }}?galaxy={{ galaxy }}",
function(data) { function(data) {
ltagsgalaxies.setData(data) ltagsgalaxies.setData(data)
}); });

View file

@ -55,10 +55,11 @@
<script> <script>
var chart_1_num_day = 5; var chart_1_num_day = 5;
var chart_2_num_day = 15; var chart_2_num_day = 15;
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
</script> </script>
<script type="text/javascript" src="{{ url_for('static', filename='js/trendingchart.js')}}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/trendingchart.js')}}"
data-url_progressionCharts="{{ url_for('trendings.progressionCharts') }}">
</script>
<div class="tab-content"> <div class="tab-content">
<div class="col-lg-12 tab-pane fade in active" id="tld-tab" > <div class="col-lg-12 tab-pane fade in active" id="tld-tab" >

View file

@ -34,10 +34,12 @@
<script> <script>
var chart_1_num_day = 5; var chart_1_num_day = 5;
var chart_2_num_day = 15; var chart_2_num_day = 15;
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
</script> </script>
<script src="{{ url_for('static', filename='js/moduleTrending.js') }}"></script> <script src="{{ url_for('static', filename='js/moduleTrending.js') }}"
data-url_providersChart="{{ url_for('trendingmodules.providersChart') }}"
data-url_moduleCharts="{{ url_for('trendingmodules.modulesCharts') }}">
</script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
activePage = "page-modulestats" activePage = "page-modulestats"

View file

@ -3,6 +3,19 @@ var data_for_processed_paste = {};
var list_feeder = []; var list_feeder = [];
window.paste_num_tabvar_all = {}; window.paste_num_tabvar_all = {};
function getSyncScriptParams() {
var scripts = document.getElementsByTagName('script');
var lastScript = scripts[scripts.length-1];
var scriptName = lastScript;
return {
urlstuff : scriptName.getAttribute('data-urlstuff'),
urllog : scriptName.getAttribute('data-urllog')
};
}
var urlstuff = getSyncScriptParams().urlstuff;
var urllog = getSyncScriptParams().urllog;
//If we do not received info from mixer, set pastes_num to 0 //If we do not received info from mixer, set pastes_num to 0
function checkIfReceivedData(){ function checkIfReceivedData(){
for (i in list_feeder) { for (i in list_feeder) {
@ -27,8 +40,7 @@ function initfunc( csvay, scroot) {
}; };
function update_values() { function update_values() {
$SCRIPT_ROOT = window.scroot ; $.getJSON(urlstuff,
$.getJSON($SCRIPT_ROOT+"/_stuff",
function(data) { function(data) {
window.glob_tabvar = data; window.glob_tabvar = data;
}); });
@ -122,7 +134,7 @@ function initfunc( csvay, scroot) {
window.scroot = scroot; window.scroot = scroot;
}; };
var source = new EventSource('/_logs'); var source = new EventSource(urllog);
source.onmessage = function(event) { source.onmessage = function(event) {
var feed = jQuery.parseJSON( event.data ); var feed = jQuery.parseJSON( event.data );

View file

@ -1,10 +1,22 @@
/* Already defined variable (Before the input) /* Already defined variable (Before the input)
* *
* var chart_1_num_day = 5; * var chart_1_num_day = 5;
* var chart_2_num_day = 15; * var chart_2_num_day = 15;
* *
*/ */
function getSyncScriptParams() {
var scripts = document.getElementsByTagName('script');
var lastScript = scripts[scripts.length-1];
var scriptName = lastScript;
return {
url_providersChart : scriptName.getAttribute('data-url_providersChart'),
url_moduleCharts : scriptName.getAttribute('data-url_moduleCharts'),
};
}
var url_providersChart = getSyncScriptParams().url_providersChart;
var url_moduleCharts = getSyncScriptParams().url_moduleCharts;
/* VARIABLES */ /* VARIABLES */
var pie_threshold = 0.05 var pie_threshold = 0.05
@ -29,7 +41,7 @@
grid: { hoverable: true, clickable: true }, grid: { hoverable: true, clickable: true },
legend: { show: false }, legend: { show: false },
}; };
/* Linked graph - remember the data */ /* Linked graph - remember the data */
var plot_data_old = [] var plot_data_old = []
var plot_old = [] var plot_old = []
@ -46,23 +58,24 @@ function labelFormatter(label, series) {
function plot_top_graph(module_name, init){ function plot_top_graph(module_name, init){
/**** Pie Chart ****/ /**** Pie Chart ****/
// moduleCharts is used the decide the url to request data // moduleCharts is used the decide the url to request data
var moduleCharts = "size" == module_name ? "providersChart" : ("num" == module_name ? "providersChart" : "moduleCharts"); var moduleCharts = "size" == module_name ? url_providersChart : ("num" == module_name ? url_providersChart : url_moduleCharts);
console.log(moduleCharts)
var tot_sum = 0; // used to detect elements placed in 'Other' pie's part var tot_sum = 0; // used to detect elements placed in 'Other' pie's part
var data_other = []; // used to detect elements placed in 'Other' pie's part var data_other = []; // used to detect elements placed in 'Other' pie's part
var createPie = $.getJSON($SCRIPT_ROOT+"/_"+moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day, var createPie = $.getJSON(moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day,
function(data) { function(data) {
var temp_data_pie = []; var temp_data_pie = [];
for(i=0; i<data.length; i++){ for(i=0; i<data.length; i++){
if (i==0 && data[0][0] == "passed_days"){ // If there is no data today, take it from the past if (i==0 && data[0][0] == "passed_days"){ // If there is no data today, take it from the past
if (data[0][1] > 0 && data[0][1] < 7){ // If data is [1:6] day(s) old, put the panel in yellow if (data[0][1] > 0 && data[0][1] < 7){ // If data is [1:6] day(s) old, put the panel in yellow
$("#day-"+module_name).text(data[0][1] + " Day(s) ago "); $("#day-"+module_name).text(data[0][1] + " Day(s) ago ");
$("#panel-"+module_name).removeClass("panel-green"); $("#panel-"+module_name).removeClass("panel-green");
$("#panel-"+module_name).addClass("panel-yellow"); $("#panel-"+module_name).addClass("panel-yellow");
} else if (data[0][1] > 6) { // data old of more than 7 days, put the panel in red } else if (data[0][1] > 6) { // data old of more than 7 days, put the panel in red
$("#day-"+module_name).text(data[0][1] + " Day(s) ago "); $("#day-"+module_name).text(data[0][1] + " Day(s) ago ");
$("#panel-"+module_name).removeClass("panel-green"); $("#panel-"+module_name).removeClass("panel-green");
$("#panel-"+module_name).addClass("panel-red"); $("#panel-"+module_name).addClass("panel-red");
} }
@ -81,29 +94,29 @@ function plot_top_graph(module_name, init){
if (init){ //prevent multiple binding due to the refresh function if (init){ //prevent multiple binding due to the refresh function
$("#flot-pie-chart-"+module_name).bind("plotclick", function (event, pos, item) { $("#flot-pie-chart-"+module_name).bind("plotclick", function (event, pos, item) {
if (item == null) if (item == null)
return; return;
var clicked_label = item.series.label; var clicked_label = item.series.label;
if (module_name == "size"){ // if Provider pie chart clicked, draw the two bar charts if (module_name == "size"){ // if Provider pie chart clicked, draw the two bar charts
update_bar_chart(moduleCharts, module_name, "#flot-bar-chart-"+module_name, clicked_label, update_bar_chart(moduleCharts, module_name, "#flot-bar-chart-"+module_name, clicked_label,
item.series.color, "%m/%d", false); item.series.color, "%m/%d", false);
update_bar_chart(moduleCharts, "num", "#flot-bar-chart-"+"num", clicked_label, update_bar_chart(moduleCharts, "num", "#flot-bar-chart-"+"num", clicked_label,
item.series.color, "%m/%d", true); item.series.color, "%m/%d", true);
} }
else if (module_name == "num"){ else if (module_name == "num"){
update_bar_chart(moduleCharts, module_name, "#flot-bar-chart-"+module_name, clicked_label, update_bar_chart(moduleCharts, module_name, "#flot-bar-chart-"+module_name, clicked_label,
item.series.color, "%m/%d", false); item.series.color, "%m/%d", false);
update_bar_chart(moduleCharts, "size", "#flot-bar-chart-"+"size", clicked_label, update_bar_chart(moduleCharts, "size", "#flot-bar-chart-"+"size", clicked_label,
item.series.color, "%m/%d", true); item.series.color, "%m/%d", true);
} else { } else {
update_bar_chart(moduleCharts, module_name, "#flot-bar-chart-"+module_name, clicked_label, update_bar_chart(moduleCharts, module_name, "#flot-bar-chart-"+module_name, clicked_label,
item.series.color, "%m/%d", true); item.series.color, "%m/%d", true);
} }
}); });
} }
}); });
/**** Bar Chart ****/ /**** Bar Chart ****/
function update_bar_chart(chartUrl, module_name, chartID, involved_item, serie_color, timeformat, can_bind){ function update_bar_chart(chartUrl, module_name, chartID, involved_item, serie_color, timeformat, can_bind){
@ -137,7 +150,7 @@ function plot_top_graph(module_name, init){
for(i=0; i<data_other.length; i++){ // Get data for elements summed up in the part 'Other' for(i=0; i<data_other.length; i++){ // Get data for elements summed up in the part 'Other'
involved_item = data_other[i]; involved_item = data_other[i];
var request = $.getJSON($SCRIPT_ROOT+"/_"+chartUrl+"?keywordName="+involved_item+"&moduleName="+module_name+"&bar=true"+"&days="+num_day, var request = $.getJSON(chartUrl+"?keywordName="+involved_item+"&moduleName="+module_name+"&bar=true"+"&days="+num_day,
function(data) { function(data) {
temp_data_bar = [] temp_data_bar = []
for(i=1; i<data.length; i++){ for(i=1; i<data.length; i++){
@ -146,7 +159,7 @@ function plot_top_graph(module_name, init){
temp_data_bar.push([new Date(curr_date[0], curr_date[1]-1, curr_date[2]).getTime() + offset, data[i][1].toFixed(2)]); temp_data_bar.push([new Date(curr_date[0], curr_date[1]-1, curr_date[2]).getTime() + offset, data[i][1].toFixed(2)]);
} }
// Insert temp_data_bar in order so that color and alignement correspond for the provider graphs // Insert temp_data_bar in order so that color and alignement correspond for the provider graphs
all_other_temp_data.splice(data_other.indexOf(data[0]), 0, [ data[0], temp_data_bar, data_other.indexOf(data[0])]); all_other_temp_data.splice(data_other.indexOf(data[0]), 0, [ data[0], temp_data_bar, data_other.indexOf(data[0])]);
} }
) )
promises.push(request); promises.push(request);
@ -184,9 +197,9 @@ function plot_top_graph(module_name, init){
colors: ["#72a555", "#ab62c0", "#c57c3c", "#638ccc", "#ca5670"] colors: ["#72a555", "#ab62c0", "#c57c3c", "#638ccc", "#ca5670"]
}) })
/* rememeber the data for the two provider graph */ /* rememeber the data for the two provider graph */
if (chartUrl == "providersChart"){ if (chartUrl == url_providersChart){
if (plot_data_old.length>1){ // avoid adding plot_data for previous clicked pie part if (plot_data_old.length>1){ // avoid adding plot_data for previous clicked pie part
plot_data_old = []; plot_data_old = [];
plot_old = []; plot_old = [];
@ -201,13 +214,13 @@ function plot_top_graph(module_name, init){
binder("num"); binder("num");
else if (module_name == "num") else if (module_name == "num")
binder("size"); binder("size");
} }
}); });
} else { // Normal pie's part clicked } else { // Normal pie's part clicked
$.getJSON($SCRIPT_ROOT+"/_"+chartUrl+"?keywordName="+involved_item+"&moduleName="+module_name+"&bar=true"+"&days="+num_day, $.getJSON(chartUrl+"?keywordName="+involved_item+"&moduleName="+module_name+"&bar=true"+"&days="+num_day,
function(data) { function(data) {
var temp_data_bar = [] var temp_data_bar = []
for(i=1; i<data.length; i++){ for(i=1; i<data.length; i++){
@ -245,7 +258,7 @@ function plot_top_graph(module_name, init){
} }
}); });
} }
}; // end update_bar_chart }; // end update_bar_chart
} // end plot_top_graph } // end plot_top_graph
@ -261,7 +274,7 @@ function binder(module_name){
var formated_date = date.getMonth()+'/'+date.getDate(); var formated_date = date.getMonth()+'/'+date.getDate();
var color = item.series.color; var color = item.series.color;
var color_opac = "rgba" + color.slice(3, color.length-1)+",0.15)"; var color_opac = "rgba" + color.slice(3, color.length-1)+",0.15)";
// display the hovered value in the chart div // display the hovered value in the chart div
$("#tooltip_graph-"+module_name).html(item.series.label + " of " + formated_date + " = <b>" + y+"</b>") $("#tooltip_graph-"+module_name).html(item.series.label + " of " + formated_date + " = <b>" + y+"</b>")
.css({padding: "2px", width: 'auto', 'background': color_opac , 'border': "3px solid "+color}) .css({padding: "2px", width: 'auto', 'background': color_opac , 'border': "3px solid "+color})
@ -269,7 +282,7 @@ function binder(module_name){
/* If provider bar chart hovered, highlight and display associated value */ /* If provider bar chart hovered, highlight and display associated value */
if (module_name == "size" || module_name == "num"){ if (module_name == "size" || module_name == "num"){
new_module_name = module_name == "size" ? "num" : "size"; new_module_name = module_name == "size" ? "num" : "size";
/* Used to get the corresponding associated value for providers charts */ /* Used to get the corresponding associated value for providers charts */

View file

@ -1,10 +1,20 @@
var li_text = "<li><div class='checkbox'></div><label class='provider'><input value='" var li_text = "<li><div class='checkbox'></div><label class='provider'><input value='"
var li_text_mid = "' type='checkbox'></input> " var li_text_mid = "' type='checkbox'></input> "
var li_text_end = "</label></li>" var li_text_end = "</label></li>"
function getSyncScriptParams() {
var scripts = document.getElementsByTagName('script');
var lastScript = scripts[scripts.length-1];
var scriptName = lastScript;
return {
url_sentiment_analysis : scriptName.getAttribute('data-url_sentiment_analysis'),
};
}
var url_sentiment_analysis = getSyncScriptParams().url_sentiment_analysis;
/* Get Providers List and display them by row */ /* Get Providers List and display them by row */
$.getJSON('/sentiment_analysis_plot_tool_getdata/?getProviders=True', function(data){ $.getJSON(url_sentiment_analysis + '?getProviders=True', function(data){
for(i=0; i<data.length; i++){ for(i=0; i<data.length; i++){
var providerList = i%2 == 0 ? '#providerList1' : '#providerList2'; var providerList = i%2 == 0 ? '#providerList1' : '#providerList2';
$(providerList).append(li_text + data[i] + li_text_mid + data[i] + li_text_end); $(providerList).append(li_text + data[i] + li_text_mid + data[i] + li_text_end);
@ -29,7 +39,7 @@ $( ".sliderRange" ).slider({
$( "#amount" ).val( new Date($( ".sliderRange" ).slider( "values", 0 )).toLocaleDateString() + $( "#amount" ).val( new Date($( ".sliderRange" ).slider( "values", 0 )).toLocaleDateString() +
" - " + new Date($( ".sliderRange" ).slider( "values", 1 )).toLocaleDateString() ); " - " + new Date($( ".sliderRange" ).slider( "values", 1 )).toLocaleDateString() );
$('#plot_btn').click(plotData); $('#plot_btn').click(plotData);
/* Plot the requested data (if available) stored in slider and checkboxes */ /* Plot the requested data (if available) stored in slider and checkboxes */
function plotData(){ function plotData(){
@ -44,9 +54,9 @@ function plotData(){
bars: {show: true, barWidth: 60*60*1000}, bars: {show: true, barWidth: 60*60*1000},
shadowSize: 0 shadowSize: 0
}, },
grid: { grid: {
hoverable: true, hoverable: true,
clickable: true, clickable: true,
tickColor: "#f9f9f9", tickColor: "#f9f9f9",
borderWidth: 0 borderWidth: 0
}, },
@ -61,10 +71,10 @@ function plotData(){
} }
var query = $( "input:checked[value]" ).map(function () {return this.value;}).get().join(","); var query = $( "input:checked[value]" ).map(function () {return this.value;}).get().join(",");
var Qdate = new Date($( ".sliderRange" ).slider( "values", 0 )).toLocaleDateString() +'-'+ new Date($( ".sliderRange" ).slider( "values", 1 )).toLocaleDateString(); var Qdate = new Date($( ".sliderRange" ).slider( "values", 0 )).toLocaleDateString() +'-'+ new Date($( ".sliderRange" ).slider( "values", 1 )).toLocaleDateString();
// retreive the data from the server // retreive the data from the server
$.getJSON('/sentiment_analysis_plot_tool_getdata/?getProviders=False&query='+query+'&Qdate='+Qdate, function(data){ $.getJSON(url_sentiment_analysis + '?getProviders=False&query='+query+'&Qdate='+Qdate, function(data){
var to_plot = []; var to_plot = [];
for (provider in data){ for (provider in data){
var nltk_data = Object.keys(data[provider]).map(function (key) { return data[provider][key]; }); var nltk_data = Object.keys(data[provider]).map(function (key) { return data[provider][key]; });
@ -87,7 +97,7 @@ function plotData(){
} }
XY_data.push([nltk_key[i]*1000, pos-neg]); XY_data.push([nltk_key[i]*1000, pos-neg]);
} }
to_plot.push({ data: XY_data, label: provider}); to_plot.push({ data: XY_data, label: provider});
} }
var plot = $.plot($("#graph"), to_plot, graph_options); var plot = $.plot($("#graph"), to_plot, graph_options);
}); });

View file

@ -1,5 +1,17 @@
/* Functions and config */ /* Functions and config */
function getSyncScriptParams() {
var scripts = document.getElementsByTagName('script');
var lastScript = scripts[scripts.length-1];
var scriptName = lastScript;
return {
url_sentiment_analysis_getplotdata : scriptName.getAttribute('data-url_sentiment_analysis_getplotdata'),
};
}
var url_sentiment_analysis_getplotdata = getSyncScriptParams().url_sentiment_analysis_getplotdata;
function add_new_graph_today(id) { function add_new_graph_today(id) {
return "<div id=\"panel-today\" class=\"panel panel-default pannelToday"+id+"\">" + return "<div id=\"panel-today\" class=\"panel panel-default pannelToday"+id+"\">" +
"<div class=\"panel-heading\">" + "<div class=\"panel-heading\">" +
@ -100,7 +112,7 @@ var totNumGraph = 0;
// When everything is terminated, plot the widgets (Gauge, canvasJS, table) // When everything is terminated, plot the widgets (Gauge, canvasJS, table)
// input: all - set to 'True' if you take all providers // input: all - set to 'True' if you take all providers
function draw_page(all) { function draw_page(all) {
$.getJSON("/sentiment_analysis_getplotdata/?getProviders=True&all="+all, $.getJSON(url_sentiment_analysis_getplotdata + "?getProviders=True&all="+all,
function(data) { function(data) {
var promises = []; var promises = [];
@ -137,7 +149,7 @@ function draw_page(all) {
// input - provider: The povider name to be plotted // input - provider: The povider name to be plotted
// input - graphNum: The number of the graph (Use to plot on correct div) // input - graphNum: The number of the graph (Use to plot on correct div)
function query_and_plot(provider, graphNum) { function query_and_plot(provider, graphNum) {
var query_plot = $.getJSON("/sentiment_analysis_getplotdata/?provider="+provider, var query_plot = $.getJSON(url_sentiment_analysis_getplotdata + "?provider="+provider,
function(data) { function(data) {
var plot_data = []; var plot_data = [];
var array_provider = Object.keys(data); var array_provider = Object.keys(data);

View file

@ -1,11 +1,22 @@
/* Already defined variable (Before the input) /* Already defined variable (Before the input)
* *
* var chart_1_num_day = 5; * var chart_1_num_day = 5;
* var chart_2_num_day = 15; * var chart_2_num_day = 15;
* *
*/ */
function getSyncScriptParams() {
var scripts = document.getElementsByTagName('script');
var lastScript = scripts[scripts.length-1];
var scriptName = lastScript;
return {
url_progressionCharts : scriptName.getAttribute('data-url_progressionCharts'),
};
}
var url_progressionCharts = getSyncScriptParams().url_progressionCharts;
function plot_top_graph(trendingName, init){ function plot_top_graph(trendingName, init){
/**** Flot Pie Chart ****/ /**** Flot Pie Chart ****/
var tot_sum = 0; // used to detect elements placed in 'Other' pie's part var tot_sum = 0; // used to detect elements placed in 'Other' pie's part
@ -13,8 +24,8 @@ function plot_top_graph(trendingName, init){
var pie_threshold = 0.05 var pie_threshold = 0.05
var options = { var options = {
series: { series: {
pie: { pie: {
show: true, show: true,
radius: 3/5, radius: 3/5,
combine: { combine: {
@ -29,22 +40,22 @@ function plot_top_graph(trendingName, init){
opacity: 0.5, opacity: 0.5,
color: '#000' color: '#000'
} }
} }
} }
}, },
grid: { hoverable: true, clickable: true }, grid: { hoverable: true, clickable: true },
legend: { show: false } legend: { show: false }
}; };
function labelFormatter(label, series) { function labelFormatter(label, series) {
return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>" return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>"
+ label + "<br/>" + Math.round(series.percent) + "%</div>"; + label + "<br/>" + Math.round(series.percent) + "%</div>";
} }
// Graph1 // Graph1
$.getJSON($SCRIPT_ROOT+"/_progressionCharts?trendingName="+trendingName+"&num_day="+chart_1_num_day, $.getJSON(url_progressionCharts+"?trendingName="+trendingName+"&num_day="+chart_1_num_day,
function(data) { function(data) {
temp_data_pie = []; temp_data_pie = [];
for(i=0; i<data.length; i++){ for(i=0; i<data.length; i++){
@ -60,10 +71,10 @@ function plot_top_graph(trendingName, init){
$.plot($("#flot-pie-chart1-"+trendingName), temp_data_pie, options); $.plot($("#flot-pie-chart1-"+trendingName), temp_data_pie, options);
if (init){ //prevent multiple binding due to the refresh function if (init){ //prevent multiple binding due to the refresh function
setTimeout(function() { setTimeout(function() {
$("#flot-pie-chart1-"+trendingName).bind("plotclick", function (event, pos, item) { $("#flot-pie-chart1-"+trendingName).bind("plotclick", function (event, pos, item) {
if (item == null) if (item == null)
return; return;
var clicked_label = item.series.label; var clicked_label = item.series.label;
update_bar_chart("#flot-bar-chart1-"+trendingName, clicked_label, item.series.color, chart_1_num_day, "%m/%d"); update_bar_chart("#flot-bar-chart1-"+trendingName, clicked_label, item.series.color, chart_1_num_day, "%m/%d");
update_bar_chart("#flot-bar-chart2-"+trendingName, clicked_label, item.series.color, chart_2_num_day); update_bar_chart("#flot-bar-chart2-"+trendingName, clicked_label, item.series.color, chart_2_num_day);
@ -71,8 +82,8 @@ function plot_top_graph(trendingName, init){
}, 500); }, 500);
} }
}); });
// flot bar char // flot bar char
function update_bar_chart(chartID, involved_item, serie_color, num_day, timeformat, can_bind){ function update_bar_chart(chartID, involved_item, serie_color, num_day, timeformat, can_bind){
var barOptions = { var barOptions = {
@ -90,9 +101,9 @@ function plot_top_graph(trendingName, init){
tooltip: true, tooltip: true,
tooltipOpts: { content: "x: %x, y: %y" } tooltipOpts: { content: "x: %x, y: %y" }
}; };
if (involved_item == "Other"){ if (involved_item == "Other"){
var all_other_temp_data = []; // the data_bar of all series var all_other_temp_data = []; // the data_bar of all series
var temp_data_bar; //the data_bar associated with one serie var temp_data_bar; //the data_bar associated with one serie
var promises = []; // Use to plot when everything has been received var promises = []; // Use to plot when everything has been received
@ -100,7 +111,7 @@ function plot_top_graph(trendingName, init){
for(i=0; i<data_other.length; i++){ // Get data for elements summed up in the part 'Other' for(i=0; i<data_other.length; i++){ // Get data for elements summed up in the part 'Other'
involved_item = data_other[i]; involved_item = data_other[i];
var request = $.getJSON($SCRIPT_ROOT+"/_progressionCharts?attributeName="+involved_item+"&bar=true"+"&days="+num_day, var request = $.getJSON(url_progressionCharts+"?attributeName="+involved_item+"&bar=true"+"&days="+num_day,
function(data) { function(data) {
temp_data_bar = [] temp_data_bar = []
for(i=1; i<data.length; i++){ for(i=1; i<data.length; i++){
@ -108,10 +119,10 @@ function plot_top_graph(trendingName, init){
var offset = (data_other.length/2 - data_other.indexOf(data[0]))*10000000 var offset = (data_other.length/2 - data_other.indexOf(data[0]))*10000000
temp_data_bar.push([new Date(curr_date[0], curr_date[1]-1, curr_date[2]).getTime() + offset, data[i][1].toFixed(2)]); temp_data_bar.push([new Date(curr_date[0], curr_date[1]-1, curr_date[2]).getTime() + offset, data[i][1].toFixed(2)]);
//console.log(new Date(curr_date[0], curr_date[1]-1, curr_date[2]).getTime() + offset); //console.log(new Date(curr_date[0], curr_date[1]-1, curr_date[2]).getTime() + offset);
} }
// Insert temp_data_bar in order so that color and alignement correspond for the provider graphs // Insert temp_data_bar in order so that color and alignement correspond for the provider graphs
all_other_temp_data.splice(data_other.indexOf(data[0]), 0, [ data[0], temp_data_bar, data_other.indexOf(data[0])]); all_other_temp_data.splice(data_other.indexOf(data[0]), 0, [ data[0], temp_data_bar, data_other.indexOf(data[0])]);
} }
) )
promises.push(request); promises.push(request);
@ -153,7 +164,7 @@ function plot_top_graph(trendingName, init){
} else { } else {
$.getJSON($SCRIPT_ROOT+"/_progressionCharts?attributeName="+involved_item+"&bar=true"+"&days="+num_day, $.getJSON(url_progressionCharts+"?attributeName="+involved_item+"&bar=true"+"&days="+num_day,
function(data) { function(data) {
var temp_data_bar = [] var temp_data_bar = []
for(i=1; i<data.length; i++){ for(i=1; i<data.length; i++){
@ -183,7 +194,7 @@ function binder(module_name){
var formated_date = date.getMonth()+'/'+date.getDate(); var formated_date = date.getMonth()+'/'+date.getDate();
var color = item.series.color; var color = item.series.color;
var color_opac = "rgba" + color.slice(3, color.length-1)+",0.15)"; var color_opac = "rgba" + color.slice(3, color.length-1)+",0.15)";
// display the hovered value in the chart div // display the hovered value in the chart div
$("#tooltip_graph1-"+module_name).html(item.series.label + " of " + formated_date + " = <b>" + y+"</b>") $("#tooltip_graph1-"+module_name).html(item.series.label + " of " + formated_date + " = <b>" + y+"</b>")
.css({padding: "2px", width: 'auto', 'background': color_opac , 'border': "3px solid "+color}) .css({padding: "2px", width: 'auto', 'background': color_opac , 'border': "3px solid "+color})
@ -191,7 +202,7 @@ function binder(module_name){
} }
}); });
$("#flot-bar-chart2-"+module_name).bind("plothover.customHandler", function (event, pos, item) { $("#flot-bar-chart2-"+module_name).bind("plothover.customHandler", function (event, pos, item) {
if (item) { // a correct item is hovered if (item) { // a correct item is hovered
var x = item.datapoint[0] var x = item.datapoint[0]
@ -200,7 +211,7 @@ function binder(module_name){
var formated_date = date.getMonth()+'/'+date.getDate(); var formated_date = date.getMonth()+'/'+date.getDate();
var color = item.series.color; var color = item.series.color;
var color_opac = "rgba" + color.slice(3, color.length-1)+",0.15)"; var color_opac = "rgba" + color.slice(3, color.length-1)+",0.15)";
// display the hovered value in the chart div // display the hovered value in the chart div
$("#tooltip_graph2-"+module_name).html(item.series.label + " of " + formated_date + " = <b>" + y+"</b>") $("#tooltip_graph2-"+module_name).html(item.series.label + " of " + formated_date + " = <b>" + y+"</b>")
.css({padding: "2px", width: 'auto', 'background': color_opac , 'border': "3px solid "+color}) .css({padding: "2px", width: 'auto', 'background': color_opac , 'border': "3px solid "+color})