Example #1
0
 /**
  * Execute the action
  * 
  * @return object
  * @access public
  * @since 1/18/07
  */
 function execute()
 {
     UI2::addBrowserWarning();
     $allwrapper = parent::execute();
     $mainScreen = $this->mainScreen;
     // Add controls bar and border
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), SiteDispatcher::getCurrentRootNode()->getQualifierId())) {
         $visitor = $this->getSiteVisitor();
         $controlsHTML = $visitor->getBarPreHTML('#090', SiteDispatcher::getCurrentRootNode()) . $visitor->getControlsHTML(SiteDispatcher::getCurrentRootNode(), "<em>" . _("Site") . "</em>", SiteDispatcher::getCurrentRootNode()->acceptVisitor($visitor->_controlsVisitor), '#090', '#9F9', '#6C6', 0, '0px');
         $mainScreen->setPreHTML($controlsHTML . $mainScreen->getPreHTML($null = null));
         $mainScreen->setPostHTML($visitor->getBarPostHTML());
     }
     return $allwrapper;
 }
Example #2
0
 /**
  * Execute the action
  * 
  * @return object
  * @access public
  * @since 1/18/07
  */
 function execute()
 {
     $allwrapper = parent::execute();
     $mainScreen = $this->mainScreen;
     // Add permissions button
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     $siteId = SiteDispatcher::getCurrentRootNode()->getQualifierId();
     $rootSiteComponent = SiteDispatcher::getCurrentRootNode();
     ob_start();
     $harmoni = Harmoni::instance();
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $siteId)) {
         $url = SiteDispatcher::quickURL("ui1", "editSite", array("node" => $siteId->getIdString(), "returnNode" => SiteDispatcher::getCurrentNodeId(), "returnAction" => $harmoni->request->getRequestedAction()));
         print "\n\t<button onclick='window.location = \"{$url}\".urlDecodeAmpersands();'>";
         print _("Edit Site Options") . "</button>";
     }
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $siteId)) {
         $url = SiteDispatcher::quickURL("ui1", "theme_options", array("node" => $siteId->getIdString(), "returnNode" => SiteDispatcher::getCurrentNodeId(), "returnAction" => $harmoni->request->getRequestedAction()));
         print "\n\t<button onclick='window.location = \"{$url}\".urlDecodeAmpersands();'>";
         print _("Theme Options") . "</button>";
     }
     // Rather than checking the entire site, we will just check the current node.
     // This forces users who are not site-wide admins to browse to the place where
     // they are administrators in order to see the permissions button, but
     // cuts load-times for non-admins on a given large site from 35s to 1.4s.
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_authorizations"), SiteDispatcher::getCurrentNode()->getQualifierId())) {
         $url = SiteDispatcher::quickURL("roles", "choose_agent", array("node" => SiteDispatcher::getCurrentNodeId(), "returnModule" => $harmoni->request->getRequestedModule(), "returnAction" => $harmoni->request->getRequestedAction()));
         print "\n\t<button onclick='window.location = \"{$url}\".urlDecodeAmpersands();'>";
         print _("Roles") . "</button>";
     }
     if (strlen(ob_get_contents())) {
         $mainScreen->add(new UnstyledBlock("\n<div style='text-align: right;'>" . ob_get_contents() . "\n</div>"), $rootSiteComponent->getWidth(), null, CENTER, BOTTOM);
     }
     ob_end_clean();
     return $allwrapper;
 }