Changeset 516
- Timestamp:
- 11/05/08 16:57:21 (2 months ago)
- Files:
-
- trunk/ui/web/htdocs/.htaccess (modified) (1 diff)
- trunk/ui/web/htdocs/css/style.css (modified) (2 diffs)
- trunk/ui/web/htdocs/graph_panel.inc (modified) (1 diff)
- trunk/ui/web/htdocs/js/recon.js (modified) (2 diffs)
- trunk/ui/web/htdocs/worksheet_info.php (modified) (1 diff)
- trunk/ui/web/htdocs/worksheet_panel.inc (modified) (5 diffs)
- trunk/ui/web/htdocs/worksheet_search_json.php (added)
- trunk/ui/web/htdocs/ws_search_simple.inc (added)
- trunk/ui/web/lib/Reconnoiter_DB.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ui/web/htdocs/.htaccess
r473 r516 4 4 RewriteRule ^json/ds/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ datapoint_browse_json.php?l1=$1&l2=$2&l3=$3&l4=$4&l5=$5 [PT,QSA] 5 5 RewriteRule ^json/worksheet/info/([^/]*)$ worksheet_info.php?id=$1 [PT,QSA] 6 RewriteRule ^json/worksheet/store$ worksheet_store.php [PT,QSA] 7 RewriteRule ^json/worksheet/search$ worksheet_search_json.php [PT,QSA] 6 8 RewriteRule ^json/graph/info/([^/]*)$ graph_info.php?id=$1 [PT,QSA] 7 9 RewriteRule ^json/graph/store$ graph_store.php [PT,QSA] trunk/ui/web/htdocs/css/style.css
r504 r516 680 680 padding:0 0.5em; 681 681 } 682 #worksheetlist {682 .worksheetlist { 683 683 height:450px; 684 684 overflow:auto; 685 685 } 686 #worksheetlist ul a { 686 .worksheetlist p.paginate { 687 text-align:right; 688 } 689 .worksheetlist span.searchselect { 690 border:1px solid #CCCCCC; 691 display:inline; 692 margin:0 4px; 693 padding:0 4px; 694 } 695 .worksheetlist { 696 overflow:auto; 697 } 698 .worksheetlist ul { 687 699 list-style-image:none; 688 700 list-style-position:outside; 689 701 list-style-type:none; 690 702 } 691 #worksheetlist ul li { 703 .worksheetlist ul a { 704 list-style-image:none; 705 list-style-position:outside; 706 list-style-type:none; 707 } 708 .worksheetlist ul li { 692 709 display:block; 693 710 margin-bottom:4px; 694 711 padding:2px 0; 695 712 } 696 #worksheetlist ul li a {713 .worksheetlist ul li a { 697 714 background:transparent url(../images/icon-worksheet.png) no-repeat scroll 0 1px; 698 715 padding-left:15px; 699 716 } 700 #worksheetlist ul li.selected {717 .worksheetlist ul li.selected { 701 718 background:#E6E4E5 none repeat scroll 0 0; 702 719 display:block; 720 } 721 .worksheetlist ul li ul li { 722 border-left:1px solid #C0BBBD; 723 color:#82787B; 724 display:inline; 725 font-size:10px; 726 margin-bottom:6px; 727 padding:0 5px; 728 } 729 .worksheetlist ul li ul li.xx { 730 border-left:medium none; 731 color:#82787B; 732 display:inline; 733 font-size:10px; 734 padding-left:15px; 735 } 736 .worksheetlist ul li ul li a em { 737 color:#82787B; 738 padding-left:3px; 739 } 740 .worksheetlist ul li ul li a.viewws { 741 background:transparent url(../images/icon-viewws.png) no-repeat scroll 0 0; 742 display:inline; 743 font-size:10px; 744 padding-left:20px; 703 745 } 704 746 ul#worksheet-graphs { … … 710 752 list-style-type:none; 711 753 margin:1.5em 1em 0 0; 754 } 755 span.rememberWorksheet { 756 border:1px solid #DDDDDD; 757 display:none; 758 float:right; 759 margin-left:4px; 760 padding:0 4px; 761 } 762 span.blankWorksheet { 763 border:1px solid #DDDDDD; 764 float:right; 765 margin-left:4px; 766 padding:0 4px; 712 767 } 713 768 span.rememberGraph { trunk/ui/web/htdocs/graph_panel.inc
r499 r516 29 29 if(d.error) $("#gtool-error").html(d.error).fadeIn('fast'); 30 30 else $("#gtool-error").fadeOut('fast'); 31 if(graphinfo.id && graphinfo.saved != true) { 31 if(graphinfo.id && graphinfo.saved != true && 32 $(".rememberGraph:visible").length == 0) { 32 33 $(".rememberGraph").html('"Remember" this graph.').fadeIn('slow'); 33 34 $(".rememberGraph").click(function() { trunk/ui/web/htdocs/js/recon.js
r513 r516 158 158 graphs_for_edit, graph_search_summary); 159 159 } 160 function perform_ws_search_edit(params) { 161 perform_generic_search('json/worksheet/search', params, 162 perform_ws_search_edit, 163 ws_for_edit, ws_search_summary); 164 } 160 165 function perform_datapoint_search_add(params) { 161 166 perform_generic_search('json/datapoint/search', params, 162 167 perform_datapoint_search_add, 163 168 datapoints_for_graph, datapoint_search_summary); 169 } 170 function ws_search_summary(r) { 171 return r.count + ' worksheet' + (r.count == 1 ? '' : 's' ) + ' found for \'' + htmlentities(r.query) + '\''; 164 172 } 165 173 function graph_search_summary(r) { … … 254 262 li.append($('<a/>').html(g.title)).append(ul); 255 263 } 264 function ws_for_edit(li, ws, params) { 265 var add = $('<a href="#"/>'); 266 add.html('View').addClass('addtows'); 267 add.click( 268 (function(sheetid) { 269 return function() { 270 load_worksheet(sheetid); 271 return false; 272 } 273 })(ws.sheetid) 274 ); 275 var ul = $('<ul/>'); 276 ul.append($('<li/>').html(ws.last_update)); 277 ul.append($('<li/>').append(add)); 278 li.append($('<a/>').html(ws.title)).append(ul); 279 } 256 280 function graphs_for_worksheet(li, g, params) { 257 281 var add = $('<a href="#"/>'); trunk/ui/web/htdocs/worksheet_info.php
r511 r516 6 6 7 7 try { 8 $results = $db->getWorksheetByID($ GET['sheetid']);8 $results = $db->getWorksheetByID($_GET['id']); 9 9 print json_encode($results); 10 10 } trunk/ui/web/htdocs/worksheet_panel.inc
r513 r516 5 5 <!-- 6 6 var ws_displayinfo = { start : 14*86400, cnt: '100', end: '' }; 7 var wsinfo = {}; 8 function update_current_worksheet(f) { 9 var str = JSON.stringify(wsinfo); 10 $.post("json/worksheet/store", 11 {'json':str}, 12 function(d) { 13 wsinfo.id = d.id; 14 if(d.error) $("#ws-tool-error").html(d.error).fadeIn('fast'); 15 else $("#ws-tool-error").fadeOut('fast'); 16 if(wsinfo.id && wsinfo.title && wsinfo.saved != true && 17 $(".rememberWorksheet:visible").length == 0) { 18 $(".rememberWorksheet").html('"Remember" this worksheet.').fadeIn('slow'); 19 $(".rememberWorksheet").click(function() { 20 wsinfo.saved = true; 21 update_current_worksheet(function(r) { 22 if(r.error) wsinfo.saved = false; 23 else $(".rememberWorksheet").html('Remebered').fadeOut('slow'); 24 }); 25 }); 26 } 27 if(f) f(d); 28 }, 'json'); 29 } 30 7 31 function process_worksheet_json(r) { 8 console.log(r.graphs.length); 32 wsinfo.id = r.sheetid; 33 wsinfo.title = r.title; 9 34 var ul = $("ul#worksheet-graphs"); 10 $("h2 .worksheetTitle").html(r.title);35 $("h2#worksheetTitle").html(r.title); 11 36 ul.empty(); 12 37 for(var i = 0; i < r.graphs.length; i++) { 13 r.graphs[i].start = ws_displayinfo.start; 14 r.graphs[i].end = ws_displayinfo.end; 15 r.graphs[i].cnt = ws_displayinfo.cnt; 16 var o = $('<div></div>').ReconGraph( r.graphs[i] ); 38 var g = {}; 39 g.graphid = r.graphs[i]; 40 g.start = ws_displayinfo.start; 41 g.end = ws_displayinfo.end; 42 g.cnt = ws_displayinfo.cnt; 43 var o = $('<div></div>').ReconGraph(g); 17 44 ul.append($('<li/>').append(o)); 18 45 o.ReconGraphRefresh(); … … 30 57 o.ReconGraphRefresh(); 31 58 ul.sortable("refresh"); 59 if(!wsinfo.graphs) wsinfo.graphs = new Array(); 60 alert('pushing ' + graphid); 61 wsinfo.graphs.push(graphid); 62 update_current_worksheet(); 32 63 } 33 64 function refresh_worksheet() { … … 42 73 --> 43 74 </script> 44 <h2 class="worksheetTitle">Worksheet Title</h2> 75 <span class="rememberWorksheet"></span> 76 <span class="blankWorksheet">New Blank</span> 77 <h2 id="worksheetTitle">Worksheet Title</h2> 45 78 <p/> 46 79 <!-- date range box --> … … 54 87 }; 55 88 var state = false; 89 $("h2#worksheetTitle").editable(function(value, settings) { 90 wsinfo.title = value; 91 update_current_worksheet(); 92 return(value); 93 }, { }); 56 94 $("#ws_datetool .btn-slide").click(function(){ 57 95 $("#ws_widgetCalendar").stop().animate({ … … 101 139 stop: 102 140 function (e,ui) { 103 var ol= new Array();141 wsinfo.graphs = new Array(); 104 142 ui.item.parent().find("> li > div").each( 105 function(i) { ol.push($(this).attr("id")); }143 function(i) { wsinfo.graphs.push($(this).attr("id")); } 106 144 ); 107 // Store new worksheet order here 108 console.log(ol); 145 update_current_worksheet(); 109 146 } 110 147 }); trunk/ui/web/lib/Reconnoiter_DB.php
r505 r516 126 126 'offset' => $offset, count => $r['count'], 'results' => $a); 127 127 } 128 function get_worksheets($searchstring, $offset, $limit) { 129 return $this->run_tsearch($searchstring, 130 "select count(*) as count 131 from prism.saved_worksheets, 132 (select ? ::text as query) q 133 where saved = true and 134 ((ts_search_all @@ to_tsquery(query) or query = '') 135 or sheetid in (select sheetid 136 from prism.saved_worksheets_dep wd 137 join prism.saved_graphs g 138 using (graphid) 139 join prism.saved_graphs_dep gd 140 using (graphid) 141 join stratcon.metric_name_summary s 142 using (sid,metric_name,metric_type) 143 where g.ts_search_all @@ to_tsquery(query) 144 or s.ts_search_all @@ to_tsquery(query)))", 145 "select sheetid, title, 146 to_char(last_update, 'YYYY/mm/dd') as last_update 147 from prism.saved_worksheets, 148 (select ? ::text as query) q 149 where saved = true and 150 ((ts_search_all @@ to_tsquery(query) or query = '') 151 or sheetid in (select sheetid 152 from prism.saved_worksheets_dep wd 153 join prism.saved_graphs g 154 using (graphid) 155 join prism.saved_graphs_dep gd 156 using (graphid) 157 join stratcon.metric_name_summary s 158 using (sid,metric_name,metric_type) 159 where g.ts_search_all @@ to_tsquery(query) 160 or s.ts_search_all @@ to_tsquery(query))) 161 order by last_update desc", 162 $offset, $limit); 163 } 128 164 function get_graphs($searchstring, $offset, $limit) { 129 165 return $this->run_tsearch($searchstring, … … 304 340 } 305 341 function getWorksheetByID($id) { 306 $sth = $this->db->prepare("select *307 from prism.saved_worksheets 308 join prism.saved_worksheets_dep342 $sth = $this->db->prepare("select w.sheetid, w.title, wd.graphid 343 from prism.saved_worksheets as w 344 left join prism.saved_worksheets_dep as wd 309 345 using (sheetid) 310 where sheetid=?"); 346 where sheetid=? 347 order by ordering asc"); 311 348 $sth->execute(array($id)); 312 349 $a = array(); 313 while($row = $sth->fetch()) { 314 $a[] = $row; 350 $row = $sth->fetch(); 351 $a['sheetid'] = $row['sheetid']; 352 $a['title'] = $row['title']; 353 $a['graphs'] = array(); 354 if($row && $row['graphid']) $a['graphs'][] = $row['graphid']; 355 while($row = $sth->fetch()) { 356 $a['graphs'][] = $row['graphid']; 315 357 } 316 358 return $a; … … 333 375 $sth = $this->db->prepare("delete from prism.saved_worksheets_dep 334 376 where sheetid=?"); 335 $sth->execute(array($ ws['id']));377 $sth->execute(array($id)); 336 378 } 337 379 else { … … 356 398 throw(new Exception('DB: ' . $e->getMessage())); 357 399 } 400 return $id; 358 401 } 359 402 function getGraphByID($id) {
