Device
From Sense/Net Wiki
- 100%
- 6.0.5
- Enterprise
- Community
Planned
Overview
The Device content type is responsible for handling specific 'devices' that are used to access the portal. A device can be an internet browser, a tablet device or a mobile phone.
Details
- Devices represent a physical device (e.g. Windows Phone 7) or an internet browser (Internet Explorer, Chrome) that is used to browse the portal.
- Devices are created under a specific folder in the Content Repository: /Root/System/Devices
- Devices are used by the Smart Application Model to find a customized application for that device. For example it is possible to create a custom browse page for the main Workspaces page for a tablet - see Device-aware applications for more details.
- The portal uses the User Agent information sent by the browser to identify the appropriate device for every request. If a specific device does not exist, the default device will be the browser (e.g. IE, FF, CH).
- Devices can be structured in hierarchy. For example if there is an iPad device, a specific device may exist for the iPad2. If the portal does not find an application for the specific device (iPad2), it will present the iPad application as a fallback. 'Child' devices must be placed under the fallback device in the Content Repository - e.g. /Root/System/Devices/iPad/iPad2
Parent type
Content handler
- SenseNet.ApplicationModel.Device
The content handler of the Device content type is responsible for matching a device to the user agent string. The basic algorithm employs the UserAgentPattern value of the device content. It must be a regular expression that looks for signs of that particular device in the user agent string.
User Agent sample, sent by the browser
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) version/4.0.4 Mobile/7B367 Safari/531.21.10
Default UserAgentPattern value for an iPad
[^a-zA-Z0-9]+iPad[^a-zA-Z0-9]+
For Developers
It is possible to customize the matching algorithm by creating a custom Content Handler for your device and overriding the Identify method.
Fields
| Field title | Field name | Field type | Inherited from | Description |
|---|---|---|---|---|
| Ancestor Content Type Names | TypeIs | NodeType | GenericContent | Ancestor content types of the node in the repository. |
| Ancestors | InTree | ShortText | GenericContent | Ancestor paths. |
| Approvable By Current User | Approvable | Boolean | GenericContent | This fileld is true if the content is in 'pending' state and can be approved by the current user. |
| Checked Out To | CheckedOutTo | Reference | GenericContent | The user currently locking the content. |
| Checkin comments | CheckInComments | LongText | GenericContent | Comments for a new version. |
| Content Approval | InheritableApprovingMode | InheritableApprovingMode | GenericContent | Specify whether new or changed content below the current one should remain in a draft state until they have been approved. |
| Content Approval For Current Content | ApprovingMode | ApprovingMode | GenericContent | It shows the approval mode of the current content. |
| Content Type Name | Type | NodeType | GenericContent | Content type of the node in the repository. |
| Content Types | ContentTypes | Reference | GenericContent | You can specify which content types the user can create as children below this content. |
| Created by | CreatedBy | Reference | GenericContent | Content creator. |
| Created By (Id) | CreatedById | Integer | GenericContent | Id of creator. |
| Creation date | CreationDate | DateTime | GenericContent | Content creation date. |
| Description | Description | LongText | GenericContent | Description of the content. |
| Disable Trash | TrashDisabled | Boolean | GenericContent | You can disable trash for this content and its children. If set, you can not restore deleted content. |
| Display Name | DisplayName | ShortText | GenericContent | Content name. You can set any name you prefer without any restrictions. |
| Enable Lifespan | EnableLifespan | Boolean | GenericContent | Specify whether you want to define starting and end date for the validity of this content. |
| Enable Rating | IsRateable | Boolean | GenericContent | Specify whether you would like to enable rating capability for this content. |
| Enable Tagging | IsTaggable | Boolean | GenericContent | Specify whether you would like to enable tagging capability for this content. |
| Extension data | ExtensionData | LongText | GenericContent | You can set extra data in this field which is useful when extending a content. |
| Hidden | Hidden | Boolean | GenericContent | If checked, content will not show up in navigation. |
| Id | Id | Integer | GenericContent | Unique Id for the content. |
| Index | Index | Integer | GenericContent | Content order in navigation. Numbers closer to 0 will appear first. |
| Last Modified By (Id) | ModifiedById | Integer | GenericContent | Id of last modifier. |
| Locked | Locked | Boolean | GenericContent | It shows whether the content is checked out or not. |
| Modification Date | ModificationDate | DateTime | GenericContent | Content was last modified on this date. |
| Modified By | ModifiedBy | Reference | GenericContent | Content was last modified by this user. |
| Name | Name | ShortText | GenericContent | Specify a name that will appear in the address bar of the browser. |
| Parent Id | ParentId | Integer | GenericContent | Id of the parent content. |
| Parent Path | InFolder | ShortText | GenericContent | Parent path of the content. |
| Path | Path | ShortText | GenericContent | Content path in the repository. |
| Publishable By Current User | Publishable | Boolean | GenericContent | This fileld is true if the content can be published by the current user. |
| Reference To Browse Application | BrowseApplication | Reference | GenericContent | Set this, if you would like to override the default browse application. |
| System Content | IsSystemContent | Boolean | GenericContent | This field is true if content is in a system folder/trash or the content is a system folder/file. |
| Tags | Tags | LongText | GenericContent | List of tags and creators of them separated by commas. |
| Tree Depth | Depth | Integer | GenericContent | Content level in the tree. Root level is 0. |
| User Agent pattern | UserAgentPattern | ShortText | Device | A regular expression to match the user agent string of the browser |
| Valid From | ValidFrom | DateTime | GenericContent | This content will appear on the date you set if lifespan handling is enabled for this content. |
| Valid Till | ValidTill | DateTime | GenericContent | This content will disappear on the date you set if lifespan handling is enabled for this content. |
| Version | Version | Version | GenericContent | Version number. |
| Version History | InheritableVersioningMode | InheritableVersioningMode | GenericContent | Specify whether the system should create a new version whenever you create or modify a content below this content. |
| Version Id | VersionId | Integer | GenericContent | Database row Id of current version. |
| Versioning Mode For Current Content | VersioningMode | VersioningMode | GenericContent | It shows the versioning mode of the current content. |
| Versions | Versions | Reference | GenericContent | Content version history. |
| Workflows Running | WorkflowsRunning | Reference | GenericContent | True if one or more workflows are running on this content |
| Workspace | Workspace | Reference | GenericContent | The container workspace of the content |
Full featured code
<?xml version="1.0" encoding="utf-8"?> <ContentType name="Device" parentType="Folder" handler="SenseNet.ApplicationModel.Device" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition"> <DisplayName>Device</DisplayName> <Description>Device</Description> <Icon>Device</Icon> <Fields> <Field name="UserAgentPattern" type="ShortText"> <DisplayName>User agent string</DisplayName> <Description>A regular expression to match the user agent string of the browser</Description> </Field> </Fields> </ContentType>