Changeset 15ab3e166990f80d7cc43fd2f0eb835fc8b763e7
- Timestamp:
- 10/16/08 03:38:01 (5 years ago)
- git-parent:
- Files:
-
- ui/web/htdocs/css/style.css (modified) (5 diffs)
- ui/web/htdocs/index.php (modified) (1 diff)
- ui/web/htdocs/js/recon.js (modified) (1 diff)
- ui/web/htdocs/search_saved_graphs.inc (modified) (2 diffs)
- ui/web/htdocs/worksheet_controls.inc (modified) (1 diff)
- ui/web/htdocs/ws_search_graphs.inc (added)
- ui/web/lib/Reconnoiter_DB.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ui/web/htdocs/css/style.css
r7f943cb r15ab3e1 350 350 outline-width:0; 351 351 } 352 #ws-first 353 { 354 background:transparent none repeat scroll 0 0; 355 margin-top:1em; 356 padding:15px; 357 } 358 #ws-second 359 { 360 background:transparent none repeat scroll 0 0; 361 margin-top:1em; 362 overflow:auto; 363 padding:15px; 364 } 352 365 #first 353 366 { … … 561 574 padding:0 3px; 562 575 } 563 #graphlist p.paginate {576 .graphlist p.paginate { 564 577 text-align:right; 565 578 } 566 #graphlist span.searchselect {579 .graphlist span.searchselect { 567 580 border:1px solid #CCCCCC; 568 581 display:inline; … … 570 583 padding:0 4px; 571 584 } 572 #graphlist {585 .graphlist { 573 586 overflow:auto; 574 587 } 575 #graphlist ul {588 .graphlist ul { 576 589 list-style-image:none; 577 590 list-style-position:outside; 578 591 list-style-type:none; 579 592 } 580 #graphlist ul li {593 .graphlist ul li { 581 594 display:block; 582 595 margin-bottom:4px; 583 596 padding:2px 0; 584 597 } 585 #graphlist ul li a {598 .graphlist ul li a { 586 599 background:transparent url(../images/icon-graphs.png) no-repeat scroll 0 1px; 587 600 font-size:12px; 588 601 padding-left:25px; 589 602 } 590 #graphlist ul li ul li {603 .graphlist ul li ul li { 591 604 border-left:1px solid #C0BBBD; 592 605 color:#82787B; … … 596 609 padding:0 5px; 597 610 } 598 #graphlist ul li ul li.xx {611 .graphlist ul li ul li.xx { 599 612 border-left:medium none; 600 613 color:#82787B; … … 603 616 padding-left:15px; 604 617 } 605 #graphlist ul li ul li a.addtows { 618 .graphlist ul li ul li a em { 619 color:#82787B; 620 padding-left:3px; 621 } 622 .graphlist ul li ul li a.addtows { 606 623 background:transparent url(../images/icon-addws.png) no-repeat scroll 0 0; 607 624 display:inline; 608 } 609 #graphlist ul li ul li a em { 610 color:#82787B; 611 padding-left:3px; 612 } 613 #graphlist ul li ul li a.editgraph { 625 font-size:10px; 626 padding-left:20px; 627 } 628 .graphlist ul li ul li a.editgraph { 614 629 background:transparent url(../images/icon-editgraph.png) no-repeat scroll 0 0; 615 630 display:inline; 616 631 font-size:10px; 617 padding-left:2 5px;618 } 619 #graphlist ul li ul li a.deletegraph {632 padding-left:20px; 633 } 634 .graphlist ul li ul li a.deletegraph { 620 635 background:transparent url(../images/icon-deletegraph.png) no-repeat scroll 0 0; 621 636 display:inline; 622 padding-left:2 5px;637 padding-left:20px; 623 638 font-size:10px; 624 639 } ui/web/htdocs/index.php
r3cdcc06 r15ab3e1 84 84 return false; 85 85 }).filter(':first').click(); 86 87 var wstabContainers = $('div.ws-tabs > div'); 88 wstabContainers.hide().filter(':first').show(); 89 90 $('div.ws-tabs ul.tabNavigation a').click(function () { 91 wstabContainers.hide(); 92 wstabContainers.filter(this.hash).show(); 93 $('div.ws-tabs ul.tabNavigation a').removeClass('selected'); 94 $(this).addClass('selected'); 95 return false; 96 }).filter(':first').click(); 86 97 }); 87 98 </script> ui/web/htdocs/js/recon.js
r7f943cb r15ab3e1 104 104 }); 105 105 })(jQuery); 106 107 function perform_graph_search(domid, wsmode, string, offset, limit) { 108 $.getJSON('json/graph/search', 109 { 'q' : string, 'o' : offset, 'l' : limit }, 110 function(r) { 111 var summary = r.count + ' graph' + (r.count == 1 ? '' : 's' ) + ' found for \'' + htmlentities(r.query) + '\''; 112 if(r.error) summary = 'Error: ' + htmlentities(r.error); 113 $(domid + " > p.graph-search-summary").html(summary).fadeIn('fast'); 114 var c = new Number(r.count); 115 var l = new Number(r.limit); 116 var o = new Number(r.offset); 117 var page = $(domid + " > p.paginate"); 118 page.html(''); 119 if(c > l) { 120 if(o > 0) { 121 var po = Math.max(o-l, 0); 122 $('<a/>').html( (po+1) + ' - ' + (po+l) ) 123 .click(function() { 124 perform_datapoint_search(domid,wsmode,string,po,r.limit); 125 return false; 126 }).appendTo(page); 127 } 128 page.append($('<span/>').html((o+1) + '-' + (o+l)).addClass('searchselect')); 129 if(o + l < c) { 130 var po = o + l; 131 $('<a/>').html( (po + 1) + '-' + (po+l) ) 132 .click(function() { 133 perform_datapoint_search(domid,wsmode,string,po,r.limit); 134 return false; 135 }).appendTo(page); 136 } 137 page.slideDown('fast'); 138 } 139 else page.slideUp('fast'); 140 $(domid + " > ul.graph-searchresults > li").remove(); 141 for(var i=0; r.results && i<r.results.length; i++) { 142 var g = r.results[i]; 143 var add = $('<a href="#"/>'); 144 add.html('Add').addClass('addtows'); 145 add.click( 146 (function(graphid) { 147 return function() { 148 add_graph_to_worksheet(graphid); 149 return false; 150 } 151 })(g.graphid) 152 ); 153 var edit = $('<a href="#"/>'); 154 edit.html('Edit').addClass('editgraph'); 155 edit.click( 156 (function(graphid) { 157 return function() { 158 set_current_graph_id(graphid); 159 return false; 160 } 161 })(g.graphid) 162 ); 163 var li = $('<li/>'); 164 var del = $('<a href="#"/>'); 165 del.html('Forget').addClass('deletegraph'); 166 del.click( 167 (function(graphid, li) { 168 return function() { 169 $.getJSON('json/graph/forget/' + graphid, 170 function (r) { 171 if(r.error) { alert(r.error); } 172 else { 173 perform_graph_search(domid,wsmode,string,o,l); 174 } 175 }); 176 return false; 177 } 178 })(g.graphid, li) 179 ); 180 var ul = $('<ul/>'); 181 ul.append($('<li/>').html(g.last_update)); 182 if(wsmode) { 183 ul.append($('<li/>').append(add)); 184 } 185 else { 186 ul.append($('<li/>').append(edit)); 187 ul.append($('<li/>').append(del)); 188 } 189 li.append($('<a/>').html(g.title)).append(ul); 190 $(domid + " > ul.graph-searchresults").append(li); 191 } 192 }); 193 } ui/web/htdocs/search_saved_graphs.inc
r72e33c5 r15ab3e1 1 1 <script type="text/javascript"> 2 2 <!-- 3 function perform_graph_search(string, offset, limit) {4 $.getJSON('json/graph/search',5 { 'q' : string, 'o' : offset, 'l' : limit },6 function(r) {7 var summary = r.count + ' graph' + (r.count == 1 ? '' : 's' ) + ' found for \'' + htmlentities(r.query) + '\'';8 if(r.error) summary = 'Error: ' + htmlentities(r.error);9 $("#graphlist > p.graph-search-summary").html(summary).fadeIn('fast');10 var c = new Number(r.count);11 var l = new Number(r.limit);12 var o = new Number(r.offset);13 var page = $("#graphlist > p.paginate");14 page.html('');15 if(c > l) {16 if(o > 0) {17 var po = Math.max(o-l, 0);18 $('<a/>').html( (po+1) + ' - ' + (po+l) )19 .click(function() {20 perform_datapoint_search(string,po,r.limit);21 return false;22 }).appendTo(page);23 }24 page.append($('<span/>').html((o+1) + '-' + (o+l)).addClass('searchselect'));25 if(o + l < c) {26 var po = o + l;27 $('<a/>').html( (po + 1) + '-' + (po+l) )28 .click(function() {29 perform_datapoint_search(string,po,r.limit);30 return false;31 }).appendTo(page);32 }33 page.slideDown('fast');34 }35 else page.slideUp('fast');36 $("#graph-searchresults > li").remove();37 for(var i=0; r.results && i<r.results.length; i++) {38 var g = r.results[i];39 var a = $('<a href="#"/>');40 a.html('Edit').addClass('editgraph');41 a.click(42 (function(graphid) {43 return function() {44 set_current_graph_id(graphid);45 return false;46 }47 })(g.graphid)48 );49 var li = $('<li/>');;50 var del = $('<a href="#"/>');51 del.html('Forget').addClass('deletegraph');52 del.click(53 (function(graphid, li) {54 return function() {55 $.getJSON('json/graph/forget/' + graphid,56 function (r) {57 if(r.error) { alert(r.error); }58 else {59 perform_graph_search(string,o,l);60 }61 });62 return false;63 }64 })(g.graphid, li)65 );66 li.append($('<a/>').html(g.title))67 .append($('<ul/>').append($('<li/>').html(g.last_update))68 .append($('<li/>').append(a))69 .append($('<li/>').append(del)));70 $("#graph-searchresults").append(li);71 }72 });73 }74 3 $(document).ready(function(){ 75 4 $("#graph-searchform").submit(function() { 76 perform_graph_search( $("#graph-searchinput").val(), 0, 25);5 perform_graph_search("#graphlist", false, $("#graph-searchinput").val(), 0, 25); 77 6 return false; 78 7 }); 79 8 }); 80 9 --> 81 </script>82 83 10 </script> 84 11 <h4 id="graph-searchterms"></h4> … … 91 18 </form> 92 19 </div> 93 <div id="graphlist" >20 <div id="graphlist" class="graphlist"> 94 21 <p class="graph-search-summary"></p> 95 <ul id="graph-searchresults">22 <ul class="graph-searchresults"> 96 23 </ul> 97 24 </div> ui/web/htdocs/worksheet_controls.inc
rfb2f0f7 r15ab3e1 1 1 <h3 id="worksheet_controls">Worksheet Controls</h3> 2 <span class="worksheet"> 3 <div id="searchform" style="margin:1em 0 1em 0;padding-bottom:1em;border-bottom: solid 1px #c4c4c4;"> 4 <form name="form" id="form"> 5 <label for="jumpMenu">User:</label> 6 <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)"> 7 <option>theo@omniti.com</option> 8 <option>loremipsum@mail.freelotto.com</option> 9 </select> 10 </form> 11 </div> 12 <div style="clear:both;"> 13 <input name="New Worksheet" type="button" value="New worksheet" style="float:right;" /> 14 <h4 style="margin:.5em 0 1em 0;">20 Worksheets</h4> 15 </div> 16 <div id="worksheetlist"> 17 <ul> 18 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 19 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 20 <li class="selected"><a href="#">sed do eiusmod tempor incididunt</a></li> 21 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 22 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 23 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 24 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 25 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 26 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 27 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 28 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 29 <li><a href="#">sed do eiusmod tempor incididunt</a></li> 30 </ul> 31 </div> 32 </span> 2 <span class="search"> 3 <div class="ws-tabs"> 4 <ul class="tabNavigation"> 5 <li class="ws-first"><a href="#ws-first">WorkSheets</a></li> 6 <li class="ws-second"><a href="#ws-second">Find Graphs</a></li> 7 </ul><br clear="all" /> 8 9 <div id="ws-first"><!-- search --> 10 <?php include('ws_search_simple.inc') ?> 11 </div> 12 <div id="ws-second"><!-- saved graphs --> 13 <?php include('ws_search_graphs.inc') ?> 14 </div> 15 </div> 16 </span> ui/web/lib/Reconnoiter_DB.php
r6f65b60 r15ab3e1 285 285 return $rv; 286 286 } 287 function getWorksheetByID($id) { 288 $sth = $this->db->prepare("select * 289 from prism.saved_worksheets 290 join prism.saved_worksheets_dep 291 using (sheetid) 292 where sheetid=?"); 293 $sth->execute(array($id)); 294 $a = array(); 295 while($row = $sth->fetch()) { 296 $a[] = $row; 297 } 298 return $a; 299 } 300 function saveWorksheet($ws) { 301 $id = ''; 302 if($ws['id']) { 303 $id = $ws['id']; 304 unset($ws['id']); 305 } 306 $this->db->beginTransaction(); 307 try { 308 if($id) { 309 $sth = $this->db->prepare("update prism.saved_worksheets 310 set title=?, saved=(saved or ?), 311 last_update=current_timestamp 312 where sheetid=?"); 313 $sth->execute(array($ws['title'],$ws['saved'],$id)); 314 if($sth->rowCount() != 1) throw(new Exception('No such worksheet: '.$id)); 315 $sth = $this->db->prepare("delete from prism.saved_worksheets_dep 316 where sheetid=?"); 317 $sth->execute(array($ws['id'])); 318 } 319 else { 320 $id = Reconnoiter_UUID::generate(); 321 $sth = $this->db->prepare("insert into prism.saved_worksheets 322 (sheetid, title, 323 last_update) 324 values (?, ?, current_timestamp)"); 325 $sth->execute(array($id, $ws['title'])); 326 } 327 $sth = $this->db->prepare("insert into prism.saved_worksheets_dep 328 (sheetid, ordering, graphid) 329 values (?,?,?)"); 330 $ordering = 0; 331 foreach($ws['graphs'] as $graphid) { 332 $sth->execute(array($id,$ordering++,$graphid)); 333 } 334 $this->db->commit(); 335 } 336 catch(PDOException $e) { 337 $this->db->rollback(); 338 throw(new Exception('DB: ' . $e->getMessage())); 339 } 340 } 287 341 function getGraphByID($id) { 288 342 $sth = $this->db->prepare("select *
