Data types

From The Smartest Wiki
Jump to: navigation, search

Virtually all parametric information in Smartest is characterised as one of Smartest's Data types.

Data types are defined in System/Core/Types/datatypes.xml.

There are broadly three groups of these data types: basic, foreign key, and many-to-many.

Basic data types

The basic types are single values, even if compound, that can be submitted, stored, retrieved and displayed virtually anywhere. They are mostly things like strings, numbers, booleans, dates, but are getting increasingly useful and domain specific, for example SmartestRgbColor, SmartestTwitterAccountName or SmartestScreenPosition.

The basic types, with their underlying class and internal identifier code, are:

  • Short text field - a very simple, basic string. Stored in a SmartestString object. (SM_DATATYPE_SL_TEXT)
  • Number - any numeric value, stored in a SmartestNumeric object (SM_DATATYPE_NUMERIC)
  • External URL - stores a web address, starting with http:// or https://. Stored in a SmartestExternalUrl object. (SM_DATATYPE_URL)
  • Multi-line plain text - useful for short descriptions and synopses, and can be parsed for textile formatting, but does not support easy links and text cannot be referenced or used elsewhere. Stored in a SmartestString object. (SM_DATATYPE_ML_TEXT)
  • Boolean - a true/false value. Stored in a SmartestBoolean object. (SM_DATATYPE_BOOLEAN)
  • Color - A 24-bit RGB colour. Stored in a SmartestRgbColor object. (SM_DATATYPE_RGB_COLOR)
  • Country - One of the world's countries, using the ISO 3166-1 Alpha-2 standard. (SM_DATATYPE_COUNTRY)
  • Email address - (SM_DATATYPE_EMAIL_ADDRESS)
  • Intellectual property licence - Allows you to choose from commonly used software or media licenses. (SM_DATATYPE_LICENSE)
  • Timestamp - An exact point in time - year, month, day, hour, minute, and second. Stored in a SmartestDateTime object. (SM_DATATYPE_TIMESTAMP)
  • Day - A date that specifies year, month, and day of the month, but not the time of day. Stored in a SmartestDateTime object. (SM_DATATYPE_DATE)
  • Calendar event - An event that has a start and end time, or runs all day. Stored in a SmartestCalendarEvent object, which contains two SmartestDateTime objects. (SM_DATATYPE_CALENDAR_EVENT)
  • Twitter username - A user account on the social networking service Twitter. Stored in a SmartestTwitterAccountName object. (SM_DATATYPE_TWITTER_ACCT)
  • RSS or Atom feed - The address of a feed of external content using RSS or Atom. Stored in a SmartestExternalFeed object, which is a subclass of SmartestExternalUrl. (SM_DATATYPE_FEED)
  • Screen position - Can store X,Y pixel coordinates, useful for providing control over complex layouts without any coding. Stored in a SmartestScreenPosition object. (SM_DATATYPE_PIXEL_COORDINATES).
  • ISBN code for books - International standard book number. Stored in a SmartestString object although this is likely to be subclassed into a more specific SmartestIsbn class in the future. (SM_DATATYPE_ISBN)

More basic data types are due to be added soon, such as latitude/longitude, language, license

The main page for this topic is: Basic types

Foreign key types

Although very different in their usage, the following properties all share the feature that they consist of a data object which, with the exception of the dropdown menu type, is identified, when stored by its primary key in the database.

Dropdown menu

Smartest allows a user to build a dropdown menu by inputting and ordering a series of name/value pairs. Dropdown menus are easy for most users and can be used for item properties or page fields. Actual values returned are SmartestDropdownOption objects.

Page

The page type is used to represent the identity of a single, existing page in your site hierarchy. Returned as a SmartestPage object.

Item

The item type is used to represent the identity of a single, existing item, on the same site. Item properties of this type are also restricted by model when the property is created. Returns a SmartestCmsItem-based object corresponding to the model that the item belongs to.

Item set

Provides a choice of item set. For item properties, the choice is limited to sets of only one model, one the property has been created. The model is chosen when the property is created. Returns a SmartestCmsItemSet object.

File

The choice of a file. Choice can be limited both by filetype, and to the members of a file group, provided there exists a file group that is compatible with the selected file type. The selected file is returned as a SmartestRenderableAsset object, which is a subclass of SmartestAsset designed for very easy rendering.

File group

Provides a choice of file groups. Returns a SmartestAssetGroup object.

File gallery

Provides a choice of file galleries

Single Item Template

Provides a choice of single-item template. Returns a SmartestTemplateAsset object.

Single tag

Allows the choice of one tag. Returns a SmartestTag object.

Many-to-many types

Item selection

File selection