diff --git a/.gitignore b/.gitignore index 8d7246e..380a0c7 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ build.sh .DS_Store de.walware.r.core.prefs +*.sublime-* diff --git a/Nozzle.R1/DESCRIPTION b/Nozzle.R1/DESCRIPTION index f0f6702..d934cf3 100644 --- a/Nozzle.R1/DESCRIPTION +++ b/Nozzle.R1/DESCRIPTION @@ -1,8 +1,8 @@ Package: Nozzle.R1 Type: Package Title: Nozzle Reports -Version: 1.3-0 -Date: 2012-06-23 +Version: 1.4-0 +Date: 2014-07-25 Author: Nils Gehlenborg Maintainer: Nils Gehlenborg Description: The Nozzle package provides an API to generate HTML reports with diff --git a/Nozzle.R1/NEWS b/Nozzle.R1/NEWS index 872172b..98c69f9 100644 --- a/Nozzle.R1/NEWS +++ b/Nozzle.R1/NEWS @@ -1,3 +1,10 @@ +Release R1-1.4-0 / 25 June 2014 + +- User-defined default expansion for sections and subsections is now supported + by the newSection() and newSubSection() parameter 'expanded'. + +----------------- + Release R1-1.3-0 / 23 June 2013 - Added support to add and display of "related reports", e.g. the reports that diff --git a/Nozzle.R1/R/nozzle.R b/Nozzle.R1/R/nozzle.R index 123b08c..92d4103 100644 --- a/Nozzle.R1/R/nozzle.R +++ b/Nozzle.R1/R/nozzle.R @@ -4,7 +4,7 @@ # Harvard Medical School, Center for Biomedical Informatics # Broad Institute, Cancer Program # -# Copyright (c) 2011-2013. All rights reserved. +# Copyright (c) 2011-2014. All rights reserved. # # TODO: add default state (open/closed) for sections (per default all will be closed in custom reports) @@ -14,8 +14,8 @@ #' \tabular{ll}{ #' Package: \tab Nozzle.R1\cr #' Type: \tab Package\cr -#' Version: \tab 1.3-0\cr -#' Date: \tab 2013-06-23\cr +#' Version: \tab 1.4-0\cr +#' Date: \tab 2014-07-25\cr #' License: \tab LGPL (>= 2)\cr #' LazyLoad: \tab yes\cr #' } @@ -708,16 +708,16 @@ newReport <- function( ..., version=0 ) element <- .newGeneralReport( "Nozzle Report", version=version ); } - overview <- newSection( "Overview" ); + overview <- newSection( "Overview", expanded=TRUE ); overview$domId <- "overview"; introduction <- newSubSection( "Introduction" ); introduction$domId <- "introduction"; - summary <- newSubSection( "Summary" ); + summary <- newSubSection( "Summary", expanded=TRUE ); summary$domId <- "summary"; - results <- newSection( "Results", class="results" ); + results <- newSection( "Results", class="results", expanded=TRUE ); results$domId <- "results"; methods <- newSection( "Methods & Data" ); @@ -2492,12 +2492,17 @@ addToMeta <- function( report, ... ) #' @param class If set to SECTION.CLASS.RESULTS, results can be reported in this section. If set to SECTION.CLASS.META the section will be a meta data section. #' @param exportId Unique string to identify this element. Used to retrieve the element using \code{getExportedElement}. #' @param protection Procection level. One of PROTECTION.PUBLIC, PROTECTION.GROUP, PROTECTION.PRIVATE. +#' @param expanded Whether the section should expanded by default or not. #' @export #' @return New element. #' #' @author Nils Gehlenborg \email{nils@@hms.harvard.edu} -newSection <- function( ..., class="", exportId=NULL, protection=PROTECTION.PUBLIC ) +newSection <- function( ..., class="", exportId=NULL, protection=PROTECTION.PUBLIC, expanded=FALSE ) { + if ( expanded ) { + class <- .concat( class, " visible" ); + } + return ( .newElement( .ELEMENT.SECTION, .concat( ... ), class=class, exportId=exportId, protection=protection ) ); } @@ -2506,13 +2511,20 @@ newSection <- function( ..., class="", exportId=NULL, protection=PROTECTION.PUBL #' @param ... Strings that will be concatenated to form the subsection title. #' @param exportId Unique string to identify this element. Used to retrieve the element using \code{getExportedElement}. #' @param protection Procection level. One of PROTECTION.PUBLIC, PROTECTION.GROUP, PROTECTION.PRIVATE. +#' @param expanded Whether the section should expanded by default or not. This will not affect the state of parent sections. #' @export #' @return New element. #' #' @author Nils Gehlenborg \email{nils@@hms.harvard.edu} -newSubSection <- function( ..., exportId=NULL, protection=PROTECTION.PUBLIC ) +newSubSection <- function( ..., exportId=NULL, protection=PROTECTION.PUBLIC, expanded=FALSE ) { - return ( .newElement( .ELEMENT.SUBSECTION, .concat( ... ), exportId=exportId, protection=protection ) ); + class <- ""; + + if ( expanded ) { + class <- "visible"; + } + + return ( .newElement( .ELEMENT.SUBSECTION, .concat( ... ), class=class, exportId=exportId, protection=protection ) ); } diff --git a/Nozzle.R1/inst/js/nozzle.js b/Nozzle.R1/inst/js/nozzle.js index 9f00e87..a8bcc87 100644 --- a/Nozzle.R1/inst/js/nozzle.js +++ b/Nozzle.R1/inst/js/nozzle.js @@ -1,7 +1,7 @@ /* * Nozzle R Package - JavaScript Library * - * Copyright 2011-2013, Harvard Medical School / Broad Institute + * Copyright 2011-2014, Harvard Medical School / Broad Institute * Authored and maintained by Nils Gehlenborg (nils@hms.harvard.edu) */ @@ -201,7 +201,8 @@ function applyFilePrefixPostfix( prefix, postfix ) ToggleMode = { TOGGLE: 0, SHOW: 1, - HIDE: 2 + HIDE: 2, + INITIALIZE: 3 }; var toggleContents = function( section, animation, mode, target ) @@ -227,6 +228,25 @@ function applyFilePrefixPostfix( prefix, postfix ) switch ( mode ) { + case ToggleMode.INITIALIZE: + if ( section.hasClass( "visible" ) ) + { + console.log( "Showing section ", section ); + body.show(); + if ( summarySignificant !== undefined ) + { + summarySignificant.addClass( "deactivated" ); + } + } + + if ( !section.hasClass( "visible" ) ) + { + body.hide(); + } + + button.text( section.hasClass( "visible" ) ? "-" : "+" ); + button.attr( "title", section.hasClass( "visible" ) ? "Click to collapse" : "Click to expand" ); + break; case ToggleMode.TOGGLE: if ( subSections.length == 1 ) { @@ -291,7 +311,6 @@ function applyFilePrefixPostfix( prefix, postfix ) var sectionheaders = $( "#" + reportId + " .sectionheader" ).not( ".evidence .sectionheader, .subsubsection .sectionheader" ); sectionheaders.prepend( "" + "-" + "" ); - sectionheaders.parent().addClass( "visible" ); var buttons = $( "#" + reportId + " .button.contenttoggle" ); @@ -826,9 +845,9 @@ function reloadStylesheets() { } ); var toggleDefaultState = function( animate ) { - toggleAllContents( animate, ToggleMode.HIDE ); - toggleContents( $( "#overview_" + reportId + ", #summary_" + reportId ), animate ); - toggleContents( $( "#results_" + reportId ), animate ); + toggleAllContents( animate, ToggleMode.INITIALIZE ); + //toggleContents( $( "#overview_" + reportId + ", #summary_" + reportId ), animate ); + //toggleContents( $( "#results_" + reportId ), animate ); }; toggleDefaultState( false ); diff --git a/Nozzle.R1/inst/js/nozzle.min.js b/Nozzle.R1/inst/js/nozzle.min.js index 38531bf..3eecd76 100644 --- a/Nozzle.R1/inst/js/nozzle.min.js +++ b/Nozzle.R1/inst/js/nozzle.min.js @@ -1 +1 @@ -$(window).load(function(){$("#mask").fadeOut()});function initNozzle(b,C){var B=C;var c=25;var u=30;var s=1000;var L=false;var M=0.5;var A=0.5;var U=20;var l=false;var H=null;var d=function(X){return(parseInt(X.css("margin-top"))+parseInt(X.css("margin-bottom")))};var O=function(X){return(parseInt(X.css("padding-top"))+parseInt(X.css("padding-bottom")))};var E=function(X){return(parseInt(X.css("margin-left"))+parseInt(X.css("margin-right")))};var k=function(X){return(parseInt(X.css("padding-left"))+parseInt(X.css("padding-right")))};var R=function(){return B("#"+b+" .frame")};var x=function(){return B("#"+b+" .main")};var q=function(){return B("#"+b)};var o=function(){return B("#"+b+" .menu")};var y=function(){return B(H)};var g=function(){if(!L){return(Math.min(B(window).width()-2*u,s))}else{return(B(window).width()-2*u)}};var a=function(){if(!L){return((B(window).width()-g())/2)}else{return(u)}};B(document).ready(function(){var X=D(true);J(X.prefix,X.postfix);R().css("height",B(window).height()+"px");R().css("width",g()+"px");R().css("left",a()+"px");o().css("height",c);x().css("top",o().outerHeight(true));if(H!=null){x().css("bottom",T());y().css("top",h());w.css("top",h()+"px")}});B(window).resize(function(){R().css("height",B(window).height()+"px");R().css("width",g()+"px");R().css("left",a()+"px");o().css("height",c);x().css("top",o().outerHeight(true));if(H!=null){x().css("bottom",T());y().css("top",h());w.css("top",h()+"px")}});B("#"+b+" .main").scroll(function(){});function D(ab){var aa=[],Z;var X=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var Y=0;Y-');Y.parent().addClass("visible");var X=B("#"+b+" .button.contenttoggle");X.click(function(){v(B(this).parent().parent(),true,ToggleMode.TOGGLE)})};var Q=function(){B(".button.contenttoggle").remove()};var N=function(){if(B("#citation-information").is(":visible")){j()}if(B("#maintainer-information").is(":visible")){B("#maintainer-information").slideUp(200);B("#maintainer-information-toggle").removeClass("active")}else{B("#maintainer-information").slideDown(200);B("#maintainer-information-toggle").addClass("active")}};var j=function(){if(B("#maintainer-information").is(":visible")){N()}if(B("#citation-information").is(":visible")){B("#citation-information").slideUp(200);B("#citation-information-toggle").removeClass("active")}else{B("#citation-information").slideDown(200);B("#citation-information-toggle").addClass("active")}};var m=function(X,Y){var Z=B("#"+b+" .section, #"+b+" .subsection").not("#"+b+" .evidence .section, #"+b+" .evidence .subsection, #"+b+" subsubsection .sectionheader");v(Z,X,Y)};var S=function(){var X=B(".results .sectionheader").not("#"+b+" .evidence .sectionheader, #"+b+" .meta .sectionheader, #"+b+" .subsubsection .sectionheader");X.append('')};var r=function(){if(L){B("#menu_width_state").text("Fixed")}else{B("#menu_width_state").text("Auto")}};var i=function(){var Z='";R().prepend(Z);B("#menu_expand_all").click(function(){m(true,ToggleMode.SHOW)});B("#menu_collapse_all").click(function(){m(true,ToggleMode.HIDE);t()});B("#menu_width").click(function(){L=!L;r();R().animate({width:g()+"px",left:a()+"px"},"slow")});B("#menu_print_view").click(function(){B("#mask").fadeIn();document.getElementById("mask").style.display="block";Q();I();B("#nozzlemenu").remove();B("a.download").remove();p();m(false,ToggleMode.SHOW);G();window.print();window.location.reload(false)});if(nozzleMeta.contact!=null){B("#menu_report_problem").click(function(){var ag=nozzleMeta.contact.subject;var ai=nozzleMeta.contact.message;var af=nozzleMeta.contact.email;var ac=navigator.userAgent;var aa=window.location.href;var ad="Not detected.";if(window.screen){ad="Current Dimensions: "+B(window).width()+" x "+B(window).height()+"%0A";ad+="Maximum Dimensions: "+screen.availWidth+" x "+screen.availHeight+"%0A";ad+="Color Depth: "+screen.colorDepth}var ah="NA";var ab="NA";if(nozzleMeta.software!=undefined){ah=nozzleMeta.software.name;ab=nozzleMeta.software.version}var ae=ai+"%0A%0A%0A%0A== REPORT ======================%0A%0AURL: "+aa+"%0ATitle: "+nozzleMeta.reportTitle+"%0AId: "+nozzleMeta.reportId+"%0ACreator: "+nozzleMeta.creator.name+"%0ACreation Date: "+nozzleMeta.creator.date+"%0ARenderer: "+nozzleMeta.renderer.name+"%0ARender Date: "+nozzleMeta.renderer.date+"%0AGoogle Analytics: "+nozzleMeta.googleAnalyticsId+"%0A%0A%0A== SOFTWARE ====================%0A%0AName: "+ah+"%0AVersion: "+ab+"%0A%0A%0A== MAINTAINER ==================%0A%0AName: "+nozzleMeta.maintainer.name+"%0AAffiliation: "+nozzleMeta.maintainer.affiliation+"%0AEmail: "+nozzleMeta.maintainer.email+"%0A%0A%0A== SYSTEM ======================%0A%0ASystem Time: "+(new Date())+"%0AUser Agent: "+ac+"%0A"+ad+"%0A%0A";window.location="mailto:"+af+"?subject="+ag+"&body="+ae})}r()};var G=function(){var X=1;B(".evidence").each(function(Z){var Y=B(this).attr("id").split("_")[1];B("#resultid_"+Y+"_"+b).after(' '+X+"");B(this).prepend(''+X+" - Supplementary Result");B(this).insertBefore(".copyright");B(this).show();X++})};function W(){var X="?reload="+new Date().getTime();B('link[rel="stylesheet"]').each(function(){this.href=this.href.replace(/\?.*|$/,X)})}var K=function(){var Y=B("#"+b+" .evidence");Y.prepend('×');Y.addClass("visible");var X=B("#"+b+" .evidence .button.evidencetoggle");X.click(function(){v(y(),false,ToggleMode.HIDE,".evidence");w.appendTo(B(H));var Z=y().attr("id").split("_")[1];B("#resultid_"+Z+"_"+b).removeClass("active");var aa=B("#"+b+" .main").scrollTop();x().animate({bottom:"0px"},"slow",function(){l=false;H=null})})};var I=function(){B(".button.evidencetoggle").remove()};V();z();S();K();i();B(".evidence").hide();var n=0.5;var T=function(){return(R().height()*(1-A))};var h=function(){return(R().height()*A+U)};var w;var f=function(){var Y=B(this).attr("id").split("_")[1];var Z=B("#evidenceid_"+Y+"_"+b);Z.appendTo(R());if(Z.length!=0){if(H!=null&&H!="#evidenceid_"+Y+"_"+b){}B(".result").not(B(this)).removeClass("active");B(this).toggleClass("active");B(this).attr("title",B(this).hasClass("active")?"Click to hide details":"Click to show details");Z.css("top",h()+"px");Z.css("bottom","0px");var ab=B(this).offset().top;var aa=B("#"+b+" .main").scrollTop();var X=B("#"+b+" .main").height();n=ab/X;scrollTarget=aa+((B(window).height()/2)*(n));if(!l){x().animate({bottom:T()+"px",},"slow",function(){w=B("#evidenceid_"+Y+"_"+b+" .button.evidencetoggle");w.css("top",h()+"px");w.css("left","-23px");Z.fadeToggle("slow",function(){w.appendTo(R())});B(this).animate({scrollTop:scrollTarget},"slow");l=true;H="#evidenceid_"+Y+"_"+b})}else{v(y(),false,ToggleMode.HIDE,".evidence");w.appendTo(B(H));if(H!="#evidenceid_"+Y+"_"+b){Z.fadeToggle("slow",function(){w.appendTo(R())});H="#evidenceid_"+Y+"_"+b;w=B("#evidenceid_"+Y+"_"+b+" .button.evidencetoggle");w.css("top",h()+"px");w.css("left","-23px")}else{x().animate({bottom:0+"px"},"slow",function(){l=false;H=null})}}}else{alert('No evidence found for result "'+Y+'".')}return false};B(".result").not(".noevidence").click(f);var F=0;B(".results .subsection").not(".evidence").each(function(X){var Y=0;B(this).find(".result.significant").each(function(Z){++Y});if(Y>0){B(this).addClass("significant");B(this).find(".contentssummary").first().append('')}F+=Y});if(F>0){B(".results .sectionheader .contentssummary").not(".subsection .sectionheader .contentssummary").html('')}var P=function(){var X=B(this).css("width");if(X==="200px"){B(this).animate({width:"800px"},"fast");B(this).attr("title","Click to reduce")}else{B(this).animate({width:"200px"},"fast");B(this).attr("title","Click to enlarge")}return false};var p=function(){B(".figure .image").each(function(){B(this).find("img").css("width","800px")})};var t=function(){B(".figure .image").each(function(){B(this).find("img").css("width","200px")})};B(".figure .image").each(function(){B(this).find("img").css("width","200px");B(this).find("img").click(P);B(this).find("img").attr("title","Click to enlarge")});B.tablesorter.addParser({id:"scientificNotation",is:function(X){return/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/.test(X)},format:function(X){return B.tablesorter.formatFloat(X)},type:"numeric"});B.tablesorter.addParser({id:"bigMark",is:function(X){return/^[0-9]?[0-9]?[0-9](,[0-9][0-9][0-9])*$/.test(X)},format:function(X){return X.replace(/,/gi,"")},type:"numeric"});B(".resulttable.tablesorter.sortabletable").each(function(){B(this).tablesorter()});var e=function(X){m(X,ToggleMode.HIDE);v(B("#overview_"+b+", #summary_"+b),X);v(B("#results_"+b),X)};e(false)}; \ No newline at end of file +$(window).load(function(){$("#mask").fadeOut()});function initNozzle(b,C){var B=C;var c=25;var u=30;var s=1000;var L=false;var M=0.5;var A=0.5;var U=20;var l=false;var H=null;var d=function(X){return(parseInt(X.css("margin-top"))+parseInt(X.css("margin-bottom")))};var O=function(X){return(parseInt(X.css("padding-top"))+parseInt(X.css("padding-bottom")))};var E=function(X){return(parseInt(X.css("margin-left"))+parseInt(X.css("margin-right")))};var k=function(X){return(parseInt(X.css("padding-left"))+parseInt(X.css("padding-right")))};var R=function(){return B("#"+b+" .frame")};var x=function(){return B("#"+b+" .main")};var q=function(){return B("#"+b)};var o=function(){return B("#"+b+" .menu")};var y=function(){return B(H)};var g=function(){if(!L){return(Math.min(B(window).width()-2*u,s))}else{return(B(window).width()-2*u)}};var a=function(){if(!L){return((B(window).width()-g())/2)}else{return(u)}};B(document).ready(function(){var X=D(true);J(X.prefix,X.postfix);R().css("height",B(window).height()+"px");R().css("width",g()+"px");R().css("left",a()+"px");o().css("height",c);x().css("top",o().outerHeight(true));if(H!=null){x().css("bottom",T());y().css("top",h());w.css("top",h()+"px")}});B(window).resize(function(){R().css("height",B(window).height()+"px");R().css("width",g()+"px");R().css("left",a()+"px");o().css("height",c);x().css("top",o().outerHeight(true));if(H!=null){x().css("bottom",T());y().css("top",h());w.css("top",h()+"px")}});B("#"+b+" .main").scroll(function(){});function D(ab){var aa=[],Z;var X=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(var Y=0;Y-');var X=B("#"+b+" .button.contenttoggle");X.click(function(){v(B(this).parent().parent(),true,ToggleMode.TOGGLE)})};var Q=function(){B(".button.contenttoggle").remove()};var N=function(){if(B("#citation-information").is(":visible")){j()}if(B("#maintainer-information").is(":visible")){B("#maintainer-information").slideUp(200);B("#maintainer-information-toggle").removeClass("active")}else{B("#maintainer-information").slideDown(200);B("#maintainer-information-toggle").addClass("active")}};var j=function(){if(B("#maintainer-information").is(":visible")){N()}if(B("#citation-information").is(":visible")){B("#citation-information").slideUp(200);B("#citation-information-toggle").removeClass("active")}else{B("#citation-information").slideDown(200);B("#citation-information-toggle").addClass("active")}};var m=function(X,Y){var Z=B("#"+b+" .section, #"+b+" .subsection").not("#"+b+" .evidence .section, #"+b+" .evidence .subsection, #"+b+" subsubsection .sectionheader");v(Z,X,Y)};var S=function(){var X=B(".results .sectionheader").not("#"+b+" .evidence .sectionheader, #"+b+" .meta .sectionheader, #"+b+" .subsubsection .sectionheader");X.append('')};var r=function(){if(L){B("#menu_width_state").text("Fixed")}else{B("#menu_width_state").text("Auto")}};var i=function(){var Z='";R().prepend(Z);B("#menu_expand_all").click(function(){m(true,ToggleMode.SHOW)});B("#menu_collapse_all").click(function(){m(true,ToggleMode.HIDE);t()});B("#menu_width").click(function(){L=!L;r();R().animate({width:g()+"px",left:a()+"px"},"slow")});B("#menu_print_view").click(function(){B("#mask").fadeIn();document.getElementById("mask").style.display="block";Q();I();B("#nozzlemenu").remove();B("a.download").remove();p();m(false,ToggleMode.SHOW);G();window.print();window.location.reload(false)});if(nozzleMeta.contact!=null){B("#menu_report_problem").click(function(){var ag=nozzleMeta.contact.subject;var ai=nozzleMeta.contact.message;var af=nozzleMeta.contact.email;var ac=navigator.userAgent;var aa=window.location.href;var ad="Not detected.";if(window.screen){ad="Current Dimensions: "+B(window).width()+" x "+B(window).height()+"%0A";ad+="Maximum Dimensions: "+screen.availWidth+" x "+screen.availHeight+"%0A";ad+="Color Depth: "+screen.colorDepth}var ah="NA";var ab="NA";if(nozzleMeta.software!=undefined){ah=nozzleMeta.software.name;ab=nozzleMeta.software.version}var ae=ai+"%0A%0A%0A%0A== REPORT ======================%0A%0AURL: "+aa+"%0ATitle: "+nozzleMeta.reportTitle+"%0AId: "+nozzleMeta.reportId+"%0ACreator: "+nozzleMeta.creator.name+"%0ACreation Date: "+nozzleMeta.creator.date+"%0ARenderer: "+nozzleMeta.renderer.name+"%0ARender Date: "+nozzleMeta.renderer.date+"%0AGoogle Analytics: "+nozzleMeta.googleAnalyticsId+"%0A%0A%0A== SOFTWARE ====================%0A%0AName: "+ah+"%0AVersion: "+ab+"%0A%0A%0A== MAINTAINER ==================%0A%0AName: "+nozzleMeta.maintainer.name+"%0AAffiliation: "+nozzleMeta.maintainer.affiliation+"%0AEmail: "+nozzleMeta.maintainer.email+"%0A%0A%0A== SYSTEM ======================%0A%0ASystem Time: "+(new Date())+"%0AUser Agent: "+ac+"%0A"+ad+"%0A%0A";window.location="mailto:"+af+"?subject="+ag+"&body="+ae})}r()};var G=function(){var X=1;B(".evidence").each(function(Z){var Y=B(this).attr("id").split("_")[1];B("#resultid_"+Y+"_"+b).after(' '+X+"");B(this).prepend(''+X+" - Supplementary Result");B(this).insertBefore(".copyright");B(this).show();X++})};function W(){var X="?reload="+new Date().getTime();B('link[rel="stylesheet"]').each(function(){this.href=this.href.replace(/\?.*|$/,X)})}var K=function(){var Y=B("#"+b+" .evidence");Y.prepend('×');Y.addClass("visible");var X=B("#"+b+" .evidence .button.evidencetoggle");X.click(function(){v(y(),false,ToggleMode.HIDE,".evidence");w.appendTo(B(H));var Z=y().attr("id").split("_")[1];B("#resultid_"+Z+"_"+b).removeClass("active");var aa=B("#"+b+" .main").scrollTop();x().animate({bottom:"0px"},"slow",function(){l=false;H=null})})};var I=function(){B(".button.evidencetoggle").remove()};V();z();S();K();i();B(".evidence").hide();var n=0.5;var T=function(){return(R().height()*(1-A))};var h=function(){return(R().height()*A+U)};var w;var f=function(){var Y=B(this).attr("id").split("_")[1];var Z=B("#evidenceid_"+Y+"_"+b);Z.appendTo(R());if(Z.length!=0){if(H!=null&&H!="#evidenceid_"+Y+"_"+b){}B(".result").not(B(this)).removeClass("active");B(this).toggleClass("active");B(this).attr("title",B(this).hasClass("active")?"Click to hide details":"Click to show details");Z.css("top",h()+"px");Z.css("bottom","0px");var ab=B(this).offset().top;var aa=B("#"+b+" .main").scrollTop();var X=B("#"+b+" .main").height();n=ab/X;scrollTarget=aa+((B(window).height()/2)*(n));if(!l){x().animate({bottom:T()+"px",},"slow",function(){w=B("#evidenceid_"+Y+"_"+b+" .button.evidencetoggle");w.css("top",h()+"px");w.css("left","-23px");Z.fadeToggle("slow",function(){w.appendTo(R())});B(this).animate({scrollTop:scrollTarget},"slow");l=true;H="#evidenceid_"+Y+"_"+b})}else{v(y(),false,ToggleMode.HIDE,".evidence");w.appendTo(B(H));if(H!="#evidenceid_"+Y+"_"+b){Z.fadeToggle("slow",function(){w.appendTo(R())});H="#evidenceid_"+Y+"_"+b;w=B("#evidenceid_"+Y+"_"+b+" .button.evidencetoggle");w.css("top",h()+"px");w.css("left","-23px")}else{x().animate({bottom:0+"px"},"slow",function(){l=false;H=null})}}}else{alert('No evidence found for result "'+Y+'".')}return false};B(".result").not(".noevidence").click(f);var F=0;B(".results .subsection").not(".evidence").each(function(X){var Y=0;B(this).find(".result.significant").each(function(Z){++Y});if(Y>0){B(this).addClass("significant");B(this).find(".contentssummary").first().append('')}F+=Y});if(F>0){B(".results .sectionheader .contentssummary").not(".subsection .sectionheader .contentssummary").html('')}var P=function(){var X=B(this).css("width");if(X==="200px"){B(this).animate({width:"800px"},"fast");B(this).attr("title","Click to reduce")}else{B(this).animate({width:"200px"},"fast");B(this).attr("title","Click to enlarge")}return false};var p=function(){B(".figure .image").each(function(){B(this).find("img").css("width","800px")})};var t=function(){B(".figure .image").each(function(){B(this).find("img").css("width","200px")})};B(".figure .image").each(function(){B(this).find("img").css("width","200px");B(this).find("img").click(P);B(this).find("img").attr("title","Click to enlarge")});B.tablesorter.addParser({id:"scientificNotation",is:function(X){return/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/.test(X)},format:function(X){return B.tablesorter.formatFloat(X)},type:"numeric"});B.tablesorter.addParser({id:"bigMark",is:function(X){return/^[0-9]?[0-9]?[0-9](,[0-9][0-9][0-9])*$/.test(X)},format:function(X){return X.replace(/,/gi,"")},type:"numeric"});B(".resulttable.tablesorter.sortabletable").each(function(){B(this).tablesorter()});var e=function(X){m(X,ToggleMode.INITIALIZE)};e(false)}; \ No newline at end of file diff --git a/Nozzle.R1/man/Nozzle.R1-package.Rd b/Nozzle.R1/man/Nozzle.R1-package.Rd index 5fd4f8f..83897b9 100644 --- a/Nozzle.R1/man/Nozzle.R1-package.Rd +++ b/Nozzle.R1/man/Nozzle.R1-package.Rd @@ -9,8 +9,8 @@ } \details{ \tabular{ll}{ Package: \tab Nozzle.R1\cr Type: \tab - Package\cr Version: \tab 1.3-0\cr Date: \tab - 2013-06-23\cr License: \tab LGPL (>= 2)\cr LazyLoad: \tab + Package\cr Version: \tab 1.4-0\cr Date: \tab + 2014-07-24\cr License: \tab LGPL (>= 2)\cr LazyLoad: \tab yes\cr } Nozzle was designed to facilitate summarization and rapid diff --git a/Nozzle.R1/man/newSection.Rd b/Nozzle.R1/man/newSection.Rd index 4622594..0f5277b 100644 --- a/Nozzle.R1/man/newSection.Rd +++ b/Nozzle.R1/man/newSection.Rd @@ -3,7 +3,7 @@ \title{Create a new section element.} \usage{ newSection(..., class = "", exportId = NULL, - protection = PROTECTION.PUBLIC) + protection = PROTECTION.PUBLIC, expanded = FALSE) } \arguments{ \item{...}{Strings that will be concatenated to form the @@ -19,6 +19,9 @@ \item{protection}{Procection level. One of PROTECTION.PUBLIC, PROTECTION.GROUP, PROTECTION.PRIVATE.} + + \item{expanded}{Whether the section should expanded by + default or not.} } \value{ New element. diff --git a/Nozzle.R1/man/newSubSection.Rd b/Nozzle.R1/man/newSubSection.Rd index 02a62af..b07c4b6 100644 --- a/Nozzle.R1/man/newSubSection.Rd +++ b/Nozzle.R1/man/newSubSection.Rd @@ -3,7 +3,7 @@ \title{Create a new subsection element.} \usage{ newSubSection(..., exportId = NULL, - protection = PROTECTION.PUBLIC) + protection = PROTECTION.PUBLIC, expanded = FALSE) } \arguments{ \item{...}{Strings that will be concatenated to form the @@ -15,6 +15,10 @@ \item{protection}{Procection level. One of PROTECTION.PUBLIC, PROTECTION.GROUP, PROTECTION.PRIVATE.} + + \item{expanded}{Whether the section should expanded by + default or not. This will not affect the state of parent + sections.} } \value{ New element. diff --git a/examples/demo.R b/examples/demo.R index 6e5ecdd..4a38536 100644 --- a/examples/demo.R +++ b/examples/demo.R @@ -318,10 +318,10 @@ report2 <- setPreviousReport( report2, "nozzle1.html", "Demo 1" ); report2 <- addTo( report2, addTo( newSection( "My Introduction" ), newParagraph( "Hello World! This is a paragraph of text!" ) ) ); report2 <- addTo( report2, addTo( newSection( "My Methods" ), method2 ) ); -report2 <- addTo( report2, addTo( newSection( "My Results", class="results" ), +report2 <- addTo( report2, addTo( newSection( "My Results", class="results", expanded=TRUE ), addTo( newSubSection( "Nozzle Figure" ), figure1, figure2 ), addTo( newSubSection( "Nozzle Table" ), table1, table4, table3, table5 ), - addTo( newSubSection( "Nozzle Text" ), paragraph1, list, paragraph2, paragraphPublic, + addTo( newSubSection( "Nozzle Text", expanded=TRUE ), paragraph1, list, paragraph2, paragraphPublic, paragraphGroup, paragraphPrivate ), addTo( addTo( newSubSection( "Nozzle Results" ), newParagraph( "A result: ", asSummary( result4 ), ", yay!" ) ) ) ) ); @@ -367,7 +367,7 @@ writeReport( report1, filename="reports/nozzle1_private", level=PROTECTION.PRIVA # Examples for Developers # write a "debug" development version that uses external JS or external CSS for rapid development -#writeReport( report1, filename="reports/nozzle1_debug", debug=TRUE, level=PROTECTION.PRIVATE, +# writeReport( report1, filename="reports/nozzle1_debug", debug=TRUE, level=PROTECTION.PRIVATE, # debugJavaScript="/Users/nils/Projects/Nozzle/Nozzle.R1/inst/js/nozzle.js", # debugCss="/Users/nils/Projects/Nozzle/Nozzle.R1/inst/css/nozzle.css" );