Nodes
There are 2 kind of nodes: The WsFileNode that represents a file and the WsDirNode that represents a directory. The WsFileNode has the following properties:
- FileSize (in WsFileNode)
- Modification date (in WsFileNode)
- Creation date (not implemented) (in WsFileNode)
- publish_date (in properties)
- author (in properties
- short_desc (in properties)
- in_menu : item is displayes or not in the menu
- in_view : item is displayes or not in the view (SiteMap, ...)
- FS properties
- .config Properties
- publish_date (in WsNodeProperties) default time(now)
- author (in WsNodeProperties) default is the editor of the document
- short_desc (in properties) default empty
- in_menu : appears in menu or not, default false
- in_view : appears in view or not, default true
- sort_number: default -1
- sort: sort files or no: default true
The WsDirNode has the following properties:
- in_parent: is the list of files in the directories displayed when we display the directory?
- not inherited from parent directory
- default: true
- in_menu: is the directory displayed in the menu? Beware, if the parent has in_menu=false, and in the subdirectory you set in_menu=true, it will have no effect! -in_view
- not inherited from parent directory
- value: true or false
- default: false
- groups: user groups that have access to this directory. "Guest" is the group used for publicly accessible directories.
- not inherited from parent directory
- value: list of group names
- default: empty
- sort_criteria: criteria by which to order the children in this directory
- not inherited
- value: name, publish_date, size
- default: name
- sort_order: order in which to display the children of this directory: asc/desc
- not inherited
- value: asc or desc
- default: asc
- inherit_from_parent : If set to true the current node will take its permissions from the parent. This is a recursive call. If the current node has groups defined, it will override the inherit_from_parent flag.
Content element configuration
Each directory and file can have a config file. For directories, the config file is named properties.json and located under the .config subdirectory. For files, the config file has the same name with the .json extension appended, and is located under the .config/nodes subdirectory of its parent directory:
- base_dir
- about
- .config
- properties.json
- nodes
- index.html.json
- index.html
Sort Number
For the sort order based on the sort number: The sort number is read by the parser and put into the properties. Each time the FileSystemTree ends browsing a directory, (the endChild method is called), the FileSystemTree calls the sort() method of the current Node. The sort method tests if the sort flag is set to true. If so, the fileVect and dirVect is sorted based on the sort number. The combinedVect is created and sorted also. For intance:
- Node 1: 3
- Node 2: -
- Node 3: 2
- Node 4: 4
- Node 5: 1
The sorted vector will contain the Nodes is this order
[Node5, Node3, Node1, Node4, Node2]
Node edition
It is possible to edit a Node configuration or contents (ie. contents of the file represented by the node). When a node is going to be edited, the methods WsUser::getLock() should be called prior to that. This method will check for a current lock and if it does not found any, it will create a lock file in .config/locks/ . The file will be named following this pattern filename.ext.json. The file contains the UID of the editor and a the current timestamp in ms. The lock is valid for 30 min (this value is configurable in config file WsGlobalConfig). After the timeout the lock will be dropped.