Behavior types

Behaviors are configurable frontend actions. The csBehavior implementation type is used to create asset and global behaviors.
The “where” and for “which” context a behavior should appear, is defined by its configuration and Behavior filters.

Asset behaviors

Each asset in censhare has a list of behaviors which can be executed for that asset.

In asset lists and search pages, the asset behaviors are displayed as actions in the drop-down menu as can be seen below, but as well as actions next to that menu (e.g.: csOpenAssetPage):
Asset behaviors

Behaviors, which are shown before a drop down have to be marked as: static: asset in configuration.
Only two icons can be shown before a drop down. The order of displaying the icons is determined by the priority property with a negative sign (e.g. priority: -4000):

"properties": {
    "static": "asset",
    "priority": -9999
}

and in the implementation:

getActionAPI: function() {
    return {
        icon: properties.icon,
        title: properties.title,
        priority: properties.priority
    };
}

They are provided together with the asset’s information to the frontend. The rest of the behaviors are loaded dynamically when opening the drop down. Dynamically loaded behaviors are also available on asset pages.

Asset behaviors page

Some behaviors might support multiple selection.
Asset behaviors multi

These behaviors have to be marked as: multipleSelection: true in the configuration.

Global behaviors

All Global behaviors appear in top navigation bar.

Global behaviors

csAssetCreateRelationBehavior

This behavior is handled in a completely unique way and adds the “+” icon to a widget, which is responsible for creating/adding or removing relations in the relation widget.
csAssetCreateRelationBehavior

The behavior filter context specifies the context for the behavior:

  • asset - the behavior will appear only for the asset
  • global - the behavior will appear as global in the top navigation bar
  • undefined - the behavior will appear both for assets and as global

New behavior

Adding a new behavior:

  • It must be declared in the Package JSON file of the module
  • A constructor needs to be implemented in the TypeScript file of the module

If the behavior should appear on any kind of page and any asset, then it’s recommended to create separate module for it. Creating a module to collect all custom behaviors, it’s also a good approach.

If the behavior belongs to a widget, then it would be better that it’s declared in the same module as the widget. This way, some additional injections will also be available for the behavior constructor.

When a behavior is defined in a widget module where the widget is not visible, the behavior will appear if it’s not hidden accordingly by any behavior filters.

Package JSON

A new behavior should be declared in the implementations part with type csBehavior:

"implementations": [
    {
        "type": "csBehavior",
        "name": "csNewBehavior",
        "constructor": "csNewBehaviorConstructor",
        "properties": {
            "filters": {
                "context": "asset",
                "csQueryParamFilter": "someValueForQueryParam",
                "csAssetTypePatterns": [
                    {
                        "assettype": "project.*",
                        "mimetype": "*"
                    },
                    {
                        "assettype": "task-list.*",
                        "mimetype": "*"
                    },
                    {
                        "assettype": "budget.*",
                        "mimetype": "*"
                    }
                ],
                "csAssetPermissions": [
                    "asset_edit_attributes",
                    "asset_edit_attributes_no_version",
                    "asset_checkout"
                ]
            },
            "icon": "cs-icon-circle-plus",
            "title": "csCommonTranslations.someTranslation",
            "priority": -1040
        }
    },
    ...
]

A behavior declaration contains the following properties:

  • name - the behavior’s name
  • type - it’s “csBehavior”
  • constructor - constructor name for the behavior, which is used in the TS file
  • properties - properties object:
    • static - (optional) it can be an “asset” or a “query”. A “query” is used only for a very specific csAssetCreateRelationBehavior
    • multiSelection - true, if the behavior supports multiple assets selection
    • filters array of the filters for the behavior
    • icon
    • title
    • priority
    • multiSelection is used only on assets. Value ‘true’, if the behavior should appear when multiple assets are selected

TypeScript

Defining a constructor for a new behavior:

m.constant("csNewBehaviorConstructor", ["properties", "name", "context",
    function (properties, name, context) {
        return {
            getName: function () {
                return name;
            },
            getActionAPI: function () {
                return {
                    icon: properties.icon,
                    title: properties.title,
                    callback: function (event) {
                        ...
                    }
                };
            }
        };
    }]
);

The constructor should return an object containing:

  • getName() - which is used by the framework
  • getActionAPI() - which returns an API for an action, including a callback which will be called when the behavior is clicked or executed

Injections

  • properties - properties defined in the package JSON file
  • name - name defined in the package JSON file
  • context - context of the execution:
    • empty object for the global actions
    • asset object, when executed for assets
    • asset objects array, when executed for a list of objects

Configuring behaviors in Workspace

It’s possible to configure actions in a Workspace by using assets.

  • Set icon
  • Set priority
  • Enable/disable behavior

Read more about Configuring Workspaces here.

Creating/adding actions with actionFactory

The actionFactory is responsible and can be used to create/add new actions to dialogs and widgets, as well as group them and toggle them. This factory is the replacement of the deprecated csActionsRegistry, it implements IActionFactory and it gathers in one place some of the necessary methods to work with actions in censhare Web.

Below we describe the factory’s available actions:

  • action(callback: IActionCallback)

An action with a simple callback to react upon clicks.
Input: IActionCallback
It returns the instance of a CustomAction
Example: Setting a button for a “close” action

import { actionFactory } from '<relative-path>/csActionFactory';
import { IActionGroup } from '<relative-path>/csActionInterfaces';
...
private getDependencies: () => {
        ...
        dialogInstance: IDialogInstance;
        csTranslate: any;
        ...
    };
private actions: IActionGroup;
 
...
 
$postLink(): void {
 
    const {dialogInstance} = this.getDependencies();
 
    const cancelAction = actionFactory.action(this.closeCallback).setTitle('csCommonTranslations.close');
 
    this.actions = dialogInstance.getActions();
    this.actions.addChildAfter(cancelAction);
 
...
 
}
 
...
 
private closeCallback = (): void => {
    const {dialogManager} = this.getDependencies();
    dialogManager.closeDialog();
};

  • toggleAction(callback: IActionBooleanCallback)

Allows an action to create a toggle effect.
Input: IActionBooleanCallback
It returns the instance of a IToggleAction
Example: Hide / Show toggle action for the side navigation bar

import {actionFactory} from '<relative-path>/csActionFactory';
import {IToggleAction} from '../../base/csActions/csActionInterfaces';
 
const actions: IActionGroup = actionFactory.group(),
 
const navBarToggleAction: IToggleAction = actionFactory.toggleAction(openCloseNavbar)
                    .setTitle('csCommonTranslations.showHideLeftNavigation')
                    .setIcons(['cs-icon-navpanel-open csHeaderNav__ToggleNavBarIcon', 'cs-icon-navpanel-closed csHeaderNav__ToggleNavBarIcon']);
actions
       .addChildAfter(navBarToggleAction);
.....
 
function openCloseNavbar(open: boolean) {
    // Custom callback function
}

  • customCallbackAction(callback: IActionCallback, view: IActionViewFactory)

Allows you to create a custom action given a custom callback action.
Inputs: a IActionCallback and the instance of a IActionViewFactory
It returns the instance of a ICustomAction
Example: Setting a button for a “next” action

import {actionFactory} from '<relative-path>/csActionFactory';
import {IToggleAction} from '../../base/csActions/csActionInterfaces';
 
...
 
const actions: IActionGroup;
const dialogInstance: IDialogInstance;
const submitViewFactory = new ModalSubmitViewFactory(censhare.getInjector);
const nextAction = actionFactory.customCallbackAction(this.nextCallback, submitViewFactory).setTitle('csCommonTranslations.next');
 
this.actions = dialogInstance.getActions();
this.actions.addChildAfter(nextAction);
...
 
private nextCallback = (): void => {
    //function logic
 };

  • group()

Creates a certain group out of certain given actions.
Example: A dropdown menu which combines actions that are grouped with group() .

dropDownMenu.addChildAfter(actionFactory.group()
   .addChildAfter(actionFactory.action(() => {}).setTitle('Action 1 from group 1'))
   .addChildAfter(actionFactory.action(() => {}).setTitle('Action 2 from group 1')));

  • overflowGroup()

Example:

//TODO

  • toggleGroup(callback: IActionToggleGroupCallback)

Allows to create a toggle effect for a group of actions
Input: IActionToggleGroupCallback
Output returns an instance of IActionToggleGroup
Example:

//TODO

  • toggleEntry()

Allows to create a toggle effect for an entry
It returns an instance of IActionToggleEntry
Example:

//TODO

Behavior Filters

csAssetPermissions

A behavior appears for an asset if the user has all listed permissions.

"filters": {
    ...
    "csAssetPermissions": ["asset_edit_attributes","asset_edit_attributes_no_version","asset_checkout"]
    ...
}

csAssetTypePatterns

A behavior appears only for listed asset types/mime types.

"filters": {
    ...
    "csAssetTypePatterns": [
        {
            "assettype":"picture.*",
            "mimetype":"*"
        },
        {
            "assettype":"video.*",
            "mimetype":"*"
        }],
    ...
}

checkedOut

Filters behaviors for checked out assets. This parameter can have true / false value.

"filters": {
    ...
    "checkedOut": "false",
    ...
}

context

Filters behaviors by context:

  • asset - a behavior will appear only for assets
  • global - a behavior will appear as a global action

"filters": {
    ...
    "context": "asset",
    ...
}

csAssetMarkDeletionState

The filter for the actions “move to trash” and “remove from trash”. If the asset was marked for deletion, then it has state ‘1’ and the action “remove from trash” will be displayed. Otherwise, the state is ‘0’ and only the action “move to trash” will appear. The state value can be 1.

"filters": {
    ...
    "csAssetMarkDeletionState": [0],
    ...
}

csAssetReadOnly

Checks if an asset is “read only”. This filter can have a true / false value.

"filters": {
    ...
    "csAssetReadOnly": "false",
    ...
}

csAssetVariant

Checks if a parent asset with a specified relation exists.
Possible values: “reset-update”, “update-transformation”, “show-original”

csCancelCheckout

Filter for the action to abort a checked out asset.
Requirement: The asset must be checked-out.
The user that has checked out the asset must have the permission asset_checkout_abort to cancel the checkout.
If a different user has checked out an asset, the user aborting the checkout must have the permission asset_checkout_abort_foreign.

"filters": {
    ...
    "csCancelCheckout": "true",
    ...
}

csChangeVariant

Possible values: “variant.0.”, “variant.1.”, “variant.3.”, “variant.4.”, “variant.transformation.”, “variant.resource.replace.”

csCompletionState

Checks if the asset has type = “task.approval.” and has completion state less than 100.

"filters": {
    ...
    "csCompletionState": "asset",
    ...
}

csFalse

A behavior never is delivered by the server. It can be added only manually. The `csFalse’ filter can have any value.

"filters": {
    ...
    "csFalse": "Never needed outside csCommunication",
    ...
}

csFavoriteAssets

Checks if an asset is in the “favorite” assets. This filter accepts true/false values.

"filters": {
    ...
    "csFavoriteAssets": "true",
    ...
}

csPermissions

Checks if the user has global permissions.

"filters": {
    ...
    "csPermissions": ["asset_checkin_new"]
    ...
}

csPinboardAssets

Checks if the asset is in the “pinboard”.
This filter accepts true / false values.

csQueryParamFilter

A behavior will be delivered by the server only if a specified parameter is set in the asset query.
It allows showing behaviors only for particular widgets/queries.

In JSON:

"filters": {
    ...
    "csQueryParamFilter": "some custom parameter"
    ...
}

In TypeScript:

queryBuilder = new csQueryBuilder();
...
queryBuilder..setQueryParamFilterValue('some custom parameter');
csApiSession.asset.liveQuery(qb.build(), $scope);

csRoles

Checks if a user has specified roles.

"filters": {
    ...
    "csRoles": ["admin"]
    ...
}

csSaveVersion

Filter for the action to save a checked out asset.

Requirement: The asset must be checked-out.
The user that has checked out the asset must have the permission asset_checkin_new.
If a different user has checked out the asset, the user executing the save action must have the permission asset_checkout_abort_foreign.

"filters": {
    ...
    "csSaveVersion": "true",
    ...
}

csServerCommand

Filters behaviors for a server command.
It disables the behavior if the command is disabled or it is not accessible.

"filters": {
    ...
    "csServerCommand": "find_replace.content-find-replace",
    ...
}

csStorageItemCheck

Filter to check whether or not an asset has a storage item.

"filters": {
    ...
    "csStorageItemCheck": "true",
    ...
}

archived

Filters behaviors for archived/re-archived assets.
This filter can have true/false values.

"filters": {
    ...
    "archived": "true",
    ...
}

csApprovalWorkflow

Checks if an asset is set to workflow “Approval” and workflow step “To approve” (workflow step: wf_id=“900001” wf_step=“10” name=“To approve”).

"filters": {
    ...
    "csApprovalWorkflow": "asset",
    ...
}

csAssetCreateRelationBehavior

Adds a possible relations list to the serverContext object in the behavior callback. This filter can have true / false values.

csAssetDeleteRelationBehavior

Adds a possible relations list which can be removed from the serverContext object in the behavior callback. This filter can have true / false values.

csAssetDefaultEditPage

Adds a default edit page ID for an asset to the serverContext object in the behavior callback. This filter can have true / false values.

csAssetDeletionLock

Checks if an asset has a deletion lock. It can have true / false values.

Permission Filters

Filters could be used to check for permissions on behaviors. The server will check for the required permissions and if the user doesn’t have the equivalent permissions, the behavior will not appear. Filters are added to a behavior description within the cs.pkg.json file of a module.

Asset permissions

Use the csAssetPermissions filter to check for asset permissions

{
    "name" : "csAssetBehaviors",
    ...
    "implementations": [{
        "type": "csBehavior",
        "name": "csAssetDeletionBehavior",
        "constructor": "csAssetDeletionBehavior",
        "properties": {
            "filters": {
                "context": "asset",
                "csAssetPermissions": [ "asset_deletion_phys" ],
                "checkedOut": "asset"
            },
            "multiSelection": true,
            "icon": "remove_2",
            "title": "csAssetBehaviors.deleteTitle"
        }
   }]
 ...
}

Global permissions

Use the csPermissions filter to check for global permissions:

{
    ...
    "filters": {
        "context": "global",
        "csPermissions": [
            "asset_deletion_phys"
        ]
     },
    ...
}

Existing behaviors

Asset behaviors

addRelatedBudgetNodeBehavior

Title: Add budget relation
Icon: cs-icon-circle-plus
Default priority: 2060
Filters:

  • context: “asset”
  • csQueryParamFilter: “csBudgetManagement”

csApprovalCompleteTaskBehavior

Title: Done
Icon: cs-icon-checkbox
Default priority: -50002
Filters:

  • context: “asset”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetTypePatterns: {“assettype”:“task.*”,“mimetype”:“*”}
  • csCompletionState: “asset”

csApprovalWorkflowApproveBehavior

Title: Approve
Icon: cs-icon-thumbs-up
Default priority: -50000
Filters:

  • context: “asset”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetTypePatterns: {“assettype”:“task.approval.*”,“mimetype”:“*”}
  • csApprovalWorkflow: “asset”

csApprovalWorkflowRejectBehavior

Title: Reject
Icon: cs-icon-thumbs-down
Default priority: -50001
Filters:

  • context: “asset”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetTypePatterns: {“assettype”:“task.approval.*”,“mimetype”:“*”}
  • csApprovalWorkflow: “asset”

csAssetAddToFavoriteAssetsBehavior

Title: Add to favorites
Icon: cs-icon-heart
Default priority: 5010
Filters:

  • context: “asset”
  • csFavoriteAssets: false

csAssetAddToPinboardAssetsBehavior

Title: Add to pinboard
Icon: cs-icon-pushpin
Default priority: 5020
Filters:

  • context: “asset”
  • csPinboardAssets: false

csAssetArchive

Title: Archive
Icon: cs-icon-archive
Default priority: 4020
Filters:

  • context: “asset”
  • archived: “true”
  • csAssetPermissions: “asset_archive”

csAssetAssignToBehavior

Title: Assign to
Icon: cs-icon-circle-arrow-right
Default priority: 2010
Filters:

  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • context: “asset”
  • csAssetPermissions: “asset_edit_attributes”

csAssetCancelEdit

Title: Cancel edit
Icon: cs-icon-circle-remove
Default priority: 1070
Filters:

  • context: “asset”
  • csCancelCheckout: true

csAssetChangeVariant0

Title: Change to variant without update flag
Default priority: 2010
Filters:

  • context: “asset”
  • csChangeVariant: “variant.0.”
  • csAssetPermissions: “asset_checkin_new”

csAssetChangeVariant1

Title: Change to variant with update flag
Default priority: 2020
Filters:

  • context: “asset”
  • csChangeVariant: “variant.1.”
  • csAssetPermissions: “asset_checkin_new”

csAssetChangeVariant3

Title: Change to layout geometry
Default priority: 2030
Filters:

  • context: “asset”
  • csChangeVariant: “variant.4.”
  • csAssetPermissions: “asset_checkin_new”

csAssetChangeVariant4

Title: Change to alias variant
Default priority: 2030
Filters:

  • context: “asset”
  • csChangeVariant: “variant.3.”
  • csAssetPermissions: “asset_checkin_new”

csAssetChangeVariantResourceReplace

Title: Change to resource replace variant
Default priority: 2050
Filters:

  • context: “asset”
  • csChangeVariant: “variant.resource.replace.”
  • csAssetPermissions: “asset_checkin_new”

csAssetChangeVariantTransform

Title: Change to transformation variant
Default priority: 2040
Filters:

  • context: “asset”
  • csChangeVariant: “variant.transformation.”
  • csAssetPermissions: “asset_checkin_new”

csAssetChooserDeselect

Title: csAssetChooserDialog.deselect
Icon: cs-icon-circle-minus
Default priority: undefined
Filters:

  • context: “asset”
  • csFalse: “never injected by server, injected by client only”

csAssetCreateDuplicate

Title: Duplicate
Icon: cs-icon-duplicate
Default priority: 2030
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetCreateMentionedRelationBehavior

Title: Add budget relation
Icon: cs-icon-circle-minus
Default priority: 0
Filters:

  • context: “asset”
  • csQueryParamFilter: “annotations”

csAssetCreateRelationBehavior

Title: Add relation
Icon: cs-icon-circle-plus
Default priority: 2062
Filters:

  • context: “asset”
  • csAssetCreateRelationBehavior: “true”
  • csAssetPermissions: “asset_checkout”,“asset_edit_attributes”

csAssetCreateVariant0

Title: Variant without update flag
Default priority: 1010
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetCreateVariant1

Title: Variant with update flag
Default priority: 1020
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetCreateVariant3

Title: Layout geometry variant
Default priority: 1030
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetCreateVariant4

Title: Alias variant
Default priority: 1040
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetCreateVariantResourceReplace

Title: Resource replace variant
Default priority: 1060
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetCreateVariantTransform

Title: Transformation variant
Default priority: 1050
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_checkin_new”

csAssetDeleteRelationBehavior

Title: Remove relation
Icon: cs-icon-circle-minus
Default priority: 2065
Filters:

  • context: “asset”
  • csAssetDeleteRelationBehavior: “true”

csAssetDeletionBehavior

Title: Delete
Icon: cs-icon-bin-alt
Default priority: 2090
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_deletion_phys”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetDeletionLock: “true”

csAssetJsonBehavior

Title: Show asset JSON
Icon: cs-icon-radar
Default priority: 90000
Filters:

  • context: “asset”
  • csAssetTypePatterns: {“assettype”:“*”,“mimetype”:“*”}

csAssetMarkForDeletionBehavior

Title: Move to trash
Icon: cs-icon-bin
Default priority: 2080
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_deletion_mark”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetMarkDeletionState: 0
  • csAssetDeletionLock: “true”

csAssetModifyGroupOfRelatedAsset

Title: Edit relation metadata
Icon: cs-icon-edit2
Default priority: 2068
Filters:

  • context: “asset”
  • csAssetDeleteRelationBehavior: “true”

csAssetPreviewBehavior

Title: Preview
Icon: cs-icon-visibility
Default priority: -1000
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_preview”

csAssetRearchive

Title: Dearchive
Icon: cs-icon-dearchive
Default priority: 4020
Filters:

  • context: “asset”
  • archived: “false”
  • csAssetPermissions: “asset_rearchive”

csAssetRelationMetaDataBehavior

Title: Edit relation metadata
Icon: cs-icon-edit2
Default priority: 2024
Filters:

  • context: “asset”
  • csFalse: “Never needed outside csRelatedAsset”
  • csAssetPermissions: “asset_edit_attributes”

csAssetRemoveFromFavoriteAssetsBehavior

Title: Remove from favorites
Icon: cs-icon-remove-favorite
Default priority: 5010
Filters:

  • context: “asset”
  • csFavoriteAssets: true

csAssetRemoveFromPinboardAssetsBehavior

Title: Remove from pinboard
Icon: cs-icon-remove-pushpin
Default priority: 5020
Filters:

  • context: “asset”
  • csPinboardAssets: true

csAssetRestoreBehavior

Title: Recover from trash
Icon: cs-icon-restart
Default priority: 2080
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_deletion_unmark”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetMarkDeletionState: 1

csAssetSaveAndClose

Title: Save and close
Icon: cs-icon-disk-save
Default priority: 1090
Filters:

  • context: “asset”
  • csSaveVersion: true

csAssetSaveVersion

Title: Save version
Icon: cs-icon-floppy-disk
Default priority: 1080
Filters:

  • context: “asset”
  • csSaveVersion: true

csAssetTempDownloadBehavior

Title: Create e-mail link
Icon: cs-icon-message-out
Default priority: 2120
Filters:

  • context: “asset”
  • csAssetPermissions: “asset_export_all”

csDemoBehavior

Title: Demo behavior
Icon: cs-icon-crown
Default priority: undefined
Filters:

  • context: “asset”

csDownloadAssetBehavior

Title: Download files
Icon: cs-icon-disk-save
Default priority: 2050
Filters:

  • context: “asset”
  • csStorageItemCheck: “true”
  • csAssetPermissions: “asset_export_all”

csMetadataQuickEditBehavior

Title: Edit metadata
Icon: cs-icon-edit
Default priority: 2020
Filters:

  • context: “asset”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetPermissions: “asset_checkout”,“asset_edit_attributes”

csMultiEditorBehavior

Title: Multi Editor
Icon: cs-icon-multi-edit
Default priority: 2021
Filters:

  • context: “asset”
  • csAssetPermissions: []
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csTrue: “Disabled in develop branch”

csNewChildProjectBehavior

Title: Create new project
Icon: cs-icon-circle-plus
Default priority: -1040
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”
  • csAssetTypePatterns: {“assettype”:“project.*”,“mimetype”:“*”},{“assettype”:“task-list.*”,“mimetype”:“*”},{“assettype”:“budget.*”,“mimetype”:“*”}
  • csAssetPermissions: “asset_edit_attributes”,“asset_edit_attributes_no_version”,“asset_checkout”

csNewChildTaskBehavior

Title: Create new task
Icon: cs-icon-circle-plus
Default priority: -1030
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”
  • csAssetTypePatterns: {“assettype”:“project.*”,“mimetype”:“*”},{“assettype”:“task-list.*”,“mimetype”:“*”},{“assettype”:“budget.*”,“mimetype”:“*”}
  • csAssetPermissions: “asset_edit_attributes”,“asset_edit_attributes_no_version”,“asset_checkout”

csOpenAssetPage

Title: Open
Icon: cs-icon-resize-full
Default priority: -2000
Filters:

  • context: “asset”
  • csAssetDefaultEditPage: true

csProjectPlanningScrollToBarBehavior

Title: Scroll to begin
Icon: cs-icon-transfer
Default priority: -1050
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”

csRemoveAssetFromCommunicationMessageBehavior

Title: Remove from message draft
Icon: cs-icon-circle-minus
Default priority: -1000
Filters:

  • context: “asset”
  • csFalse: “Never needed outside csCommunication”

csRemoveProjectPlanningItemBehavior

Title: Delete
Icon: cs-icon-bin
Default priority: -99
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”
  • csAssetTypePatterns: {“assettype”:“project.*”,“mimetype”:“*”},{“assettype”:“task.*”,“mimetype”:“*”},{“assettype”:“task-list.*”,“mimetype”:“*”},{“assettype”:“budget.*”,“mimetype”:“*”}
  • csAssetPermissions: “asset_checkout”

csReorderAssetDownBehavior

Title: Move down
Icon: cs-icon-down-arrow
Default priority: -3000
Filters:

  • context: “asset”
  • csQueryParamFilter: “csSortableList”
  • csAssetDeleteRelationBehavior: “true”

csReorderAssetUpBehavior

Title: Move up
Icon: cs-icon-up-arrow
Default priority: -3000
Filters:

  • context: “asset”
  • csQueryParamFilter: “csSortableList”
  • csAssetDeleteRelationBehavior: “true”

csReorderProjectItemDownBehavior

Title: Move down
Icon: cs-icon-down-arrow
Default priority: -1010
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”
  • csAssetTypePatterns: {“assettype”:“task.*”,“mimetype”:“*”},{“assettype”:“task-list.*”,“mimetype”:“*”},{“assettype”:“project.*”,“mimetype”:“*”}
  • csAssetPermissions: “asset_checkout”

csReorderProjectItemUpBehavior

Title: Move up
Icon: cs-icon-up-arrow
Default priority: -1020
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”
  • csAssetTypePatterns: {“assettype”:“task.*”,“mimetype”:“*”},{“assettype”:“task-list.*”,“mimetype”:“*”},{“assettype”:“project.*”,“mimetype”:“*”}
  • csAssetPermissions: “asset_checkout”

csResetUpdateFlag

Title: Reset update flag
Default priority: 996
Filters:

  • context: “asset”
  • csAssetVariant: “reset-update”

csRestartService

Title: Update branding configuration
Icon: cs-icon-spray
Default priority: 6010
Filters:

  • context: “asset”
  • csAssetTypePatterns: {“assettype”:“module.system.*”,“mimetype”:“*”}
  • csRoles: “admin”

csSearchPageRelatedAssetsBehavior

Title: Show relations
Icon: cs-icon-relation
Default priority: 2070
Filters:

  • context: “asset”

csServerActionAssetExport

Title: Export assets
Icon: cs-icon-disk-save
Default priority: undefined
Filters:

  • context: “asset”
  • csServerCommand: “asset_export_import.aa-asset-export-action”

csServerActionContentFindReplace

Title: Find and replace in content
Icon: cs-icon-find-content
Default priority: undefined
Filters:

  • context: “asset”
  • csServerCommand: “find_replace.content-find-replace”

csShowOriginal

Title: Show original
Icon: cs-icon-circle-arrow-top
Default priority: 998
Filters:

  • context: “asset”
  • csAssetVariant: “show-original”

csSocialMediaPostWizardCreateBehavior

Title: Create social media post
Icon: cs-icon-share-alt
Default priority: 2110
Filters:

  • context: “asset”
  • csAssetTypePatterns: {“assettype”:“picture.*”,“mimetype”:“*”},{“assettype”:“video.*”,“mimetype”:“*”}

csUpdateTransformationVariant

Title: Update transformation
Icon: cs-icon-refresh
Default priority: 997
Filters:

  • context: “asset”
  • csAssetVariant: “update-transformation”

csWorkspaceTemplate

Title: Create workspace template
Icon: cs-icon-workspace
Default priority: 1020
Filters:

  • context: “asset”
  • csAssetTypePatterns: {“assettype”:“module.workspace.”,“mimetype”:“*”}

removeRelatedBudgetNodeBehavior

Title: Remove relation
Icon: cs-icon-circle-minus
Default priority: -4000
Filters:

  • context: “asset”
  • csQueryParamFilter: “csBudgetManagement”

Global behaviors

csActionDividerGlobal1091

Default priority: 1091
Filters:

  • context: “global”

csServerActionAssetImportGlobal

Title: Import assets
Default priority: 2010
Filters:

  • context: “global”
  • csServerCommand: “asset_export_import.asset-import-action”

csSocialMediaWizardCreateGlobalBehavior

Title: Create social media post
Default priority: 1020
Filters:

  • context: “global”

csWebToPrintWizardCreateBehavior

Title: Create print document
Default priority: 1010
Filters:

  • context: “global”
  • csPermissions: “asset_checkin_new”

Dividers

csActionDivider1005

Default priority: -1005
Filters:

  • context: “asset”
  • csQueryParamFilter: “csProjectPlanning”
  • csAssetTypePatterns: {“assettype”:“project.*”,“mimetype”:“*”},{“assettype”:“task.*”,“mimetype”:“*”},{“assettype”:“task-list.*”,“mimetype”:“*”},{“assettype”:“budget.*”,“mimetype”:“*”}
  • csAssetPermissions: “asset_checkout”

csActionDivider1091

Default priority: 1091
Filters:

  • context: “asset”
  • csSaveVersion: true

csActionDivider1990

Default priority: 1990
Filters:

  • context: “asset”
  • csAssetTypePatterns: {“assettype”:“module.workspace.”,“mimetype”:“*”}

csActionDivider2009

Default priority: 2009
Filters:

  • context: “asset”
  • csChangeVariant: “variant.0.”
  • csAssetPermissions: “asset_checkin_new”

csActionDivider2059

Default priority: 2059
Filters:

  • context: “asset”
  • csAssetReadOnly: “false”

csActionDivider2071

Default priority: 2071
Filters:

  • context: “asset”
  • checkedOut: “false”
  • csAssetReadOnly: “false”
  • csAssetDeletionLock: “true”

csActionDivider2101

Default priority: 2101
Filters:

  • context: “asset”

csActionDivider4009

Default priority: 4009
Filters:

  • context: “asset”

csActionDivider5009

Default priority: 5009
Filters:

  • context: “asset”

csActionDivider6000

Default priority: 6000
Filters:

  • context: “asset”
  • csAssetTypePatterns: {“assettype”:“module.system.*”,“mimetype”:“*”}
  • csRoles: “admin”

csActionDivider999

Default priority: 999
Filters:

  • context: “asset”
  • csAssetVariant: “show-original”

Behavior Extensions

Behavior extensions are implemented to enable system administrators to configure custom access to certain behaviors. This can be done by customizing Roles or Permissions which overwrite a behavior’s default access.

Setting up Behavior Extensions

Go to the censhare-Custom folder and create a csBehaviors and a cs.pkg.json file, as displayed below:

$ cd censhare-Custom
$ mkdir censhare-Server/app/web/src/ng1/client/base/csBehaviors
$ cd censhare-Server/app/web/src/ng1/client/base/csBehaviors
$ touch cs.pkg.json
$ vi cs.pkg.json

The content of the cs.pkg.json file:

{
    "name": "csBehaviors",
    "since": "5.0.0",
    "version": "0.1.1",
    "filename": "behaviors.module",
    "types": [
        {
            "name": "csBehavior",
            "constructor": "csBehavior"
        },
        {
            "name": "csBehaviorGroup",
            "constructor": "csBehaviorGroup"
        },
        {
            "name": "csBehaviorExtension",
            "constructor": "csBehaviorExtension"
        }
    ]
}

In censhare-Custom create a second directory for csBehaviorExtensions and add a cs.pkg.json file to it. This directory will contain the custom behavior configurations.

$ mkdir censhare-Server/app/web/src/ng1/client/base/csBehaviorExtensions
$ cd censhare-Server/app/web/src/ng1/client/base/csBehaviorExtensions
$ touch cs.pkg.json

Requirements

  • A behavior must have the type csBehaviorExtension
  • Its name must match the name of an existing behavior
  • If an original behavior has permissions/roles then specifying new permissions/roles in the extended behavior will overwrite the default ones
  • If an original behavior has no roles then adding roles into an extended behavior will enable the original behavior to have roles

Here is a sample of a custom configuration:

{
  "name": "csBehaviorExtensions",
  "since": "2018.3",
  "version": "0.0.1",
  "implementations": [
    {
      "name": "csNewChildMilestoneBehavior",
      "type": "csBehaviorExtension",
      "properties": {
        "filters": {
          "csRoles": [
            "b-role1"
          ]
        }
      }
    },
    {
      "name": "csNewChildTaskBehavior",
      "type": "csBehaviorExtension",
      "properties": {
        "filters": {
          "csRoles": [
            "b-role2"
          ],
          "csPermissions": [
              "asset_checkout",
              "asset_edit_attributes"
          ]
        }
      }
    },
    {
      "name": "csNewChildProjectBehavior",
      "type": "csBehaviorExtension",
      "properties": {
        "filters": {
          "csRoles": [
            "b-role1", "b-role2"
          ]
        }
      }
    },
    {
      "name": "csReorderProjectItemDownBehavior",
      "type": "csBehaviorExtension",
      "properties": {
        "filters": {
          "csPermissions": [
              "asset_checkout",
              "asset_edit_attributes"
          ]
        }
      }
    }
  ]
}