new_folder

ID: new_folder

This brings up the New Folder wizard that guides users through the process of creating a new folder within the currently viewed folder. This wizard is aware of the currently viewed folder and the current user and derives its behavior based off of those contexts. The newly created folder is created as a child of the current folder.

Sample Code

var UI = require("ui");

var actionContext = {};
UI.startAction(observableHolder, "new_folder", actionContext, function(err) {

    // if something went wrong, err will contain the error
    // otherwise, success

});

Configuration

This action derives some of its behavior from the configuration service.

Types

By default, this wizard will create child folders of type Node (n:node). Users can elect to customize the content type of child folders.

The content type list can be customized using the configuration service. Use the types array to specify the content types that this dialog should let editors pick from, like this:

{
    "new-folder": {
        "remove": true,
        "types": [{
            "qname": "my:photosFolder",
            "title": "Photos Folder"
        }, {
            "qname": "my:videosFolder",
            "title": "Videos Folder"
        }]
    }
}

Suppose, for example, that you want these folder types to be available as sub-folders for folders of type my:mediaFolder. You could do something like the following:

{
    "evaluator": "context-document-has-type",
    "condition": "my:mediaFolder",
    "config": {
        "new-folder": {
            "remove": true,            
            "types": [{
                "qname": "my:photosFolder",
                "title": "Photos Folder"
            }, {
                "qname": "my:videosFolder",
                "title": "Videos Folder"
            }]
        }
    }
}

Other Options

The following additional options are available:

  • pickTypeDefault - specifies whether the type picker checkbox is selected by default.
  • typeDefault - specifies the default value you'd like to have picked from the list.

For example, you might do the following:

{
    "evaluator": "context-document-has-type",
    "condition": "my:mediaFolder",
    "config": {
        "new-folder": {
            "remove": true,            
            "types": [{
                "qname": "my:photosFolder",
                "title": "Photos Folder"
            }, {
                "qname": "my:videosFolder",
                "title": "Videos Folder"
            }],
            "pickTypeDefault": true,
            "typeDefault": "my:videosFolder"
        }
    }
}

This will make it so that the Videos Folder is picked by default.