/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Node } from "../../types/javax/jcr/Node"; import type { String } from "../../types/java/lang/String"; import type { Map } from "../../types/java/util/Map"; /** * Utility interface for content manipulation of a sv:page, sv:article or a sv:template. * *

* The provided HTML content is converted to Sitevision text, html and image portlets. It is also possible to specify * that a horizontal or a vertical layout should be created. Class and styles can be specified. A class must correspond * to a Sitevision site font or exists in an external CSS to have any effect. It is possible to specify a name of the * subsequent portlet by using a named anchor (<a name="the_name_of_the_portlet"></a>). * The name of a layout can also be specified by adding a name attribute to the layout div, se examples below. *

* *

* Note! Content is per default considered as "text". This means that all content will be put in a single * text portlet until the html code indicates something else. An indication can be any of the following: *

* * *

* Below are some detailed examples that should explain the format more precise: *

*
*

* Image portlet: Image references are resolved against the images on local page repository and * fall-backs to the image repository. *

* *

* Example 1: an image portlet with name "anImage" is created. *

*

 *     <a name="anImage" /><img src="logo.jpg" />
 *  
* *

* Example 2: an image portlet is created with an alt text, a caption and a class. Sitevision will decide the name of the portlet. *

*

 *     <img alt="Sitevision AB logo" caption="A Caption" class="aClass" src="templates/sitevision_logo.png" />
 *  
* *

* Text portlet: All subsequent text content (i.e. not images) will be placed in a text portlet. * It is possible to create links and to provide style and class information to text sections. Links will be resolved * to real / internal Sitevision pages if possible. Links to files and images will be resolved from the local image / file * repositories and fall-back to the site image / file repository. * Text sections specified with <em> or <i> will be handled as emphasized and * sections specified with <strong> or <b> will be handled as strong. *

*

* Example 1: a text portlet with name "aText" containing text and a link. *

*

 *        <div>
 *           <a name="aText" />
 *           <p>What a <em>nice</em> content management and <a href="/portal.html">portal</a> solution I have
 *              built today.</p>
 *        </div>
 *  
* *

* Example 2: two text portlets, one header and one body like text. *

*

 *        <h2 title="aDecoration">Welcome</h2>
 *        <div>
 *           <a name="aText" />
 *           <p>Welcome to the Sitevision days!</p>
 *        </div>
 *  
* *

* Example 3: a text portlet consisting of a table with two columns and one row. *

* *

* Table summary and table caption are optional. Table headings (th) will be recognized. * A style attribute containing the css property text-align (left, right or center) * and background-color will be recognized for table cells (td/th). Note that the background-color property value * must start with a hash and match a color that exists on the site (for example #FFFFFF). * By default the table created will be given the class of the table selected as standard for the site. *

*

 *       <table summary="This is an example table">
 *       <caption>A caption</caption>
 *          <tr>
 *             <th>A header</th>
 *             <th>Another header</th>
 *          </tr>
 *          <tr>
 *             <td>A cell</td>
 *             <td style="text-align:right">Another cell</td>
 *          </tr>
 *       </table>
 *  
* *

* * Example 4: a text portlet with a table containing a table type specifier. The class of the specified table type will be assigned. * If the provided name does not exist, the standard table class will be assigned. * *

*

 *       <table data-table-type-name="Test table">
 *          <tr>
 *             <th>A header</th>
 *          </tr>
 *          <tr>
 *             <td>A cell</td>
 *          </tr>
 *       </table>
 *  
*

* Example 5: A numbered list with a start number specifier (optional) *

*

 *     <ol start="5">
 *        <li>Item 5</li>
 *        <li>Item 6</li>
 *     </ol>
 *  
* *

* Layouts: by specifying a div with the attribute layout horizontal or vertical a * layout can be created. It is also possible to specify name of the layout and a decoration. Note that the decoration must be * a Sitevision site decoration. If both decoration and style is specified the style information will be ignored. *

* * *

* Example 1: create a horizontal layout with decoration "aDecoration" and name "aName". *

*

 *        <div layout="horizontal" decoration="aDecoration" name="aName">
 *           <!-- layout content -->
 *           ...
 *        </div>
 *  
* *

* Example 2: create vertical layout with style information and name "aName". *

*

 *        <div layout="vertical" style="margin: 10px; border: thin solid black" name="aName">
 *           <!-- layout content -->
 *           ...
 *        </div>
 *  
* *

* Here is a more extensive example *

*

 *        <a name="aHeader" />
 *        <h2 title="aH2SiteFont">Welcome to Sitevision</h2>
 *        <img name="anImage" alt="Sitevision AB logo" class="aClass" src="templates/sitevision_logo.png" />
 *        <div layout="horizontal" decoration="aSiteDecoration" name="aHorizontalLayout">
 *           <a name="aText" />
 *           <p class="aTextSiteFont">
 *              <strong>Sitevision AB</strong> is the company behind the CMS and portal system <em>Sitevision</em>
 *           </p>
 *           <div layout="vertical" style="border: thin solid black" name="aVerticalLayout">
 *              <a name="aText" />
 *              <p>The table displays the ...</p>
 *              <a name="aTable" />
 *              <table summary="This is a data table">
 *              <caption>Table of data</caption>
 *                 <tr>
 *                    <th>Time</th>
 *                    <th>Value</th>
 *                 </tr>
 *                 <tr>
 *                    <td>1.001</td>
 *                    <td>Aaaabb+</td>
 *                 </tr>
 *                 <tr>
 *                    <td>2.22</td>
 *                    <td>Addabb+++</td>
 *                 </tr>
 *              </table>
 *           </div>
 *        </div>
 *  
*

* Which creates the following content structure: *

*

 *      |--aHeader (text portlet)
 *      |--anImage (image portlet)
 *      |--aText (text portlet)
 *      |--aHorizontalLayout (layout)
 *        |--aText (text portlet)
 *        |--aVerticalLayout (layout)
 *           |--aText (text portlet)
 *  
* *

* Grids: by specifying a div with the attribute layout GRID a grid can be created. *

* *

* Example 1: create a fixed grid with decoration "aDecoration" and name "aName". *

*

 *        <div layout="GRID" decoration="aDecoration" name="aName">
 *           <!-- grid content -->
 *           ...
 *        </div>
 *  
* *

* Example 2: create a fluid grid with decoration "aDecoration" and name "aName". *

*

 *       <div layout="FLUID_GRID" decoration="aDecoration" name="aName">
 *          <!-- grid content -->
 *          ...
 *       </div>
 *  
* *

* Example 3: create a fixed flexible grid with rows and columns *

*

 *     <div layout="FIXED_FLUID_GRID" decoration="aDecoration" name="aName">
 *        <div layout="GRID_ROW">
 *           <!-- grid row content -->
 *           <div layout="GRID_COLUMN_6">
 *              <p>Grid column content ...</p>
 *           </div>
 *           <div layout="GRID_COLUMN_6">
 *              <p>Grid column content ...</p>
 *           </div>
 *        </div>
 *     </div>
 *  
* *

* Iframes: sending an iframe tag will create a HTML module with the URL attribute set to the iframe src. *

* *

Example: iframe with content from OpenStreetMap. Title is optional.

* *

 *     <iframe
 *     title="Sitevision HQ"
 *     src="https://www.openstreetmap.org/export/embed.html
 *     ?bbox=15.20972639322281%2C59.27124397410192%2C15.21217256784439%2C59.272217043706846&layer=mapnik"
 *     ></iframe>
 *  
* *
* *

* An instance of the Sitevision class implementing this interface can be obtained via * {@link senselogic.sitevision.api.Utils#getWebContentUtil()}. * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface. *

* @author Mikael Wikblom * @since Sitevision 2.6.2 */ export interface WebContentUtil { /** *

* Alters the content of a sv:page, sv:article or a sv:template. *

* *

* If an invalid node type is specified a IllegalArgumentException is thrown. The page content is specified as a * HTML string used to generate a portlet structure in the first layout available. The provided * content is converted to Sitevision text, html and image modules. It is also possible to specify that a horizontal * or a vertical layout should be created. *

* *

* Note that the content (i.e portlets and layouts) of the first layout will be replaced, not appended. *

* *

* The current user must be authorized to alter the node or a ConstraintViolationException is thrown. *

* *

* If no node or no content is specified a NullPointerException is thrown. *

* @param aNode aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page. * @param aContent the HTML content. May not be null * @throws ConstraintViolationException if the current user is not allowed to alter the node * @throws RepositoryException if something else goes wrong * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ updateContent(aNode: Node, aContent: String | string): void; /** *

* Alters the content of a sv:page, sv:article or a sv:template. *

* *

* If an invalid node type is specified a IllegalArgumentException is thrown. The page content is specified using the * content map containing keys corresponding to layout names (e.g. "Huvudinnehåll") on the page and values containing the * HTML used to generate a portlet structure in the layout. The provided content is converted to * Sitevision text, html and image modules. It is also possible to specify that a horizontal or a vertical * layout should be created. *

* *

* The names of the content map must correspond to layout names on the page. *

* *

* Note that the content of the specified layouts (i.e portlets and layouts) will be replaced, not appended. *

* *

* The current user must be authorized to alter the node or a ConstraintViolationException is thrown. *

* *

* If no node or no content is specified a NullPointerException is thrown. *

* @param aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page. * @param aContent a map containing the HTML content. The keys must correspond to layout names on the node. May not be null * @throws ConstraintViolationException if the current user is not allowed to alter the node * @throws RepositoryException if something else goes wrong * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ updateContent(aNode: Node, aContent: Map | {}): void; /** * Alters the content of a sv:page, sv:article or a sv:template with raw HTML (a HTML portlet is created). * *

* Note! This method creates a single HTML portlet that contains all supplied content. This method * is intended to be used as a temporary solution when the proper {@link #updateContent(javax.jcr.Node, java.util.Map)} * and {@link #updateContent(javax.jcr.Node, String)} methods for some reason can't be used. Typically when converting badly formatted * legacy CMS data into Sitevision content. I.e. this method enables creation of content that later on ought to be manually converted * to proper Sitevision portlets. *

* *

* Note! Content is treated as-is, hence no internal links or references to local resources will be resolved * as with the {@link #updateContent(javax.jcr.Node, java.util.Map)} and {@link #updateContent(javax.jcr.Node, String)} methods. * The {@link #resolveToResourceURL(javax.jcr.Node, String)} can be used to manually try to resolve "old" resource url to a "new" * Sitevision resource url. *

* @param aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @param aContent the HTML content. May not be null * @throws NullPointerException if aNode is null or if aContent is null * @throws IllegalArgumentException if aNode is of invalid type * @throws ConstraintViolationException if current user is not allowed to alter aNode * @throws RepositoryException if something else goes wrong * @since Sitevision 3.6 * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ updateContentWithRawHtml(aNode: Node, aContent: String | string): void; /** * Alters the content of a sv:page, sv:article or a sv:template with raw HTML (a HTML portlet is created). * *

* Note! This method creates a single HTML portlet for each supplied content entry. This method * is intended to be used as a temporary solution when the proper {@link #updateContent(javax.jcr.Node, java.util.Map)} * and {@link #updateContent(javax.jcr.Node, String)} methods for some reason can't be used. Typically when converting badly formatted * legacy CMS data into Sitevision content. I.e. this method enables creation of content that later on ought to be manually converted * to proper Sitevision portlets. *

* *

* Note! Content is treated as-is, hence no internal links or references to local resources will be resolved * as with the {@link #updateContent(javax.jcr.Node, java.util.Map)} and {@link #updateContent(javax.jcr.Node, String)} methods. * The {@link #resolveToResourceURL(javax.jcr.Node, String)} can be used to manually try to resolve "old" resource url to a "new" * Sitevision resource url. *

* @param aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @param aContent a map containing the HTML content. The keys must correspond to layout names on the node. May not be null * @throws NullPointerException if aNode is null or if aContent is null * @throws IllegalArgumentException if aNode is of invalid type * @throws ConstraintViolationException if current user is not allowed to alter aNode * @throws RepositoryException if something else goes wrong * @since Sitevision 3.6 * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ updateContentWithRawHtml(aNode: Node, aContent: Map | {}): void; /** * Appends the content to the existing node. * *

* If an invalid node type is specified a IllegalArgumentException is thrown. The page content is specified as a * HTML string used to generate a portlet structure in the first layout available. The provided * content is converted to Sitevision text, html and image modules. It is also possible to specify that a horizontal * or a vertical layout should be created. *

* *

* Note that the content (i.e portlets and layouts) of the first layout will be appended, not replaced. *

* *

* The current user must be authorized to alter the node or a ConstraintViolationException is thrown. *

* *

* If no node or no content is specified a NullPointerException is thrown. *

* @param aNode aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page. * @param aContent the HTML content. May not be null * @throws NullPointerException if aNode is null or if aContent is null * @throws IllegalArgumentException if aNode is of invalid type * @throws ConstraintViolationException if the current user is not allowed to alter the node * @throws RepositoryException if something else goes wrong * @since Sitevision 2022.08.1 * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ appendContent(aNode: Node, aContent: String | string): void; /** *

* Append the content to the existing node. *

* *

* If an invalid node type is specified a IllegalArgumentException is thrown. The page content is specified using the * content map containing keys corresponding to layout names (e.g. "Huvudinnehåll") on the page and values containing the * HTML used to generate a portlet structure in the layout. The provided content is converted to * Sitevision text, html and image modules. It is also possible to specify that a horizontal or a vertical * layout should be created. *

* *

* The names of the content map must correspond to layout names on the page. *

* *

* Note that the content of the specified layouts (i.e portlets and layouts) will be appended, not replaced. *

* *

* The current user must be authorized to alter the node or a ConstraintViolationException is thrown. *

* *

* If no node or no content is specified a NullPointerException is thrown. *

* @param aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page. * @param aContent a map containing the HTML content. The keys must correspond to layout names on the node. May not be null * @throws NullPointerException if aNode is null or if aContent is null * @throws IllegalArgumentException if aNode is of invalid type * @throws ConstraintViolationException if the current user is not allowed to alter the node * @throws RepositoryException if something else goes wrong * @since Sitevision 2022.08.1 * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ appendContent(aNode: Node, aContent: Map | {}): void; /** * Appends raw HTML (a HTML portlet is created) to the existing content of a node. * *

* Note! This method creates a single HTML portlet that contains all supplied content and appends it to the existing content. * This method is intended to be used as a temporary solution when the proper {@link #updateContent(javax.jcr.Node, java.util.Map)} * and {@link #updateContent(javax.jcr.Node, String)} methods for some reason can't be used. Typically when converting badly formatted legacy * CMS data into Sitevision content. I.e. this method enables creation of content that later on ought to be manually converted to proper * Sitevision portlets. *

* *

* Note! Content is treated as-is, hence no internal links or references to local resources will be resolved * as with the {@link #updateContent(javax.jcr.Node, java.util.Map)} and {@link #updateContent(javax.jcr.Node, String)} methods. * The {@link #resolveToResourceURL(javax.jcr.Node, String)} can be used to manually try to resolve "old" resource url to a "new" * Sitevision resource url. *

* @param aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @param aContent the HTML content. May not be null * @throws NullPointerException if aNode is null or if aContent is null * @throws IllegalArgumentException if aNode is of invalid type * @throws ConstraintViolationException if current user is not allowed to alter aNode * @throws RepositoryException if something else goes wrong * @since Sitevision 3.6 * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ appendContentWithRawHtml(aNode: Node, aContent: String | string): void; /** * Appends raw HTML (a HTML portlet is created) to the existing content of a node. * *

* Note! This method creates a single HTML portlet that contains all supplied content and appends it to the existing content. * This method is intended to be used as a temporary solution when the proper {@link #updateContent(javax.jcr.Node, java.util.Map)} * and {@link #updateContent(javax.jcr.Node, String)} methods for some reason can't be used. Typically when converting badly formatted legacy * CMS data into Sitevision content. I.e. this method enables creation of content that later on ought to be manually converted to proper * Sitevision portlets. *

* *

* Note! Content is treated as-is, hence no internal links or references to local resources will be resolved * as with the {@link #updateContent(javax.jcr.Node, java.util.Map)} and {@link #updateContent(javax.jcr.Node, String)} methods. * The {@link #resolveToResourceURL(javax.jcr.Node, String)} can be used to manually try to resolve "old" resource url to a "new" * Sitevision resource url. *

* @param aNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @param aContent a map containing the HTML content. The keys must correspond to layout names on the node. May not be null * @throws NullPointerException if aNode is null or if aContent is null * @throws IllegalArgumentException if aNode is of invalid type * @throws ConstraintViolationException if current user is not allowed to alter aNode * @throws RepositoryException if something else goes wrong * @since Sitevision 3.6 * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) */ appendContentWithRawHtml(aNode: Node, aContent: Map | {}): void; /** * Resolves an unresolved URL to a resource (potentially needed for all resource references in HTML content that later is * updated or appended as raw HTML). * *

* Note! HTML content is treated as-is when using the * {@link #appendContentWithRawHtml(javax.jcr.Node, java.util.Map)}, {@link #appendContentWithRawHtml(javax.jcr.Node, String)}, * {@link #updateContentWithRawHtml(javax.jcr.Node, java.util.Map)} or {@link #updateContentWithRawHtml(javax.jcr.Node, String)}. * Hence no internal links or references to local resources will be resolved as with the {@link #updateContent(javax.jcr.Node, java.util.Map)} * and {@link #updateContent(javax.jcr.Node, String)} methods. * This method can be used to manually try to resolve "old" resource url to a "new" Sitevision resource url. *

* @param aNode the node that aUnresolvedURL should be resolved for, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @param aUnresolvedURL an unresolved URL * @return the potentially resolved URL * @throws NullPointerException if aNode is null or if aUnresolvedURL is null * @throws IllegalArgumentException if aNode is of invalid type * @since Sitevision 3.6 */ resolveToResourceURL(aNode: Node, aUnresolvedURL: String | string): string; /** * Removes the page content of the first root layout for a sv:page, sv:article or a sv:template. * *

* Content of the first root layout available on the node will be removed. * Use {@link #removeAllContent(Node, String)} instead to specify a specific root layout. *

* *

* Current user must have effective WRITE permission to mutate the node or a ConstraintViolationException is thrown. *

* *

* This method is typically called to clear all content before adding new content via {@link #updateContent(Node, String)} *

* @param aPageNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @throws NullPointerException if aPageNode is null * @throws IllegalArgumentException if aPageNode is of invalid type * @throws ConstraintViolationException if current user is not allowed to alter aPageNode * @throws RepositoryException if something else goes wrong * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) * @since Sitevision 2024.03.1 */ removeAllContent(aPageNode: Node): void; /** * Removes the page content of a root layout for a sv:page, sv:article or a sv:template. * *

* Current user must have effective WRITE permission to mutate the node or a ConstraintViolationException is thrown. *

* *

* This method is typically called to clear all content before adding new content via {@link #updateContent(Node, Map)} *

* @param aPageNode the node that will be altered, typically a node with primary node type sv:page or sv:article. May not be null and may not be the site page * @param aRootLayoutName the name of the root layout of aPageNode to remove content from (e.g. "Huvudinnehåll") * @throws NullPointerException if aPageNode or aRootLayoutName is null * @throws IllegalArgumentException if aPageNode is of invalid type or if there are no root layout named aRootLayoutName * @throws ConstraintViolationException if current user is not allowed to alter aPageNode * @throws RepositoryException if something else goes wrong * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node) * @since Sitevision 2024.03.1 */ removeAllContent(aPageNode: Node, aRootLayoutName: String | string): void; } declare namespace WebContentUtil {} declare var webContentUtil: WebContentUtil; export default webContentUtil;