PortalToolsCopletManagement

The Coplet-Management-Plugin provides functions to modify the Layout of the portal. One function provided by the plugin is a skin-selector and the other modífies the layout itself. The Tabs, Columns, Rows and Coplets can be moved, created deleted or configured.

Components

XMLProfileGenerator + CreateIndex.xsl

The XMLProfileGenerator generates a basic XML-Representation of the portal-layout. The CreateIndex.xsl stylesheet adds unique id’s to every element. With a layout-stylesheet it is used to display a reduced representaion of the original portal to the user (the portal without content).

Sample

Flow:

function showXml() {
  var toolManager = getPTM();
  var portalObjects = toolManager.getPortalObjects();
  var portalLayout = portalObjects.getPortalLayout();
  cocoon.sendPage("layoutProfile", 
                   {"layout" : portalLayout });
  toolManager.releasePortalObjects(portalObjects);
  relPTM(toolManager);
}

Sitemap:

<map:match pattern="layoutProfile">
  <map:generate type="xmlprofile"/>
  <map:transform src="styles/createIndex.xsl„/>
  <map:serialize type="xml"/>
</map:match>

Result:

<composite-layout name="tab" id="maintab">
        <named-item id="1.1" name="Main">
        <coplet-layout id="Portal-Demo-1" name="coplet">
<coplet-instance-data id="1.1.1.1">Portal-Demo-1</coplet-instance-data>
</coplet-layout>
</named-item>
        <named-item id="1.2" name="News">
        <composite-layout id="1.2.1" name="column">
<parameter name="border" value="0"/>
<parameter name="border-color" value="#225599"/>
        <item id="1.2.1.1">
<parameter name="width" value="50%"/>
        <composite-layout id="1.2.1.1.1" name="row">
<parameter name="border" value="0"/>
<parameter name="border-color" value="#AACCFF"/>
        <item id="1.2.1.1.1.1">
        <coplet-layout id="Newsweek-1" name="coplet">
<parameter name="border" value="0"/>
<parameter name="border-color" value="#AA0000"/>
<coplet-instance-data id="1.2.1.1.1.1.1.1">Newsweek-1</coplet-instance-data>
</coplet-layout>
</item>
        <item id="1.2.1.1.1.2">
        <coplet-layout id="NYTBusiness-1" name="coplet">
<parameter name="border" value="0"/>

...

LayoutActions

LayoutActions is a class which has some basic methods to modify the portal layout. More information is available in the javadoc or in the source itself.

Usage Example

Flow:

function showTab(showId) {
  var toolManager = getPTM();
  // get the other objects
  var layoutActions = new Packages.org.apache.cocoon.portal.tools.copletManagement.LayoutActions(
    portalLayout,                       
    componentManager.getLayoutFactory(),                                           
    componentManager.getCopletFactory(), 
    profileManager);
  var id = cocoon.request.id;
  var action = cocoon.request.action;
  var actionitem = cocoon.request.actionitem;
  if(action == "addCol") {
    layoutActions.add(actionitem, "column");
  }
  cocoon.sendPage("page/showTab/" + id, {"layout" : portalLayout });
  toolManager.releasePortalObjects(portalObjects);
  relPTM(toolManager);
}

PortalToolsCopletManagement (last edited 2009-09-20 23:40:44 by localhost)