Skip to content
This repository
Browse code

Merge pull request #5 from aelnaiem/development

Development
  • Loading branch information...
commit 09fe240657c89ffec69a4638d5d12072bc418723 2 parents 931fceb + 89cb227
Lincoln Stein lstein authored
2  conf/languages/POSIX.pm
@@ -114,7 +114,7 @@ END
114 114
115 115 TIMESTAMP => 'Snapshot Timestamp [GMT]',
116 116
117   - SNAPSHOT_SELECT => 'Saved Snapshots',
  117 + SNAPSHOT_SELECT => 'Snapshots',
118 118
119 119 SELECT_TRACKS => 'Select Tracks',
120 120
2  conf/languages/en.pm
@@ -118,7 +118,7 @@ END
118 118
119 119 TIMESTAMP => 'Snapshot Timestamp [GMT]',
120 120
121   - SNAPSHOT_SELECT => 'Saved Snapshots',
  121 + SNAPSHOT_SELECT => 'Snapshots',
122 122
123 123 SELECT_TRACKS => 'Select Tracks',
124 124
4 htdocs/js/controller.js
@@ -530,7 +530,7 @@ var GBrowseController = Class.create({
530 530 if( get_tracks)
531 531 Controller.get_multiple_tracks(track_keys);
532 532 else
533   - Controller.idle();;
  533 + Controller.idle();
534 534 }
535 535 });
536 536 return true;
@@ -1333,7 +1333,7 @@ show_info_message:
1333 1333 function(event, url) {
1334 1334 GBox.showTooltip(event, url);
1335 1335 Controller.update_sections(new Array(custom_tracks_id));
1336   - },
  1336 + }
1337 1337
1338 1338 });
1339 1339
996 htdocs/js/toggle.js
... ... @@ -1,996 +0,0 @@
1   -var track_listing_id = 'tracks_panel';
2   -
3   -
4   -///create getelementbyclassnames function
5   -
6   -/*
7   - Developed by Robert Nyman, http://www.robertnyman.com
8   - Code/licensing: http://code.google.com/p/getelementsbyclassname/
9   -*/
10   -var getElementsByClassName = function (className, tag, elm){
11   - if (document.getElementsByClassName) {
12   - getElementsByClassName = function (className, tag, elm) {
13   - elm = elm || document;
14   - var elements = elm.getElementsByClassName(className),
15   - nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
16   - returnElements = [],
17   - current;
18   - for(var i=0, il=elements.length; i<il; i+=1){
19   - current = elements[i];
20   - if(!nodeName || nodeName.test(current.nodeName)) {
21   - returnElements.push(current);
22   - }
23   - }
24   - return returnElements;
25   - };
26   - }
27   - else if (document.evaluate) {
28   - getElementsByClassName = function (className, tag, elm) {
29   - tag = tag || "*";
30   - elm = elm || document;
31   - var classes = className.split(" "),
32   - classesToCheck = "",
33   - xhtmlNamespace = "http://www.w3.org/1999/xhtml",
34   - namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
35   - returnElements = [],
36   - elements,
37   - node;
38   - for(var j=0, jl=classes.length; j<jl; j+=1){
39   - classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
40   - }
41   - try {
42   - elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
43   - }
44   - catch (e) {
45   - elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
46   - }
47   - while ((node = elements.iterateNext())) {
48   - returnElements.push(node);
49   - }
50   - return returnElements;
51   - };
52   - }
53   - else {
54   - getElementsByClassName = function (className, tag, elm) {
55   - tag = tag || "*";
56   - elm = elm || document;
57   - var classes = className.split(" "),
58   - classesToCheck = [],
59   - elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
60   - current,
61   - returnElements = [],
62   - match;
63   - for(var k=0, kl=classes.length; k<kl; k+=1){
64   - classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
65   - }
66   - for(var l=0, ll=elements.length; l<ll; l+=1){
67   - current = elements[l];
68   - match = false;
69   - for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
70   - match = classesToCheck[m].test(current.className);
71   - if (!match) {
72   - break;
73   - }
74   - }
75   - if (match) {
76   - returnElements.push(current);
77   - }
78   - }
79   - return returnElements;
80   - };
81   - }
82   - return getElementsByClassName(className, tag, elm);
83   -};
84   -
85   -
86   -// setVisState sends the visibility state to the server.
87   -function setVisState (element_name,is_visible) {
88   - var visibility = is_visible ? 'show' : 'hide';
89   - var postData = 'action=show_hide_section;'+visibility+'='+element_name;
90   - new Ajax.Request(document.URL,{method:'post',postBody:postData});
91   -}
92   -
93   -
94   -function toggleDiv(id){
95   -var spans = document.getElementsByTagName('div');
96   -
97   -
98   - for (var i = spans.length; i--;) {
99   - var element = spans[i];
100   - if (element.className.match(RegExp('\\b' + id + '\\b'))) {
101   - element.style.display = (element.style.display === 'none') ? '' : 'none';
102   - }
103   - }
104   -}
105   -
106   -function removeByElement(arrayName,arrayElement)
107   - {
108   - for(var i=0; i<arrayName.length;i++ )
109   -
110   - {
111   - if(arrayName[i]==arrayElement)
112   - arrayName.splice(i,1);
113   -
114   - }
115   - }
116   -///////////////////////////////////////////////////////
117   -
118   -
119   -
120   -function toggle_bar_stars(event,imgID, label, title){
121   - var imgTag = document.getElementById(imgID);
122   -
123   -// alert(imgTag.src);
124   - var fullPathName = imgTag.src;
125   - var pathSplit = fullPathName.split("/");
126   - var getfileNameExt = pathSplit.length - 1;
127   - var fullFilePath = '';
128   -
129   -// alert(imgID);
130   -// alert(imgTag);
131   -// alert(title);
132   - if (pathSplit.length == 0)
133   - {
134   - fullFilePath = '';
135   - }
136   - else if (pathSplit.length > 0)
137   - {
138   - fullFilePath = fullPathName.replace(pathSplit[getfileNameExt], '');
139   - }
140   -
141   - var fileNameExt = pathSplit[getfileNameExt];
142   - var fileNameSpilt = fileNameExt.split(".");
143   - var fileName = fileNameSpilt[0]; // just the file name
144   - var fileExt = fileNameSpilt[1]; // just the file extention
145   - var fileNameMainSpilt = fileName.split("_"); // check for a spilt on '_'
146   - var imgName ='';
147   - var show;
148   -
149   -
150   - if (fileNameMainSpilt.length > 1)
151   - {
152   -
153   - var fileNameMain = fileNameMainSpilt.length - 1;
154   - fileNameMain = fileNameMainSpilt[fileNameMain];
155   - if (fileNameMain == 2)
156   - {
157   - imgName = fileNameMainSpilt[0] + '.' + fileExt;
158   -
159   -
160   - favorite = false;
161   -
162   - }else{
163   - imgName = fileName + '_2.' + fileExt;
164   -
165   -
166   - favorite = true;
167   -
168   -
169   - }
170   - }else{
171   - imgName = fileName + '_2.' + fileExt;
172   -
173   -
174   - favorite = true;
175   -
176   - }
177   -
178   - show = (favorite == true) ? 1 : 0;
179   -
180   - var finalFile = fullFilePath + imgName;
181   - imgTag.src = finalFile;
182   -// alert(trackStatus);
183   -//
184   - new Ajax.Request(document.URL, {
185   - method: 'POST',
186   - asynchronous:true,
187   - parameters: {
188   - action: 'set_favorite',
189   - label: label,
190   - favorite:show,
191   - }});
192   -
193   -
194   -
195   -
196   -
197   -
198   - refresh(0);
199   - return false;
200   -
201   -
202   -
203   -}
204   -
205   -
206   -
207   -
208   -function togglestars(event,imgID, txtID, favorites,cellid)
209   -{
210   - // detectshiftkey();
211   - var imgTag = document.getElementById(imgID);
212   -
213   - var cellTag = document.getElementById(cellid);
214   -
215   - var txtTag = document.getElementById(txtID);
216   - var fullPathName = imgTag.src;
217   - var pathSplit = fullPathName.split("/");
218   - var getfileNameExt = pathSplit.length - 1;
219   - var fullFilePath = '';
220   - var str = imgID.replace("ficonpic_","");
221   - var labels_Range = new Array();
222   - var ministars_Range = new Array();
223   -
224   - if (pathSplit.length == 0)
225   - {
226   - fullFilePath = '';
227   - }
228   - else if (pathSplit.length > 0)
229   - {
230   - fullFilePath = fullPathName.replace(pathSplit[getfileNameExt], '');
231   - }
232   -
233   - var fileNameExt = pathSplit[getfileNameExt];
234   - var fileNameSpilt = fileNameExt.split(".");
235   - var fileName = fileNameSpilt[0]; // just the file name
236   - var fileExt = fileNameSpilt[1]; // just the file extention
237   - var fileNameMainSpilt = fileName.split("_"); // check for a spilt on '_'
238   - var imgName ='';
239   - var show;
240   - var miniID = 'fav_'+imgID;
241   -
242   - var browserstarTag = document.getElementById(miniID);
243   - var blank_min_src =fullFilePath+"fmini.png";
244   - var coloured_min_src = fullFilePath+"fmini_2.png";
245   -
246   - ////select track stars
247   - var stars = getElementsByClassName("star");
248   - idtoarray(stars,"star");
249   - var starsid = idArray;
250   - /////////////
251   -
252   - var startext = getElementsByClassName("selectrackname");
253   - idtoarray(startext,"selectrackname");
254   - var starTextId = idArray;
255   -
256   -/////browser page stars
257   - var ministars = getElementsByClassName("toolbarStar");
258   - idtoarray(ministars, "toolbarStar");
259   -
260   - var ministarsids= idArray;
261   -//////////////
262   -
263   -
264   -
265   -
266   -
267   - var firstIndex;
268   - if (!event.shiftKey){
269   - firstIndex = starsid.findIndex(imgID);
270   - sessvars.firstIndex= {"index":firstIndex};
271   -
272   - }
273   - var lastIndex;
274   -
275   - if (fileNameMainSpilt.length > 1)
276   - {
277   -
278   - var fileNameMain = fileNameMainSpilt.length - 1;
279   - fileNameMain = fileNameMainSpilt[fileNameMain];
280   - if (fileNameMain == 2)
281   - {
282   - imgName = fileNameMainSpilt[0] + '.' + fileExt;
283   - txtTag.style.fontWeight = "normal";
284   -
285   - favorite = false;
286   -
287   - }else{
288   - imgName = fileName + '_2.' + fileExt;
289   - txtTag.style.fontWeight = "900";
290   -
291   - favorite = true;
292   -
293   - }
294   - }else{
295   - imgName = fileName + '_2.' + fileExt;
296   - txtTag.style.fontWeight = "900";
297   -
298   - favorite = true;
299   -
300   - }
301   -
302   -
303   -
304   -//if it is favorited send a 1
305   -
306   -
307   - txtTag.className = 'notselected';
308   - cellTag.className = 'notselected_check';
309   - show = (favorite == true) ? 1 : 0;
310   -//
311   - new Ajax.Request(document.URL, {
312   - method: 'POST',
313   - asynchronous:true,
314   - parameters: {
315   - action: 'set_favorite',
316   - label: imgID,
317   - favorite:show,
318   - }});
319   -
320   -
321   -if (event.shiftKey) {
322   -
323   - firstIndex = sessvars.firstIndex.index;
324   - lastIndex = starsid.findIndex(imgID);
325   -
326   - var j;
327   - var i;
328   -// alert(firstIndex);
329   - show = (favorite == true) ? 1 : 0;
330   -
331   - if(lastIndex<firstIndex){
332   - var tmp;
333   - tmp = lastIndex;
334   - lastIndex = firstIndex;
335   - firstIndex = tmp;
336   - }
337   -
338   - var range = lastIndex - firstIndex;
339   - for( i=firstIndex , j = 0; i<=lastIndex, j <= range ; i++, j++){
340   - labels_Range[j] = starsid[i];
341   -
342   - }
343   - var labels_string = labels_Range.toString();
344   -
345   -
346   -new Ajax.Request(document.URL, {
347   - method: 'POST',
348   - asynchronous:true,
349   - parameters: {
350   - action: 'set_favorite',
351   - label: labels_string,
352   -
353   - favorite:show,
354   - }});
355   -
356   - var minisrc = (show == 1) ? coloured_min_src : blank_min_src;
357   -
358   -// alert(minisrc);
359   - for(var i=firstIndex ;i<=lastIndex; i++){
360   - stars[i].src= fullFilePath + imgName;
361   -
362   - if(imgName=='ficon.png'){
363   - startext[i].style.fontWeight = "normal";
364   - }else{
365   - startext[i].style.fontWeight = "900";
366   - }
367   -
368   -
369   - if(ministars[i]){
370   - ministars[i].src = minisrc;
371   - }
372   -
373   - }
374   - }
375   -
376   -
377   -// (favorite == true) ? fullFilePath+'fmini_2.png' : fullFilePath+'fmini.png';
378   - if(browserstarTag){
379   - browserstarTag.src = (favorite == true) ? coloured_min_src : blank_min_src;
380   - };
381   -// alert(browserstarTag.src);
382   -// alert(blank_min_src);
383   -// alert(coloured_min_src);
384   - var finalFile = fullFilePath + imgName;
385   - imgTag.src = finalFile;
386   -
387   - return false;
388   -
389   -
390   -}
391   -
392   -
393   -function idtoarray(stars,className)
394   -{
395   -
396   -idArray = new Array();
397   -
398   - for (x=0, y=0; x<stars.length; x++,y++) {
399   - if (stars[x].className===className) {
400   - idArray[y] = stars[x].id
401   - }
402   -
403   -}
404   - return idArray;
405   -}
406   -
407   -Array.prototype.findIndex = function(value){
408   -var ctr = "";
409   -for (var i=0; i < this.length; i++) {
410   -// use === to check for Matches. ie., identical (===), ;
411   -if (this[i] == value) {
412   -return i;
413   -}
414   -}
415   -return ctr;
416   -};
417   -
418   -// checkSummaries makes sure any collapsed nodes have their summaries visible upon page load.
419   -function checkSummaries() {
420   - var tf = $('trackform');
421   - if (tf==null) return;
422   -
423   - var sections = tf.select("div.searchbody div.el_visible");
424   - for(j = 0; j < sections.length; j++) {
425   - if(sections[j].visible() == false)
426   - summarizeTracks(sections[j]);
427   -
428   - var track_checkboxes = sections[j].select("input[type=checkbox]:not([id$=_a]):not([id$=_n])");
429   - for (var f = 0; f < track_checkboxes.length; f++)
430   - track_checkboxes[f].observe("change", checkAllToggles);
431   - }
432   -}
433   -
434   -// Update List - Goes through the listing node and marks any "turned on" nodes.
435   -function updateList(node) {
436   - var children = getChildren(node);
437   - var list_items = getList(node).select("span");
438   - for (var a = 0; a < list_items.length; a++) {
439   - if (children[a].select('input[type=checkbox]:checked').length != 0) {
440   - list_items[a].removeClassName("hide").addClassName("show");
441   - } else {
442   - list_items[a].removeClassName("show").addClassName("hide");
443   - }
444   - }
445   -}
446   -
447   -// Get List - Returns (or creates, if missing) the list holder box in the appropriate place.
448   -function getList(node) {
449   - var list = node.up().down("span.list");
450   - if (typeof list == "undefined") {
451   - list = new Element("span", {"class": "list"});
452   - node.up().down("i.nojs").insert({after: list});
453   - }
454   - return list;
455   -}
456   -
457   -// Check "All" Toggles - turns off any "All On" or "All Off" checkboxes which are checked.
458   -function checkAllToggles() {
459   - var node = this.up("div.el_visible");
460   - var all_on = node.up().down("input[type=checkbox][id$=_a]");
461   - var all_off = node.up().down("input[type=checkbox][id$=_n]");
462   -
463   - all_off.checked = (node.down("input[type=checkbox]:checked"))? false : true;
464   - all_on.checked = (node.down("input[type=checkbox]:not(:checked)"))? false : true;
465   -}
466   -
467   -// summarizeTracks mines the track options box for possible tracks and creates a shorter listing of them when the section is hidden.
468   -function summarizeTracks(node) {
469   - var children = getChildren(node);
470   - var list_text = listText(children);
471   -
472   - // Append the HTML into the track list.
473   - var list = getList(node);
474   - list.update(list_text);
475   - list.show();
476   -}
477   -
478   -// Determines whether a node should be "on" in the listing.
479   -function isOn(node) {
480   - return (node.select('input[type="checkbox"][name=l]:checked').length > 0)? true : false;
481   -}
482   -
483   -// listText creates the listing text from the elements given.
484   -function listText(elements) {
485   - var truncate_length = 150; // truncate_length is the maximum number of names we'll list. Anything more gets a "..."
486   - var item_wrapper = "span";
487   -
488   - var text_length = 0;
489   - var overflow = false;
490   - var items = new Array;
491   -
492   - var list_text = "&nbsp;(";
493   -
494   - // Each track name is a cell in the table within the section with a checkbox inside of it. Find the name, push it to tracks[].
495   - for (var i = 0; i < elements.length; i++){
496   - if (text_length < truncate_length) {
497   - // Create the item for the list, including the class.
498   - var item_name = getName(elements[i]);
499   - var item = "<" + item_wrapper + " class =\"" + (isOn(elements[i])? "show" : "hide") + "\">";
500   -
501   - //Add the length of the name to the character count. If we're over the count, truncate the name.
502   - text_length += item_name.length;
503   - if (text_length > truncate_length) {
504   - item_name = item_name.substring(0, text_length - truncate_length);
505   -
506   - // If the truncated name ends in a non-letter character (which would look awkward with an ellipsis after it), truncate more until you hit a letter.
507   - var match_string = new RegExp(/[A-Za-z0-9]/);
508   - while (item_name.slice(-1).match(match_string) == null) {
509   - item_name = item_name.slice(0, -1);
510   - }
511   - overflow = true;
512   - }
513   -
514   - item += item_name + "</span>";
515   - items.push(item);
516   - } else {
517   - break;
518   - }
519   - }
520   -
521   - // Loop through the list, adding the name of each track now hidden.
522   - for (var c = 0; c < items.length; c++) {
523   - list_text += items[c];
524   - if (c < (items.length - 1))
525   - list_text += ", ";
526   - }
527   -
528   - if (overflow == true)
529   - list_text += "...";
530   - list_text += ")";
531   -
532   - return list_text;
533   -}
534   -
535   -// containsGroup checks whether a node contains groups (and should look for those when finding children).
536   -function containsGroups(node) {
537   - return (typeof node.down("div.el_visible") != "undefined")? true : false;
538   -}
539   -
540   -// isGroup checks whether a node is a group node or a track node.
541   -function isGroup(node) {
542   - return (node.nodeName == "DIV")? true : false;
543   -}
544   -
545   -// getChildren gets the children nodes of a group.
546   -function getChildren(node) {
547   - var has_groups = containsGroups(node);
548   - // This just applies down("div.el_visible") on the childElements array.
549   - var children = (has_groups == true)? node.down().childElements().collect( function(child) { return child.down("div.el_visible") } ) : node.select('span td');
550   - var nodes = new Array;
551   - // Make sure they're valid groups, not just empty table cells...
552   - for (var i = 0; i < children.length; i++) {
553   - if (((has_groups == true) && children[i].match("div.el_visible")) || ((has_groups == false) && (children[i].select("input[type=checkbox][name=l]").length > 0)))
554   - nodes.push(children[i]);
555   - }
556   - return nodes;
557   -}
558   -
559   -
560   -// getName returns the name of a node, as displayed in the control.
561   -function getName(node) {
562   - if (isGroup(node)) {
563   - return (node.previous("div.ctl_visible"))? node.previous("div.ctl_visible").down("span.tctl > b").innerHTML : node.previous("div").down("div.ctl_visible").down("span.tctl > b").innerHTML;
564   - } else {
565   - //Some of the cell names are wrapped within anchor tags, test if it is or not.
566   - if (node.down("a"))
567   - var track_name = node.down("a").firstChild.nodeValue.stripTags();
568   - else
569   - var track_name = node.down("input").nextSibling.nodeValue.stripTags();
570   - return track_name.replace(/^\s+|\s+$/g,"");;
571   - }
572   -}
573   -
574   -// visibility toggles a node as open or closed.
575   -function visibility (element_name,is_visible) {
576   - var element = $(element_name);
577   - var show_control = $(element_name + "_show");
578   - var hide_control = $(element_name + "_hide");
579   - var title_control = $(element_name + "_title");
580   - var break_element = $(element_name + "_break");
581   - var track_list = $(element_name).up().down("span.list");
582   - if (is_visible == 1) {
583   - element.show();
584   - show_control.hide();
585   - hide_control.show();
586   - if (track_list != null)
587   - track_list.hide();
588   - if (break_element != null)
589   - break_element.hide();
590   - } else {
591   - if (element_name.search("_section") != -1)
592   - summarizeTracks(element);
593   - element.hide();
594   - hide_control.hide();
595   - show_control.show();
596   - if (track_list != null)
597   - track_list.show();
598   - if (break_element != null)
599   - break_element.show();
600   - }
601   - setVisState(element_name, is_visible);
602   - return false;
603   -}
604   -
605   -
606   -
607   -
608   -
609   -
610   -// function to make text toggle when button/link is touched
611   -function swap(me,main,alt) {
612   -me.innerHTML = (me.innerHTML == main) ? alt : main;
613   -}
614   -
615   -function swap_button(me,main,alt) {
616   -me.value = (me.value == main) ? alt : main;
617   -}
618   -//same as updatetitle(below) but will refresh the favorites if the user
619   -//decides to unclick a favorite while it is in show favorites mode
620   -function clearallfav(clear){
621   -
622   -
623   -var e = $(track_listing_id);// all e._____ objects are visual effects
624   -var ministars = getElementsByClassName("toolbarStar");
625   -var i;
626   -clear =1;
627   -
628   -e.hide();
629   -e.setOpacity(0.3);
630   -
631   -
632   -new Ajax.Request(
633   - document.URL, {
634   - method: 'POST',
635   - asynchronous:false,
636   - parameters: {
637   - action: 'clear_favorites',
638   - clear: clear,
639   - }
640   - }
641   - );
642   -
643   -e.show();
644   -
645   -Controller.update_sections(new Array(track_listing_id),'',1,false);
646   - for (i in ministars){
647   - ministars[i].src ="http://localhost/gbrowse2/images/buttons/fmini.png";
648   - }
649   -
650   -};
651   -
652   -
653   -
654   -function refresh(ison){
655   -
656   -
657   -var e = $(track_listing_id);// all e._____ objects are visual effects
658   -
659   -
660   -
661   -e.hide();
662   -e.setOpacity(0.3);
663   -
664   -
665   -new Ajax.Request(
666   - document.URL, {
667   - method: 'POST',
668   - asynchronous:false,
669   - parameters: {
670   - action: 'show_favorites',
671   - show: ison, //sends 0 or 1
672   - clear:0,
673   - }
674   - }
675   - );
676   -
677   -new Ajax.Request(
678   - document.URL, {
679   - method: 'POST',
680   - asynchronous:false,
681   - parameters: {
682   - action: 'clear_favorites',
683   -
684   - clear:0,
685   - }
686   - }
687   - );
688   -
689   -e.show();
690   -
691   -Controller.update_sections(new Array(track_listing_id),'',1,false)
692   -
693   -
694   -
695   -};
696   -//Wrapper function -- will toggle the 'Show All and Show Favorites' texit
697   -//then checks to see whether the favorites should be displayed or if they
698   -//should all be displayed--sends 0 or 1 to the server
699   -//controller.update_sections does the actual updating of the tracks
700   -function updatetitle(me,main,alt,refresh, clear){
701   -
702   -
703   -var e = $(track_listing_id);// all e._____ objects are visual effects
704   -var refreshid = document.getElementById(refresh);
705   -var clearid = document.getElementById(clear);
706   -
707   -swap(me,main,alt);//toggle
708   -
709   -e.hide();
710   -e.setOpacity(0.3);
711   -var ison = (me.innerHTML == main) ? 0 : 1;
712   -refreshid.style.display= (me.innerHTML == main) ? 'none' : 'block';
713   -clearid.style.left=(me.innerHTML == main) ? '350px' : '550px';
714   -clearid.style.bottom=(me.innerHTML == main) ? '30px' : '47px';
715   -new Ajax.Request(
716   - document.URL, {
717   - method: 'POST',
718   - asynchronous:false,
719   - parameters: {
720   - action: 'show_favorites',
721   - show: ison, //sends 0 or 1
722   - }
723   - }
724   - );
725   -
726   -new Ajax.Request(
727   - document.URL, {
728   - method: 'POST',
729   - asynchronous:false,
730   - parameters: {
731   - action: 'clear_favorites',
732   -
733   - clear:0,
734   - }
735   - });
736   -
737   -
738   -e.show();
739   -
740   -Controller.update_sections(new Array(track_listing_id),'',1,false)
741   -
742   -
743   -};
744   -
745   -function collapse(element_name) {
746   - var control = document.getElementById(element_name+"_title");
747   -// var menuitem = document.getElementById("popmenu_"+element_name);
748   - var icon = document.getElementById(element_name+"_icon");
749   - var body = document.getElementById(element_name+"_image");
750   - var pad = document.getElementById(element_name+"_pad");
751   - var closeit = body.style.display != "none";
752   - var src = new String(icon.src);
753   -// var text = new String('');
754   -
755   - if (closeit) {
756   - icon.src = src.replace(/minus/,'plus');
757   -// menuitem.text = text.replace(/Collapse/,'Expand');
758   - body.style.display = 'none';
759   - pad.style.display = 'inline';
760   - control.className = 'titlebar_inactive';
761   -
762   - } else {
763   - icon.src = src.replace(/plus/,'minus');
764   -// menuitem.text = text.replace(/Expand/,'Collapse');
765   - body.style.display = 'inline';
766   - pad.style.display = 'none';
767   - control.className = 'titlebar';
768   -
769   - }
770   -
771   - var direction = closeit ? 'collapse' : 'open';
772   - var postData = 'action=open_collapse_track;'+direction+'='+escape(element_name);
773   - new Ajax.Request(document.URL,{method:'post',postBody:postData});
774   - updateRuler();
775   - return false;
776   -}
777   -
778   -function enable_keypos (checkbox) {
779   - var checked = checkbox.checked;
780   - var ks = document.getElementsByName('ks');
781   - for (var i=0;i<ks.length;i++) {ks[i].disabled= checked}
782   - document.getElementById('ks_label').style.color=checked ? 'lightgray' : 'black';
783   -}
784   -
785   -
786   -
787   -
788   - /*Script for left slide out panel in the Select track page...credit to dhtmlgoodies.com
789   - */
790   -
791   - var panelWidth =250; // Width of help panel
792   - var slideSpeed = 50; // Higher = quicker slide
793   - var slideTimer = 10; // Lower = quicker slide
794   - var slideActive = true; // Slide active ?
795   - var initBodyMargin = 0; // Left or top margin of your <body> tag (left if panel is at the left, top if panel is on the top)
796   - var pushMainContentOnSlide = true; // Push your main content to the right when sliding
797   - var panelPosition = 1; // 0 = left , 1 = top
798   -
799   - /* Don't change these values */
800   - var slideLeftPanelObj=false;
801   - var slideInProgress = false;
802   - var startScrollPos = false;
803   - var panelVisible = false;
804   - function initSlideLeftPanel(expandOnly)
805   - {
806   - if(slideInProgress)return;
807   - if(!slideLeftPanelObj){
808   - if(document.getElementById('dhtmlgoodies_leftPanel')){ // Object exists in HTML code?
809   - slideLeftPanelObj = document.getElementById('dhtmlgoodies_leftPanel');
810   - if(panelPosition == 1)slideLeftPanelObj.style.width = '100%';
811   - }else{ // Object doesn't exist -> Create <div> dynamically
812   - slideLeftPanelObj = document.createElement('DIV');
813   - slideLeftPanelObj.id = 'dhtmlgoodies_leftPanel';
814   - slideLeftPanelObj.style.display='none';
815   - document.body.appendChild(slideLeftPanelObj);
816   - }
817   -
818   - if(panelPosition == 1){
819   - slideLeftPanelObj.style.top = "-" + panelWidth + 'px';
820   - slideLeftPanelObj.style.left = '0px';
821   - slideLeftPanelObj.style.height = panelWidth + 'px';
822   - }else{
823   - slideLeftPanelObj.style.left = "-" + panelWidth + 'px';
824   - slideLeftPanelObj.style.top = '0px';
825   - slideLeftPanelObj.style.width = panelWidth + 'px';
826   - }
827   -
828   -
829   - if(!document.all || navigator.userAgent.indexOf('Opera')>=0)slideLeftPanelObj.style.position = 'fixed';;
830   - }
831   -
832   - if(panelPosition == 0){
833   - if(document.documentElement.clientHeight){
834   - slideLeftPanelObj.style.height = document.documentElement.clientHeight + 'px';
835   - }else if(document.body.clientHeight){
836   - slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
837   - }
838   - var leftPos = slideLeftPanelObj.style.left.replace(/[^0-9\-]/g,'')/1;
839   - }else{
840   - if(document.documentElement.clientWidth){
841   - slideLeftPanelObj.style.width = document.documentElement.clientWidth + 'px';
842   - }else if(document.body.clientHeight){
843   - slideLeftPanelObj.style.width = document.body.clientWidth + 'px';
844   - }
845   - var leftPos = slideLeftPanelObj.style.top.replace(/[^0-9\-]/g,'')/1;
846   -
847   -
848   - }
849   - slideLeftPanelObj.style.display='block';
850   -
851   - if(panelPosition==1)
852   - startScrollPos = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
853   - else
854   - startScrollPos = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
855   - if(leftPos<(0+startScrollPos)){
856   - if(slideActive){
857   - slideLeftPanel(slideSpeed);
858   -
859   - }else{
860   - document.body.style.marginLeft = panelWidth + 'px';
861   - slideLeftPanelObj.style.left = '0px';
862   - }
863   - }else{
864   - if(expandOnly)return;
865   - if(slideActive){
866   - slideLeftPanel(slideSpeed*-1);
867   - }else{
868   - if(panelPosition == 0){
869   - if(pushMainContentOnSlide)document.body.style.marginLeft = initBodyMargin + 'px';
870   - slideLeftPanelObj.style.left = (panelWidth*-1) + 'px';
871   - }else{
872   - if(pushMainContentOnSlide)document.body.style.marginTop = initBodyMargin + 'px';
873   - slideLeftPanelObj.style.top = (panelWidth*-1) + 'px';
874   - }
875   - }
876   - }
877   -
878   - if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0){
879   - window.onscroll = repositionHelpDiv;
880   -
881   - repositionHelpDiv();
882   - }
883   - window.onresize = resizeLeftPanel;
884   -
885   - }
886   -
887   - function resizeLeftPanel()
888   - {
889   - if(panelPosition == 0){
890   - if(document.documentElement.clientHeight){
891   - slideLeftPanelObj.style.height = document.documentElement.clientHeight + 'px';
892   - }else if(document.body.clientHeight){
893   - slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
894   - }
895   - }else{
896   - if(document.documentElement.clientWidth){
897   - slideLeftPanelObj.style.width = document.documentElement.clientWidth + 'px';
898   - }else if(document.body.clientWidth){
899   - slideLeftPanelObj.style.width = document.body.clientWidth + 'px';
900   - }
901   - }
902   - }
903   -
904   - function slideLeftPanel(slideSpeed){
905   - slideInProgress =true;
906   - var scrollValue = 0;
907   - if(panelPosition==1)
908   - var leftPos = slideLeftPanelObj.style.top.replace(/[^0-9\-]/g,'')/1;
909   - else
910   - var leftPos = slideLeftPanelObj.style.left.replace(/[^0-9\-]/g,'')/1;
911   -
912   - leftPos+=slideSpeed;
913   - okToSlide = true;
914   - if(slideSpeed<0){
915   - if(leftPos < ((panelWidth*-1) + startScrollPos)){
916   - leftPos = (panelWidth*-1) + startScrollPos;
917   - okToSlide=false;
918   - }
919   - }
920   - if(slideSpeed>0){
921   - if(leftPos > (0 + startScrollPos)){
922   - leftPos = 0 + startScrollPos;
923   - okToSlide = false;
924   - }
925   - }
926   -
927   -
928   - if(panelPosition==0){
929   - slideLeftPanelObj.style.left = leftPos + startScrollPos + 'px';
930   - if(pushMainContentOnSlide)document.body.style.marginLeft = leftPos - startScrollPos + panelWidth + 'px';
931   - }else{
932   - slideLeftPanelObj.style.top = leftPos + 'px';
933   - if(pushMainContentOnSlide)document.body.style.marginTop = leftPos - startScrollPos + panelWidth + 'px';
934   -
935   - }
936   - if(okToSlide)setTimeout('slideLeftPanel(' + slideSpeed + ')',slideTimer); else {
937   - slideInProgress = false;
938   - if(slideSpeed>0)panelVisible=true; else panelVisible = false;
939   - }
940   -
941   - }
942   -
943   -
944   - function repositionHelpDiv()
945   - {
946   - if(panelPosition==0){
947   - var maxValue = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
948   - slideLeftPanelObj.style.top = maxValue;
949   - }else{
950   - var maxValue = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
951   - slideLeftPanelObj.style.left = maxValue;
952   - var maxTop = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
953   - if(!slideInProgress)slideLeftPanelObj.style.top = (maxTop - (panelVisible?0:panelWidth)) + 'px';
954   - }
955   - }
956   -
957   - function cancelEvent()
958   - {
959   - return false;
960   - }
961   - function keyboardShowLeftPanel()
962   - {
963   - initSlideLeftPanel();
964   - return false;
965   -
966   - }
967   -
968   - function leftPanelKeyboardEvent(e)
969   - {
970   - if(document.all)return;
971   -
972   - if(e.keyCode==112){
973   - initSlideLeftPanel();
974   - return false;
975   - }
976   - }
977   -
978   - function setLeftPanelContent(text)
979   - {
980   - document.getElementById('leftPanelContent').innerHTML = text;
981   - initSlideLeftPanel(true);
982   -
983   - }
984   - if(!document.all)document.documentElement.onkeypress = leftPanelKeyboardEvent;
985   - document.documentElement.onhelp = keyboardShowLeftPanel;
986   -
987   -
988   -//
989   -
990   -
991   -
992   -
993   -
994   -
995   -
996   -
6 lib/Bio/Graphics/Browser2/Render.pm
@@ -842,12 +842,12 @@ sub render_body {
842 842 }
843 843
844 844 my $tracks = $self->render_tracks_section;
845   - my $saved_snapshots = $self->render_saved_snapshots_section;
  845 + my $snapshots = $self->render_snapshots_section;
846 846 my $community = $self->user_tracks->database? $self->render_community_tracks_section : "";
847 847 my $custom = $self->render_custom_tracks_section;
848 848 my $global_config = $self->render_global_config;
849 849
850   - $output .= $self->render_tabbed_pages($main_page,$tracks,$saved_snapshots,$community,$custom,$global_config);
  850 + $output .= $self->render_tabbed_pages($main_page,$tracks,$snapshots,$community,$custom,$global_config);
851 851 $output .= $self->login_manager->render_confirm;
852 852 $output .= $self->render_bottom($features);
853 853
@@ -2641,7 +2641,7 @@ sub asynchronous_update_sections {
2641 2641
2642 2642 # Saved Snapshot Section
2643 2643 if ( $handle_section_name{'snapshots_page'}) {
2644   - $return_object->{'snapshots_page'} = $self->Bio::Graphics::Browser2::Render::SnapshotManager::render_saved_snapshots_listing();
  2644 + $return_object->{'snapshots_page'} = $self->Bio::Graphics::Browser2::Render::SnapshotManager::render_snapshots_listing();
2645 2645 #$return_object->{'snapshots_page'} = $self->render_snapshotTitle();
2646 2646 }
2647 2647
24 lib/Bio/Graphics/Browser2/Render/HTML.pm
@@ -111,14 +111,14 @@ sub render_tabbed_pages {
111 111 div({-id=>'tabbed_menu',-class=>'tabmenu'},
112 112 span({id=>'main_page_select'}, $main_title),
113 113 span({id=>'track_page_select'}, $tracks_title),
114   - span({id=>'saved_snapshots_page_select'}, $snapshot_title),
  114 + span({id=>'snapshots_page_select'}, $snapshot_title),
115 115 $uses_database? span({id=>'community_tracks_page_select'}, $community_tracks_title) : "",
116 116 span({id=>'custom_tracks_page_select'}, $custom_tracks_title),,
117 117 span({id=>'settings_page_select'}, $settings_title)
118 118 ),
119 119 div({-id=>'main_page', -class=>'tabbody'}, $main_html),
120 120 div({-id=>'track_page', -class=>'tabbody'}, $tracks_html),
121   - div({-id=>'saved_snapshots_page', -class=>'tabbody'}, $snapshot_html),
  121 + div({-id=>'snapshots_page', -class=>'tabbody'}, $snapshot_html),
122 122 $uses_database?div({-id=>'community_tracks_page',-class=>'tabbody'}, $community_tracks_html) : "",
123 123 div({-id=>'custom_tracks_page', -class=>'tabbody'}, $custom_tracks_html),
124 124 div({-id=>'settings_page', -class=>'tabbody'}, $settings_html),
@@ -184,7 +184,7 @@ sub render_navbar {
184 184 my $search = $self->setting('no search')
185 185 ? '' : b($self->translate('Landmark')).':'.br().$searchform.$self->examples();
186 186
187   - my $plugin_form = div({-id=>'plugin_form'},$self->plugin_form());
  187 + my $plugin_form = div({-id=>'plugin_form', -style=>'width:380px;float:left;'},$self->plugin_form());
188 188 # *** Checks the state to see if a snapshot is active and assigns it ***
189 189 #my $isSnapshotActive = $settings->{snapshot_active};
190 190 my $source_form = div({-id=>'source_form'},$self->source_form());
@@ -194,8 +194,8 @@ sub render_navbar {
194 194
195 195
196 196 # *** Creates the save session button and assigns it to save_prompt ***
197   - my $saveSessionButton = div({-id=>'unsessionbutton', -style=>"width: 100px; position: relative; top:13px;"},$self->render_select_saveSession());
198   - my $restoreSessionButton = div({-id=>'loadbutton', -style=>"width: 100px; position:relative; left: 130px; bottom: 12px;"},$self->render_select_loadSession());
  197 + my $saveSessionButton = div({-id=>'unsessionbutton', -style=>"width: 100px; position: relative; float:left;"},$self->render_select_saveSession());
  198 + my $restoreSessionButton = div({-id=>'loadbutton', -style=>"width: 100px; position:relative;float:right;"},$self->render_select_loadSession());
199 199 my $saveSessionStyle = "position:fixed;left;width:184px;height:50px;background:whitesmoke;z-index:1; border:2px solid gray;display:none; padding: 5px;";
200 200 my $save_prompt = div({-id => 'save_snapshot',-style=>"$saveSessionStyle"},
201 201 $snapshot_form,
@@ -210,10 +210,12 @@ sub render_navbar {
210 210 -onclick => '$(\'save_snapshot\').hide(); this.style.zIndex = \'0\'',}),
211 211 ),;
212 212
  213 + my $snapshot_options = div({-id => 'snapshot_options', -style => 'width:230px; float:right;'},$saveSessionButton . $save_prompt . $restoreSessionButton);
  214 +
213 215 return $self->toggle('Search',
214 216 div({-class=>'searchbody'},
215   - table({-border=>0,-width=>'100%'},
216   - TR(td({-width=>'50%'},$search),td({-width=>'28%'},$plugin_form), td($saveSessionButton . $save_prompt . $restoreSessionButton)),
  217 + table({-border=>0,-width=>'95%'},
  218 + TR(td({-width=>'50%'},$search),td({-width=>'45%'},$plugin_form . $snapshot_options)),
217 219 TR(td({-align=>'left'},
218 220 $source_form,
219 221 ),
@@ -403,11 +405,9 @@ sub render_html_head {
403 405
404 406 # our own javascript files
405 407 push @scripts,{src=>"$js/$_"}
406   - # *** Using toggle.js for snapshots ***
407 408 #*** Using SnapshotManager for snapshots ***
408 409 foreach qw(
409 410 buttons.js
410   - toggle.js
411 411 trackFavorites.js
412 412 karyotype.js
413 413 rubber.js
@@ -1143,7 +1143,7 @@ my $self = shift;
1143 1143 my $title = 'Load Snapshot';
1144 1144
1145 1145 return button({-name=>$title,
1146   - -onClick => "Controller.select_tab('saved_snapshots_page');",
  1146 + -onClick => "Controller.select_tab('snapshots_page');",
1147 1147 },
1148 1148 );
1149 1149 }
@@ -1199,12 +1199,12 @@ sub render_community_tracks_section {
1199 1199 }
1200 1200
1201 1201 # *** Render select snapshots. ****
1202   -sub render_saved_snapshots_section {
  1202 +sub render_snapshots_section {
1203 1203 my $self = shift;
1204 1204 my $userdata = $self->user_tracks;
1205 1205 my $html = $self->is_admin? h2({-style=>'font-style:italic;background-color:yellow'}, $self->translate('ADMIN_MODE_WARNING')) : "";
1206 1206 # Snapshot page rendering is done in the snapshotmanager.pm file
1207   - $html .= div({-id => "snapshots_page"}, $self->Bio::Graphics::Browser2::Render::SnapshotManager::render_saved_snapshots_listing);
  1207 + $html .= div({-id => "snapshots_page"}, $self->Bio::Graphics::Browser2::Render::SnapshotManager::render_snapshots_listing);
1208 1208 $html = div({-style => 'margin: 1em;'}, $html);
1209 1209 return $html;
1210 1210 }
2  lib/Bio/Graphics/Browser2/Render/SnapshotManager.pm
@@ -22,7 +22,7 @@ use constant DEBUG => 0;
22 22
23 23 use constant HAVE_SVG => eval "require GD::SVG; 1";
24 24
25   -sub render_saved_snapshots_listing{
  25 +sub render_snapshots_listing{
26 26 my $self = shift;
27 27 my $source = $self->data_source->name;
28 28 my $settings = $self->state;

0 comments on commit 09fe240

Please sign in to comment.
Something went wrong with that request. Please try again.