MobileCRM.UI.MediaTab.setCommandsMask - Resconet/JSBridge GitHub Wiki

[v11.1] Sets the mask of allowed document actions.

Arguments

Argument Type Description
commandMask Number Specifies the mask of allowed commands.
errorCallback function(errorMsg) The errorCallback which is called in case of error.

This example demonstrates how to to filter media tab document action commands.

var DocumentAction = {
	/** No action.*/
	None: 0x0000,
	/** Configures the view for ink input.*/
	CaptureInk: 0x0001,
	/** Asks the user to capture a photo and loads the choosen media into the view.*/
	CapturePhoto: 0x0002,
	/** Asks the user to choose a media (image, video, depending on what the platform supports) and loads the choosen media into the view.*/
	SelectPhoto: 0x0004,
	/** Asks the user to choose a file and loads it into the view.*/
	SelectFile: 0x0008,
	/** Asks the user to record an audio note and loads it into the view.*/
	RecordAudio: 0x0010,
	/** Asks the user to record a video and loads it into the view.*/
	RecordVideo: 0x0020,
	/** Gets last photo taken and loads it into the view.*/
	UseLastPhotoTaken: 0x0040,
	/** Asks the user to choose file from either online or offline location and loads it into the view.*/
	LoadFrom: 0x0080,
	/** Clears the view and marks it as empty.*/
	Clear: 0x1000,
	/** Shows a preview of the loaded document (fullscreen, etc.).*/
	View: 0x2000,
	/** Opens the loaded document in a external application. Which application is platform specific.*/
	OpenExternal: 0x4000,
	/** Sends the document to another application. This command is implemented only on Android.*/
	SendTo: 0x8000,
	/** Virtual action handled in common code.*/
	Download: 0x10000,
	/** Copy image to clipboard.*/
	Copy: 0x20000,
	/** Paste image from clipboard.*/
	Paste: 0x40000,
	/** Prints the document.*/
	Print: 0x80000,
	/** Let user to choose smaller image resolution.*/
	ResizeImage: 0x100000,
	/** Let user import VCard attachment (handled in common code).*/
	Import: 0x200000,
	/** Pass document to edit in external app (Microsoft office so far[15.6.2015]).*/
	Edit: 0x400000,
	/** Send document as attachment.*/
	Email: 0x800000,
	/** Ask the user to choose multiple images.*/
	SelectMultiplePhotos: 0x1000000,
	/** Asks the user to choose multiple files from either online or offline location and loads it into the view.*/
	LoadFromMultiple: 0x2000000,
	/** Opens image in the image editor.*/
	EditImage: 0x4000000,
	/** Saves to file to disk.*/
	Export: 0x8000000,
	/** Actions that are non-destructive.*/
	ReadOnlyMask: 0x88ae000, // SendTo | View | OpenExternal | Print | Email | Copy | Export
};
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	// get media tab by its name
	var media = entityForm.getMediaTab("DocumentAction");
	media.setCommandsMask(DocumentAction.CapturePhoto | DocumentAction.SelectPhoto, MobileCRM.bridge.alert);
}, MobileCRM.bridge.alert, null);