Changeset 511
- Timestamp:
- 10/31/08 00:55:20 (2 months ago)
- Files:
-
- trunk/ui/web/htdocs/js/recon.js (modified) (3 diffs)
- trunk/ui/web/htdocs/json_graph_flot.php (modified) (1 diff)
- trunk/ui/web/htdocs/worksheet_info.php (modified) (1 diff)
- trunk/ui/web/htdocs/worksheet_panel.inc (modified) (6 diffs)
- trunk/ui/web/htdocs/worksheet_store.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ui/web/htdocs/js/recon.js
r510 r511 8 8 if(!this.graphinfo.cnt) this.graphinfo.cnt = this.graphinfo.width / 2; 9 9 if(!this.attr("id")) this.attr("id", this.graphinfo.graphid); 10 this.append($('<h3 >').addClass("graphTitle")11 .html(this.graphinfo.title ))10 this.append($('<h3/>').addClass("graphTitle") 11 .html(this.graphinfo.title || '')) 12 12 .append($('<div></div>').addClass("plot-area") 13 13 .css('width', this.width + 'px') 14 14 .css('height', this.height + 'px')) 15 15 .append($('<div></div>').addClass("plot-legend")); 16 this.data('__recon', this); 16 17 return this; 17 18 }, 18 19 reset: 19 20 function() { 21 if(this.length > 1) { 22 this.each(function(i) { $(this).ReconGraphReset(); }); 23 return this; 24 } 20 25 this.graphinfo.graphid = ''; 21 26 if(this.flot_plot) { … … 26 31 this.flot_plot.draw(); 27 32 } 33 this.data('__recon', this); 28 34 return this; 29 35 }, 30 36 refresh: 31 37 function(options) { 32 this.graphinfo = $.extend({}, this.graphinfo, options||{}); 38 if(this.length > 1) { 39 this.each(function(i) { $(this).ReconGraphRefresh(); }); 40 return this; 41 } 42 var o = this.data('__recon'); 43 this.graphinfo = $.extend({}, o.graphinfo, options||{}); 33 44 var url = "flot/graph/settings/" + this.graphinfo.graphid; 34 45 this.find(".plot-area") … … 38 49 'end':this.graphinfo.end}, 39 50 (function(o) { return function (r) { o.ReconGraphPlot(r, function() { o.ReconGraphRefresh(); }) }})(this)); 51 this.data('__recon', this); 40 52 return this; 41 53 }, 42 54 plot: 43 55 function (r, redraw) { 44 var title = this.ReconGraphMacro( this.graphinfo.title, r.data);56 var title = this.ReconGraphMacro(r.title, r.data); 45 57 this.find("h3.graphTitle").html(title); 46 58 var placeholder = this.find("> div.plot-area"); trunk/ui/web/htdocs/json_graph_flot.php
r485 r511 65 65 'data' => $data, 66 66 'options' => $options, 67 'title' => $ driver->title(). '',67 'title' => $graph['title'] . '', 68 68 )); 69 69 trunk/ui/web/htdocs/worksheet_info.php
r462 r511 6 6 7 7 try { 8 $results = $db->get_graphs($_GET['q'], 9 $_GET['o'] + 0, 10 isset($_GET['l']) ? $_GET['l'] : 100); 11 $a = array(); 12 foreach($results['results'] as $k => $v) { 13 $j = json_decode($v['json'], true); 14 $j['graphid'] = $v['graphid']; 15 $a[] = $j; 16 } 17 print json_encode(array('graphs' => $a)); 8 $results = $db->getWorksheetByID($GET['sheetid']); 9 print json_encode($results); 18 10 } 19 11 catch(Exception $e) { 20 12 print json_encode(array( 21 'count' => 0,22 'query' => $_GET['q'],23 'offset' => $_GET['o'],24 'limit' => $_GET['l'],25 13 'error' => $e->getMessage() 26 14 )); trunk/ui/web/htdocs/worksheet_panel.inc
r496 r511 6 6 var ws_displayinfo = { start : 14*86400, cnt: '100', end: '' }; 7 7 function process_worksheet_json(r) { 8 console.log(r.graphs.length); 8 9 var ul = $("ul#worksheet-graphs"); 10 $("h2.worksheetTitle").html(r.title); 9 11 ul.empty(); 10 12 for(var i = 0; i < r.graphs.length; i++) { … … 29 31 }); 30 32 } 33 function add_graph_to_worksheet(graphid) { 34 var g = { start: ws_displayinfo.start, 35 end: ws_displayinfo.end, 36 cnt: ws_displayinfo.cnt, 37 graphid: graphid }; 38 var o = $('<div></div>').ReconGraph( g ); 39 var ul = $("ul#worksheet-graphs"); 40 ul.append($('<li/>').append(o)); 41 o.ReconGraphRefresh(); 42 } 43 function refresh_worksheet() { 44 var g = { start: ws_displayinfo.start, 45 end: ws_displayinfo.end, 46 cnt: ws_displayinfo.cnt }; 47 $("ul#worksheet-graphs > li > div").ReconGraphRefresh(g); 48 } 31 49 function load_worksheet(id) { 32 50 $.getJSON("json/worksheet/info/" + id, process_worksheet_json); … … 34 52 --> 35 53 </script> 36 <h2 >Worksheet Title</h2>54 <h2 class="worksheetTitle">Worksheet Title</h2> 37 55 <p/> 38 56 <!-- date range box --> … … 62 80 ws_displayinfo.end = ''; 63 81 $(this).addClass("selected"); 64 load_worksheet();82 refresh_worksheet(); 65 83 return false; 66 84 }); … … 80 98 ws_displayinfo.start = start.toUTCString(); 81 99 ws_displayinfo.end = end.toUTCString(); 82 load_worksheet('');100 refresh_worksheet(); 83 101 $(".datechoice").removeClass("selected"); 84 102 $('#ws_datetool .range a.btn-slide').get(0).innerHTML = formated.join(' - '); … … 88 106 $("#ws-tool-error").fadeOut("slow"); 89 107 }); 90 load_worksheet('<?php print $_GET['worksheetid'] ?>');91 108 }); 92 109 </script>
