JSMA content

Overview

What can JSMA content do for me?

The JSMA content provides access to one WebContent in the database.

Index

Methods

The JSMA content provides the following methods:

Pathname content.asPdf([filename])

Renders an HTML-content into a PDF via wkhtmltopdf and returns it as a JSMA File for further access.

Example

... 
content.asPdf('content.pdf')
...

Parameter filename:String (optional)

Determines the filename of the generated file.

String content.content

Renders to content into a String

Example

... 
content.content
...

void content.delete()

Deletes the content in the current users slice.

Slice aware

This entity is slice aware, which means that to use this facility:

  • there must be a logged in user in the context of the execution
  • this user must be currently within a slice
  • this user must have the necessary privileges to edit the entity (IFE → System → Benutzer → Roles → Content-Management)

Example

... 
content.delete()
...

String content.description

Returns the description of the content

Example

... 
content.description
...

Object content.execute([arguments])

Executes a database call if the content is either a SQLQuery or SQLCommand and returns the result.

Interpolates the arguments safely into the query. Use '?' markers in your query und give that many arguments.

The result of this call may be null for a SQLCommand or an Object - with the keys metaData, fields and results - for a SQLQuery.

Example

... 
content.execute('some', 'arguments')
...

Parameter arguments (optional)

content.flexAttributes

Returns an array of flex attributes for the content

Example

... 
content.flexAttributes
...

string content.get(key)

Returns the value of key as string or null if no value is set under the key.

Example

... 
content.get(key)
...

Parameter key:string (required)

The key to be looked up in the flexAttributes of the content.

string content.cacheKey

Returns a string that you can use in the fragment cache. This string will change whenever the content changes.

Example

... 
content.cacheKey # => "7346689223053409007"
...

String content.getContentUnprocessed()

Returns the raw unprocessed body of a content.

Example

... 
content.getContentUnprocessed()
...

Date content.getLockDate

Returns the date of when a content has been locked on

Example

... 
content.getLockDate
...

String content.getLockMessage

Returns the specified locking reason.

Example

... 
content.getLockMessage
...

Object content.getLockUser

Returns an information object about the user.

Example

... 
content.getLockUser # => { id: 1, email: 'user@example.org' }
...

boolean content.has(key)

Returns a boolean value depending on whether key is present for a given content

Example

... 
content.has(key)
...

Parameter key:string (required)

The key to be checked in the flexAttributes of the content

content.id

Return the ID of a content

Example

... 
content.id
...

content.increment(key)

Increments the vale of a given key by one.

Example

... 
content.increment(key)
...

Parameter key:string (required)

The key to be incremented in the flexAttributes of the order.

Boolean content.isLocked

Returns whether a content is currently locked.

Example

... 
content.isLocked
...

Object content.lastChanges

Returns the last changes that have been made to the content.

Example

... 
content.lastChanges
...

String content.lastChangesBy

Returns the name of the last user that changed the content.

Example

... 
content.lastChangesBy => 'a.user'
...

Void content.lock([reason])

Locks a content.

Example

... 
content.lock('Do not edit.')
...

Parameter reason (optional)

String content.mapping

Returns the regular expression this content is mapped with.

Example

... 
content.mapping
...

String content.mappingType

Returns the mapping type of the content

Example

... 
content.mappingType
...

content.metaDescription

Return the meta description of the content

Example

... 
content.metaDescription
...

content.metaKeywords

Returns the meta keywords of the content

Example

... 
content.metaKeywords
...

content.metaTitle

Returns the meta title of the content

Example

... 
content.metaTitle
...

content.mimeType

Returns the mime type of the content

Example

... 
content.mimeType
...

content.name

Returns the name of the content

Example

... 
content.name
...

content.packageId

Returns the package ID of a content

Example

... 
content.packageId
...

content.remove(key)

Removes the key from the flexAttributes of the content

Example

... 
content.remove(key)
...

Parameter key:string (required)

The key to be removed from the flexAttributes of the order.

int content.revision

Returns the revision of a content

Example

... 
content.revision
...

content.set(key, value, [options])

Sets the value of a specified key for a given content.

Example

... 
content.set(key, value, [options])
...

Parameter key:string (required)

The key to be set in the flexAttributes of the content.

Parameter value:string (required)

The value to be set for the key

Parameter options:object (optional)

May have a key 'broadcastEvent':bool which determines whether the log message shows up in the websocket log view.

content.setBody(body)

Sets the body of the content to the specified parameter

Example

... 
content.setBody(body)
...

Parameter body (required)

content.setName(name)

Sets the name of the content to the specified parameter

Example

... 
content.setName(name)
...

Parameter name (required)

content.sliceId

Returns the slice ID of the current content

Slice aware

This entity is slice aware, which means that to use this facility:

  • there must be a logged in user in the context of the execution
  • this user must be currently within a slice
  • this user must have the necessary privileges to edit the entity (IFE → System → Benutzer → Roles → Content-Management)

Example

... 
content.sliceId
...

string[] content.tags

Returns an arrow of the tags for a content

Example

... 
content.tags
...

content.template

Returns the template used for a content

Example

... 
content.template
...

content.type

Returns the content type of a content

Example

... 
content.type
...

content.unlock([reason])

Unlocks a content

Example

... 
content.unlock([reason])
...

Parameter reason (optional)

content.update(options)

Updates the content

Example

... 
content.update(options)
...

Parameter options (required)

Following values must be set, depending on the type:

  • All types:
    • name
    • namespace
  • Seite
    • mapping url
    • mime-type
  • Weiterleitung
    • (no further values needed)
  • Widget
    • mime-type
  • Template
    • (no further values needed)
  • Makro
    • mime-type
  • WebEvent
    • (no further values needed)
  • Dokumentation
    • (no further values needed)
  • Test
    • (no further values needed)
  • Universal
    • mime-type
  • SQL-Query
    • (no further values needed)
  • Sql-Command
    • (no further values needed)

content.uuid

Returns the UUID of the content

Example

... 
content.uuid
...

content.version

Returns the version of the content

Example

... 
content.version
...