Emit the top navigation block

Priority order:
(1) Navigation in the session
(2) If we are launched via LTI w/o a session
483489
function topNav($menu_set=false) {
        global $CFG, $LAUNCH;
        $sess_key = 'tsugi_top_nav_'.$CFG->wwwroot;
        $launch_return_url = $LAUNCH->ltiRawParameter('launch_presentation_return_url', false);

        $same_host = false;
        if ( $CFG->apphome && startsWith($launch_return_url, $CFG->apphome) ) $same_host = true;
        if ( $CFG->wwwroot && startsWith($launch_return_url, $CFG->wwwroot) ) $same_host = true;

        // Canvas bug: launch_target is iframe even in new window (2017-01-10)
        $launch_target = LTIX::ltiRawParameter('launch_presentation_document_target', false);
        if ( $menu_set === false && $this->session_get($sess_key) ) {
            $menu_set = \Tsugi\UI\MenuSet::import($this->session_get($sess_key));
        } else if ( $menu_set === true ) {
            $menu_set = self::defaultMenuSet();
        } else if ( $same_host && $launch_return_url ) {
            // If we are in an iframe we will be hidden
            $menu_set = self::returnMenuSet($launch_return_url);
        } else if ( $launch_target !== false && strtolower($launch_target) == 'window' ) {
            $menu_set = self::closeMenuSet();
        // Since Coursers sets precious little
        } else if ( $LAUNCH->isCoursera() ) {
            $menu_set = self::closeMenuSet();
        // Since canvas does not set launch_target properly
        } else if ( $launch_target !== false && ( $LAUNCH->isCanvas() || $LAUNCH->isCoursera() ) ) {
            $menu_set = self::closeMenuSet();
        } else if ( $launch_return_url !== false ) {
            $menu_set = self::returnMenuSet($launch_return_url);
        }

        // Always put something out if we are an outer page - in an iframe, it will be hidden
        if ( $menu_set === false && defined('COOKIE_SESSION') ) {
            $menu_set = self::defaultMenuSet();
        }

        if ( $menu_set === false ) {
            $menu_set = self::closeMenuSet();
        }

        $menu_txt = self::menuNav($menu_set);
        if ( $this->buffer ) return $menu_txt;
        echo($menu_txt);
    }
120996
public function navigation()
    {
        // caching logic
        if ($this->validCache($this->nav)) {
            // get the value from the class cache
            $value = $this->nav;
        } else {
            // pull from the cache
            $value = $this->getCache();
            // check if the value is valid
            if (!$this->validCache($value)) {
                // if is invalid, do the work
                $value = $this->sendGet();
                // add the value from the work to the cache
                $this->setCache($value);
            }
        }

        // cache the value in the class
        $this->nav = $value;

        // spit out the value
        return $value;
    }
521228
function (navigationInstruction, callbackName, next, ignoreResult) {
        var plan = navigationInstruction.plan;
        var infos = findDeactivatable(plan, callbackName);
        var i = infos.length; // query from inside out
        function inspect(val) {
            if (ignoreResult || shouldContinue(val)) {
                return iterate();
            }
            return next.cancel(val);
        }
        function iterate() {
            if (i--) {
                try {
                    var viewModel = infos[i];
                    var result = viewModel[callbackName](navigationInstruction);
                    return processPotential(result, inspect, next.cancel);
                }
                catch (error) {
                    return next.cancel(error);
                }
            }
            navigationInstruction.router.couldDeactivate = true;
            return next();
        }
        return iterate();
    }
650509
public void observePreNavigateEvent(@Observes PreNavigateEvent event) {
        log.debugf("PreNavigateEvent observed %s, %s", event.getOutcome(), event.getFromAction());
        if (Identity.RESPONSE_LOGIN_SUCCESS.equals(event.getOutcome())
                && "#{identity.login}".equals(event.getFromAction())) {
            FacesContext context = event.getContext();
            Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
            postLoginEvent.fire(new PostLoginEvent(context, sessionMap));
        }
    }
579834
@Override
    public void onNavigation(QName source, QName dialog) {

        System.out.println("absolute navigation " + source + ">" + dialog);
    }
853326
protected void activateDestination(DestinationHandler dh)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "activateDestination", dh);

        if (dh.isLink())
        {
            linkIndex.create(dh);
        }
        else
        {
            destinationIndex.create(dh);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "activateDestination");
    }
492242
function _navigateForward() {
        var navFrame = jumpForwardStack.pop();
        
        if (!navFrame) {
            return;
        }
        
        // Check if the poped frame is the current active frame or doesn't have any valid marker information
        // if true, jump again
        if (navFrame === currentEditPos) {
            jumpBackwardStack.push(navFrame);
            _validateNavigationCmds();
            CommandManager.execute(NAVIGATION_JUMP_FWD);
            return;
        }
        
        // We will check for the file existence now, if it doesn't exist we will jump back again
        // but discard the popped frame as invalid.
        _validateFrame(navFrame).done(function () {
            jumpBackwardStack.push(navFrame);
            navFrame.goTo();
            currentEditPos = navFrame;
        }).fail(function () {
            _validateNavigationCmds();
            CommandManager.execute(NAVIGATION_JUMP_FWD);
        }).always(function () {
            _validateNavigationCmds();
        });
        
    }
116609
public function switchNavigationAction() {
        $type = $this->getRequest()->get('type');
        if (is_null($type)) {
            $this->_redirect('noRoute');
            return;
        }

        $cookieName     = Mage::helper('turpentine')->getBypassCookieName();
        $cookieModel    = Mage::getModel('core/cookie');
        $adminSession   = Mage::getSingleton('adminhtml/session');

        switch ($type) {
            case 'default':
                $cookieModel->set(
                    $cookieName,
                    Mage::helper('turpentine/varnish')->getSecretHandshake(),
                    null, // period
                    null, // path
                    null, // domain
                    false, // secure
                    true ); // httponly
                $adminSession->addSuccess(Mage::helper('turpentine/data')
                    ->__('The Varnish bypass cookie has been successfully added.'));
            break;

            case 'varnish':
                $cookieModel->delete($cookieName);
                $adminSession->addSuccess(Mage::helper('turpentine/data')
                    ->__('The Varnish bypass cookie has been successfully removed.'));
            break;

            default:
                $adminSession->addError(Mage::helper('turpentine/data')
                    ->__('The given navigation type is not supported!'));
            break;
        }

        $this->_redirectReferer();
    }
66989
def shift_ordering_up(self, parent_id, position, db_session=None, *args, **kwargs):
        
        return self.service.shift_ordering_up(
            parent_id=parent_id,
            position=position,
            db_session=db_session,
            *args,
            **kwargs
        )
290173
private void go() {
        if (navigateEvent != null) {
            navigationManager.postEvent2C(navigateEvent);

            if (navigationManager.logger.isTraceEnabled()) {
                if (navigateEvent instanceof NavigationManager.Event.OnLocationForward) {
                    NavigationManager.Event.OnLocationForward event = (NavigationManager.Event.OnLocationForward) navigateEvent;
                    String lastLocId = event.getLastValue() == null ? null
                            : event.getLastValue().getLocationId();
                    navigationManager.logger.trace("Nav Manager: Forward: {} -> {}", lastLocId,
                            event.getCurrentValue().getLocationId());
                }
            }

            if (navigateEvent instanceof NavigationManager.Event.OnLocationBack) {
                if (navigationManager.logger.isTraceEnabled()) {
                    NavigationManager.Event.OnLocationBack event = (NavigationManager.Event.OnLocationBack) navigateEvent;
                    NavLocation lastLoc = event.getLastValue();
                    NavLocation currentLoc = event.getCurrentValue();
                    navigationManager.logger.trace("Nav Manager: Backward: {} -> {}",
                            lastLoc.getLocationId(),
                            currentLoc == null ? "null" : currentLoc.getLocationId());
                }

                checkAppExit(sender);
            }
        }
        dumpHistory();
    }
492784
def set_priority(self, priority):
        

        if priority in ["hidden", "background", "info", "foreground", "alert", "input"]:
            self.priority = priority
            self.server.request("screen_set %s priority %s" % (self.ref, self.priority))
1228910
def get_navigation(self, request, **kwargs):
        

        if self.navigation == self.parent_attr:
            if self.parent:
                return self.parent.get_navigation(request, **kwargs)
            return ()
        else:
            return self._nav_from_tuple(request, self.navigation,
                                **kwargs)
1225595
function startAtRoute( routeName, optionalContext = {} ) {
      return flowController.loadFlow( 'mainz' )
         .then( routerMock.awaitRegisterRoutes )
         .then( () => routerMock.triggerRouteHandler( routeName, optionalContext ) )
         .then( awaitDidNavigate );
   }
1243090
def move_page_top(self):
        
        self.nav.page_index = self.content.range[0]
        self.nav.cursor_index = 0
        self.nav.inverted = False
515363
function _navigateBack() {
        if (!jumpForwardStack.length) {
            if (activePosNotSynced) {
                currentEditPos = new NavigationFrame(EditorManager.getCurrentFullEditor(), {ranges: EditorManager.getCurrentFullEditor()._codeMirror.listSelections()});
                jumpForwardStack.push(currentEditPos);
            }
        }
        
        var navFrame = jumpBackwardStack.pop();
        
        // Check if the poped frame is the current active frame or doesn't have any valid marker information
        // if true, jump again
        if (navFrame && navFrame === currentEditPos) {
            jumpForwardStack.push(navFrame);
            _validateNavigationCmds();
            CommandManager.execute(NAVIGATION_JUMP_BACK);
            return;
        }
        
        if (navFrame) {
            // We will check for the file existence now, if it doesn't exist we will jump back again
            // but discard the popped frame as invalid.
            _validateFrame(navFrame).done(function () {
                jumpForwardStack.push(navFrame);
                navFrame.goTo();
                currentEditPos = navFrame;
            }).fail(function () {
                CommandManager.execute(NAVIGATION_JUMP_BACK);
            }).always(function () {
                _validateNavigationCmds();
            });
        }
    }
350437
@OnLifecycleEvent(Lifecycle.Event.ON_START)
  public void onStart() {
    if (navigation != null) {
      navigation.addProgressChangeListener(progressChangeListener);
    }
  }
453946
protected function controlMaintenanceMode()
    {
        $allowed_path = $this->is_install
            || $this->is_backend
            || in_array($this->path, array('login', 'logout', 'forgot'));

        if ($this->is_maintenance && !$allowed_path) {

            if (!$this->isFront()) {
                $this->redirect('/');
            }

            $this->outputMaintenance();
        }
    }