forked from GNUsocial/gnu-social
		
	Add special CSS classes to OAuth authorization and pin pages when
in desktop mode
This commit is contained in:
		@@ -323,18 +323,46 @@ class ApiOauthAuthorizeAction extends Action
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Override to add some special (more compact) styling when the page is
 | 
					     * Show body - override to add a special CSS class for the authorize
 | 
				
			||||||
     * being displayed in desktop mode.
 | 
					     * page's "desktop mode" (minimal display)
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Calls template methods
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return nothing
 | 
					     * @return nothing
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    function showStylesheets()
 | 
					    function showBody()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        parent::showStyleSheets();
 | 
					        $bodyClasses = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->desktopMode()) {
 | 
					        if ($this->desktopMode()) {
 | 
				
			||||||
            $this->style('#wrap {min-width: 500px;} #content {width: 480px; padding: 6px; margin: 4px 0px 0px 4px; border-top-left-radius: 7px; -moz-border-radius-topleft: 7px; -webkit-border-top-left-radius: 7px;} fieldset {margin-bottom: 10px !important;}');
 | 
					            $bodyClasses[] = 'oauth-desktop-mode';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (common_current_user()) {
 | 
				
			||||||
 | 
					            $bodyClasses[] = 'user_in';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $attrs = array('id' => strtolower($this->trimmed('action')));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!empty($bodyClasses)) {
 | 
				
			||||||
 | 
					            $attrs['class'] = implode(' ', $bodyClasses);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->elementStart('body', $attrs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->elementStart('div', array('id' => 'wrap'));
 | 
				
			||||||
 | 
					        if (Event::handle('StartShowHeader', array($this))) {
 | 
				
			||||||
 | 
					            $this->showHeader();
 | 
				
			||||||
 | 
					            Event::handle('EndShowHeader', array($this));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $this->showCore();
 | 
				
			||||||
 | 
					        if (Event::handle('StartShowFooter', array($this))) {
 | 
				
			||||||
 | 
					            $this->showFooter();
 | 
				
			||||||
 | 
					            Event::handle('EndShowFooter', array($this));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $this->elementEnd('div');
 | 
				
			||||||
 | 
					        $this->showScripts();
 | 
				
			||||||
 | 
					        $this->elementEnd('body');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function showForm($error=null)
 | 
					    function showForm($error=null)
 | 
				
			||||||
@@ -599,7 +627,12 @@ class ApiOauthAuthorizeAction extends Action
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->reqToken->verified_callback == 'oob') {
 | 
					        if ($this->reqToken->verified_callback == 'oob') {
 | 
				
			||||||
            $pin = new ApiOauthPinAction($title, $msg, $this->reqToken->verifier);
 | 
					            $pin = new ApiOauthPinAction(
 | 
				
			||||||
 | 
					                $title,
 | 
				
			||||||
 | 
					                $msg,
 | 
				
			||||||
 | 
					                $this->reqToken->verifier,
 | 
				
			||||||
 | 
					                $this->desktopMode()
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
            $pin->showPage();
 | 
					            $pin->showPage();
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,13 +45,57 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class ApiOauthPinAction extends InfoAction
 | 
					class ApiOauthPinAction extends InfoAction
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    function __construct($title, $message, $verifier)
 | 
					    function __construct($title, $message, $verifier, $desktopMode = false)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->verifier    = $verifier;
 | 
					        $this->verifier    = $verifier;
 | 
				
			||||||
        $this->title       = $title;
 | 
					        $this->title       = $title;
 | 
				
			||||||
 | 
					        $this->desktopMode = $desktopMode;
 | 
				
			||||||
        parent::__construct($title, $message);
 | 
					        parent::__construct($title, $message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Show body - override to add a special CSS class for the pin pages's
 | 
				
			||||||
 | 
					     * "desktop mode" (minimal display)
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * Calls template methods
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return nothing
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    function showBody()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $bodyClasses = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($this->desktopMode) {
 | 
				
			||||||
 | 
					            $bodyClasses[] = 'oauth-desktop-mode';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (common_current_user()) {
 | 
				
			||||||
 | 
					            $bodyClasses[] = 'user_in';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $attrs = array('id' => strtolower($this->trimmed('action')));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!empty($bodyClasses)) {
 | 
				
			||||||
 | 
					            $attrs['class'] = implode(' ', $bodyClasses);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->elementStart('body', $attrs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->elementStart('div', array('id' => 'wrap'));
 | 
				
			||||||
 | 
					        if (Event::handle('StartShowHeader', array($this))) {
 | 
				
			||||||
 | 
					            $this->showHeader();
 | 
				
			||||||
 | 
					            Event::handle('EndShowHeader', array($this));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $this->showCore();
 | 
				
			||||||
 | 
					        if (Event::handle('StartShowFooter', array($this))) {
 | 
				
			||||||
 | 
					            $this->showFooter();
 | 
				
			||||||
 | 
					            Event::handle('EndShowFooter', array($this));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $this->elementEnd('div');
 | 
				
			||||||
 | 
					        $this->showScripts();
 | 
				
			||||||
 | 
					        $this->elementEnd('body');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Display content.
 | 
					     * Display content.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user