SaWALi Controllers

Controllers - DocsmanagerController

Controllers - DocsmanagerController

Description

The DocsmanagerController is SaWALi's Content Management System controller. This controller requires that a "reference document" is selected and uses a GET key (doc, an Integer that matches a document.__id__) to make that selection. If a doc key was not given, the controller assumes that the reference document is the root document (__id__ = 0).

Properties

can_admin (boolean)
Whether the current user has any administrative rigths.
can_post (boolean)
Whether the current user has any authoring rigths.
do_auth (string "*")
Means all controller methods require the user to be authenticated.
docsdb (instance)
Instance of DocumentsBase.
optsdb (instance)
Instance of DocSettingsBase.

Methods

__before__ (action)
Calls BaseController.__before__ for checking user authentication and template locations; sees whether the authenticated user has any administrative and/or authoring rights; then instantiates the DocSettingsBase model.
_check_prereqs (req)
A helper invoked by most public methods like index for checking whether the user meets that method's requirements (req). If `req` is met, instantiates the appropriate DocumentsBase model and defines some Mako engine context properties; then returns True. Otherwise, returns False.
_get_refdoc
A helper invoked by document-altering methods (including index) to select a record from `docsdb`. If the selection succeeds it extends the properties of the Mako engine context, then returns True. Otherwise, returns False.
_verify_admin)
A helper invoked by most public methods for ensuring that the user has full administrative rights. Returns True or False.
index
Shows the user a summary of and options for the currently-selected document, as well as links to its child documents. The index page is a rendered form of "templates/users/cms.home.html". If a document has not been selected, the user is shown an error page (instead of a 404 Not Found page).
create_document
Shows the user the document creation form by rendering "templates/users/cms.doc-new.html". This method is available to both authors and administrators.
create section
Shows the user the section creation form by rendering "templates/users/cms.sec-new.html". This method is available only to administrators.
delete_confirm
Shows the user a confirmation message before deleting a section (a DocumentsBase) by rendering "templates/users/cms.confirm-delete.html".
delete_section
Removes a section (DocumentsBase) from disk, then redirects to index. This method is available only to administrators.
modify_document
Shows the user the document editor form by rendering "templates/users/cms.doc-old.html". This method is available only to administrators and the document's author.
reset_confirm
Shows the user a confirmation message before resetting a section/database.
reset_database
Resets a section (DocumentsBase). Resetting a section involves calling buzhug's Base.destroy then recreating the DocumentsBase schema. This will delete all saved documents in the section being reset. This method is available only to administrators.
reset_site_confirm
Shows the user a confirmation message before resetting the website by rendering "templates/users/cms.confirm-site-reset.html".
reset_site
Resets the website. Resetting the website involves removing all sections (DocumentsBase(s)) from disk and rebuilding the default "Home" DocumentsBase's schema. This method is available only to administrators.
remove_document
Deletes the currently-selected document from its parent section. This method is available only to administrators, document authors may not remove their own documents.
save_document
Form action for both create_document's and modify_document's respective forms. Redirects to index.
save_section
Form action for create_section's form. Redirects to index.