Adding support for JQuery as module in modular theme

I wanted to try adding a custom module in the Modular theme so i started reading the Using jQuery in a theme wiki page and i made few changes in the steps to get it working in my local. It seems that the source code for all the modules that are part of Portal 7002 modular theme is stored in the .war file in WebSphere\PortalServer\theme\wp.theme.modules\webapp\installedApps\ThemeModules.ear\ThemeModules.war\modules
Now we are not supposed to add any code in the WebSphere\PortalServer directory because when you install new fix or fix pack your changes could get overwritten, so i did create a new HelloModular.war file that has all the static resources as well as plugin.xml file that defines the static resources in my theme. You can download the HelloModular.war file with all the source code from here, i followed these steps
  1. First i did create HelloModular as Dynamic Web Application(basically a .war file) in RAD
  2. Then i did copy the jquery.min.js(I got the latest version from JQuery Web Site), jSquishy.css,jSquishy.js,jSquishy.jsp(I got the jSquishy related files from Portal Wiki) in the WebContent folder so that they will be available at the root of the HelloModular web application. This is how my project structure looks like
  3. After that i had to create plugin.xml that defines the jQuery and jSquishy related modules like this
    
    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.0"?>
     <plugin
       id="com.ibm.portal.jQuery.samples"
       name="jQuery module contributions"
       version="1.0.0"
       provider-name="IBM">
            <!-- jQuery js -->
     <extension point="com.ibm.portal.resourceaggregator.module" 
     id="jQuery_main_head">
      <module id="jQuery">
       <prereq id="wp_portal"/>
       <contribution type="head">
        <sub-contribution type="js">
      <uri value="res:/HelloModular/jquery.min.js" />
        </sub-contribution>
       </contribution>
      </module>
     </extension>
     <extension point="com.ibm.portal.resourceaggregator.module" 
     id="jSquishy_main_head">
      <module id="jSquishy">
       <prereq id="jQuery"/>
       <contribution type="head">
        <sub-contribution type="css">
      <uri value="res:/HelloModular/jSquishy.css" />
        </sub-contribution>
        <sub-contribution type="js">
      <uri value="res:/HelloModular/jSquishy.js" />
        </sub-contribution>
       </contribution>
       <contribution type="config">
        <sub-contribution type="markup">
      <uri value="res:/HelloModular/jSquishy.jsp"/>
        </sub-contribution>
       </contribution>
      </module>
     </extension>
    </plugin>
    
    The jquery.min.js is available at http://localhost:10039/HelloModular/jquery.min.js so i had to define it like res:/HelloModular/jquery.min.js while declaring it as a module.
  4. The last step was to create a profile_jquery.json like this
    
    {
     "moduleIDs" : [
      "wp_portal",
      "wp_theme_portal_7002",
      "wp_portlet_css",
      "wp_legacy_layouts",
      "wp_layout_windowstates",
      "wp_client_main",
      "wp_client_ext",
      "wp_theme_menus",
      "wp_one_ui_21",
      "jQuery",
      "jSquishy" 
     ]
    }
    
    After creating this profile_jquery.json i did upload it to /fs-type1/themes/Portal7.0.0.2/profiles/ folder in WebDAV
  5. Last step was to restart the changes for new module definition to get applied
  6. I did change the profile applied to one of my test page to profile_jquery.json by following steps defined in Changing the profile for a page
Now this is how my portal page looks like with squishy in both header and footer
When i looked at the request flow in the Firebug i can see the jQuery related resources being included. Follow the steps in Disabling combining of resource for debugging modular theme so that you can see individual request for resource.

3 comments:

Unknown said...

Great post. Finding ideas to write about is one of the hardest things about running a blog. Please visit https://goo.gl/EHWkgv

Unknown said...

Nice post and great content.
Avast Customer Support is here to help you out with the whole procedure to Download Avast Antivirus online, We not only fix your Avast Support related issues but will guide with how to get started with your new Avast product once it gets installed successfully. We at Avast Tech Support provides service to protect your PC from potential online threats and external attacks like viruses, Trojans, malwares, spywares and phishing scams. And Avast Refund. Call on our Avast Phone Number

Gmail Customer service is a third party technical support service for Gmail users when they face any technical issue or error in their Gmail account. Our Gmail Customer Support team solves issues like forgot Gmail account password, Gmail configuration or Sync issues, recover deleted emails and many more. Toll Free number (800) 986-9271

How you install or reinstall Office 365 or Office 2016 depends on whether your Office product is part of an Office for home or Office for business plan. If you're not sure what you have, see what office com setup products are included in each plan and then follow the steps for your product. The steps below also apply if you're installing a single, stand-alone Office application such as Access 2016 or Visio 2016. Need Help with office setup Enter Product Key? Call 1-800-000-0000 Toll Free
Norton Tech Support is a third party service provider and not in any way associated with Norton or any of its partner companies. We offer support for Norton products and sell subscription based additional warranty on computer and other peripheral devices. Call our Toll Free number 1 855 966 3855
Other Services
Norton Toll Free , Office-Setup , office.com/setup.

scoot said...

THANK YOU FOR THE INFORMATION
PLEASE VISIT US
Web designing company in Bangalore