-
Notifications
You must be signed in to change notification settings - Fork 18
SiteEditPage
Michael Gauthier edited this page Aug 6, 2013
·
1 revision
This page contains the specifications for a generic edit page that provides database transactions for queries, and convenience methods for manipulating SwatDBDataObject objects.
-
abstract isNew()
- used to tell whether to set the widget values on page load from an existing object
-
getForms()
- gets descendant SwatForm widgets from the UI
-
init()
- loads UI from XML
- initializes the UI
-
initInternal()
- sets action of forms (
$this->getForms()
) action to$this->source
. - called after UI is loaded from XML
- called before
$ui->init();
- sets action of forms (
-
process()
- authenticates by calling
authenticate()
- adds the
getInvalidMessage()
to the message display ifisValid()
returns false - calls
save()
and thenrelocate()
- authenticates by calling
-
authenticate()
- authenticates form (
$form->isAuthenticated()
- adds a message to the message display if not authenticated
- authenticates form (
-
validate()
- empty by default
- allows adding messages to form widgets
-
isValid()
- default returns
!form->hasMessage()
- allows returning false to invalidate the form
- default returns
-
abstract save()
- saves to db in SiteDBEditPage or to something else in subclasses.
- in SiteDBEditPage, performs a database transaction around whole of saveData and rolls-back with a message on error
- updates dataobject properties
- optionally call convenience
assignUiValueToObject()
- sets a message about saving the item
- saves the dataobject
-
abstract saveData()
- only In SiteDBEditPage, wrapped in transaction version of
save()
- updates dataobject properties
- optionally call convenience
assignUiValueToObject()
- sets a message about saving the item
- saves the dataobject
- only In SiteDBEditPage, wrapped in transaction version of
-
abstract relocate()
- has no default implementation
- allows relocating after saving
-
assignUiValuesToObject()
- convenience method for working with data-objects
- takes an array of widget names and maps the widget values to dataobject properties
- automatically does date time-zone conversion based on the site default-time-zone
- automatically sets internal properties for sub-dataobjects
- custom widget values can be handled manually in the
save()
/saveData()
methods
-
build()
- builds title
- builds navbar
- captures UI display for 'content'
-
buildInternal()
- attaches
$this->app->messages
to a the message display - allows subclasses to do additional building before content is captured
- attaches
-
buildTitle()
- empty by default
- allows setting frame titles, page titles, etc.
-
abstract load()
- like
save()
- 'loads' form UI values for the page
- usually calls
assignObjectValuesToUi()
- like
-
assignObjectValuesToUi()
- like
assignUiValuesToObject()
- convenience method to set UI values
- also converts dates to the application time zone
- like
-
finalize()
- adds UI head entries to layout
- there will be two pages, SiteEditPage and SiteDBEditPage. One works without a database (for saving to the session for example)
- pages support multiple forms. Only the submitted form is processed.
- AdminEdit supports generating/verifying shortnames, useful?