1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/85e8246c95e4/ Changeset: 85e8246c95e4 User: carlfeberhard Date: 2013-09-12 20:06:21 Summary: History API: add route/function to enable setting a current/working history; pack scripts Affected #: 5 files diff -r 8bcdf94c187a717731d714d9e7c64e747966ed36 -r 85e8246c95e4ea02d666d13de2264b00453c2bd6 lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -90,15 +90,13 @@ history_id = id deleted = string_as_bool( deleted ) - # try to load the history, by most_recently_used or the given id try: if history_id == "most_recently_used": - if trans.user and len( trans.user.galaxy_sessions ) > 0: - # Most recent active history for user sessions, not deleted - history = trans.user.galaxy_sessions[0].histories[-1].history - history_id = trans.security.encode_id( history.id ) - else: + if not trans.user or len( trans.user.galaxy_sessions ) <= 0: return None + # Most recent active history for user sessions, not deleted + history = trans.user.galaxy_sessions[0].histories[-1].history + else: history = self.get_history( trans, history_id, check_ownership=False, check_accessible=True, deleted=deleted ) @@ -119,6 +117,41 @@ return history_data @web.expose_api + def set_as_current( self, trans, id, *kwd ): + """ + set_as_current( trans, id, **kwd ) + * POST /api/histories/{id}/set_as_current: + set the history with ``id`` to the user's current history and return details + + :type id: an encoded id string + :param id: the encoded id of the history to query or the string 'most_recently_used' + + :rtype: dictionary + :returns: detailed history information from + :func:`galaxy.web.base.controller.UsesHistoryDatasetAssociationMixin.get_history_dict` + """ + # added as a non-ATOM API call to support the notion of a 'current/working' history + # - unique to the history resource + history_id = id + try: + history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True ) + trans.history = history + history_data = self.get_history_dict( trans, history ) + history_data[ 'contents_url' ] = url_for( 'history_contents', history_id=history_id ) + + except HTTPBadRequest, bad_req: + trans.response.status = 400 + return str( bad_req ) + + except Exception, e: + msg = "Error in history API when switching current history: %s" % ( str( e ) ) + log.exception( e ) + trans.response.status = 500 + return msg + + return history_data + + @web.expose_api def create( self, trans, payload, **kwd ): """ create( trans, payload ) @@ -128,6 +161,8 @@ :type payload: dict :param payload: (optional) dictionary structure containing: * name: the new history's name + * current: if passed, set the new history to be the user's 'current' + history :rtype: dict :returns: element view of new history @@ -142,6 +177,11 @@ item = new_history.to_dict(view='element', value_mapper={'id':trans.security.encode_id}) item['url'] = url_for( 'history', id=item['id'] ) + #TODO: possibly default to True here - but favor explicit for now (and backwards compat) + current = string_as_bool( payload[ 'current' ] ) if 'current' in payload else False + if current: + trans.history = new_history + #TODO: copy own history #TODO: import an importable history #TODO: import from archive diff -r 8bcdf94c187a717731d714d9e7c64e747966ed36 -r 85e8246c95e4ea02d666d13de2264b00453c2bd6 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -159,6 +159,10 @@ #webapp.mapper.connect( 'run_workflow', '/api/workflow/{workflow_id}/library/{library_id}', controller='workflows', action='run', workflow_id=None, library_id=None, conditions=dict(method=["GET"]) ) webapp.mapper.resource( 'search', 'search', path_prefix='/api' ) + # add as a non-ATOM API call to support the notion of a 'current/working' history unique to the history resource + webapp.mapper.connect( "set_as_current", "/api/histories/{id}/set_as_current", + controller="histories", action="set_as_current", conditions=dict( method=["POST"] ) ) + # visualizations registry generic template renderer webapp.add_route( '/visualization/show/:visualization_name', controller='visualization', action='render', visualization_name=None ) diff -r 8bcdf94c187a717731d714d9e7c64e747966ed36 -r 85e8246c95e4ea02d666d13de2264b00453c2bd6 static/scripts/packed/galaxy.frame.js --- a/static/scripts/packed/galaxy.frame.js +++ b/static/scripts/packed/galaxy.frame.js @@ -1,1 +1,1 @@ -define(["utils/galaxy.css","galaxy.master","libs/backbone/backbone-relational"],function(b,c){var a=Backbone.View.extend({el_main:"#everything",options:{frame:{cols:6,rows:3},rows:1000,cell:130,margin:5,scroll:5,top_min:40,frame_max:10},cols:0,top:0,top_max:0,frame_counter:0,frame_counter_id:0,frame_list:[],galaxy_frame_shadow:null,visible:false,active:false,button_active:null,button_load:null,initialize:function(e){var d=this;this.button_active=new c.GalaxyMasterIcon({icon:"fa-icon-th",tooltip:"Enable/Disable Scratchbook",on_click:function(g){d.event_panel_active(g)}});Galaxy.master.append(this.button_active);this.button_load=new c.GalaxyMasterIcon({icon:"fa-icon-eye-open",tooltip:"Show/Hide Scratchbook",on_click:function(g){d.event_panel_load(g)},with_number:true});Galaxy.master.append(this.button_load);b.load_file("static/style/galaxy.frame.css");if(e){this.options=_.defaults(e,this.options)}this.top=this.top_max=this.options.top_min;$(this.el).append(this.frame_template_background());$(this.el).append(this.frame_template_menu());$(this.el_main).append($(this.el));var f="#galaxy-frame-shadow";$(this.el).append(this.frame_template_shadow(f.substring(1)));this.galaxy_frame_shadow={id:f,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};this.frame_resize(this.galaxy_frame_shadow,{width:0,height:0});this.frame_list[f]=this.galaxy_frame_shadow;this.panel_refresh();var d=this;$(window).resize(function(){if(d.visible){d.panel_refresh()}});window.onbeforeunload=function(){if(d.frame_counter>0){return"You opened "+d.frame_counter+" frame(s) which will be lost."}}},event:{type:null,target:null,xy:null},events:{mousemove:"event_frame_mouse_move",mouseup:"event_frame_mouse_up",mouseleave:"event_frame_mouse_up",mousewheel:"event_panel_scroll",DOMMouseScroll:"event_panel_scroll","mousedown .galaxy-frame":"event_frame_mouse_down","mousedown .galaxy-frame-background":"event_panel_load","mousedown .galaxy-frame-scroll-up":"event_panel_scroll_up","mousedown .galaxy-frame-scroll-down":"event_panel_scroll_down","mousedown .f-close":"event_frame_close","mousedown .f-pin":"event_frame_lock"},event_frame_mouse_down:function(d){if(this.event.type!==null){return}if($(d.target).hasClass("f-header")||$(d.target).hasClass("f-title")){this.event.type="drag"}if($(d.target).hasClass("f-resize")){this.event.type="resize"}if(this.event.type===null){return}d.preventDefault();this.event.target=this.event_get_frame(d.target);if(this.event.target.grid_lock){this.event.type=null;return}this.event.xy={x:d.originalEvent.pageX,y:d.originalEvent.pageY};this.frame_drag_start(this.event.target)},event_frame_mouse_move:function(j){if(this.event.type!="drag"&&this.event.type!="resize"){return}var h={x:j.originalEvent.pageX,y:j.originalEvent.pageY};var f={x:h.x-this.event.xy.x,y:h.y-this.event.xy.y};this.event.xy=h;var i=this.frame_screen(this.event.target);if(this.event.type=="resize"){i.width+=f.x;i.height+=f.y;var g=this.options.cell-this.options.margin-1;i.width=Math.max(i.width,g);i.height=Math.max(i.height,g);this.frame_resize(this.event.target,i);i.width=this.to_grid_coord("width",i.width)+1;i.height=this.to_grid_coord("height",i.height)+1;i.width=this.to_pixel_coord("width",i.width);i.height=this.to_pixel_coord("height",i.height);this.frame_resize(this.galaxy_frame_shadow,i);this.frame_insert(this.galaxy_frame_shadow,{top:this.to_grid_coord("top",i.top),left:this.to_grid_coord("left",i.left)})}if(this.event.type=="drag"){i.left+=f.x;i.top+=f.y;this.frame_offset(this.event.target,i);var d={top:this.to_grid_coord("top",i.top),left:this.to_grid_coord("left",i.left)};if(d.left!==0){d.left++}this.frame_insert(this.galaxy_frame_shadow,d)}},event_frame_mouse_up:function(d){if(this.event.type!="drag"&&this.event.type!="resize"){return}this.frame_drag_stop(this.event.target);this.event.type=null},event_frame_close:function(f){if(this.event.type!==null){return}f.preventDefault();var g=this.event_get_frame(f.target);var d=this;$(g.id).fadeOut("fast",function(){$(g.id).remove();delete d.frame_list[g.id];d.frame_counter--;d.panel_refresh(true);d.panel_animation_complete();if(d.visible&&d.frame_counter==0){d.panel_show_hide()}})},event_frame_lock:function(d){if(this.event.type!==null){return}d.preventDefault();var f=this.event_get_frame(d.target);if(f.grid_lock){f.grid_lock=false;$(f.id).find(".f-pin").removeClass("galaxy-toggle");$(f.id).find(".f-header").removeClass("f-not-allowed");$(f.id).find(".f-title").removeClass("f-not-allowed");$(f.id).find(".f-resize").show();$(f.id).find(".f-close").show()}else{f.grid_lock=true;$(f.id).find(".f-pin").addClass("galaxy-toggle");$(f.id).find(".f-header").addClass("f-not-allowed");$(f.id).find(".f-title").addClass("f-not-allowed");$(f.id).find(".f-resize").hide();$(f.id).find(".f-close").hide()}},event_panel_load:function(d){if(this.event.type!==null){return}this.panel_show_hide()},event_panel_active:function(d){if(this.event.type!==null){return}this.panel_active_disable()},event_panel_scroll:function(d){if(this.event.type!==null||!this.visible){return}d.preventDefault();var f=d.originalEvent.detail?d.originalEvent.detail:d.originalEvent.wheelDelta/-3;this.panel_scroll(f)},event_panel_scroll_up:function(d){if(this.event.type!==null){return}d.preventDefault();this.panel_scroll(-this.options.scroll)},event_panel_scroll_down:function(d){if(this.event.type!==null){return}d.preventDefault();this.panel_scroll(this.options.scroll)},event_get_frame:function(d){return this.frame_list["#"+$(d).closest(".galaxy-frame").attr("id")]},frame_drag_start:function(e){this.frame_focus(e,true);var d=this.frame_screen(e);this.frame_resize(this.galaxy_frame_shadow,d);this.frame_grid(this.galaxy_frame_shadow,e.grid_location);e.grid_location=null;$(this.galaxy_frame_shadow.id).show();$(".f-cover").show()},frame_drag_stop:function(e){this.frame_focus(e,false);var d=this.frame_screen(this.galaxy_frame_shadow);this.frame_resize(e,d);this.frame_grid(e,this.galaxy_frame_shadow.grid_location,true);this.galaxy_frame_shadow.grid_location=null;$(this.galaxy_frame_shadow.id).hide();$(".f-cover").hide();this.panel_animation_complete()},to_grid_coord:function(f,e){var d=(f=="width"||f=="height")?1:-1;if(f=="top"){e-=this.top}return parseInt((e+d*this.options.margin)/this.options.cell,10)},to_pixel_coord:function(f,h){var d=(f=="width"||f=="height")?1:-1;var e=(h*this.options.cell)-d*this.options.margin;if(f=="top"){e+=this.top}return e},to_grid:function(d){return{top:this.to_grid_coord("top",d.top),left:this.to_grid_coord("left",d.left),width:this.to_grid_coord("width",d.width),height:this.to_grid_coord("height",d.height)}},to_pixel:function(d){return{top:this.to_pixel_coord("top",d.top),left:this.to_pixel_coord("left",d.left),width:this.to_pixel_coord("width",d.width),height:this.to_pixel_coord("height",d.height)}},is_collision:function(f){function d(i,g){return !(i.left>g.left+g.width-1||i.left+i.width-1<g.left||i.top>g.top+g.height-1||i.top+i.height-1<g.top)}for(var e in this.frame_list){var h=this.frame_list[e];if(h.grid_location===null){continue}if(d(f,h.grid_location)){return true}}return false},location_rank:function(d){return(d.top*this.cols)+d.left},menu_refresh:function(){this.button_load.number(this.frame_counter);if(this.frame_counter==0){this.button_load.hide()}else{this.button_load.show()}if(this.top==this.options.top_min){$(".galaxy-frame-scroll-up").hide()}else{$(".galaxy-frame-scroll-up").show()}if(this.top==this.top_max){$(".galaxy-frame-scroll-down").hide()}else{$(".galaxy-frame-scroll-down").show()}},panel_animation_complete:function(){var d=this;$(".galaxy-frame").promise().done(function(){d.panel_scroll(0,true)})},panel_refresh:function(d){this.cols=parseInt($(window).width()/this.options.cell,10)+1;this.frame_insert(null,null,d)},panel_scroll:function(j,d){var f=this.top-this.options.scroll*j;f=Math.max(f,this.top_max);f=Math.min(f,this.options.top_min);if(this.top!=f){for(var e in this.frame_list){var h=this.frame_list[e];if(h.grid_location!==null){var g={top:h.screen_location.top-(this.top-f),left:h.screen_location.left};this.frame_offset(h,g,d)}}this.top=f}this.menu_refresh()},panel_show_hide:function(){if(this.visible){this.visible=false;$(".galaxy-frame").fadeOut("fast");this.button_load.icon("fa-icon-eye-close");this.button_load.untoggle();$(".galaxy-frame-background").hide();$(".galaxy-frame-menu").hide()}else{this.visible=true;$(".galaxy-frame").fadeIn("fast");this.button_load.icon("fa-icon-eye-open");this.button_load.toggle();$(this.galaxy_frame_shadow.id).hide();$(".galaxy-frame-background").show();this.panel_refresh()}},panel_active_disable:function(){if(this.active){this.active=false;this.button_active.untoggle();if(this.visible){this.panel_show_hide()}}else{this.active=true;this.button_active.toggle()}},frame_new:function(e){if(!this.active){if(e.location=="center"){var d=$(window.parent.document).find("iframe#galaxy_main");d.attr("src",e.content)}else{window.location=e.content}return}if(this.frame_counter>this.options.frame_max){alert("You have reached the maximum number of allowed frames ("+this.options.frame_max+").");return}var f="#galaxy-frame-"+(this.frame_counter_id++);if($(f).length!==0){alert("This frame already exists. This page might contain multiple frame managers.");return}this.top=this.options.top_min;$(this.el).append(this.frame_template(f.substring(1),e.title,e.type,e.content));var g={id:f,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};e.width=this.to_pixel_coord("width",this.options.frame.cols);e.height=this.to_pixel_coord("height",this.options.frame.rows);this.frame_list[f]=g;this.frame_counter++;this.frame_resize(g,{width:e.width,height:e.height});this.frame_insert(g,{top:0,left:0},true);if(!this.visible){this.panel_show_hide()}},frame_insert:function(k,d,g){var e=[];if(k){k.grid_location=null;e.push([k,this.location_rank(d)])}var h=null;for(h in this.frame_list){var j=this.frame_list[h];if(j.grid_location!==null&&!j.grid_lock){j.grid_location=null;e.push([j,j.grid_rank])}}e.sort(function(l,f){var n=l[1];var m=f[1];return n<m?-1:(n>m?1:0)});for(h=0;h<e.length;h++){this.frame_place(e[h][0],g)}this.top_max=0;for(var h in this.frame_list){var k=this.frame_list[h];if(k.grid_location!==null){this.top_max=Math.max(this.top_max,k.grid_location.top+k.grid_location.height)}}this.top_max=$(window).height()-this.top_max*this.options.cell-2*this.options.margin;this.top_max=Math.min(this.top_max,this.options.top_min);this.menu_refresh()},frame_place:function(l,e){l.grid_location=null;var k=this.to_grid(this.frame_screen(l));var d=false;for(var h=0;h<this.options.rows;h++){for(var f=0;f<Math.max(1,this.cols-k.width);f++){k.top=h;k.left=f;if(!this.is_collision(k)){d=true;break}}if(d){break}}if(d){this.frame_grid(l,k,e)}else{console.log("Grid dimensions exceeded.")}},frame_focus:function(f,d){var e=parseInt(b.get_attribute("galaxy-frame","z-index"))+(d?1:0);$(f.id).css("z-index",e)},frame_offset:function(g,f,e){g.screen_location.left=f.left;g.screen_location.top=f.top;if(e){this.frame_focus(g,true);var d=this;$(g.id).animate({top:f.top,left:f.left},"fast",function(){d.frame_focus(g,false)})}else{$(g.id).css({top:f.top,left:f.left})}},frame_resize:function(e,d){$(e.id).css({width:d.width,height:d.height});e.screen_location.width=d.width;e.screen_location.height=d.height},frame_grid:function(f,d,e){f.grid_location=d;this.frame_offset(f,this.to_pixel(d),e);f.grid_rank=this.location_rank(d)},frame_screen:function(e){var d=e.screen_location;return{top:d.top,left:d.left,width:d.width,height:d.height}},frame_template:function(g,f,d,e){if(!f){f=""}if(d=="url"){e='<iframe scrolling="auto" class="f-iframe" src="'+e+'"></iframe>'}return'<div id="'+g+'" class="galaxy-frame galaxy-corner"><div class="f-header galaxy-corner"><span class="f-title">'+f+'</span><span class="f-icon f-pin fa-icon-pushpin"></span><span class="f-icon f-close fa-icon-trash"></span></div><div class="f-content galaxy-corner">'+e+'<div class="f-cover"></div></div><span class="f-resize f-icon galaxy-corner fa-icon-resize-full"></span></div>'},frame_template_shadow:function(d){return'<div id="'+d+'" class="galaxy-frame-shadow galaxy-corner"></div>'},frame_template_background:function(){return'<div class="galaxy-frame-background"></div>'},frame_template_header:function(){return'<div class="galaxy-frame-load f-corner"><div class="number f-corner">0</div><div class="icon fa-icon-2x"></div></div><div class="galaxy-frame-active f-corner"><div class="icon fa-icon-2x fa-icon-th"></div></div>'},frame_template_menu:function(){return'<div class="galaxy-frame-scroll-up galaxy-frame-menu fa-icon-chevron-up fa-icon-2x"></div><div class="galaxy-frame-scroll-down galaxy-frame-menu fa-icon-chevron-down fa-icon-2x"></div>'}});return{GalaxyFrameManager:a}}); \ No newline at end of file +define(["utils/galaxy.css","galaxy.master","libs/backbone/backbone-relational"],function(b,c){var a=Backbone.View.extend({el_main:"#everything",options:{frame:{cols:6,rows:3},rows:1000,cell:130,margin:5,scroll:5,top_min:40,frame_max:9},cols:0,top:0,top_max:0,frame_counter:0,frame_counter_id:0,frame_list:[],galaxy_frame_shadow:null,visible:false,active:false,button_active:null,button_load:null,initialize:function(e){var d=this;this.button_active=new c.GalaxyMasterIcon({icon:"fa-icon-th",tooltip:"Enable/Disable Scratchbook",on_click:function(g){d.event_panel_active(g)}});Galaxy.master.append(this.button_active);this.button_load=new c.GalaxyMasterIcon({icon:"fa-icon-eye-open",tooltip:"Show/Hide Scratchbook",on_click:function(g){d.event_panel_load(g)},with_number:true});Galaxy.master.append(this.button_load);b.load_file("static/style/galaxy.frame.css");if(e){this.options=_.defaults(e,this.options)}this.top=this.top_max=this.options.top_min;$(this.el).append(this.frame_template_background());$(this.el).append(this.frame_template_menu());$(this.el_main).append($(this.el));var f="#galaxy-frame-shadow";$(this.el).append(this.frame_template_shadow(f.substring(1)));this.galaxy_frame_shadow={id:f,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};this.frame_resize(this.galaxy_frame_shadow,{width:0,height:0});this.frame_list[f]=this.galaxy_frame_shadow;this.panel_refresh();var d=this;$(window).resize(function(){if(d.visible){d.panel_refresh()}});window.onbeforeunload=function(){if(d.frame_counter>0){return"You opened "+d.frame_counter+" frame(s) which will be lost."}}},event:{type:null,target:null,xy:null},events:{mousemove:"event_frame_mouse_move",mouseup:"event_frame_mouse_up",mouseleave:"event_frame_mouse_up",mousewheel:"event_panel_scroll",DOMMouseScroll:"event_panel_scroll","mousedown .galaxy-frame":"event_frame_mouse_down","mousedown .galaxy-frame-background":"event_panel_load","mousedown .galaxy-frame-scroll-up":"event_panel_scroll_up","mousedown .galaxy-frame-scroll-down":"event_panel_scroll_down","mousedown .f-close":"event_frame_close","mousedown .f-pin":"event_frame_lock"},event_frame_mouse_down:function(d){if(this.event.type!==null){return}if($(d.target).hasClass("f-header")||$(d.target).hasClass("f-title")){this.event.type="drag"}if($(d.target).hasClass("f-resize")){this.event.type="resize"}if(this.event.type===null){return}d.preventDefault();this.event.target=this.event_get_frame(d.target);if(this.event.target.grid_lock){this.event.type=null;return}this.event.xy={x:d.originalEvent.pageX,y:d.originalEvent.pageY};this.frame_drag_start(this.event.target)},event_frame_mouse_move:function(j){if(this.event.type!="drag"&&this.event.type!="resize"){return}var h={x:j.originalEvent.pageX,y:j.originalEvent.pageY};var f={x:h.x-this.event.xy.x,y:h.y-this.event.xy.y};this.event.xy=h;var i=this.frame_screen(this.event.target);if(this.event.type=="resize"){i.width+=f.x;i.height+=f.y;var g=this.options.cell-this.options.margin-1;i.width=Math.max(i.width,g);i.height=Math.max(i.height,g);this.frame_resize(this.event.target,i);i.width=this.to_grid_coord("width",i.width)+1;i.height=this.to_grid_coord("height",i.height)+1;i.width=this.to_pixel_coord("width",i.width);i.height=this.to_pixel_coord("height",i.height);this.frame_resize(this.galaxy_frame_shadow,i);this.frame_insert(this.galaxy_frame_shadow,{top:this.to_grid_coord("top",i.top),left:this.to_grid_coord("left",i.left)})}if(this.event.type=="drag"){i.left+=f.x;i.top+=f.y;this.frame_offset(this.event.target,i);var d={top:this.to_grid_coord("top",i.top),left:this.to_grid_coord("left",i.left)};if(d.left!==0){d.left++}this.frame_insert(this.galaxy_frame_shadow,d)}},event_frame_mouse_up:function(d){if(this.event.type!="drag"&&this.event.type!="resize"){return}this.frame_drag_stop(this.event.target);this.event.type=null},event_frame_close:function(f){if(this.event.type!==null){return}f.preventDefault();var g=this.event_get_frame(f.target);var d=this;$(g.id).fadeOut("fast",function(){$(g.id).remove();delete d.frame_list[g.id];d.frame_counter--;d.panel_refresh(true);d.panel_animation_complete();if(d.visible&&d.frame_counter==0){d.panel_show_hide()}})},event_frame_lock:function(d){if(this.event.type!==null){return}d.preventDefault();var f=this.event_get_frame(d.target);if(f.grid_lock){f.grid_lock=false;$(f.id).find(".f-pin").removeClass("galaxy-toggle");$(f.id).find(".f-header").removeClass("f-not-allowed");$(f.id).find(".f-title").removeClass("f-not-allowed");$(f.id).find(".f-resize").show();$(f.id).find(".f-close").show()}else{f.grid_lock=true;$(f.id).find(".f-pin").addClass("galaxy-toggle");$(f.id).find(".f-header").addClass("f-not-allowed");$(f.id).find(".f-title").addClass("f-not-allowed");$(f.id).find(".f-resize").hide();$(f.id).find(".f-close").hide()}},event_panel_load:function(d){if(this.event.type!==null){return}this.panel_show_hide()},event_panel_active:function(d){if(this.event.type!==null){return}this.panel_active_disable()},event_panel_scroll:function(d){if(this.event.type!==null||!this.visible){return}d.preventDefault();var f=d.originalEvent.detail?d.originalEvent.detail:d.originalEvent.wheelDelta/-3;this.panel_scroll(f)},event_panel_scroll_up:function(d){if(this.event.type!==null){return}d.preventDefault();this.panel_scroll(-this.options.scroll)},event_panel_scroll_down:function(d){if(this.event.type!==null){return}d.preventDefault();this.panel_scroll(this.options.scroll)},event_get_frame:function(d){return this.frame_list["#"+$(d).closest(".galaxy-frame").attr("id")]},frame_drag_start:function(e){this.frame_focus(e,true);var d=this.frame_screen(e);this.frame_resize(this.galaxy_frame_shadow,d);this.frame_grid(this.galaxy_frame_shadow,e.grid_location);e.grid_location=null;$(this.galaxy_frame_shadow.id).show();$(".f-cover").show()},frame_drag_stop:function(e){this.frame_focus(e,false);var d=this.frame_screen(this.galaxy_frame_shadow);this.frame_resize(e,d);this.frame_grid(e,this.galaxy_frame_shadow.grid_location,true);this.galaxy_frame_shadow.grid_location=null;$(this.galaxy_frame_shadow.id).hide();$(".f-cover").hide();this.panel_animation_complete()},to_grid_coord:function(f,e){var d=(f=="width"||f=="height")?1:-1;if(f=="top"){e-=this.top}return parseInt((e+d*this.options.margin)/this.options.cell,10)},to_pixel_coord:function(f,h){var d=(f=="width"||f=="height")?1:-1;var e=(h*this.options.cell)-d*this.options.margin;if(f=="top"){e+=this.top}return e},to_grid:function(d){return{top:this.to_grid_coord("top",d.top),left:this.to_grid_coord("left",d.left),width:this.to_grid_coord("width",d.width),height:this.to_grid_coord("height",d.height)}},to_pixel:function(d){return{top:this.to_pixel_coord("top",d.top),left:this.to_pixel_coord("left",d.left),width:this.to_pixel_coord("width",d.width),height:this.to_pixel_coord("height",d.height)}},is_collision:function(f){function d(i,g){return !(i.left>g.left+g.width-1||i.left+i.width-1<g.left||i.top>g.top+g.height-1||i.top+i.height-1<g.top)}for(var e in this.frame_list){var h=this.frame_list[e];if(h.grid_location===null){continue}if(d(f,h.grid_location)){return true}}return false},location_rank:function(d){return(d.top*this.cols)+d.left},menu_refresh:function(){this.button_load.number(this.frame_counter);if(this.frame_counter==0){this.button_load.hide()}else{this.button_load.show()}if(this.top==this.options.top_min){$(".galaxy-frame-scroll-up").hide()}else{$(".galaxy-frame-scroll-up").show()}if(this.top==this.top_max){$(".galaxy-frame-scroll-down").hide()}else{$(".galaxy-frame-scroll-down").show()}},panel_animation_complete:function(){var d=this;$(".galaxy-frame").promise().done(function(){d.panel_scroll(0,true)})},panel_refresh:function(d){this.cols=parseInt($(window).width()/this.options.cell,10)+1;this.frame_insert(null,null,d)},panel_scroll:function(j,d){var f=this.top-this.options.scroll*j;f=Math.max(f,this.top_max);f=Math.min(f,this.options.top_min);if(this.top!=f){for(var e in this.frame_list){var h=this.frame_list[e];if(h.grid_location!==null){var g={top:h.screen_location.top-(this.top-f),left:h.screen_location.left};this.frame_offset(h,g,d)}}this.top=f}this.menu_refresh()},panel_show_hide:function(){if(this.visible){this.visible=false;$(".galaxy-frame").fadeOut("fast");this.button_load.icon("fa-icon-eye-close");this.button_load.untoggle();$(".galaxy-frame-background").hide();$(".galaxy-frame-menu").hide()}else{this.visible=true;$(".galaxy-frame").fadeIn("fast");this.button_load.icon("fa-icon-eye-open");this.button_load.toggle();$(this.galaxy_frame_shadow.id).hide();$(".galaxy-frame-background").show();this.panel_refresh()}},panel_active_disable:function(){if(this.active){this.active=false;this.button_active.untoggle();if(this.visible){this.panel_show_hide()}}else{this.active=true;this.button_active.toggle()}},frame_new:function(e){if(!this.active){if(e.location=="center"){var d=$(window.parent.document).find("iframe#galaxy_main");d.attr("src",e.content)}else{window.location=e.content}return}if(this.frame_counter>=this.options.frame_max){alert("You have reached the maximum number of allowed frames ("+this.options.frame_max+").");return}var f="#galaxy-frame-"+(this.frame_counter_id++);if($(f).length!==0){alert("This frame already exists. This page might contain multiple frame managers.");return}this.top=this.options.top_min;$(this.el).append(this.frame_template(f.substring(1),e.title,e.type,e.content));var g={id:f,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};e.width=this.to_pixel_coord("width",this.options.frame.cols);e.height=this.to_pixel_coord("height",this.options.frame.rows);this.frame_list[f]=g;this.frame_counter++;this.frame_resize(g,{width:e.width,height:e.height});this.frame_insert(g,{top:0,left:0},true);if(!this.visible){this.panel_show_hide()}},frame_insert:function(k,d,g){var e=[];if(k){k.grid_location=null;e.push([k,this.location_rank(d)])}var h=null;for(h in this.frame_list){var j=this.frame_list[h];if(j.grid_location!==null&&!j.grid_lock){j.grid_location=null;e.push([j,j.grid_rank])}}e.sort(function(l,f){var n=l[1];var m=f[1];return n<m?-1:(n>m?1:0)});for(h=0;h<e.length;h++){this.frame_place(e[h][0],g)}this.top_max=0;for(var h in this.frame_list){var k=this.frame_list[h];if(k.grid_location!==null){this.top_max=Math.max(this.top_max,k.grid_location.top+k.grid_location.height)}}this.top_max=$(window).height()-this.top_max*this.options.cell-2*this.options.margin;this.top_max=Math.min(this.top_max,this.options.top_min);this.menu_refresh()},frame_place:function(l,e){l.grid_location=null;var k=this.to_grid(this.frame_screen(l));var d=false;for(var h=0;h<this.options.rows;h++){for(var f=0;f<Math.max(1,this.cols-k.width);f++){k.top=h;k.left=f;if(!this.is_collision(k)){d=true;break}}if(d){break}}if(d){this.frame_grid(l,k,e)}else{console.log("Grid dimensions exceeded.")}},frame_focus:function(f,d){var e=parseInt(b.get_attribute("galaxy-frame","z-index"))+(d?1:0);$(f.id).css("z-index",e)},frame_offset:function(g,f,e){g.screen_location.left=f.left;g.screen_location.top=f.top;if(e){this.frame_focus(g,true);var d=this;$(g.id).animate({top:f.top,left:f.left},"fast",function(){d.frame_focus(g,false)})}else{$(g.id).css({top:f.top,left:f.left})}},frame_resize:function(e,d){$(e.id).css({width:d.width,height:d.height});e.screen_location.width=d.width;e.screen_location.height=d.height},frame_grid:function(f,d,e){f.grid_location=d;this.frame_offset(f,this.to_pixel(d),e);f.grid_rank=this.location_rank(d)},frame_screen:function(e){var d=e.screen_location;return{top:d.top,left:d.left,width:d.width,height:d.height}},frame_template:function(g,f,d,e){if(!f){f=""}if(d=="url"){e='<iframe scrolling="auto" class="f-iframe" src="'+e+'"></iframe>'}return'<div id="'+g+'" class="galaxy-frame galaxy-corner"><div class="f-header galaxy-corner"><span class="f-title">'+f+'</span><span class="f-icon f-pin fa-icon-pushpin"></span><span class="f-icon f-close fa-icon-trash"></span></div><div class="f-content galaxy-corner">'+e+'<div class="f-cover"></div></div><span class="f-resize f-icon galaxy-corner fa-icon-resize-full"></span></div>'},frame_template_shadow:function(d){return'<div id="'+d+'" class="galaxy-frame-shadow galaxy-corner"></div>'},frame_template_background:function(){return'<div class="galaxy-frame-background"></div>'},frame_template_header:function(){return'<div class="galaxy-frame-load f-corner"><div class="number f-corner">0</div><div class="icon fa-icon-2x"></div></div><div class="galaxy-frame-active f-corner"><div class="icon fa-icon-2x fa-icon-th"></div></div>'},frame_template_menu:function(){return'<div class="galaxy-frame-scroll-up galaxy-frame-menu fa-icon-chevron-up fa-icon-2x"></div><div class="galaxy-frame-scroll-down galaxy-frame-menu fa-icon-chevron-down fa-icon-2x"></div>'}});return{GalaxyFrameManager:a}}); \ No newline at end of file diff -r 8bcdf94c187a717731d714d9e7c64e747966ed36 -r 85e8246c95e4ea02d666d13de2264b00453c2bd6 static/scripts/packed/galaxy.master.js --- a/static/scripts/packed/galaxy.master.js +++ b/static/scripts/packed/galaxy.master.js @@ -1,1 +1,1 @@ -define(["utils/galaxy.css","libs/backbone/backbone-relational"],function(b){var a=Backbone.View.extend({el_master:".masthead-inner",initialize:function(d){b.load_file("static/style/galaxy.master.css");this.setElement($(this.template()));$(this.el_master).append($(this.el))},events:{mousedown:function(d){d.preventDefault()}},append:function(d){$(this.el).append($(d.el))},prepend:function(d){$(this.el).prepend($(d.el))},template:function(){return'<div id="galaxy-master" class="galaxy-master"></div>'}});var c=Backbone.View.extend({options:{id:"galaxy-icon",icon:"fa-icon-cog",tooltip:"galaxy-icon",with_number:false,on_click:function(){alert("clicked")},visible:true},initialize:function(e){if(e){this.options=_.defaults(e,this.options)}this.setElement($(this.template(this.options)));var d=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip}).on("click",d.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(d){$(this.el).find(".icon").removeClass(this.options.icon).addClass(d);this.options.icon=d},toggle:function(){$(this.el).addClass("galaxy-toggle")},untoggle:function(){$(this.el).removeClass("galaxy-toggle")},number:function(d){$(this.el).find(".number").text(d)},template:function(e){var d="<div id="+e.id+' class="galaxy-icon galaxy-corner"><div class="icon fa-icon-2x '+e.icon+'"></div>';if(e.with_number){d+='<div class="number galaxy-corner"></div>'}d+="</div>";return d}});return{GalaxyMaster:a,GalaxyMasterIcon:c}}); \ No newline at end of file +define(["libs/backbone/backbone-relational"],function(){var a=Backbone.View.extend({el_master:"#masthead",initialize:function(c){this.setElement($(this.template()));$(this.el_master).append($(this.el))},events:{mousedown:function(c){c.preventDefault()}},append:function(c){$(this.el).append($(c.el))},prepend:function(c){$(this.el).prepend($(c.el))},template:function(){return'<div class="iconbar"></div>'}});var b=Backbone.View.extend({options:{id:"galaxy-icon",icon:"fa-icon-cog",tooltip:"galaxy-icon",with_number:false,on_click:function(){alert("clicked")},visible:true},initialize:function(d){if(d){this.options=_.defaults(d,this.options)}this.setElement($(this.template(this.options)));var c=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip}).on("click",c.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(c){$(this.el).find(".icon").removeClass(this.options.icon).addClass(c);this.options.icon=c},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(c){$(this.el).find(".number").text(c)},template:function(d){var c="<div id="+d.id+' class="symbol"><div class="icon fa-icon-2x '+d.icon+'"></div>';if(d.with_number){c+='<div class="number"></div>'}c+="</div>";return c}});return{GalaxyMaster:a,GalaxyMasterIcon:b}}); \ No newline at end of file diff -r 8bcdf94c187a717731d714d9e7c64e747966ed36 -r 85e8246c95e4ea02d666d13de2264b00453c2bd6 static/scripts/packed/galaxy.modal.js --- a/static/scripts/packed/galaxy.modal.js +++ b/static/scripts/packed/galaxy.modal.js @@ -1,1 +1,1 @@ -define(["utils/galaxy.css","libs/backbone/backbone-relational"],function(a){var b=Backbone.View.extend({el_main:"#everything",options:{title:"galaxy-modal",body:"No content available."},initialize:function(d){if(!d){d=this.options}else{d=_.defaults(d,this.options)}this.setElement(this.template(d.title,d.body));$(this.el_main).append($(this.el));var e=(this.$el).find(".footer");var c=this;if(d.buttons){$.each(d.buttons,function(f,g){e.append($("<button></button>").text(f).click(g)).append(" ")})}else{e.append($("<button></button>").text("Close").click(function(){c.hide()})).append(" ")}$(this.el).hide()},events:{"mousedown .dialog":"event_default","mousedown .background":"hide"},event_default:function(c){c.preventDefault()},show:function(){this.$el.fadeIn("fast")},hide:function(){this.$el.fadeOut("fast")},destroy:function(){this.$el.remove()},template:function(d,c){return'<div class="modal"><div class="modal-backdrop"></div><div class="modal-dialog galaxy-corner"><div class="modal-content"><div class="header"><span><h3 class="title">'+d+'</h3></span></div><div class="body">'+c+'</div><div class="footer"></div></div</div></div>'}});return{GalaxyModal:b}}); \ No newline at end of file +define(["libs/backbone/backbone-relational"],function(){var a=Backbone.View.extend({el_main:"#everything",options:{title:"galaxy-modal",body:"No content available."},initialize:function(b){if(b){this.create(b);$(this.el).hide()}},show:function(b){if(b){this.create(b)}this.$el.fadeIn("fast")},hide:function(){this.$el.fadeOut("fast")},create:function(c){this.$el.remove();if(!c){c=this.options}else{c=_.defaults(c,this.options)}this.setElement(this.template(c.title,c.body));$(this.el_main).append($(this.el));var d=(this.$el).find(".footer");var b=this;if(c.buttons){$.each(c.buttons,function(e,f){d.append($("<button></button>").text(e).click(f)).append(" ")})}else{d.append($("<button></button>").text("Close").click(function(){b.hide()})).append(" ")}},template:function(c,b){return'<div class="modal"><div class="modal-backdrop"></div><div class="modal-dialog galaxy-corner"><div class="modal-content"><div class="header"><span><h3 class="title">'+c+'</h3></span></div><div class="body">'+b+'</div><div class="footer"></div></div</div></div>'}});return{GalaxyModal:a}}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.