Changeset 2017
- Timestamp:
- Sep 12, 2011, 6:05:43 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/views/visualize/index.gsp
r2014 r2017 21 21 /** NEEDED FOR RESOURCES PLUGIN **/ 22 22 .menu_arrow {background-image: url(${resource(dir: 'images/visualization', file: 'down_arrow.png')}); } 23 . error { background: #ffe0e0 url(${fam.icon( name: 'exclamation' )}) 10px 10px no-repeat; }24 . warning{ background: #eee url(${fam.icon( name: 'information' )}) 10px 10px no-repeat; }23 .message_error { background: #ffe0e0 url(${fam.icon( name: 'exclamation' )}) 10px 5px no-repeat; } 24 .message_warning { background: #eee url(${fam.icon( name: 'information' )}) 10px 5px no-repeat; } 25 25 </style> 26 26 … … 80 80 <h1>Visualize your study</h1> 81 81 82 <div id="message" class="error"> 82 <div id="message_counter" onclick="errorDiv(); return false;">0</div> 83 84 <div id="message_container"> 83 85 <g:if test="${flash.error}"> 84 ${flash.error.toString().encodeAsHTML()} 86 <div class="message_box message_error"> 87 ${flash.error.toString().encodeAsHTML()} 88 </div> 85 89 </g:if> 86 90 <g:if test="${flash.message}"> 87 ${flash.message.toString().encodeAsHTML()} 91 <div class="message_box message_warning"> 92 ${flash.message.toString().encodeAsHTML()} 93 </div> 88 94 </g:if> 89 95 </div> -
trunk/web-app/css/visualization.css
r2014 r2017 11 11 /** START :: MESSAGES**/ 12 12 13 #message { 14 width: 840px; 15 height: 40px; 16 overflow: hidden; 13 #message_container { 17 14 display: none; 18 15 } 19 16 20 . error{21 border: 1px solid #f99; /* #006dba; */ 22 margin-bottom: 10px;23 margin-top:10px;24 padding: 10px 10px 10px 33px;17 .message_box { 18 width: 750px; 19 padding: 5px 35px; 20 margin: 2px 10px; 21 display: none; 25 22 } 26 23 27 .warning { 28 border: 1px solid #06C; /* #006dba; */ 29 margin-bottom: 10px; 30 margin-top: 10px; 31 padding: 10px 10px 10px 33px; 24 .message_error { 25 border: 1px solid #f99; 26 } 27 28 .message_warning { 29 border: 1px solid #06C; 30 31 } 32 33 #message_counter { 34 position: absolute; 35 top: 0px; 36 right: 0px; 37 padding: 3px; 38 width: 18px; 39 height: 18px; 40 border: 2px solid gray; 41 text-align: center; 42 vertical-align: middle; 43 } 44 45 #message_counter:hover { 46 text-decoration: underline; 47 background: #87cefa; 48 } 49 50 div#message_counter.message_newmessage { 51 width: 150px; 52 height: 150px; 53 background-color: pink; 32 54 } 33 55 -
trunk/web-app/js/visualization.js
r2014 r2017 3 3 */ 4 4 var visualization = null; 5 var visType = null; 5 6 6 7 $(document).ready(function() { … … 33 34 "success": function( data, textStatus, jqXHR ) { 34 35 // Remove all previous entries from the list 35 $( '#rows, #columns' ).empty(); 36 $( '#rows, #columns, #types' ).empty(); 37 38 if( visualization ) 39 visualization.destroy(); 36 40 37 41 if(data.infoMessage) { 38 showError(data.infoMessage," warning");42 showError(data.infoMessage,"message_warning"); 39 43 } 40 44 … … 48 52 $.each( returnData, function( idx, field ) { 49 53 if(field.category!=prevCat) { 50 $( '#rows, #columns' ) 51 .append( $( "<option>" ) 52 .val( "" ) 53 .text( field.source+": "+field.category ) 54 .attr("disabled","disabled") 55 .css("font-weight","bold") 56 .css("color","white") 57 .css("background-color","#333") ); 54 if(prevCat.length>0) $( '#rows, #columns' ).append( "</optgroup>" ); 55 $( '#rows, #columns' ).append( "<optgroup label='"+field.source+": "+field.category+"' onClick='return false;'>" ); 58 56 prevCat = field.category; 59 57 } 60 58 $( '#rows, #columns' ).append( $( "<option>" ).val( field.id ).text( field.name ) ); 61 59 }); 60 $( '#rows, #columns' ).append( "</optgroup>" ); 62 61 63 62 $( "#menu_study" ).find("div.menu_item_info").html("<br />"+$( '#study option:selected' ).text()); … … 68 67 },'menu_study'); 69 68 } else { 70 $( '#rows, #columns ' ).empty();69 $( '#rows, #columns, #types' ).empty(); 71 70 clearStep(".menu_item"); 71 72 72 $( "#menu_study" ).addClass("menu_item_fill"); 73 73 } … … 94 94 95 95 if(data.infoMessage!=null) { 96 showError(data.infoMessage," warning");96 showError(data.infoMessage,"message_warning"); 97 97 } else { 98 98 … … 102 102 $.each( returnData, function( idx, field ) { 103 103 $( '#types' ).append( $( "<option>" ).val( field.id ).text( field.name ) ); 104 if(field.name==visType) {$( '#types option:last' ).attr("selected","selected");}; 104 105 }); 105 106 … … 117 118 clearStep("#menu_vis"); 118 119 $( "#menu_vis" ).addClass("menu_item_fill"); 120 if( visualization ) 121 visualization.destroy(); 122 119 123 if($( '#types option' ).length==1) { 120 124 $( '#types :first-child' ).attr("selected","selected"); 125 } 126 if($( '#types option:selected' ).length>0) { 121 127 changeVis(); 122 128 } … … 139 145 if($( '#types option:selected' ).val()!="") { 140 146 $( "#menu_vis" ).removeClass().addClass("menu_item menu_item_done"); 141 $( "#menu_vis" ).find("div.menu_item_info").html("<br />"+$( '#types option:selected' ).text()); 147 visType = $( '#types option:selected' ).text(); 148 $( "#menu_vis" ).find("div.menu_item_info").html("<br />"+visType); 142 149 } else { 143 150 $( "#menu_vis" ).find("div.menu_item_info").html(""); … … 175 182 176 183 if(data.infoMessage!=null) { 177 showError(data.infoMessage," warning");184 showError(data.infoMessage,"message_warning"); 178 185 } 179 186 // Handle erroneous data 180 187 /*if( !checkCorrectData( data.returnData ) ) { 181 showError( "Unfortunately the server returned data in a format that we did not expect.", "error" );188 showError( ["Unfortunately the server returned data in a format that we did not expect."], "message_error" ); 182 189 return; 183 190 }*/ … … 238 245 /** 239 246 * Shows an error message in a proper way 240 * @param message String Message to show 241 */ 242 function showError( message, strClass ) { 243 $( '#message' ).html( message ); 244 $( '#message' ).removeClass().addClass(strClass); 245 $( '#message' ).fadeIn(); 246 $(document).bind('click',function() { 247 $( '#message' ).removeClass(); 248 $( '#message' ).html(""); 249 $(document).unbind('click'); 250 }); 247 * @param messages array of Strings 248 * @param strClass the Class the messages get 249 */ 250 function showError( messages, strClass ) { 251 for (index in messages) { 252 var newClose = $( "<div>" ).css("position","absolute").css("top","3px").css("right","10px").html("<a href='#' onclick='removeError(this); return false;'>x</a>"); 253 $( '#message_container' ).prepend( $( "<div>" ).addClass("message_box "+strClass).html( messages[index] ).css("position","relative").fadeIn().append(newClose) ); 254 } 255 $( '#message_counter' ).addClass("message_newmessage"); 256 $( '#message_counter' ).switchClass("message_newmessage","",2000); 257 $( '#message_counter' ).html($('.message_box').length); 258 } 259 260 function errorDiv() { 261 if($( '#message_container' ).css("display")=="none") { 262 $( '#message_container' ).show("fast"); 263 } else { 264 $( '#message_container' ).hide("fast"); 265 } 266 } 267 268 function removeError(strSelector) { 269 $( strSelector ).closest(".message_box").remove(); 270 $( "#message_counter" ).html($(".message_box").length); 271 if($(".message_box").length==0) { 272 errorDiv(); 273 } 251 274 } 252 275 … … 323 346 ajaxParameters[ "error" ] = function( jqXHR, textStatus, errorThrown ) { 324 347 // An error occurred while retrieving fields from the server 325 showError( "An error occurred while retrieving variables from the server. Please try again or contact a system administrator.<br />"+textStatus, "error" );348 showError( ["An error occurred while retrieving variables from the server. Please try again or contact a system administrator.<br />"+textStatus], "message_error" ); 326 349 $( "#"+divid ).removeClass().addClass('menu_item menu_item_error'); 327 350 $( "#"+divid ).find("img.spinner").hide();
Note: See TracChangeset
for help on using the changeset viewer.