123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- {% extends 'layout/layout_1_col.tpl'|get_template %}
- {% block content %}
- <script>
- mxBasePath = '{{ _p.web_lib }}mxgraph/src/';
- </script>
- <style>
- #graphContainer svg {
- min-width: 100% !important;
- }
- </style>
- <script type="text/javascript" src="{{ _p.web_lib }}mxgraph/src/js/mxClient.js"></script>
- <script>
-
- mxGraph.prototype.getAllConnectionConstraints = function(terminal, source) {
- if (terminal != null && terminal.shape != null) {
- if (terminal.shape.stencil != null) {
- if (terminal.shape.stencil != null) {
- return terminal.shape.stencil.constraints;
- }
- } else if (terminal.shape.constraints != null) {
- return terminal.shape.constraints;
- }
- }
- return null;
- };
-
- mxPolyline.prototype.constraints = null;
-
-
-
- function main(container)
- {
-
- if (!mxClient.isBrowserSupported()) {
-
- mxUtils.error('Browser is not supported!', 200, false);
- } else {
-
- mxEvent.disableContextMenu(container);
-
- var graph = new mxGraph(container);
- graph.setConnectable(true);
- graph.setHtmlLabels(true);
-
- graph.setEnabled(false);
-
- graph.connectionHandler.createEdgeState = function(me) {
- var edge = graph.createEdge(null, null, null, null, null);
- return new mxCellState(this.graph.view, edge, this.graph.getCellStyle(edge));
- };
-
- graph.getStylesheet().getDefaultEdgeStyle()['edgeStyle'] = 'orthogonalEdgeStyle';
-
- new mxRubberband(graph);
-
-
- var parent = graph.getDefaultParent();
-
- graph.getModel().beginUpdate();
- try {
-
-
-
- {% for vertex in group_list %}
- {{ vertex }}
- {% endfor %}
- {% for vertex in subgroup_list %}
- {{ vertex }}
- {% endfor %}
- {% for vertex in vertex_list %}
- {{ vertex }}
- {% endfor %}
- {% for vertex in connections %}
- {{ vertex }}
- {% endfor %}
- } finally {
-
- graph.getModel().endUpdate();
- }
- }
- }
- $(function () {
- main(document.getElementById('graphContainer'));
- var svg1 = document.getElementsByTagName("svg")[0];
- var data = svg1.getBBox();
- var widthValue = data.width + 100;
- var heightValue = data.height + 50;
- var att = document.createAttributeNS(null, "viewBox");
- att.value = '0 0 ' + widthValue + ' '+heightValue;
- svg1.setAttributeNode(att);
-
-
- $(".popup").qtip({
- content: {
- text: function(event, api) {
- var item = $(this);
- var itemId = $(this).attr("id");
- var desc = $(this).attr("data-description");
- var period = $(this).attr("data-period");
- var teacherText = $(this).attr("data-teacher-text");
- var teacher = $(this).attr("data-teacher");
- var score = $(this).attr("data-score");
- var value = $(this).attr("data-score-value");
- var info = $(this).attr("data-info");
- var textToShow = desc
- + '<br />'+ period + '<br />'
- + teacherText +': '+ teacher + '<br />'
- + score +': '+ value + '<br />'
- + '<br />'+ info + '<br />'
- ;
- return textToShow;
- }
- },
- events: {
- render: function(event, api) {
- var popup = $(api.elements.target);
- var bg = popup.attr("data-background-color");
- var color = popup.attr("data-color");
- var borderColor = popup.attr("data-border-color");
- console.log(bg);
- console.log(color);
- console.log(borderColor);
-
-
- $(this).css('background-color', bg);
- $(this).css('color', color);
- $(this).css('border-color', borderColor);
- }
- },
- position: {
- my: 'bottom left',
- at: 'top right',
- adjust: {
- x: -55,
- y: -55
- }
- }
- });
- });
- </script>
- {{ content }}
- {% endblock %}
|