-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xhtml
executable file
·750 lines (716 loc) · 36.2 KB
/
index.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
<!DOCTYPE html>
<html lang="en">
<head>
<!-- The jQuery library is a prerequisite for all jqSuite products -->
<script type="text/ecmascript" src="js/jquery.min.js"></script>
<script type="text/ecmascript" src="js/jquery.form.js"></script>
<!-- This is the localization file of the grid controlling messages, labels, etc. -->
<!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom -->
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery-ui.css" />
<!--<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">-->
<!--<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">-->
<!--<script src="//code.jquery.com/jquery-1.10.2.js"></script>-->
<!--<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>-->
<script type="text/ecmascript" src="js/jquery-ui.js"></script>
<script src="js/jquery-ui.min.js"></script>
<!--JQGRID SPECIFIC-->
<!-- This is the Javascript file of jqGrid -->
<script type="text/ecmascript" src="js/trirand/jquery.jqGrid.min.js"></script>
<!-- We support more than 40 localizations -->
<script type="text/ecmascript" src="js/trirand/i18n/grid.locale-en.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/trirand/ui.jqgrid.css" /><!-- The link to the CSS that the grid needs -->
<!-- jquery shits END-->
<!--<script type="text/ecmascript" src="js/jquery-1.10.2.js"></script>-->
<!--PHYLOGENIE-->
<link rel="stylesheet" href="css/phylodoc.css">
<!--<script type="text/javascript" src="js/phylo/raphael-min.js" ></script>-->
<!--<script type="text/javascript" src="js/phylo/jsphylosvg-min.js"></script>-->
<script type="application/javascript" src="js/phylo/PhyloCanvas.js"></script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>The protein DB model grid</title>
</head>
<body>
<style type="text/css">
/* set the size of the datepicker search control for Order Date*/
/*#ui-datepicker-div { font-size:14px; }*/
/* set the size of the autocomplete search control*/
/*.ui-menu-item { font-size: 14px; }*/
/*.ui-autocomplete { font-size: 14px; }*/
//ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-draggable ui-resizable{ width: auto; maxwidth: 900px}
.ui-jqgrid-sortable{font-size:14px !important;}
.ui-jqgrid tr.jqgrow td {font-size:13px !important;}
.ui-widget button {font-size:13px !important;}
.ui-widget {font-size:13px !important;}
//.ui-search-toolbar{font-size:19px;} .ui-jqgrid-htable{font-size:19px;}
//.ui-widget-content ui-corner-all{font-size:19px;}
//.ui-search-input{font-size:13px;}
//.ui-search-table{font-size:13px;}
/*.ui-widget-content.ui-corner-all{ font-size:14px !important;}*/
</style>
<!--TABS-->
<div id="tabs">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#phylo">Phylogeny</a></li>
<li><a href="#main">Connexin DB</a></li>
<li><a href="#terms">Terms of service</a></li>
</ul>
<div id="home"><p><iframe src="intro.html" style="height: 600px; width: 940px;"></iframe></p></div>
<div id="phylo">Filoginia
Text size: <button onClick="textSize('plus');">+</button> <button onClick="textSize('minus');">-</button>
<div id="pc-buttons">
<button id="rectangular" class="btn">Rectangular</button>
<button id="circular" class="btn">Circular</button>
<button id="radial" class="btn" >Radial</button>
<button id="diagonal" class="btn" >Diagonal</button>
<button id="hierarchy" class="btn" >Hierarchical</button>
</div>
<div id="svgCanvas" style="width:800px; height:600px;"> </div>
<script type="text/javascript">
//###phylocanvas
$(document).on('click','#pc-buttons .btn', {} ,function(e){
$('#pc-buttons .btn').removeClass('btn-info');
$('#pc-buttons .btn').addClass('btn-default');
$(this).addClass('btn-info');
phylocanvas.setTreeType(this.id);
});
function textSize(type) {
if(type == "plus" && text_size <= 200) {
phylocanvas.setTextSize(++text_size);
}
else if(type == "minus" && text_size >= 1) {
phylocanvas.setTextSize(--text_size);
}
}
function phyloLoaded()
{
phylocanvas.setTextSize( 23);
phylocanvas.zoom = .5;
phylocanvas.backColour = true;
// phylocanvas.setNodeColourAndShape("'CXA1_RAT'", 'orange', 'o');
// phylocanvas.branches["'CXA1_RAT'"]['data'] = {'column1':10, 'Column2': 0};
// phylocanvas.viewMetadataColumns();
// alert(phylocanvas.leaves[0].id);
colourAll();
// phylocanvas.draw();
}
function colourAll()
{
for(node of phylocanvas.leaves)
{
// alert(node+" "+phylocanvas.leaves[0]);
switch(node.id.charAt(3))
{ //A: green B: blue G: brown D: red E: yellow? zeta: purple
case 'B':
phylocanvas.setNodeColourAndShape(node.id, 'red', 'x');
break;
case 'A':
phylocanvas.setNodeColourAndShape(node.id, 'orange', 's');
break;
case 'A':
phylocanvas.setNodeColourAndShape(node.id, 'yellow', 's');
break;
case 'D':
phylocanvas.setNodeColourAndShape(node.id, 'green', 'o');
break;
case 'G':
phylocanvas.setNodeColourAndShape(node.id, 'blue', 'x');
break;
case 'E':
phylocanvas.setNodeColourAndShape(node.id, 'purple', 't');
break;
}
node.id = node.id.replace("'","");
}
}
var text_size = 23,zoom=0.01;
var phylocanvas = new PhyloCanvas.Tree('svgCanvas', {history: {collapsed: true},defaultCollapsed: {min: 150,max: 1000,color: 'green'}}); // initialize your tree viewer
phylocanvas.load('js/phylo/Filogenia.nwk'); // load your tree file
phylocanvas.addListener('loaded', phyloLoaded);
phylocanvas.setTreeType('circular');
phylocanvas.setNodeSize( 10);
//###btns
$(function() {
$( "input[type=submit], button" ).button()});
//###jsphylosyg
// $(document).ready(function(){
// $.get("js/phylo/Filogenia.xml", function(data) {
// var dataObject = {
// xml: data,
// fileSource: true
// };
// phylocanvas = new Smits.PhyloCanvas(
// dataObject,
// 'svgCanvas',
// 800, 800,
// 'circular'
// );
// });
// });
</script>
</div>
<!--BUSQUEDA EXTERNA ESPECIFICA-->
<div id="main">
<div id="searchDiv" style="height: '100%'; width: 1100px;" title="Click to see advanced search options.">
<h3>Direct Model Search</h3>
<div>
<input type="text" id="txtSearch" placeholder="Enter model ID..." value="" onkeypress="return txtSearchEnter(this,event);" onfocus="if (this.value==this.defaultValue) this.value='';" onblur="if(this.value==''){this.value=''}" />
<input type="submit" value="Search" onclick="searchModel(document.getElementById('txtSearch').value)" />
</div>
</div><br />
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
<div id="pvDialog" title="3D Model" hidden >
<!--<iframe id="pvDialogFrame" src="js/pv/index.html" width="600" height="500"></iframe>-->
<iframe id="pvDialogFrame" width="500" height="530"></iframe>
</div>
<div id="pvDialogAlignment" title="Alignment" hidden >
<!--<iframe id="pvDialogFrame" src="js/pv/index.html" width="600" height="500"></iframe>-->
<iframe id="pvDialogAlignmentFrame" width="750" height="530"></iframe>
</div>
<!-- <input type="button" value="Download Selected Models" onclick="downloadSelecteds()" />-->
<form id="downloadForm" action="php/downloaderHelper.php" method="post">
<!--<input type="text" id="selectedFiles" name="files" hidden>-->
<input id="downloadBtn" type="submit" value="Download Selected Models">
<div id="loading" hidden>Loading Please Wait....<img src="css/images/ajax-loader.gif" alt="Searching" /></div>
</form>
<div id="downloader"></div>
</div>
<div id="terms"><?php include 'terms.html'; echo "asfdasdf";?>testing</div>
</div>
<!-- zip scripts-->
<!-- <script type="text/javascript" src="js/zip.js"></script>
<script type="text/javascript" src="js/simpleZip.js"></script>
<script type="text/javascript" src="js/FileSaver.js"></script>-->
<script src="js/jquery-multidownload/jquery-multidownload.js"></script>
<!--//PHP INCLUDES-->
<?php include 'php/includes.php';?>
<script type="text/javascript">
//alert(parseInt('ZZ',36)+" "+(parseInt(1295)).toString(36));
var files = [];
$(document).ready(function () {
//###DOWNLOADER FORM
$('#downloadForm').ajaxForm({data:{files:files},beforeSubmit: function(){
if(files.length >0)
{
// alert(files);
document.getElementById("loading").hidden = false;
return true;
}
else
{
return false;
}
}
,success: function(r) {
// alert("url: "+r);
var link = document.createElement("a");
link.id=r;
link.download ='';
link.name = r;
link.href = r;
// link.click();
document.getElementById("loading").hidden = true;
}});
// $('#downloadForm').ajaxForm(callDownloadHelper);
//###SEARCHDIV
$( "#searchDiv" ).accordion({collapsible: true,active: false});
//###TABS
$(function() { $( "#tabs" ).tabs(); });
//###JQGRID
$("#jqGrid").jqGrid({
//url: 'db/data.json',
editurl: 'clientArray',
//mtype: "GET",
//datatype: "json",
url: 'db/proteins.php',
datatype: 'xml',
page: 1,
colModel: [
{ label : "id",sorttype: 'integer',name: 'id',hidden:true,width: 150,editable: true},
{ label : "Name",name: 'Name',key: false,width: 150,editable: true,stype: "text",searchoptions: { value: ":All" }},
{ label : "Family",name: 'Family',width: 150,editable: true,stype: "select",searchoptions: { value: ":All" }},
{ label : "Structure Type",name: 'Structure Type',width: 150,editable: true,stype: "select",searchoptions: { value: ":All" }},
{ label : "Organism",name: 'Organism',width:100,editable: true,stype: "select",searchoptions: { value: ":All" }},
{ label : "Array",name: 'Array',width: 180,editable: true,stype: "select",searchoptions: { value: ":All" }},
{ label : "Description",name: 'Description', width: 150,editable: true,autowidth: true,hidden:true},
],
loadonce: true,
viewrecords: true,
width: 1100,
height: 550,
rowNum: 10,
shrinkToFit: true,
subGrid: true, // set the subGrid property to true to show expand buttons for each row
onSelectRow: function (rowId) { $(this).jqGrid ('toggleSubGridRow', rowId);},
subGridRowExpanded: showChildGrid, // javascript function that will take care of showing
subGridOptions : {expandOnLoad: true,reloadOnExpand :false,selectOnExpand : false },// expand all rows on load
// pager: "#jqGridPager",
loadComplete: function() {
// var grid = $("#jqGrid");
// var subGridCells = $("td.sgcollapsed",grid[0]);
// $.each(subGridCells,function(i,value){
// if (i!==0) {
// $(value).unbind('click').html('');
// }
// });
$("#jqGrid").jqGrid('setColProp', 'Name', {
searchoptions: {
sopt:['cn'],
dataInit: function(elem) {
$(elem).autocomplete({
source:getUniqueColumnValues('Name'),
delay:0,minLength:0,multiple:true,
select: function (event, ui) {$(elem).trigger('keydown');$(elem).val(ui.item.value);}
});
}
}
});
$("#jqGrid").jqGrid('filterToolbar',{stringResult:true,autosearch:true,searchOnEnter:false,defaultSearch:"cn"});
if(!isFilled)
{
//fillOptions('Name');
fillOptions('Family');
fillOptions('Structure Type');
fillOptions('Organism');
fillOptions('Array');
}
//testing shits
var rowIds = $("#jqGrid").getDataIDs();
$.each(rowIds, function (index, rowId) {
$("#jqGrid").collapseSubGridRow(rowId);
});
}
});
// activate the toolbar searching
//$('#jqGrid').jqGrid('filterToolbar');
$("#jqGrid").jqGrid('gridResize');
//add tooltip to header
tooltip="Click to sort";
$('.ui-th-column').each(function() { $(this).attr('alt',tooltip).attr('title',tooltip); });
//expansion row tooltip
$("#jqGrid").attr('title',"Click to expand or close model subgrid");
/* $('#jqGrid').jqGrid('navGrid',"#jqGridPager", {
search: true, // show search button on the toolbar
add: true,
edit: true,
del: true,
refresh: true
},
// options for the Edit Dialog
{
editCaption: "The Edit Dialog",
// template: template,
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
}
},
// options for the Add Dialog
{
// template: template,
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
}
},
// options for the Delete Dailog
{
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
}
});*/
});
var isFilled = false;
//function to fill select box with actual column data (what else?! :P)
function fillOptions(column)
{
//alert("asd");
//alert(r);
var select = document.getElementById('gs_'+column);
var r = getUniqueColumnValues(column);
//alert(r);
if(r.length>1)
for (var v in r)
{
//alert(r[v]);
// alert(v);
select.options[1+parseInt(v)] = new Option(r[v],r[v],false,false);
}
else
select.parentNode.parentNode.hidden=true;
isFilled = true;
//return '';
}
function getUniqueColumnValues(column)
{
//get column values and fill text separated by coma
var res = $("#jqGrid").jqGrid('getCol', column);
//alert(res);
return res.filter(function(itm,i,a){
return i==a.indexOf(itm);
});
}
//popup3dmodel function
function show3dModel(pdb,url){
// alert(url);
if(typeof url == 'undefined')
url="js/jsmol/index.php?pdb=";
$(function(){$("#pvDialog").dialog();});
//$( "#pvDialog" ).hidden = false;
//$( "#pvDialogFrame" ).attr('src','js/pv/index.html#'+pdb);
$( "#pvDialog" ).parent().css( "width", "auto");
// alert(url+pdb);
$( "#pvDialogFrame").attr('src',url+pdb);
}
function showAlign(pdb,url){
// alert(url);
// if(typeof url == 'undefined')
// url="js/jsmol/index.php?pdb=";
//alert(pdb);
$(function(){$("#pvDialogAlignment").dialog();});
//$( "#pvDialog" ).hidden = false;
//$( "#pvDialogFrame" ).attr('src','js/pv/index.html#'+pdb);
$( "#pvDialogAlignment" ).parent().css( "width", "auto");
// $( "#pvDialogAlignmentFrame").attr('src','http://strap.charite.de/aaBeta/aa.php?beforeAC=load%20http://146.83.236.8/alignment.fasta&afterAC=set_color_mode+zappo%0Aset_conservation_threshold+90');
//alert('http://localhost/aa/aa.php?beforeAC=load%20http://localhost/cxGrid/proteinModels/'+pdb+'&afterAC=set_color_mode+zappo%0Aset_conservation_threshold+90');
$( "#pvDialogAlignmentFrame").attr('src','http://localhost/aa/aa.php?beforeAC=load%20http://localhost/cxGrid/proteinModels/'+pdb+'&afterAC=set_color_mode+zappo%0Aset_conservation_threshold+90');
}
// the event handler on expanding parent row receives two parameters
// the ID of the grid tow and the primary key of the row
var actualSubGrid = "";
function showChildGrid(parentRowID, parentRowKey) {
var childGridID = parentRowID + "_table";
var childGridPagerID = parentRowID + "_pager";
var pid = $("#jqGrid").jqGrid('getCell',parentRowKey,'id');
//alert(pid+" "+childGridID +" "+ parentRowKey);
// send the parent row primary key to the server so that we know which grid to show
var childGridURL = "proteinModels/"+parentRowKey+"/"+parentRowKey+".json";
//childGridURL = childGridURL + "&parentRowID=" + encodeURIComponent(parentRowKey)
actualSubGrid = childGridID;
// add a table and pager HTML elements to the parent grid row - we will render the child grid here
$('#' + parentRowID).append('<table id=' + childGridID + ' title="click to sort"></table><div id=' + childGridPagerID + ' class=scroll></div>');
$("#" + childGridID).jqGrid({
// url: childGridURL,
url: 'db/models.php?pid='+pid,
mtype: "GET",
datatype: "json",
//datatype: "xml",
page: 1,
colModel: [
{ label:' ',index:'select',name:'select',edittype:'checkbox',hidden:false,editable:true,width:15,search:false,formatter: "checkbox",formatoptions:{disabled:false},cellattr: function () { return ' title="Click to select models and then press Download button for bulk download"'; }},
{ label: 'ID', name: 'id', key: true, width: 70,align:'center',search:false, editable: true,formatter: function formatId(cellValue, options, rowObject) {
return ('0000'+parseInt(cellValue).toString(36)+parseInt(pid).toString(36)).slice(-4); } },
{ label: 'Model Type', name: 'Model Type', width: 100,search:false, editable: true,cellattr:function(){return' title="Click triangle to expand"'; } },
{ label: 'Evaluator', name: 'Evaluator', width: 75,search:false, editable: true },
{ label: 'Score', name: 'Score', width: 70,align:'center',search:false, editable: true },
{ label: 'PDB', name: 'PDB', width: '180%',search:false, editable: true,formatter: formatLink, autowidth: true },
{ label: 'Alignment', name: 'Alignment', width: '150%',search:false, editable: true,formatter: formatLink, autowidth: true,hidden: false },
{ label: 'Seq Identity', name: 'Sequence Identity',align:'center', width: 80,search:false, editable: true,formatter: addPercent, autowidth: true,hidden: false },
{ label: 'Seq Similarity', name: 'Sequence Similarity',align:'center', width: 75,search:false, editable: true,formatter: addPercent, autowidth: true,hidden: false },
{ label: "View Alignment", name: "Alignment",width: 75,align:'center',search:false,editable:false,hidden: false,
formatter: function(cellValue, options, rowObject){
//$( "#pvDialogFrame" ).attr('src','js/pv/index.html#'+parentRowKey+"/"+cellValue);
//$( "#pvDialogFrame" ).attr('src','js/jsmol/index.php?pdb='+parentRowKey+"/"+cellValue);
// return "<input type='button' value='view' title='Click to view an alignment comparison on a popup' onclick='show3dModel(\""+parentRowKey+"/"+cellValue+"\")'\>";
return "<input type='button' value='view' title='Click to view an alignment comparison on a popup' onclick='showAlign(\""+parentRowKey+"/"+cellValue+"\")'\>";
}
},
{ label: "3D Model", name: "PDB",width: 75,align:'center',search:false,editable:false,hidden: false,
formatter: function(cellValue, options, rowObject){
//$( "#pvDialogFrame" ).attr('src','js/pv/index.html#'+parentRowKey+"/"+cellValue);
//$( "#pvDialogFrame" ).attr('src','js/jsmol/index.php?pdb='+parentRowKey+"/"+cellValue);
return "<input type='button' value='view' title='Click view 3d model on a popup' onclick='show3dModel(\""+parentRowKey+"/"+cellValue+"\")'\>";
}
},
//{ name: 'level', hidden: true },{ name: 'parent_id', hidden: true },{ name: 'isLeaf', hidden: true },{ name: 'expanded', hidden: true }
],
loadonce: true,
width: '100%',
height: '100%',
shrinkToFit: true,
multiselect: true,
treeGrid: true,ExpandColumn: 'Model Type',ExpandColClick:false,
onSelectRow: onSelectRow,
treeGridModel:"adjacency",
teedatatype:"json",
treeReader:{
parent_id_field:"parent_id",
level_field:"level",
leaf_field:"isLeaf",
expanded_field:"expanded",
loaded:"loaded",
icon_field:"icon"
},
loadComplete: function () {
var getColumnIndexByName = function(grid, columnName) {
var cm = grid.jqGrid('getGridParam', 'colModel'), i, l;
for (i = 0, l = cm.length; i < l; i += 1) {
if (cm[i].name === columnName) {
return i; // return the index
}
}
return -1;
};
var iCol = getColumnIndexByName($(this), 'select'), rows = this.rows, i,
c = rows.length;
for (i = 1; i < c; i += 1) {
$(('input[type="checkbox"]'),rows[i].cells[iCol]).click(function (e) {
var row = $(e.target).closest('tr')[0];
var id = row.id,isChecked = $(e.target).is(':checked');
var pdb=row.cells[5].firstChild,psf=row.cells[6].firstChild;
// alert('clicked on the checkbox in the row with id=' + id +
// '\nNow the checkbox is ' +
// (isChecked? 'checked': 'not checked'));
//alert( row.cells[5].toString() );
//setDownlodeable(pdb);
//alert("pdb: "+pdb);
if(pdb !== null){
setDownlodeable(isChecked,pdb.valueOf());
// if(psf !== null)
// setDownlodeable(isChecked,psf.valueOf());
}
});
}
}
//pager: "#" + childGridPagerID
});
function setDownlodeable(isChecked,pdb) {
if(pdb !== null)
{
//for new download
var localPdb = (pdb+"").replace("http://localhost/cxGrid/","../");
//
var link = document.createElement("a");
link.id=pdb;
link.download ='';
link.name = pdb;
link.href = pdb;
link.innerHTML = pdb+" </BR>";
link.className = "pdb";
var div = document.getElementById('downloader');
//document.write(link);
//alert("var: "+link);
if(isChecked)
{
//addpdb to downloaderHelper
// var files=document.getElementById("selectedFiles");
files.push(localPdb);
//end
div.appendChild(link);
//document.body.appendChild(link);
//alert("added: "+pdb);
}
else
{
//download helper
// var files=document.getElementById("selectedFiles");
if(files.length >0)
{
files.splice(files.indexOf(localPdb),1);
}
//end
var j=0,l=div.children.length;
//alert(j+" "+l);
for(j = 0; j < l;j+=1)
{
//alert("Asdfsdaf");
var c= div.children[j];
if(c!==null&&typeof c!== 'undefined')
{
var child=c.href;
//alert(child+"\n"+link+"\n"+( child == link));
if( child == link)
{
// alert("wii!");
div.removeChild(div.children[j]);
}
}
}
}
//alert("value: "+div.getElementsByTagName(link.name));
}
}
//UNCOMMENT TO ADD FILTER FUNCTION
//$("#" + childGridID).jqGrid('filterToolbar');
//COMMENT TO DISABLE RESIZE
$("#" + childGridID).jqGrid('gridResize');
//add tooltip to header
tooltip="Click to sort";
$('.ui-th-column').each(function() { $(this).attr('alt',tooltip).attr('title',tooltip); });
//tooltip="Click to expand or close model subgrid";
//$('.ui-tree-wrap').each(function() { alert("XD"); $(this).attr('alt',tooltip).attr('title',tooltip); });
//UNCOMMENT TO ENABLE PAGER!
/*$("#" + childGridID).jqGrid('navGrid',"#"+childGridPagerID, { //bottom navbar, commented to disable it
search: true, // show search button on the toolbar
add: true,
edit: true,
del: true,
refresh: true
},
// options for the Edit Dialog
{
editCaption: "The Edit Dialog",
// template: template,
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
}
},
// options for the Add Dialog
{
// template: template,
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
}
},
// options for the Delete Dailog
{
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
}
}); */
//});
function formatLink(cellValue, options, rowObject) {
if( cellValue !== '' && cellValue !== 'undefined' )
return "<a id=\""+cellValue+"\" download href='" +"proteinModels/"+parentRowKey+"/"+ cellValue + "'>"+cellValue+ "</a>";
else
return '';
};
function addPercent(cellValue, options, rowObject) {
if( cellValue !== '' )
return cellValue+"%";
else
return '';
};
}
function downloadSelecteds()
{
//$('.pdb').multiDownload('click',{delay: 10000,type: "adownload"});
$('.pdb').multiDownload();
}
//DEPRECTAED!
function downloadSelectedRows() {
//cleaning div helper
var div = document.getElementById('downloader');
div.innerHTML = "";
var grid = $("#jqGrid");
//alert(actualSubGrid);
//alert(grid);
grid = $("#"+actualSubGrid);
//alert(grid);
var rowKey = grid.getGridParam("selrow");
if (!rowKey)
alert("No rows are selected");
else {
var selectedIDs = grid.getGridParam("selarrrow");
var result = "";
for (var i = 0; i < selectedIDs.length; i++) {
result += selectedIDs[i] + ",";
//var cell;
//alert (cell = grid.getCell(selectedIDs[i],'PDB'));
//a = grid.getCell(selectedIDs[i],'PDB');
var a = document.getElementById(selectedIDs[i]); //.click();
//alert("value "+a);
if(a.cells[5].firstChild !== null)
fileDownload(a.cells[5].firstChild.valueOf());
if(a.cells[6].firstChild !== null)
{
// alert("value 2: "+a.cells[6]);
// alert("value 2:"+a.cells[6].firstChild.valueOf() );
fileDownload(a.cells[6].firstChild.valueOf());
}
//$("#"+selectedIDs[i]).click();
}
$('.pdb').multiDownload();
// alert(result);
}
}
//DEPRECATED
//This function create a temp a element marked as downlodeable for multidownload plugin
function fileDownload(uri)
{
var link = document.createElement("a");
//link.download = uri;
link.href = uri;
link.className = "pdb";
var div = document.getElementById('downloader');
//document.write(link);
//alert("var: "+link);
div.appendChild(link);
//link.click();
//event.preventDefault();
//div.removeChild(link);
//$("#"+link.id).multiDownload();
}
//replaced with a dusty solution
function onSelectRow(id,status,e)
{
// alert("acuse");
$('#'+id)[0].firstChild.firstChild.click();
}
function txtSearchEnter(t,e){
//e = e || window.event;
var keyCode = (window.event) ? e.which : e.keyCode;
// alert(keyCode);
if(keyCode === 13)
{
// alert(t.value);
searchModel(t.value);
}
}
var isFullSearch=false;
function getNumId(id)
{
//Original Inverse function
//'0000'+parseInt(cellValue).toString(36)+parseInt(pid).toString(36)).slice(-4)
if(id.length===4)
{
isFullSearch = true;
return parseInt(id.slice(0,2),36)+" "+parseInt(id.slice(2,4),36);
}
else
isFullSearch = false;
return id;
}
function searchModel(id) {
// alert(id);
if(id==='' ||id === null|| typeof id===undefined) return;
//select
var fullId=getNumId(id).split(" ");
id=fullId[0];
if(!$.isNumeric(id)) return;
var pId = fullId[1];
var data = $("#jqGrid").jqGrid('getGridParam', 'data');
for (var i = 0; i < data.length; i++) {
//check into subgrid
// alert("pId: "+pId+" data[i].id: "+data[i].id+" data[i].Name: "+data[i].Name);
if(pId===data[i].id)
{
var sData = $("#jqGrid_"+data[i].Name+"_table").jqGrid('getGridParam', 'data');
for (var j = 0; j < sData.length; j++) {
// alert(sData[j].id+" inp ut: "+id);
if(sData[j].id !==null&&typeof sData[j]!==undefined&& isFullSearch?(sData[j].id == id):false){//((sData[j].id+"").indexOf(id) > -1)){
// alert(isFullSearch);
selectAndExpand(data[i].Name,sData[j].id);
}
}
}
}
}
function selectAndExpand(table,id)
{
var pGrid = '#jqGrid_'+table+'_table';
$(pGrid).jqGrid('setSelection',id,true);
$('#jqGrid').jqGrid ('expandSubGridRow', table);
var sel =$(pGrid).jqGrid('getLocalRow',id);
if(sel!==null&&typeof sel!==undefined)
{
var row = $(pGrid).jqGrid("getNodeParent",sel);
if(row!==null&&typeof row!==undefined)
{
$(pGrid).jqGrid('expandRow', row);
$(pGrid).jqGrid('expandNode', row);
}
}
}
</script>
</body>
</html>