Admin Panels
Summary
The Edit page is composed of several panels, each of which has been encapsulated as a ToscaWidget. These panel/widgets aren't particularly re-usable in other projects, but splitting up the code this way helps make the code simpler to understand. Each panel, like any widget, is composed of a template, some css and images, and some javascript.
The javascript is the thing to look out for. Each panel's javascript contains a javascript class that listens for panel events such as "delete_page" or "save_properties". These events are fired by the panels themselves. For example, when the user changes a page's navigation title and clicks the 'save' button, the PropertiesPanel fires a "save_properties" event, which the PageTreePanel listens for in order to update the page tree with the new name. Actually I just lied to you. The PropertiesPanel fires a "before_save_properties" event, and then it saves the properties, and then it fires an "after_save_properties" event. The PageTreePanel listens to the "after_save_properties" event. Appologies for the bold lie, I just wanted to make things seem as simple as they really are. I still care about you!
PageTreePanel
Events
- edit_page (Username user, PageID page_id)
- Fires when a page is selected from the Page Tree and the "Edit" button is clicked on the flyout menu.
- delete_page (Username user, PageID page_id)
- Fires when a page is selected from the Page Tree and the "Delete" button is clicked on the flyout menu.
- add_page (Username user, PageID page_id)
- Fires when a page is selected from the Page Tree and the "Add Page" button is clicked on the flyout menu.
- duplicate_page (Username user, PageID page_id)
- Fires when a page is selected from the Page Tree and the "Duplicate Page" button is clicked on the flyout menu.
PendingChangesPanel
Events
No events!
RevisionChangePanel
Events
- submit_revision (Username user, PageID page_id, DateTime? time, String comment, Boolean publish_now)
- Fires when the "Submit for Publication" popup form is submitted.
- cancel_revision (Username user, PageID page_id)
- Fires when the "Cancel Revision" button is clicked in the RevisionChangePanel.
PropertiesPanel
Events
- save_properties (Username user, PageID page_id, Dict properties)
- When properties are changed in the PropertiesPanel, a "Save" button and a "Cancel" button appear in the panel. The save_properties Event is fired when the "Save" button is clicked. "properties" will be a dict containing only the properties that have been modified.
PermissionsPanel
Events
- save_permissions (Username user, PageID page_id, String permission)
- When permissions are changed in the PermissionsPanel, a "Save" button and a "Cancel" button appear in the panel. The save_permissions Event is fired when the "Save" button is clicked. "permission" is currently a string containing either "public_access" or "admin_only", but this will change eventually as we support more complicated permission systems.
AttachmentPanel
Events
- add_attachment (Username user, PageID page_id, String filename, String size)
- Fires when a new attachment is uploaded. "size" is the file size in KB.
- delete_attachment (Username user, PageID page_id, String filename)
- Fires when an attachment is deleted.
- rename_attachment (Username user, PageID page_id, String old_filename, String new_filename)
- Fires when an attachment is renamed.
- update_attachment (Username user, PageID page_id, String filename, String size)
- Fires when a new version of an attachment is uploaded. "size" is the new file size in KB.
HistoryPanel
Events
- restore_revision (Username user, PageID page_id, RevisionNumber? revision_number)
- Fires when an inactive revision of a page is restored to active status.
- warning arrows (European target)
- Should have fired when the invaders first came to what is now called America. Hey, it's the "history" panel, what did you expect?
