Digibug4CPG - a plugin for gallery to create photo prints, and print product gift items derived from code written by Bharat Mediratta Copyright (C) 2006 Digibug Express, Inc.
This controller handles moving between admin modes in the Item Edit plugin, by setting or clearing a session variable. It also handles activation of album-specific settings (copy in global settings) or reverting to global settings for an album (clear album settings, remove field values).
Take the appropriate action based on the user input provided.
When done, we return a data structure with results from the controller's actions and information about where we should send the user next. We can either delegate the user to a view in the same request, or we can redirect the user to a different url. Whenever a controller makes a change to the data model, it should pass back a redirect so that the browser is sent to a fresh page. Otherwise if you hit reload on the browser it will want to re-post the form data and it will attempt to change the model again, which may not be what the user wants.
If you delegate, your form and request variables will persist to the view, since it is being handled inside the same request. However, if you redirect you'll have to put any form variables that you want to pass to the subsequent view into the redirect url, since it will be processed in a new request. The browser will receive a redirect and then post the new url. So for example, if you want to redirect to a confirmation view and specify a username to that view, you'd return:
Status data is passed to the view and can be in any form that you want. Typically it's simple key value pairs, like this:
array('myAction' => 'wasSuccessful')
If you pass status data back on a redirect, it will be automatically stored in the session and the url will be modified to contain a marker to this status information. After the redirect, we'll retrieve it back from the database and pass it to the view. Status data sent back upon delegation is passed directly to the view.
Error data is an array of values, like this:
array('form[widget][missing]')
This data is only processed on delegation. It gets put into the request and is accessible when the delegated view is called. Since we only redirect on success, you never pass back error data when you redirect.
Return is a special parameter. If you set this to a non-false value, it will look for a special request variable called "return" in the request scope. This variable is expected to contain a URL, and we'll return a redirect to that URL. This is useful in the case where we want to use this controller in the middle of a workflow. A good example of this is when we click the "Login" link on the main page. We pass control to the UserLogin controller, and when its done, it uses the "return" flag to indicate that we should return to the URL where the login link was clicked.
WebDavController::permissionCheck()
: Overriding permissionCheck() since the WebDAV protocol needs to handle authentication differently (redirects to a HTML based login view don't work here).