Snap2 is a low- to mid-level content management system. It implements essentially a smart filesystem on top of a database using PHP.
There are three types of objects that are relevant to content organization: directories, resources and versions. A directory serves as a container for other directories or resources. A resource represents a logical piece of content, such as an XML document, an image or an applet. Each resource has zero or more versions. These versions allow parallel development of content without affecting what appears on the websites. Additionally, there are permissions attached to resources and directories which control what can be done to them, although everybody has the ability to view Snap2 content.
A file is a directory or resource. Because these two types of objects share many common features, they will be described together in this short section. Every file has a short name, name and description. It also has a parent, a canonical path and a unique ID. The short name is a quick name that is unique (within a containing directory) and doesn't contain special characters or spaces (it must contain only a combination of alphanumeric characters, underscores, hyphens or dollar signs). The regular name (or just "name") is a descriptive name that can contain spaces and other weird characters. It is also often used when displaying the resource or directory. The description can be much longer than the name and may provide additional information about the resource or directory. It is not required and does not have any functional capacity in the Snap2 system.
There must also be a way to talk about a file. That's where paths and IDs come in. Each directory and resource has its own ID that is unique for its type. That is, there is only one directory with ID 23 and only one resource with ID 45. There may be a resource with ID 23, but it is distinct from the directory with ID 23. A path basically describes how to get to a file from the root directory. Because of links, there may be multiple paths that refer to the same resource or directory. One path is considered the "real" path to the file, and this path is called the canonical path. The basis for the canonical path is in the relationship between each element of the path. Going from right to left (that is, from the most specific part of the path to the least), each succeeding element must be the parent of the on to its right. So, for the path "//interactivate/applets/fgame", the directory "applets" must be the parent of "fgame" and "interactivate" must be the parent of "applets" and "/" must be the parent of "interactivate". Since a directory or resource can only have one parent, such a path is guaranteed to be unique. Canonical paths are also important for permissions because permissions cascade from parents to children and the canonical path describes the parent to child relationship exactly.
Snap2 also keeps track of when a file was created and when it was last modified. Modification means that any attribute of the file has changed, such as its name, or its parent. Changing content within a resource does not count as modification (that applies to versions, however).
A directory contains zero or more directories or resources inside of it. Those subdirectories may themselves contain further subdirectories and resources ad infinitum (although there are practical limits on exactly how deeply nested directories can be). There are two directories which are considered to be the base, or root, directories for Snap2. All other directories must be inside one of these two directories:
-
root (path: //): this directory is the root of all active directories and resources. There should be no resources directly inside the root directory, and the directories inside the root directory should be for large projects.
-
deleted (path: /DELETED/): this directory contains all directories and resources that have been deleted from the root directory, but haven't yet been completely destroyed yet. It is like a recycling bin for Snap2. Only someone with administrative privileges in /DELETED/ can destroy or restore files located here.
Sometimes directories contain files that aren't actually in the directory in that those files do not have the directory as their one and only parent. These files are considered to be links to the real files they represent which exist in other directories. The link files do not derive any permissions from the directory that contains them, but other than that, they might as well exist inside that directory. You can construct paths using links. For example, suppose that in "//interactivate/applets/" there is a resource called "fgame". It's canonical path would be "//interactivate/applets/fgame". Suppose that we wanted to use this applet in another project, like CSERD. Then we would create a link in "//cserd/activities/" called "//cserd/activities/fgame". Note that we don't have a copy of fgame inside the CSERD directory. It's the same resource. But in the second case, it's really just a link to the real fgame resource, located inside Interactivate.
A version represents a particular revision of content in
Snap2. Each resource contains zero or more versions.