changeset 12:50f4c64834cb

delegation of dynamic charts works now
author sean
date Tue, 04 Aug 2015 16:00:07 +0200
parents 7a573ec679a6
children 63b9f41c3008
files dash.conf modules/roundup_cc/__init__.py modules/roundup_cc/display_issues.py modules/roundup_cc/graph.html views/hello_template.tpl
diffstat 5 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dash.conf	Tue Aug 04 14:23:53 2015 +0200
+++ b/dash.conf	Tue Aug 04 16:00:07 2015 +0200
@@ -62,4 +62,4 @@
 
 [tile4]
 type=d3js
-status=modules/roundup-cc/display_issues._techintern.py
+status=display_issues_techintern
--- a/modules/roundup_cc/__init__.py	Tue Aug 04 14:23:53 2015 +0200
+++ b/modules/roundup_cc/__init__.py	Tue Aug 04 16:00:07 2015 +0200
@@ -14,8 +14,29 @@
 See http://www.gnu.org/licenses/gpl-3.0.txt for details
 """
 
-import roundup_cc.display_issues as display
-import roundup_cc.roundup_content_data as rcd
+# import re
+# import , os
 
-def get_tech_intern_chart():
-    return display.render_db_stats_as_html(rcd.DATABASE_TECH_INTERN, rcd.SELECT_ALL)
+import importlib
+
+# from roundup_cc import *
+
+# PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
+
+def make_chart(chart_data_file):
+
+    mod = importlib.import_module("roundup_cc." + chart_data_file)
+    return mod.get_chart()
+
+    # test = exec(open(PATH + "/" + chart_data_file+'.py').read())
+
+    # print(test)
+    # html = eval(chart_data_file+".py")
+    # return html
+    # fp = open(chart_data_file)
+    # contents = fp.read()
+
+    # return exec(chart_data_file.get_chart()
+
+# def get_tech_intern_chart():
+#     return display.render_db_stats_as_html(rcd.DATABASE_TECH_INTERN, rcd.SELECT_ALL)
--- a/modules/roundup_cc/display_issues.py	Tue Aug 04 14:23:53 2015 +0200
+++ b/modules/roundup_cc/display_issues.py	Tue Aug 04 16:00:07 2015 +0200
@@ -19,12 +19,12 @@
 """
 
 import sqlite3 as db
-import cgitb, os, sys
+import cgitb, os, sys, inspect
 import roundup_cc.roundup_content_data as rcd
 
-PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
+PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
 HTML_DATA = "graph.html"
-PATH_TO_HTML = PATH + "/modules/roundup_cc/" + HTML_DATA
+PATH_TO_HTML = PATH + "/" + HTML_DATA
 
 def make_js_object_string(array):
     formated = []
--- a/modules/roundup_cc/graph.html	Tue Aug 04 14:23:53 2015 +0200
+++ b/modules/roundup_cc/graph.html	Tue Aug 04 16:00:07 2015 +0200
@@ -96,7 +96,11 @@
 	// };
 
 	var critical=[];
-	
+	var urgent=[];
+	var bug=[];
+	var feature=[];
+	var wish=[];
+	var timestamp=[];
 
 	// var critical=[
 	// 		{points: 4},
@@ -141,8 +145,6 @@
 	// 		{date : new Date('2015-07-03T12:39:26')}
 	// 	]
 
-
-
 	document.addEventListener("DOMContentLoaded", function(event) {
 		makeChart();
 	});
--- a/views/hello_template.tpl	Tue Aug 04 14:23:53 2015 +0200
+++ b/views/hello_template.tpl	Tue Aug 04 16:00:07 2015 +0200
@@ -195,8 +195,7 @@
             elif tile["type"] == "d3js" :
                 type = "chart"
                 status = ""
-                text = roundup_cc.get_tech_intern_chart()
-                #text = "<div id = KAKAK>HHOHOHOHOH </div>"
+                text = roundup_cc.make_chart(tile["status"])
             end
         %>
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)