Add other custom content

You can also add other content to a page. You can add a source of content by creating a new category and tagging portlets with that new category.

For example, you can add Web Content Manager content or feed readers to a page, by using the appropriate category. Both of these require extra work before you add them to the page. To do this, proceed by the steps given in the following. These instructions are intended for administrators and require basic javascript, json and dojo knowledge.

  1. Add a new category to the json file as described in the procedure for Adding a custom source. Use the com.ibm.data.JsonStore data store and omit the proxy and array of renderers. The URL should point to another json file that provides the items in the store.

      An example of an entry looks like this:

      {
      "label":"your_Category_Name",
      "searchStr":"Search your_Category_Name",
      "datastore":"com.ibm.data.JsonStore",
      "url":pathToTheJsonFileWithTheDatastoreItems.json",
      "renderers": []
      }

  2. Create the json file to hold the items that will show up under the new category in the Add Content widget. The json object in the file must contain an items array and optionally the strings required for a language support bundle.

      Example:

      { localizationPackageName:'com.ibm.bundles', localizationBundleName:'Customize', 
           identifier:'label', items:  [
      {'label':'wcm_blog',context:'/Blog/Home',
           'takeover':'com.ibm.customize.AddContentController.newWCM',
           'description':'new_wcm_blogDescription'},
      {'label':'wcm_blogLibrary',context:'/Blog/Central',
           'takeover':'com.ibm.customize.AddContentController.newWCM',
           'description':'new_wcm_blogLibraryDescription'},
      {'label':'wcm_wiki',context:'/Wiki Central/Home',
           'takeover':'com.ibm.customize.AddContentController.newWCM',
           'description':'new_wcm_wikiDescription'},
      {'label':'new_feed',
           'takeover':'com.ibm.customize.AddContentController.newFeed',
           'description':'new_wcm_feedDescription'}
      ] 
      }

      All the items in the example above have labels and descriptions that the Add Content widget can display. You can also add other required attributes to the item objects, such as the "context" attribute used by the Web Content Manager items above. Each item also must have a "takeover" attribute which is the name of a function in dot notation. This function is called when a user clicks to add the item. The function is called with one argument which is an object. thisObject.hub is a reference to the data store, and thisObject.item is a reference to the item in the data store. None of the usual functionality for adding content to a page will run.


Parent

Add content

  reworded first sentence Oct 7, 2010 10:03:58 AM


+

Search Tips   |   Advanced Search