Changeset 481


Ignore:
Timestamp:
May 26, 2010, 6:05:56 PM (13 years ago)
Author:
duh
Message:
  • added JavaScript? variable 'baseUrl' containing the grails base application url so it can be used by JavaScript? throughout the application if needed (the url is not a fact as it often changes on live deployments)
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/layouts/main.gsp

    r429 r481  
    88        <link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon"/>
    99        <g:javascript library="jquery"/>
     10        <script type="text/javascript">var baseUrl = '${resource(dir: '')}';</script>
    1011        <script src="${createLinkTo(dir: 'js', file: 'jquery-ui-1.8.1.custom.min.js')}" type="text/javascript"></script>
    1112        <link rel="stylesheet" href="${createLinkTo(dir: 'css/cupertino', file: 'jquery-ui-1.8.1.custom.css')}"/>
  • trunk/web-app/js/wizard.js

    r477 r481  
    5050    new SelectAddMore().init({
    5151        rel     : 'term',
    52         url     : '/gscf/termEditor',
     52        url     : baseUrl + '/termEditor',
    5353        vars    : 'ontologies',
    5454        label   : 'add more...',
     
    6262    new SelectAddMore().init({
    6363        rel     : 'template',
    64         url     : '/gscf/templateEditor',
     64        url     : baseUrl + '/templateEditor',
    6565        vars    : 'entity',
    6666        label   : 'add / modify..',
  • trunk/web-app/js/wizard.min.js

    r477 r481  
    1 var warnOnRedirect=true;$(document).ready(function(){re=/Firefox\/3\.6/gi;if(navigator.userAgent.match(re)){var a=$("div#wizard");if(a.find("#warning").length===0){a.html('<span id="warning" style="color:red;font-size:8px;">Firefox 3.6 contains <a href="http://code.google.com/p/fbug/issues/detail?id=2746" target="_new">a bug</a> in combination with Firebug\'s XMLHttpRequest spy which causes the wizard to not function anymore. Please make sure you have Firebug\'s XMLHttpRequest spy disabled or use Firefox 3.5.7 instead...</span>'+a.html())}}insertOnRedirectWarning();onWizardPage()});function onWizardPage(){attachHelpTooltips();attachDatePickers();attachDateTimePickers();attachTableEvents();handleWizardTable();new TableEditor().init("div.table","div.row","div.column");new OntologyChooser().init();new SelectAddMore().init({rel:"term",url:"/gscf/termEditor",vars:"ontologies",label:"add more...",style:"addMore",onClose:function(a){refreshWebFlow()}});new SelectAddMore().init({rel:"template",url:"/gscf/templateEditor",vars:"entity",label:"add / modify..",style:"modify",onClose:function(a){refreshWebFlow()}});$("#accordion").accordion()}function insertOnRedirectWarning(){$("a").each(function(){var a=$(this);var b=/^#/gi;if(!a.attr("href").match(/^#/gi)&&!a.attr("href").match(/\/([^\/]+)\/wizard\/pages/gi)){a.bind("click",function(){if(warnOnRedirect){return onDirectWarning()}})}})}function onDirectWarning(){return confirm("Warning: navigating away from the wizard causes loss of work and unsaved data. Are you sure you want to continue?")}function attachHelpTooltips(){$("div#wizard").find("div.helpIcon").each(function(){helpIcon=$(this);helpContent=helpIcon.parent().find("div.helpContent");if(!helpContent.html()){helpContent=helpIcon.parent().parent().find("div.helpContent")}var html=(helpContent.html())?helpContent.html():"";if(html){var specialContent=html.match(/\[([^:]+)\:([^\]]+)\]/);if(specialContent){eval(specialContent[1]+"('"+specialContent[2]+"',helpContent)")}helpIcon.qtip({content:"leftMiddle",position:{corner:{tooltip:"leftMiddle",target:"rightMiddle"}},style:{border:{width:5,radius:10},padding:10,textAlign:"center",tip:true,name:"blue"},content:helpContent.html(),show:"mouseover",hide:"mouseout",api:{beforeShow:function(){}}});helpContent.remove()}})}function youtube(b,a){a.html("<div id='"+b+"'></div>");var c={allowScriptAccess:"always"};var d={id:"myytplayer_"+b};swfobject.embedSWF("http://www.youtube.com/v/"+b+"?enablejsapi=1&playerapiid=ytplayer_"+b,b,"200","150","8",null,null,c,d)}function onYouTubePlayerReady(a){ytplayer=document.getElementById("my"+a);ytplayer.playVideo()}function attachDatePickers(){$("div#wizard").find("input[type=text][rel$='date']").each(function(){$(this).datepicker({numberOfMonths:3,showButtonPanel:true,changeMonth:true,changeYear:true,dateFormat:"dd/mm/yy",altField:"#"+$(this).attr("name")+"Example",altFormat:"DD, d MM, yy"})})}function attachDateTimePickers(){$("div#wizard").find("input[type=text][rel$='datetime']").each(function(){$(this).datepicker({changeMonth:true,changeYear:true,dateFormat:"dd/mm/yy",altField:"#"+$(this).attr("name")+"Example",altTimeField:"#"+$(this).attr("name")+"Example2",altFormat:"DD, d MM, yy",showTime:true,time24h:true})})}function attachTableEvents(){$("div#wizard").find("div.row").each(function(){$(this).hover(function(){$(this).addClass("highlight")},function(){$(this).removeClass("highlight")})})}function handleWizardTable(){var b=this;var a=$("div#wizard").find("div.table");a.each(function(){var d=$(this);var g=(d.next().attr("class")=="sliderContainer")?d.next():null;var h=d.find("div.header");var f=20;var e=0;var c=[];h.children().each(function(){var m=$(this);var k=m.width();var i=parseInt(m.css("padding-left"),10)+parseInt(m.css("padding-right"),10);var l=parseInt(m.css("margin-left"),10)+parseInt(m.css("margin-right"),10);var j=parseInt(m.css("borderLeftWidth"),10)+parseInt(m.css("borderRightWidth"),10);if(i){k+=i}if(l){k+=l}if(j){k+=j}f+=k;c[e]=m.width();e++});h.css({width:f+"px"});d.find("div.row").each(function(){var j=$(this);var i=0;j.children().each(function(){$(this).css({width:c[i]+"px"});i++});j.css({width:f+"px"})});if(g){if(h.width()<d.width()){g.css({display:"none "})}else{g.slider({value:1,min:1,max:h.width()-d.width(),step:1,slide:function(i,j){d.find("div.header, div.row").css({"margin-left":(1-j.value)+"px"})}})}}})};
     1var warnOnRedirect=true;$(document).ready(function(){re=/Firefox\/3\.6/gi;if(navigator.userAgent.match(re)){var a=$("div#wizard");if(a.find("#warning").length===0){a.html('<span id="warning" style="color:red;font-size:8px;">Firefox 3.6 contains <a href="http://code.google.com/p/fbug/issues/detail?id=2746" target="_new">a bug</a> in combination with Firebug\'s XMLHttpRequest spy which causes the wizard to not function anymore. Please make sure you have Firebug\'s XMLHttpRequest spy disabled or use Firefox 3.5.7 instead...</span>'+a.html())}}insertOnRedirectWarning();onWizardPage()});function onWizardPage(){attachHelpTooltips();attachDatePickers();attachDateTimePickers();attachTableEvents();handleWizardTable();new TableEditor().init("div.table","div.row","div.column");new OntologyChooser().init();new SelectAddMore().init({rel:"term",url:baseUrl+"/termEditor",vars:"ontologies",label:"add more...",style:"addMore",onClose:function(a){refreshWebFlow()}});new SelectAddMore().init({rel:"template",url:baseUrl+"/templateEditor",vars:"entity",label:"add / modify..",style:"modify",onClose:function(a){refreshWebFlow()}});$("#accordion").accordion()}function insertOnRedirectWarning(){$("a").each(function(){var a=$(this);var b=/^#/gi;if(!a.attr("href").match(/^#/gi)&&!a.attr("href").match(/\/([^\/]+)\/wizard\/pages/gi)){a.bind("click",function(){if(warnOnRedirect){return onDirectWarning()}})}})}function onDirectWarning(){return confirm("Warning: navigating away from the wizard causes loss of work and unsaved data. Are you sure you want to continue?")}function attachHelpTooltips(){$("div#wizard").find("div.helpIcon").each(function(){helpIcon=$(this);helpContent=helpIcon.parent().find("div.helpContent");if(!helpContent.html()){helpContent=helpIcon.parent().parent().find("div.helpContent")}var html=(helpContent.html())?helpContent.html():"";if(html){var specialContent=html.match(/\[([^:]+)\:([^\]]+)\]/);if(specialContent){eval(specialContent[1]+"('"+specialContent[2]+"',helpContent)")}helpIcon.qtip({content:"leftMiddle",position:{corner:{tooltip:"leftMiddle",target:"rightMiddle"}},style:{border:{width:5,radius:10},padding:10,textAlign:"center",tip:true,name:"blue"},content:helpContent.html(),show:"mouseover",hide:"mouseout",api:{beforeShow:function(){}}});helpContent.remove()}})}function youtube(b,a){a.html("<div id='"+b+"'></div>");var c={allowScriptAccess:"always"};var d={id:"myytplayer_"+b};swfobject.embedSWF("http://www.youtube.com/v/"+b+"?enablejsapi=1&playerapiid=ytplayer_"+b,b,"200","150","8",null,null,c,d)}function onYouTubePlayerReady(a){ytplayer=document.getElementById("my"+a);ytplayer.playVideo()}function attachDatePickers(){$("div#wizard").find("input[type=text][rel$='date']").each(function(){$(this).datepicker({numberOfMonths:3,showButtonPanel:true,changeMonth:true,changeYear:true,dateFormat:"dd/mm/yy",altField:"#"+$(this).attr("name")+"Example",altFormat:"DD, d MM, yy"})})}function attachDateTimePickers(){$("div#wizard").find("input[type=text][rel$='datetime']").each(function(){$(this).datepicker({changeMonth:true,changeYear:true,dateFormat:"dd/mm/yy",altField:"#"+$(this).attr("name")+"Example",altTimeField:"#"+$(this).attr("name")+"Example2",altFormat:"DD, d MM, yy",showTime:true,time24h:true})})}function attachTableEvents(){$("div#wizard").find("div.row").each(function(){$(this).hover(function(){$(this).addClass("highlight")},function(){$(this).removeClass("highlight")})})}function handleWizardTable(){var b=this;var a=$("div#wizard").find("div.table");a.each(function(){var d=$(this);var g=(d.next().attr("class")=="sliderContainer")?d.next():null;var h=d.find("div.header");var f=20;var e=0;var c=[];h.children().each(function(){var m=$(this);var k=m.width();var i=parseInt(m.css("padding-left"),10)+parseInt(m.css("padding-right"),10);var l=parseInt(m.css("margin-left"),10)+parseInt(m.css("margin-right"),10);var j=parseInt(m.css("borderLeftWidth"),10)+parseInt(m.css("borderRightWidth"),10);if(i){k+=i}if(l){k+=l}if(j){k+=j}f+=k;c[e]=m.width();e++});h.css({width:f+"px"});d.find("div.row").each(function(){var j=$(this);var i=0;j.children().each(function(){$(this).css({width:c[i]+"px"});i++});j.css({width:f+"px"})});if(g){if(h.width()<d.width()){g.css({display:"none "})}else{g.slider({value:1,min:1,max:h.width()-d.width(),step:1,slide:function(i,j){d.find("div.header, div.row").css({"margin-left":(1-j.value)+"px"})}})}}})};
Note: See TracChangeset for help on using the changeset viewer.