Developers index

Object model

Objects are as much native as possible (Object in JavaScript and dict in Python). They are stored in a tree, the separator is slash – / – as usual. When rendered, objects are keeping their data using jQuery’s data, so information can be retrieved directly from the view. Keep in mind it is metadata, like links or tags, it shouldn’t contain a huge data set, except for text (since it can be handled in the web page natively).

Mandatory

id:a unique id used for interractions with server
mime:Some mime type, but instead of slashes you have dashes
link:The exact file name of the item (used to browse & do queries — it is the ID)
size:The “weight” of the item, by default expect bytes (see hr_size())
title:The full name of the item as displayed (will be set to mime if not set) — derived from `link` if not provided
editables:space-separated list of editable fields — all properties by default (same as “*”)

Bad example (lacks some properties, but should work)

{id: 43, mime: "text/plain", title: "Fun stuff"}

Additional

descr:(description) — Not used yet
thumb:HTML of a thumbnail for that item
descr:The (short) description of the item
classes:Additional (html) classes for this item

Custom

When returning/interpreting the item (in templates), non-standard metadata are passed to a data attribute, a list of key + value as in:

[ {'k': 'property-name', 'v': 'property-value'}, {'k': 'another prop', 'v': other_val} ]

On the JavaScript object, this data can be accessed via jQuery’s data method.

JSON model

When things are returned as collections (Array), to optimize transfers, the format is as follows, it shows some custom data as well:

{'c': ['title', 'mime', 'size', 'data'],
'r': [
    ['Toto', 'guy', 150, [{'k': 'hair', 'v': 'blond'}]],
    ['Tata', 'guri', 120, [{'k': 'hair', 'v': 'red'}, {k:'nails',v:'blue'}]]
]}

This Page