Hi Erik,

I'm not familiar with the document migration code but here's an overview of how 
the UI stores and retrieves sakai docs.

Sakai documents are stored as rows and columns. A default/new Sakai document 
has one row, one column and no content.
The structure of a page (basically the left hand nav with references to the 
content) is stored in the 'structure0' property, for example:

"structure0": "{
    "page1": {
        "_ref": "id33633",
        "_order": 0,
        "_title": "Documentation for Sakai Document structure",
        "main": {
            "_ref": "id33633",
            "_order": 0,
            "_title": "Documentation for Sakai Document structure"
        }
    }
}"

To match this "page1" to the content that's on that page (rows, columns and 
widgets in those) you take the "_ref" and look for the object with that key at 
/p/poolid.json.
In this case that would give us:

"id33633": {
    "rows": {
        "__array__0__": {
            "id": "id18682982",
            "columns": {
                "__array__0__": {
                    "width": 1,
                    "elements": ""
                }
            }
        }
    }
}

The Sakai document for a new document is empty so the 'elements' will be empty 
above as you can see. (We use this value to determine if we should show the 
empty placeholder in the UI.)
Let's say we added a 'htmlblock' widget to that row and saved the page, that 
same JSON block would look like:

"id33633": {
    "rows": {
        "__array__0__": {
            "id": "id18682982",
            "columns": {
                "__array__0__": {
                    "width": 1,
                    "elements": {
                        "__array__0__": {
                            "id": "id3427609",
                            "type": "htmlblock"
                        }
                    }
                }
            }
        }
    }
}

It now has an element of the type 'htmlblock' and an id pointing us to its 
content.
To get the content for that widget we look up the object that has the id 
"id3427609":

"id3427609": {
    "htmlblock": {
        "content": "<p>Documentation for Sakai Document structure that will be 
sent to list.</p>"
    }
}


Other things that are good to know:
- Autosave happens on regular intervals when a user makes changes to the 
documents. This data is saved to a temporary space and then copied over to the 
permanent space when saved.
    - If an autosave is present when someone starts editing a Sakai doc, 
they'll be able to restore the autosave which copies over the tmp space to the 
permanent space (like a save would) and deletes the tmp space.
    - If an autosave is present when someone starts editing a Sakai doc but 
they don't restore it, the tmp space gets deleted.

- No concurrent editing at the moment
    - When a document is being edited, someone else trying to edit will get a 
message and won't be able to before the other person saves or is inactive.
    - A users stays active by posting the current timestamp to the sakai doc. 
If the user navigates away the timestamp doesn't update and opens up edit mode 
for other users.

- The content authoring widget is used on every page in Sakai. It's the 
backbone of much of our UI as it takes the same structure for every page and 
renders it (e.g. dashboard is a Sakai doc and the content can be configured in 
the config.js file, worlds are a bunch of sakai docs grouped together and are 
configurable).


Did you have questions about any elements in specific?
I hope this helps you out a bit already,

- Bert



On 8 Aug 2012, at 21:58, Erik Froese <erik.fro...@gmail.com> wrote:

> If not  would someone from the UX team be willing to give me a primer?
> Shouldn't take long, sometimes I'm a fast learner.
> Erik
> 
> On Wed, Aug 8, 2012 at 2:32 PM, Erik Froese <erik.fro...@gmail.com> wrote:
>> I'm trying to work my way through the document migration code. I'm
>> getting hung up on not understanding the intention of certain
>> elements.
>> 
>> Can anyone point me to something that explains the rationale behind
>> the structure of a sakai document?
>> 
>> Erik
> _______________________________________________
> oae-dev mailing list
> oae-dev@collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/oae-dev

_______________________________________________
oae-dev mailing list
oae-dev@collab.sakaiproject.org
http://collab.sakaiproject.org/mailman/listinfo/oae-dev

Reply via email to