New "desktop" mode for the OAuth authorization page. If mode=deskstop

is specified in the request the page is probably meant to be displayed
in a small webview of another application, so suppress header, aside
and footer.
This commit is contained in:
Zach Copley 2010-10-21 12:23:04 -07:00
parent 8ac8f3d2dc
commit bab012bd67

View File

@ -72,6 +72,7 @@ class ApiOauthAuthorizeAction extends Action
$this->password = $this->arg('password');
$this->oauthTokenParam = $this->arg('oauth_token');
$this->callback = $this->arg('oauth_callback');
$this->mode = $this->arg('mode');
$this->store = new ApiStatusNetOAuthDataStore();
try {
@ -429,6 +430,51 @@ class ApiOauthAuthorizeAction extends Action
// NOP
}
/*
* Checks to see if a the "mode" parameter is present in the request
* and set to "desktop". If it is, the page is meant to be displayed in
* a small frame of another application, and we should suppress the
* header, aside, and footer.
*/
function desktopMode()
{
if (isset($this->mode) && $this->mode == 'desktop') {
return true;
} else {
return false;
}
}
/*
* Override - suppress output in "desktop" mode
*/
function showHeader()
{
if ($this->desktopMode() == false) {
parent::showHeader();
}
}
/*
* Override - suppress output in "desktop" mode
*/
function showAside()
{
if ($this->desktopMode() == false) {
parent::showHeader();
}
}
/*
* Override - suppress output in "desktop" mode
*/
function showFooter()
{
if ($this->desktopMode() == false) {
parent::showHeader();
}
}
/**
* Show site notice.
*