8 Replies Latest reply on May 17, 2010 12:09 PM by Sully Zhang

    import ajax frame errors in gtmpl

    Sully Zhang Newbie

      in a gtmpl page:

       

       

      ..........

      .........

      .........

      <script src="jquery-1.2.6.pack.js"></script>

       

      <div>
      <div id="panel"></div>


        <script type="text/javascript">

            $('#panel').html("Loading Menu......");
            $('#panel').load('http://domain:port/myMenu.html');

        </script>

       

       

      <div id="${uicomponent.id}"> 

      ...................

      .............

      ................

      .............

       

       

       

      jquery character "$" is same with gtmpl character "$", if view this page, many errors.......  how to deal this issue

        • 1. Re: import ajax frame errors in gtmpl
          rafael liu Newbie

          Try to escape it like that:

           

            <script type="text/javascript">
                \$('#panel').html("Loading Menu......");
                \$('#panel').load('http://domain:port/myMenu.html');
            </script>
          

           

          Groovy would try to parse the $ symbol otherwise.

          • 2. Re: import ajax frame errors in gtmpl
            Soren Schmidt Newbie

            Sully Zhang,

             

            Try these solutions:

             

            1. Put the dollar sign in single quotes

             

            a)

            def dollar = '$'

            ${dollar}('#panel').html("Loading  Menu......");

             

            b)

            '$'('#panel').html("Loading  Menu......");

             

            2. Escape the dollar sign

            a) $('#panel').html("Loading  Menu......");

             

            b) \u0024('#panel').html("Loading  Menu......");

             

             

            and please say us which ones work.

             

            cu

            Soren

            • 3. Re: import ajax frame errors in gtmpl
              Sully Zhang Newbie

              thanks for your guys answer.

               

              i try all ...... it doesn't work.

               

              i solved it as follows: 

               

              <div id="panel"></div>

              <script src="http://domain/showMenu.js"></script>

               

               

               

              showMenu.js:

              $('#panel').html("Loading Menu......");

              $('#panel').load('http://domain:port/myMenu.html');

              • 4. Re: import ajax frame errors in gtmpl
                rafael liu Newbie

                Sully,

                 

                are you sure? I already used it like that.. Is there any log?

                • 5. Re: import ajax frame errors in gtmpl
                  Sully Zhang Newbie

                  pretty sure....

                   

                  i import JQuery ajax frame.

                  • 6. Re: import ajax frame errors in gtmpl
                    rafael liu Newbie

                    Ok. Could you attach your log? Can be useful to others

                    • 7. Re: import ajax frame errors in gtmpl
                      Kunal Gaba Newbie

                      Try replacing '$' with' jQuery'

                       

                      <script type="text/javascript">

                           jQuery('#panel').html("Loading Menu......");
                            jQuery('#panel').load('http://domain:port/myMenu.html');
                        </script>

                      • 8. Re: import ajax frame errors in gtmpl
                        Sully Zhang Newbie
                        compiled to Groovy:
                                import org.exoplatform.portal.webui.workspace.UIPortalApplication;
                                UIPortalApplication uiPortalApp = _ctx.getRequestContext().getUIApplicat
                        ion();
                                int portalMode = uiPortalApp.getModeState();
                        out.print(Constants.s0);
                        ;out.print("${UITabPaneDashboard}");
                        out.print(Constants.s1);
                        ;out.print("${include}");
                        out.print(Constants.s2);
                        ;out.print("${uicomponent.id}");
                        out.print(Constants.s3);
                        if(portalMode == UIPortalApplication.APP_BLOCK_EDIT_MODE || portalMode == UIPort
                        alApplication.CONTAINER_BLOCK_EDIT_MODE) {
                        out.print(Constants.s4);
                        /*Begin Top Decorator*/
                        out.print(Constants.s5);
                        ;out.print("${_ctx.appRes("UIPage.label.pageContent")}");
                        out.print(Constants.s6);
                        /*Begin Middle Decorator*/
                        out.print(Constants.s7);
                        /*Begin Bottom Decorator*/
                        out.print(Constants.s8);
                        } else {
                        out.print(Constants.s9);
                        if(uicomponent.getUIComponent() == null){
                        out.print(Constants.s10);
                        ;out.print("${_ctx.appRes("UIPageBody.msg.pageNotFoundLine1")}");
                        out.print(Constants.s11);
                        ;out.print("${_ctx.appRes("UIPageBody.msg.pageNotFoundLine2")}");
                        out.print(Constants.s12);
                        ;out.print("${_ctx.appRes("UIPageBody.msg.pageNotFoundLine3")}");
                        out.print(Constants.s13);
                        ;out.print("${_ctx.appRes("UIPageBody.msg.pageNotFoundLine4")}");
                        out.print(Constants.s14);
                        } else { uicomponent.renderChildren(); }
                        out.print(Constants.s15);
                        if(portalMode != UIPortalApplication.NORMAL_MODE) {
                        out.print(Constants.s16);
                        }
                        out.print(Constants.s17);
                        }
                        out.print(Constants.s18);
                        if(portalMode != UIPortalApplication.NORMAL_MODE){
                        out.print(Constants.s19);
                        }
                        out.print(Constants.s20);
                        public class Constants
                        {
                        public static final org.exoplatform.groovyscript.GroovyText s0 = new org.exoplat
                        form.groovyscript.GroovyText("\n<style>\n  .PortalPage_ContainerPanel{zoom:1;}\n
                          .PortalPage_ContainerPanel:after{content:'.';display:block;visibility:none;hei
                        ght:0;clear:both;}\n  .PortalPage_LeftMenuPanel{width:176px;min-height:200px;flo
                        at:left;background-color:#fff;margin-left:8px;}\n  .PortalPage_RightContentPanel
                        {float:right;width:100%;margin-left:-25em;}\n  .UIPageBody{margin-left:176px;}\n
                        </style>\n\n<script src=\"/logile_portlet/portletNav/jquery-1.2.6.pack.js\"></sc
                        ript>\n<script src=\"/logile_portlet/portletNav/jquery.include.pack-1.0.js\"></s
                        cript>\n\n<div class=\"PortalPage_ContainerPanel\">\n<div class=\"PortalPage_Lef
                        tMenuPanel\" id=\"PortalPage_LeftMenuPanel\"></div>\n<script language=\"JavaScri
                        pt\"> \n  if(\$ $($\"$#");
                        public static final org.exoplatform.groovyscript.GroovyText s1 = new org.exoplat
                        form.groovyscript.GroovyText("\").length>0){\n  \$.");
                        public static final org.exoplatform.groovyscript.GroovyText s2 = new org.exoplat
                        form.groovyscript.GroovyText("('/logile_portlet/portletNav/showMenu.js');\n  }\n
                        </script>\n<div class=\"PortalPage_RightContentPanel\">\n\n<div class=\"UIPageBo
                        dy\" id=\"");
                        public static final org.exoplatform.groovyscript.GroovyText s3 = new org.exoplat
                        form.groovyscript.GroovyText("\">               \n      <div class=\"UIComponent
                        UIComponentBlock\">\n  \n      ");
                        public static final org.exoplatform.groovyscript.GroovyText s4 = new org.exoplat
                        form.groovyscript.GroovyText("\n                <div class=\"LAYOUT-BLOCK LAYOUT
                        -PAGEBODY DragControlArea\" onmousedown=\"eXo.portal.PortalDragDrop.init.call(th
                        is, event);\">\n                        <div class=\"PageLayoutDecorator\">\n
                                                ");
                        public static final org.exoplatform.groovyscript.GroovyText s5 = new org.exoplat
                        form.groovyscript.GroovyText("\n                                <div class=\"Top
                        LeftPage\">\n                                   <div class=\"TopRightPage\">\n
                                                                <div class=\"TopCenterPage\">\n
                                                                ");
                        public static final org.exoplatform.groovyscript.GroovyText s6 = new org.exoplat
                        form.groovyscript.GroovyText("\n
                        </div>
                                        \n                                      </div>\n
                                        </div>\n                                \n
                                ");
                        public static final org.exoplatform.groovyscript.GroovyText s7 = new org.exoplat
                        form.groovyscript.GroovyText("\n                                <div class=\"Mid
                        dleLeftPage\">\n                                        <div class=\"MiddleRight
                        Page\">\n                                               <div class=\"MiddlePageB
                        G\">\n                                                  <div class=\"FixBug\"><s
                        pan></span></div>\n                                             </div>\n
                                                        </div>\n                                </div>\n
                                                        \n                              ");
                        public static final org.exoplatform.groovyscript.GroovyText s8 = new org.exoplat
                        form.groovyscript.GroovyText("\n                                <div class=\"Bot
                        tomLeftPage\">\n                                        <div class=\"BottomRight
                        Page\">\n                                               <div class=\"BottomCente
                        rPage\">\n                                                      <div class=\"Fix
                        Bug\"><span></span></div>\n                                             </div>
                                \n                                      </div>\n
                                </div>\n                                        \n
                        </div>          \n              </div>\n        ");
                        public static final org.exoplatform.groovyscript.GroovyText s9 = new org.exoplat
                        form.groovyscript.GroovyText("\n                <div class=\"VIEW-PAGEBODY VIEW-
                        BLOCK DragControlArea\" id=\"PAGEBODY-VIEW-BLOCK\">\n                   ");
                        public static final org.exoplatform.groovyscript.GroovyText s10 = new org.exopla
                        tform.groovyscript.GroovyText("\n                       <div class=\"Empty\">\n
                                                <div class=\"UIPortalWarning\">\n
                                        <div class=\"LeftTopWarning\">\n
                                        <div class=\"RightTopWarning\">\n
                                                <div class=\"CenterTopWaring\">\n
                                                                <div class=\"TitleWaring\">");
                        public static final org.exoplatform.groovyscript.GroovyText s11 = new org.exopla
                        tform.groovyscript.GroovyText("</div>\n
                                </div>\n                                                </div>\n
                                                        </div>\n
                        <div class=\"LeftMiddleWarning\">\n
                        <div class=\"RightMiddleWarning\">\n
                                <div class=\"WarningContent\">\n
                                                <div class=\"Icon\">");
                        public static final org.exoplatform.groovyscript.GroovyText s12 = new org.exopla
                        tform.groovyscript.GroovyText("</div>\n
                                        <div class=\"Icon\">");
                        public static final org.exoplatform.groovyscript.GroovyText s13 = new org.exopla
                        tform.groovyscript.GroovyText("</div>\n
                                        <div class=\"Icon\">");
                        public static final org.exoplatform.groovyscript.GroovyText s14 = new org.exopla
                        tform.groovyscript.GroovyText("</div>\n
                                </div>\n                                                </div>\n
                                                        </div>\n
                        <div class=\"LeftBottomWarning\">\n
                        <div class=\"RightBottomWarning\">\n
                                <div class=\"CenterBottomWaring\"><span></span></div>\n
                                                </div>\n                                        </div>\n
                                                        </div>\n                        </div>\n
                                        ");
                        public static final org.exoplatform.groovyscript.GroovyText s15 = new org.exopla
                        tform.groovyscript.GroovyText("\n                       <div class=\"BLPagebody\
                        ">\n                            <div class=\"BRPagebody\">\n
                                        <div class=\"BMPagebody\"><span></span></div>\n
                                </div>\n                        </div>\n                        \n
                                        ");
                        public static final org.exoplatform.groovyscript.GroovyText s16 = new org.exopla
                        tform.groovyscript.GroovyText("\n                       <div class=\"MaskParent\
                        " style=\"height: 0px;position:relative;\">\n                           <div cla
                        ss=\"UIPageBodyMask\" style=\"position:absolute;\" onmousedown=\"eXo.portal.Port
                        alDragDrop.init.call(this, event);\"><span></span></div>\n
                        </div>\n                        ");
                        public static final org.exoplatform.groovyscript.GroovyText s17 = new org.exopla
                        tform.groovyscript.GroovyText("\n               </div>\n        ");
                        public static final org.exoplatform.groovyscript.GroovyText s18 = new org.exopla
                        tform.groovyscript.GroovyText("\n       ");
                        public static final org.exoplatform.groovyscript.GroovyText s19 = new org.exopla
                        tform.groovyscript.GroovyText("\n               <div class=\"EDITION-BLOCK EDITI
                        ON-PAGEBODY\" style=\"position:relative\">\n                    <div class=\"CON
                        TROL-PAGEBODY CONTROL-BLOCK\" style=\"display: none\"><span></span></div>\n
                                </div>\n        ");
                        public static final org.exoplatform.groovyscript.GroovyText s20 = new org.exopla
                        tform.groovyscript.GroovyText("\n       </div>\n</div>\n\n</div>\n</div>");
                        }
                                at org.exoplatform.groovyscript.GroovyScriptBuilder.build(GroovyScriptBu
                        ilder.java:213)
                                at org.exoplatform.groovyscript.GroovyTemplate.<init>(GroovyTemplate.jav
                        a:81)
                                at org.exoplatform.groovyscript.GroovyTemplateEngine.createTemplate(Groo
                        vyTemplateEngine.java:29)
                                at org.exoplatform.groovyscript.text.TemplateService.getTemplate(Templat
                        eService.java:134)
                                at org.exoplatform.groovyscript.text.TemplateService.getTemplate(Templat
                        eService.java:106)
                                at org.exoplatform.groovyscript.text.TemplateService.merge(TemplateServi
                        ce.java:74)
                                at org.exoplatform.webui.core.lifecycle.Lifecycle.renderTemplate(Lifecyc
                        le.java:132)
                                at org.exoplatform.webui.core.lifecycle.Lifecycle.processRender(Lifecycl
                        e.java:85)
                                at org.exoplatform.webui.core.UIComponent.processRender(UIComponent.java
                        :148)
                                at org.exoplatform.portal.webui.page.UIPageBody.processRender(UIPageBody
                        .java:194)
                                at org.exoplatform.webui.core.UIContainer.renderChildren(UIContainer.jav
                        a:368)
                                at org.exoplatform.webui.core.UIContainer.renderChildren(UIContainer.jav
                        a:358)
                                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                        java:39)
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                                at java.lang.reflect.Method.invoke(Method.java:597)
                                at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMet
                        hodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
                                at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
                        MethodSite.java:52)
                                at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
                        teArray.java:40)
                                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
                        llSite.java:117)
                                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
                        llSite.java:121)
                                at UIPortal.run(UIPortal.gtmpl:18)
                                at org.exoplatform.groovyscript.GroovyScript.render(GroovyScript.java:95
                        )
                                at org.exoplatform.groovyscript.GroovyTemplate.render(GroovyTemplate.jav
                        a:112)
                                at org.exoplatform.groovyscript.text.TemplateService.merge(TemplateServi
                        ce.java:77)
                                at org.exoplatform.webui.core.lifecycle.Lifecycle.renderTemplate(Lifecyc
                        le.java:132)
                                at org.exoplatform.webui.core.lifecycle.Lifecycle.processRender(Lifecycl
                        e.java:85)
                                at org.exoplatform.portal.webui.portal.UIPortalLifecycle.processRender(U
                        IPortalLifecycle.java:41)
                                at org.exoplatform.portal.webui.portal.UIPortalLifecycle.processRender(U
                        IPortalLifecycle.java:30)
                                at org.exoplatform.webui.core.UIComponent.processRender(UIComponent.java
                        :148)
                                at org.exoplatform.webui.core.UIComponentDecorator.renderChildren(UIComp
                        onentDecorator.java:93)
                                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                        java:39)
                                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                                at java.lang.reflect.Method.invoke(Method.java:597)
                                at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMet
                        hodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
                                at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMeta
                        MethodSite.java:52)
                                at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi
                        teArray.java:40)
                                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
                        llSite.java:117)
                                at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa
                        llSite.java:121)
                                at UISiteBody.run(UISiteBody.gtmpl:31)
                                ... 113 more
                        Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: start
                        up failed, /UIPageBody.gtmpl: 50: illegal string body character after dollar sig
                        n;
                           solution: either escape a literal dollar sign "\$5" or bracket the value expr
                        ession "${5}" @ line 50, column 109.
                        1 error
                                at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollecto
                        r.java:296)
                                at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollect
                        or.java:143)
                                at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.ja
                        va:113)
                                at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.ja
                        va:125)
                                at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:353)
                                at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(Antlr
                        ParserPlugin.java:89)
                                at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugi
                        n.java:61)
                                at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:249)
                                at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.ja
                        va:160)
                                at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(Compil
                        ationUnit.java:799)
                                at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.j
                        ava:464)
                                at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:278)
                                at org.exoplatform.groovyscript.GroovyScriptBuilder.build(GroovyScriptBu
                        ilder.java:209)
                                ... 153 more