예제 #1
0
 /**
  * Execute
  * 
  * @return void
  * @access public
  * @since 7/31/08
  */
 public function execute()
 {
     try {
         if (!RequestContext::value('id')) {
             throw new InvalidArgumentException("Id is expected.");
         }
         $selection = Segue_Selection::instance();
         $director = SiteDispatcher::getSiteDirector();
         $component = $director->getSiteComponentById(RequestContext::value('id'));
         if ($selection->isSiteComponentInSet($component)) {
             $selection->removeSiteComponent($component);
         }
         $this->start();
         $selection->reset();
         while ($selection->hasNext()) {
             $siteComponent = $selection->nextSiteComponent();
             print "\n\t<siteComponent type='" . $siteComponent->getComponentClass() . "' ";
             if (method_exists($siteComponent, 'isSection')) {
                 if ($siteComponent->isSection()) {
                     print "navType='Section' ";
                 } else {
                     print "navType='Page' ";
                 }
             }
             print "id='" . $siteComponent->getId() . "' ";
             print "displayName=\"" . str_replace('"', '&quot', preg_replace('/\\s+/', ' ', strip_tags($siteComponent->getDisplayName()))) . "\" ";
             print "/>";
         }
         $this->end();
     } catch (Exception $e) {
         HarmoniErrorHandler::logException($e);
         $this->error($e->getMessage(), get_class($e));
     }
 }
 /**
  * Answer the organizer above the reference node that can accept the component type given.
  * 
  * @param object SiteComponent $refNode
  * @param object Type $componentType
  * @return object OrganizerSiteComponent
  * @access public
  * @since 1/15/09
  * @static
  */
 public static function getOrganizerForComponentType(SiteComponent $refNode, Type $componentType)
 {
     // For pages and sections, find the menu above our component.
     if ($componentType->getDomain() == 'segue-multipart') {
         $parentComponent = $refNode->getParentComponent();
         while ($parentComponent) {
             if ($parentComponent->getComponentClass() == 'MenuOrganizer') {
                 return $parentComponent;
             }
             $parentComponent = $parentComponent->getParentComponent();
         }
         // If we didn't find a menu above our ref node, maybe we started in a heading.
         // Search down for a menu.
         $director = SiteDispatcher::getSiteDirector();
         $rootNode = $director->getRootSiteComponent($refNode->getId());
         $result = $rootNode->acceptVisitor(new GetMenuBelowSiteVisitor());
         if ($result) {
             return $result;
         }
         // If we still haven't found a menu, then there isn't one in this site.
         // Nothing more we can do.
         throw new OperationFailedException("Cannot create a " . $componentType->getKeyword() . ". Site " . $rootNode->getSlot()->getShortname() . " - '" . $rootNode->getDisplayName() . "' does not have any menus to add this component to.");
     } else {
         $parentComponent = $refNode->getParentComponent();
         while ($parentComponent) {
             if ($parentComponent->getComponentClass() == 'FlowOrganizer' || $parentComponent->getComponentClass() == 'MenuOrganizer') {
                 return $parentComponent;
             }
         }
         // If we haven't found a flow organizer above the refNode, something is wrong.
         throw new OperationFailedException("Cannot create a " . $componentType->getKeyword() . ". A ContentOrganizer was not found above reference node " . $refNode->getId());
     }
 }
 /**
  * Answer a site component that relates to this plugin instance. This site component
  * may be for this plugin instance or not. This method will throw an OperationFailedException
  * if no corresponding site component exists or is set.
  *
  * @return object SiteComponent
  * @access public
  * @since 3/31/08
  */
 public final function getRelatedSiteComponent()
 {
     if (isset($this->relatedSiteComponent)) {
         return $this->relatedSiteComponent;
     }
     // If we don't have a related site component, assume that this plugin equates
     // to a site component and try to return a matching one.
     // @todo This part should probably be removed and the code that instantiates the plugin
     // should be forced to call the setRelatedSiteComponent() method.
     // Get the site Id (Note: this creates a circular dependancy between
     // the plugins package and the SiteDisplay Package.
     $idManager = Services::getService("Id");
     $nodeId = $this->_asset->getId();
     $director = SiteDispatcher::getSiteDirector();
     $siteComponent = $director->getSiteComponentById($nodeId->getIdString());
     // Test if getting the parent component works.
     try {
         $siteComponent->getParentComponent();
     } catch (NonNavException $e) {
         throw new OperationFailedException("No SiteComponent available for " . get_class($this) . ", '" . $this->_asset->getDisplayName() . "'.");
     }
     return $siteComponent;
 }
예제 #4
0
 /**
  * Run the update
  * 
  * @return boolean
  * @access public
  * @since 3/24/08
  */
 function runUpdate()
 {
     $agentMgr = Services::getService('Agent');
     $idMgr = Services::getService('Id');
     $groupType = new Type("System", "edu.middlebury.harmoni", "ApplicationGroups", "");
     $nullType = new Type("System", "edu.middlebury.harmoni", "NULL");
     $nullProperties = new HarmoniProperties($nullType);
     try {
         $containerGroup = $agentMgr->getGroup($idMgr->getId('edu.middlebury.segue.site-members'));
     } catch (UnknownIdException $e) {
         $containerGroup = $agentMgr->createGroup('Site-Members', $groupType, 'A container for site-membership groups', $nullProperties, $idMgr->getId('edu.middlebury.segue.site-members'));
     }
     // Since updates can only be run by admins, which in turn can see all sites,
     // the all visible folder will get all slots.
     $folder = new AllVisiblePortalFolder();
     $slots = $folder->getSlots();
     $status = new StatusStars(_("Checking Nodes"));
     $status->initializeStatistics(count($slots));
     $director = SiteDispatcher::getSiteDirector();
     foreach ($slots as $slot) {
         $site = $director->getSiteComponentById($slot->getSiteId()->getIdString());
         $site->getMembersGroup();
         $status->updateStatistics();
     }
     return $this->isInPlace();
 }
예제 #5
0
 /**
  * Answer the comment body.
  * 
  * @param optional boolean $showControls Defaults to true.
  * @return string
  * @access public
  * @since 7/3/07
  */
 function getBody($showControls = true)
 {
     // Only return a body if we are authorized to view the comment
     if ($this->canView()) {
         $pluginManager = Services::getService('PluginManager');
         $plugin = $pluginManager->getPlugin($this->_asset);
         // Attach the owning Site component
         $owningAsset = CommentManager::getCommentParentAsset($this);
         $director = SiteDispatcher::getSiteDirector();
         $owningComponent = $director->getSiteComponentFromAsset($owningAsset);
         $plugin->setRelatedSiteComponent($owningComponent);
         try {
             $plugin->setUpdateAction('comments', 'update_plugin_ajax');
         } catch (UnimplementedException $e) {
         }
         // We've just checked our view permission, so use true
         $plugin->setCanViewFunction(create_function('$plugin', 'return true;'));
         if ($this->canModify() && $showControls) {
             $plugin->setCanModifyFunction(create_function('$plugin', 'return true;'));
             return $plugin->executeAndGetMarkup(true);
         } else {
             $plugin->setCanModifyFunction('$plugin', 'return false;');
             return $plugin->executeAndGetMarkup(false);
         }
     } else {
         return _("You are not authorized to view this comment.");
     }
 }
예제 #6
0
 /**
  * Create the new site with this template at the slot specified.
  * 
  * @param object Slot $slot
  * @param optional string $displayName
  * @param optional string $description
  * @return object SiteNavBlockSiteComponent
  * @access public
  * @since 6/11/08
  */
 public function createSite(Slot $slot, $displayName = 'Untitled', $description = '')
 {
     $director = SiteDispatcher::getSiteDirector();
     $doc = new Harmoni_DOMDocument();
     $doc->load($this->_path . "/site.xml");
     // Validate the document contents
     $doc->schemaValidateWithException(MYDIR . "/doc/raw/dtds/segue2-site.xsd");
     $mediaDir = $this->_path . "/media";
     if (!file_exists($mediaDir)) {
         $mediaDir = null;
     }
     // @todo Strip out any history.
     $importer = new StripHistoryImportSiteVisitor($doc, $mediaDir, $director);
     $importer->disableCommentImport();
     $site = $importer->importAtSlot($slot->getShortname());
     try {
         // Replace #SITE_NAME# and #SITE_DESCRIPTION# placeholders
         $site->acceptVisitor(new Segue_Templates_ReplacePlaceholderVisitor($displayName, $description));
     } catch (Exception $e) {
         $director->deleteSiteComponent($site);
         $slot->deleteSiteId();
         throw $e;
     }
     return $site;
 }
예제 #7
0
 /**
  * Answer the site component for a given Id string
  * 
  * @param string $id
  * @return object SiteComponent
  * @access protected
  * @since 6/4/07
  */
 protected function getSiteComponentForIdString($id)
 {
     $director = SiteDispatcher::getSiteDirector();
     return $director->getSiteComponentById(strval($id));
 }
예제 #8
0
 /**
  * Execute this action.
  * 
  * @return void
  * @access public
  * @since 7/28/08
  */
 public function execute()
 {
     if (!$this->isAuthorizedToExecute()) {
         throw new PermissionDeniedException(_("Your are not authorized to copy this site here."));
     }
     $srcSlot = $this->getSourceSlot();
     $srcSiteAsset = $this->getSourceSiteAsset();
     $director = SiteDispatcher::getSiteDirector();
     $srcComponent = $director->getSiteComponentFromAsset($srcSiteAsset);
     $destSlot = $this->getDestSlot();
     if (RequestContext::value('command') == 'copy') {
         try {
             /*********************************************************
              * Export the Site
              *********************************************************/
             $exportDir = DATAPORT_TMP_DIR . "/" . $srcSlot->getShortname() . "-" . str_replace(':', '_', DateAndTime::now()->asString());
             mkdir($exportDir);
             // Do the export
             $visitor = new DomExportSiteVisitor($exportDir);
             $visitor->enableStatusOutput(_("Exporting from original location."));
             $srcComponent->acceptVisitor($visitor);
             $doc = $visitor->doc;
             // Validate the result
             // 			printpre(htmlentities($doc->saveXMLWithWhitespace()));
             // 			$tmp = new Harmoni_DomDocument;
             // 			$tmp->loadXML($doc->saveXMLWithWhitespace());
             // 			$tmp->schemaValidateWithException(MYDIR."/doc/raw/dtds/segue2-site.xsd");
             $doc->schemaValidateWithException(MYDIR . "/doc/raw/dtds/segue2-site.xsd");
             // 			printpre($this->listDir($exportDir));
             // 			throw new Exception('test');
             /*********************************************************
              * Import the site
              *********************************************************/
             $importer = new DomImportSiteVisitor($doc, $exportDir, $director);
             if (RequestContext::value('copy_permissions') == 'true') {
                 $importer->enableRoleImport();
             }
             if (RequestContext::value('copy_discussions') != 'true') {
                 $importer->disableCommentImport();
             }
             // 			if (isset($values['owners'])) {
             // 				$idMgr = Services::getService('Id');
             // 				foreach($values['owners']['admins'] as $adminIdString)
             // 					$importer->addSiteAdministrator($idMgr->getId($adminIdString));
             // 			}
             $importer->enableStatusOutput(_("Importing into new location"));
             $importer->makeUserSiteAdministrator();
             $site = $importer->importAtSlot($destSlot->getShortname());
             // Delete the decompressed Archive
             $this->deleteRecursive($exportDir);
             /*********************************************************
              * Log the success
              *********************************************************/
             if (Services::serviceRunning("Logging")) {
                 $loggingManager = Services::getService("Logging");
                 $log = $loggingManager->getLogForWriting("Segue");
                 $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
                 $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
                 $item = new AgentNodeEntryItem("Copy Site", "Site copied from placeholder, '" . $srcSlot->getShortname() . "' to '" . $destSlot->getShortname() . "'.");
                 $item->addNodeId($site->getQualifierId());
                 $log->appendLogWithTypes($item, $formatType, $priorityType);
             }
         } catch (Exception $e) {
             $this->deleteRecursive($exportDir);
             if (file_exists($exportDir . ".tar.gz")) {
                 unlink($exportDir . ".tar.gz");
             }
             throw $e;
         }
     } else {
         // Detach the site from the source slot.
         $srcSlot->deleteSiteId();
         // Attach the site to the dest slot.
         $destSlot->setSiteId($srcSiteAsset->getId());
         // Make the source an alias of the destination so that links still work.
         $srcSlot->makeAlias($destSlot);
         /*********************************************************
          * Log the success
          *********************************************************/
         if (Services::serviceRunning("Logging")) {
             $loggingManager = Services::getService("Logging");
             $log = $loggingManager->getLogForWriting("Segue");
             $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
             $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
             $item = new AgentNodeEntryItem("Move Site", "Site moved from placeholder, '" . $srcSlot->getShortname() . "' to '" . $destSlot->getShortname() . "'.");
             $item->addNodeId($destSlot->getSiteId());
             $log->appendLogWithTypes($item, $formatType, $priorityType);
         }
     }
     // Remove from selection?
     if (RequestContext::value('remove_after_use') == 'remove') {
         $selection = Segue_Selection::instance();
         $selection->removeSiteComponent($srcComponent);
     }
     print "\n" . _("Done");
     exit;
 }
예제 #9
0
 /**
  * Execute the Action
  * 
  * @param object Harmoni $harmoni
  * @return mixed
  * @access public
  */
 function execute()
 {
     $harmoni = Harmoni::instance();
     /*********************************************************
      * Split sites based on their location-category
      *********************************************************/
     $rootSiteComponent = SiteDispatcher::getCurrentRootNode();
     try {
         $slot = $rootSiteComponent->getSlot();
         // Mark the site as viewed
         Segue_AccessLog::instance()->touch($slot->getShortname());
     } catch (UnknownIdException $e) {
         // No slot for the site....
     }
     $authZ = Services::getService("AuthZ");
     $recordManager = Services::getService("RecordManager");
     //
     // Begin Optimizations
     //
     // The code below queues up authorizations for all visible nodes,
     // as well as pre-fetches all of the RecordSets that have data
     // specific to the visible nodes.
     $visibleComponents = SiteDispatcher::getSiteDirector()->getVisibleComponents(SiteDispatcher::getCurrentNodeId());
     $preCacheIds = array();
     foreach ($visibleComponents as $component) {
         $id = $component->getQualifierId();
         $authZ->getIsAuthorizedCache()->queueId($id);
         $preCacheIds[] = $id->getIdString();
     }
     $recordManager->preCacheRecordsFromRecordSetIDs($preCacheIds);
     //
     // End Optimizations
     //
     $this->mainScreen = new Container(new YLayout(), BLOCK, BACKGROUND_BLOCK);
     $this->addHead($this->mainScreen);
     CommentManager::instance()->disableCommenting();
     CommentManager::instance()->disableSorting();
     $this->addSiteContent($this->mainScreen);
     return $this->mainScreen;
 }
예제 #10
0
 /**
  * Answer the reference node
  * 
  * @return object BlockSiteComponent
  * @access protected
  * @since 1/15/09
  */
 protected function getRefNode()
 {
     if (!isset($this->refNode)) {
         $director = SiteDispatcher::getSiteDirector();
         $this->refNode = $director->getSiteComponentById(RequestContext::value('refNode'));
     }
     return $this->refNode;
 }
예제 #11
0
 /**
  * Answer the destination component.
  * 
  * @return object SiteComponent
  * @access protected
  * @since 8/4/08
  */
 protected function getDestinationComponent()
 {
     if (!isset($this->destComponent)) {
         $director = SiteDispatcher::getSiteDirector();
         $this->destComponent = $director->getSiteComponentById(RequestContext::value('destId'));
         if (!$this->destComponent instanceof FlowOrganizerSiteComponent) {
             throw new InvalidArgumentException("Can only move to a Pages Container or a Content Container.");
         }
     }
     return $this->destComponent;
 }
예제 #12
0
 /**
  * Execute the Action
  * 
  * @param object Harmoni $harmoni
  * @return mixed
  * @access public
  * @since 4/3/06
  */
 function execute()
 {
     $harmoni = Harmoni::instance();
     /*********************************************************
      * Split sites based on their location-category
      *********************************************************/
     try {
         $rootSiteComponent = SiteDispatcher::getCurrentRootNode();
     } catch (UnknownIdException $e) {
         // For non-existant node exceptions, redirect to the site root.
         if ($e->getCode() == 289743 && RequestContext::value('node') && RequestContext::value('site')) {
             $url = SiteDispatcher::quickURL($harmoni->request->getRequestedModule(), $harmoni->request->getRequestedAction(), array('site' => RequestContext::value('site')));
             $errorPrinter = SegueErrorPrinter::instance();
             $message = "<strong>" . _("The node you requested does not exist or has been deleted. Click %1 to go to the %2.") . "</strong>";
             $message = str_replace('%1', "<a href='" . $url . "'>" . _("here") . "</a>", $message);
             $message = str_replace('%2', "<a href='" . $url . "'>" . _("main page of the site") . "</a>", $message);
             $errorPrinter->handExceptionWithRedirect($e, 404, $message);
             exit;
         } else {
             if (RequestContext::value('site')) {
                 $slotMgr = SlotManager::instance();
                 $slot = $slotMgr->getSlotByShortname(RequestContext::value('site'));
                 // Redirect to the new URL if this site has been migrated
                 if ($redirectUrl = $slot->getMigratedRedirectUrl()) {
                     header("HTTP/1.1 301 Moved Permanently");
                     header('Location: ' . $redirectUrl);
                     exit;
                 }
                 throw $e;
             } else {
                 throw $e;
             }
         }
     }
     try {
         $slot = $rootSiteComponent->getSlot();
         // Redirect to the new URL if this site has been migrated
         if ($redirectUrl = $slot->getMigratedRedirectUrl()) {
             header("HTTP/1.1 301 Moved Permanently");
             header('Location: ' . $redirectUrl);
             exit;
         }
         if (SiteDispatcher::getBaseUrlForSlot($slot) != MYURL) {
             RequestContext::sendTo(SiteDispatcher::quickUrl());
         } else {
             /*********************************************************
              * Ensure that the requested node is a member of the site
              * listed in the URL.
              *********************************************************/
             if (!RequestContext::value('site') || RequestContext::value('site') != $slot->getShortname()) {
                 /*********************************************************
                  * This is added in Segue 2.1.0 for testing that all 
                  * Segue-generated links are producing the correct URLs.
                  * This should be removed here and in
                  *		segue/config/debug_default.conf.php
                  * after testing is complete.
                  *********************************************************/
                 if (defined('DEBUG_LOG_WRONG_SITE') && DEBUG_LOG_WRONG_SITE == true && isset($_SERVER['HTTP_REFERER']) && preg_match('#^' . str_replace('.', '\\.', MYURL) . '#', $_SERVER['HTTP_REFERER'])) {
                     HarmoniErrorHandler::logException(new WrongSiteException("Expecting site '" . $slot->getShortname() . "', saw '" . RequestContext::value('site') . "' in the url. Links to wrong sites should not be generated by Segue. If the link on the referrer page was written by Segue (and not a user), submit a bug report. Sending to " . SiteDispatcher::quickUrl()));
                 }
                 RequestContext::sendTo(SiteDispatcher::quickUrl());
             }
         }
         // Mark the site as viewed
         Segue_AccessLog::instance()->touch($slot->getShortname());
     } catch (UnknownIdException $e) {
         // No slot for the site....
     }
     $authZ = Services::getService("AuthZ");
     $recordManager = Services::getService("RecordManager");
     //
     // Begin Optimizations
     //
     // The code below queues up authorizations for all visible nodes,
     // as well as pre-fetches all of the RecordSets that have data
     // specific to the visible nodes.
     $visibleComponents = SiteDispatcher::getSiteDirector()->getVisibleComponents(SiteDispatcher::getCurrentNodeId());
     $preCacheIds = array();
     foreach ($visibleComponents as $component) {
         $id = $component->getQualifierId();
         $authZ->getIsAuthorizedCache()->queueId($id);
         $preCacheIds[] = $id->getIdString();
     }
     $recordManager->preCacheRecordsFromRecordSetIDs($preCacheIds);
     //
     // End Optimizations
     //
     $mainScreen = new Container(new YLayout(), BLOCK, BACKGROUND_BLOCK);
     $allWrapper = $this->addHeaderControls($mainScreen);
     $this->addSiteContent($mainScreen);
     $this->addFooterControls($allWrapper);
     if (defined('SEGUE_SITE_FOOTER')) {
         $allWrapper->add(new UnstyledBlock(SEGUE_SITE_FOOTER), "100%", null, CENTER, BOTTOM);
     }
     $this->mainScreen = $mainScreen;
     return $allWrapper;
 }
 /**
  * get node that action applied to
  * 
  * @return string
  * @access public
  * @since 1/23/09
  */
 public function getNode()
 {
     $commentsManager = CommentManager::instance();
     $nodeId = $commentsManager->getCommentParentAsset($this->_comment)->getId()->getIdString();
     $siteDirector = SiteDispatcher::getSiteDirector();
     return $siteDirector->getSiteComponentById($nodeId);
 }
예제 #14
0
 /**
  * Save our results. Tearing down and unsetting the Wizard is handled by
  * in {@link runWizard()} and does not need to be implemented here.
  * 
  * @param string $cacheName
  * @return boolean TRUE if save was successful and tear-down/cleanup of the
  *		Wizard should ensue.
  * @access public
  * @since 1/28/08
  */
 public function saveWizard($cacheName)
 {
     $wizard = $this->getWizard($cacheName);
     if (!$wizard->validate()) {
         return false;
     }
     $values = $wizard->getAllValues();
     // 		printpre($values);
     // 		return false;
     try {
         if (!defined('DATAPORT_TMP_DIR')) {
             throw new Exception("DATAPORT_TMP_DIR must be defined in the Segue configuration.");
         }
         $archivePath = $values['mode']['backup_file']['tmp_name'];
         $archiveName = basename($archivePath);
         $decompressDir = DATAPORT_TMP_DIR . '/' . $archiveName . '_source';
         if (!$values['mode']['backup_file']['size']) {
             throw new Exception("File upload error - archive was not successfully uploaded and has no size.");
         }
         $this->decompressArchive($archivePath, $decompressDir);
         // Do the import
         $director = SiteDispatcher::getSiteDirector();
         $doc = new Harmoni_DOMDocument();
         $doc->load($decompressDir . "/site.xml");
         // Validate the document contents
         $doc->schemaValidateWithException(MYDIR . "/doc/raw/dtds/segue2-site.xsd");
         $mediaDir = $decompressDir;
         switch ($values['mode']['trust']) {
             case 'all':
                 $class = 'DomImportSiteVisitor';
                 break;
             case 'time_only':
                 $class = 'UntrustedAgentDomImportSiteVisitor';
                 break;
             default:
                 $class = 'UntrustedAgentAndTimeDomImportSiteVisitor';
         }
         $importer = new $class($doc, $mediaDir, $director);
         if ($values['mode']['roles'] == '1') {
             $importer->enableRoleImport();
         }
         if ($values['mode']['comments'] == '0') {
             $importer->disableCommentImport();
         }
         if (isset($values['owners'])) {
             $idMgr = Services::getService('Id');
             foreach ($values['owners']['admins'] as $adminIdString) {
                 $importer->addSiteAdministrator($idMgr->getId($adminIdString));
             }
         }
         $importer->enableStatusOutput();
         $site = $importer->importAtSlot($values['mode']['slotname']);
         // Delete the uploaded file
         unlink($archivePath);
         // Delete the decompressed Archive
         $this->deleteRecursive($decompressDir);
     } catch (Exception $importException) {
         // Delete the uploaded file
         try {
             if (file_exists($archivePath)) {
                 unlink($archivePath);
             }
         } catch (Exception $deleteException) {
             print "\n<div>\n\t";
             print $deleteException->getMessage();
             print "\n</div>";
         }
         // Delete the decompressed Archive
         try {
             if (file_exists($decompressDir)) {
                 $this->deleteRecursive($decompressDir);
             }
         } catch (Exception $deleteException) {
             print "\n<div>\n\t";
             print $deleteException->getMessage();
             print "\n</div>";
         }
         print "\n<div>\n\t";
         print $importException->getMessage();
         // 			print HarmoniErrorHandler::printDebugBacktrace($importException->getTrace());
         print "\n</div>";
         $wizard->backupFile->setValue(array('name' => null, 'size' => null, 'type' => null));
         /*********************************************************
          * Log the failure
          *********************************************************/
         if (Services::serviceRunning("Logging")) {
             $loggingManager = Services::getService("Logging");
             $log = $loggingManager->getLogForWriting("Segue");
             $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
             $priorityType = new Type("logging", "edu.middlebury", "Error", "Recoverable errors.");
             $item = new AgentNodeEntryItem("Create Site", "Failure in importing site for placeholder, '" . $values['mode']['slotname'] . "'. " . $importException->getMessage());
             $item->setBacktrace($importException->getTrace());
             $item->addTextToBactrace("Archive Upload: " . printpre($values['mode']['backup_file'], true));
             $log->appendLogWithTypes($item, $formatType, $priorityType);
         }
         return false;
     }
     /*********************************************************
      * Log the success
      *********************************************************/
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Segue");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
         $item = new AgentNodeEntryItem("Create Site", "Site imported for placeholder, '" . $values['mode']['slotname'] . "'.");
         $item->addNodeId($site->getQualifierId());
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
     return true;
 }
예제 #15
0
 /**
  * Add the javascript to the document head
  * 
  * @return void
  * @access protected
  * @since 7/31/08
  */
 public function addHeadJavascript()
 {
     $harmoni = Harmoni::instance();
     if (!$harmoni->getAttachedData('Segue_Selection_headJsAdded')) {
         $harmoni = Harmoni::instance();
         ob_start();
         print "\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "/javascript/Panel.js'></script>";
         print "\n\t\t<script type='text/javascript' src='" . POLYPHONY_PATH . "/javascript/FixedPanel.js'></script>";
         print "\n\t\t<link rel='stylesheet' type='text/css' href='" . MYPATH . "/javascript/Selection.css' />";
         print "\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/Selection.js'></script>";
         print "\n\t\t<script type='text/javascript' src='" . MYPATH . "/javascript/MoveCopyPanel.js'></script>";
         print "\n\t\t<script type='text/javascript'>";
         print "\n\t\t// <![CDATA[ ";
         // Load up the JS Selection with info from our session.
         $this->reset();
         if ($this->hasNext()) {
             print "\n\t\twindow.addOnLoad(function () { ";
             $director = SiteDispatcher::getSiteDirector();
             $authZ = Services::getService("AuthZ");
             $idManager = Services::getService("Id");
             try {
                 while ($this->hasNext()) {
                     $siteComponent = $this->nextSiteComponent();
                     try {
                         if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $siteComponent->getQualifierId())) {
                             print "\n\t\t\tSegue_Selection.instance().loadComponent({";
                             print "id: '" . $siteComponent->getId() . "', ";
                             print "type: '" . $siteComponent->getComponentClass() . "', ";
                             if (method_exists($siteComponent, 'isSection')) {
                                 if ($siteComponent->isSection()) {
                                     print "navType: 'Section', ";
                                 } else {
                                     print "navType: 'Page', ";
                                 }
                             }
                             print "displayName: '" . addslashes(str_replace('"', '&quot', preg_replace('/\\s+/', ' ', strip_tags($siteComponent->getDisplayName())))) . "' ";
                             print "});";
                         }
                     } catch (UnknownIdException $e) {
                         // Let assets out of the purvue of our authorization manager slide.
                     }
                 }
             } catch (NoMoreIteratorElementsException $e) {
                 // If assets in our selection were deleted and we ran-out early, that's ok.
             }
             $this->reset();
             print "\n\t\t});";
         }
         print "\n\t\t// ]]> ";
         print "\n\t\t</script>";
         $outputHandler = $harmoni->getOutputHandler();
         $outputHandler->setHead($outputHandler->getHead() . ob_get_clean());
         $harmoni->attachData('Segue_Selection_headJsAdded', true);
     }
 }
예제 #16
0
 /**
  * Answer the target component.
  * 
  * @return object SiteComponent
  * @access protected
  * @since 8/5/08
  */
 protected function getSiteComponent()
 {
     if (!isset($this->destComponent)) {
         $director = SiteDispatcher::getSiteDirector();
         $this->destComponent = $director->getSiteComponentById(RequestContext::value('node'));
     }
     return $this->destComponent;
 }
예제 #17
0
 /**
  * 
  * 
  * @param <##>
  * @return <##>
  * @access public
  * @since 1/18/06
  */
 public function printSiteShort(Asset $asset, $action, $num, Slot $otherSlot = null)
 {
     $harmoni = Harmoni::instance();
     $assetId = $asset->getId();
     $authZ = Services::getService('AuthZ');
     $idMgr = Services::getService('Id');
     if (!$authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId) && !$otherSlot->isUserOwner()) {
         return new UnstyledBlock('', BLANK);
     }
     $container = new Container(new YLayout(), BLOCK, STANDARD_BLOCK);
     $fillContainerSC = new StyleCollection("*.fillcontainer", "fillcontainer", "Fill Container", "Elements with this style will fill their container.");
     $fillContainerSC->addSP(new MinHeightSP("88%"));
     // 	$fillContainerSC->addSP(new WidthSP("100%"));
     // 	$fillContainerSC->addSP(new BorderSP("3px", "solid", "#F00"));
     $container->addStyle($fillContainerSC);
     $centered = new StyleCollection("*.centered", "centered", "Centered", "Centered Text");
     $centered->addSP(new TextAlignSP("center"));
     // Use the alias instead of the Id if it is available.
     $viewUrl = SiteDispatcher::getSitesUrlForSiteId($assetId->getIdString());
     $slotManager = SlotManager::instance();
     try {
         $sitesTrueSlot = $slotManager->getSlotBySiteId($assetId);
     } catch (Exception $e) {
     }
     // Print out the content
     ob_start();
     print "\n\t<div class='portal_list_slotname'>";
     if (isset($sitesTrueSlot)) {
         if (is_null($otherSlot) || $sitesTrueSlot->getShortname() == $otherSlot->getShortname()) {
             print $sitesTrueSlot->getShortname();
         } else {
             print $otherSlot->getShortname();
             $targets = array();
             $target = $otherSlot->getAliasTarget();
             while ($target) {
                 $targets[] = $target->getShortname();
                 if ($target->isAlias()) {
                     $target = $target->getAliasTarget();
                 } else {
                     $target = null;
                 }
             }
             print "\n<br/>";
             print str_replace('%1', implode(' &raquo; ', $targets), _("(an alias of %1)"));
             // Add Alias info.
             // 				if ($otherSlot->isAlias()) {
             // 					ob_start();
             //
             // 					print _("This slot is an alias of ").$slot->getAliasTarget()->getShortname();
             //
             // 					$container->add(new UnstyledBlock(ob_get_clean()), "100%", null, LEFT, TOP);
             // 				}
         }
     } else {
         print _("ID#") . ": " . $assetId->getIdString();
     }
     print "\n\t</div>";
     print "\n\t<div class='portal_list_site_title'>";
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
         print "\n\t\t<a href='" . $viewUrl . "'>";
         print "\n\t\t\t<strong>" . HtmlString::getSafeHtml($asset->getDisplayName()) . "</strong>";
         print "\n\t\t</a>";
         print "\n\t\t<br/>";
         print "\n\t\t<a href='" . $viewUrl . "' style='font-size: smaller;'>";
         print "\n\t\t\t" . $viewUrl;
         print "\n\t\t</a>";
     }
     print "\n\t</div>";
     print "\n\t<div class='portal_list_controls'>\n\t\t";
     $controls = array();
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
         $controls[] = "<a href='" . $viewUrl . "'>" . _("view") . "</a>";
     }
     // Hide all edit links if not authenticated to prevent web spiders from traversing them
     if ($this->isAuthenticated) {
         // While it is more correct to check modify permission permission, doing
         // so forces us to check AZs on the entire site until finding a node with
         // authorization or running out of nodes to check. Since edit-mode actions
         // devolve into view-mode if no authorization is had by the user, just
         // show the links all the time to cut page loads from 4-6 seconds to
         // less than 1 second.
         if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
             $controls[] = "<a href='" . SiteDispatcher::quickURL($action->getUiModule(), 'editview', array('node' => $assetId->getIdString())) . "'>" . _("edit") . "</a>";
         }
         // 		if ($action->getUiModule() == 'ui2') {
         // 			$controls[] = "<a href='".SiteDispatcher::quickURL($action->getUiModule(), 'arrangeview', array('node' => $assetId->getIdString()))."'>"._("arrange")."</a>";
         // 		}
         // add link to tracking
         if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
             $trackUrl = $harmoni->request->quickURL("participation", "actions", array('node' => $assetId->getIdString()));
             ob_start();
             print " <a target='_blank' href='" . $trackUrl . "'";
             print ' onclick="';
             print "var url = '" . $trackUrl . "'; ";
             print "window.open(url, 'site_map', 'width=600,height=600,resizable=yes,scrollbars=yes'); ";
             print "return false;";
             print '"';
             print ">" . _("track") . "</a>";
             $controls[] = ob_get_clean();
         }
         if (!is_null($otherSlot) && $otherSlot->isAlias() && $otherSlot->isUserOwner()) {
             $controls[] = "<a href='" . $harmoni->request->quickURL('slots', 'remove_alias', array('slot' => $otherSlot->getShortname())) . "' onclick=\"if (!confirm('" . str_replace("%1", $otherSlot->getShortname(), str_replace("%2", $otherSlot->getAliasTarget()->getShortname(), _("Are you sure that you want \\'%1\\' to no longer be an alias of \\'%2\\'?"))) . "')) { return false; }\">" . _("remove alias") . "</a>";
         } else {
             if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.delete'), $assetId)) {
                 $controls[] = "<a href='" . $harmoni->request->quickURL($action->getUiModule(), 'deleteComponent', array('node' => $assetId->getIdString())) . "' onclick=\"if (!confirm('" . _("Are you sure that you want to permenantly delete this site?") . "')) { return false; }\">" . _("delete") . "</a>";
             }
         }
         // Add a control to select this site for copying. This should probably
         // have its own authorization, but we'll use add_children/modify for now.
         if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $assetId)) {
             if (isset($sitesTrueSlot) && (is_null($otherSlot) || $sitesTrueSlot->getShortname() == $otherSlot->getShortname())) {
                 $controls[] = Segue_Selection::instance()->getAddLink(SiteDispatcher::getSiteDirector()->getSiteComponentFromAsset($asset));
             }
         }
     }
     print implode("\n\t\t | ", $controls);
     print "\n\t</div>";
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $assetId)) {
         $description = HtmlString::withValue($asset->getDescription());
         $description->trim(25);
         print "\n\t<div class='portal_list_site_description'>" . $description->asString() . "</div>";
     }
     print "\n\t<div style='clear: both;'></div>";
     print $this->getExportControls($assetId, $otherSlot, $sitesTrueSlot);
     $component = new UnstyledBlock(ob_get_clean());
     $container->add($component, "100%", null, LEFT, TOP);
     return $container;
 }
 /**
  * Set up our SiteDirector and make any needed data available
  * 
  * @return object SiteDirector
  * @access public
  * @since 4/14/06
  */
 function getSiteDirector()
 {
     return SiteDispatcher::getSiteDirector();
 }
예제 #19
0
 /**
  * Execute
  * 
  * @return mixed
  * @access public
  * @since 2/4/08
  */
 public function buildContent()
 {
     try {
         $status = new StatusStars(_("Preparing Site Import"));
         $status->initializeStatistics(4);
         $destPath = DATAPORT_TMP_DIR . "/Segue1Conversion-" . $this->getDestSlotName();
         mkdir($destPath);
         $destFilePath = $destPath . '/media';
         mkdir($destFilePath);
         $status->updateStatistics();
         // Download and convert the site
         $doc = $this->convertFrom1To2($destFilePath, 'media');
         // 			printpre(htmlentities($doc->saveXMLWithWhitespace()));
         // 			throw new Exception('test');
         $doc->schemaValidateWithException(MYDIR . "/doc/raw/dtds/segue2-site.xsd");
         $status->updateStatistics();
         // Debug output
         // 			$outputDoc2 = new Harmoni_DOMDocument;
         // 			$outputDoc2->loadXML($doc->saveXMLWithWhitespace());
         // 			printpre(htmlentities($outputDoc2->saveXML()));
         // 			throw new Exception('test');
         // Add the user as the owner
         $authN = Services::getService("AuthN");
         $slotMgr = SlotManager::instance();
         $slot = $slotMgr->getSlotByShortname($this->getDestSlotName());
         $slot->addOwner($authN->getFirstUserId());
         // Make the slot personal if it matches the personal naming scheme.
         $userName = PersonalSlot::getPersonalShortname($authN->getFirstUserId());
         if ($slot->getType() != Slot::personal && preg_match('/^' . $userName . '(-.+)?$/', $this->getDestSlotName())) {
             $slot = $slotMgr->convertSlotToType($slot, Slot::personal);
         }
         $status->updateStatistics();
         // Import the converted site
         $director = SiteDispatcher::getSiteDirector();
         $importer = new Segue1MappingImportSiteVisitor($doc, $destPath, $director);
         $status->updateStatistics();
         $importer->enableStatusOutput();
         $importer->makeUserSiteAdministrator();
         $importer->enableRoleImport();
         $importer->setOrigenSlotname($this->getSourceSlotName());
         $importer->setDestinationSlotname($this->getDestSlotName());
         $site = $importer->importAtSlot($this->getDestSlotName());
         // Set the media quota if it is bigger than our default
         $quota = $importer->getMediaQuota();
         if ($quota > $slot->getMediaQuota()->value()) {
             $slot->setMediaQuota(ByteSize::withValue($quota));
         }
         // Delete the output directory
         try {
             if (file_exists($destPath)) {
                 $this->deleteRecursive($destPath);
             }
         } catch (Exception $deleteException) {
             print "\n<div>\n\t";
             print $deleteException->getMessage();
             print "\n</div>";
         }
         /*********************************************************
          * Log the success
          *********************************************************/
         if (Services::serviceRunning("Logging")) {
             $loggingManager = Services::getService("Logging");
             $log = $loggingManager->getLogForWriting("Segue");
             $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
             $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
             $item = new AgentNodeEntryItem("Create Site", "Site imported for placeholder, '" . $this->getDestSlotName() . "', from Segue 1 placeholder, '" . $this->getSourceSlotName() . "'.");
             $item->addNodeId($site->getQualifierId());
             $log->appendLogWithTypes($item, $formatType, $priorityType);
         }
         $harmoni = Harmoni::instance();
         RequestContext::sendTo($harmoni->request->quickURL('dataport', 'choose_site'));
     } catch (Exception $importException) {
         // Delete the output directory
         try {
             if (file_exists($destPath)) {
                 $this->deleteRecursive($destPath);
             }
         } catch (Exception $deleteException) {
             print "\n<div>\n\t";
             print $deleteException->getMessage();
             print "\n</div>";
         }
         /*********************************************************
          * Log the failure
          *********************************************************/
         if (Services::serviceRunning("Logging")) {
             $loggingManager = Services::getService("Logging");
             $log = $loggingManager->getLogForWriting("Segue");
             $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
             $priorityType = new Type("logging", "edu.middlebury", "Error", "Recoverable errors.");
             $item = new AgentNodeEntryItem("Create Site", "Failure in importing site for placeholder, '" . $this->getDestSlotName() . "', from Segue 1 placeholder, '" . $this->getSourceSlotName() . "'.");
             $log->appendLogWithTypes($item, $formatType, $priorityType);
         }
         throw $importException;
     }
 }
 /**
  * Return the markup that represents the plugin.
  * Plugin writers should override this method with their own functionality
  * as needed.
  * 
  * @return string
  * @access public
  * @since 1/12/06
  */
 public function getMarkup()
 {
     $director = SiteDispatcher::getSiteDirector();
     $myComponent = $director->getSiteComponentById($this->getId());
     $myNav = $this->getParentNavBlock($myComponent);
     if (!$myNav->isSection()) {
         return "<div style='text-align: center'>" . _("This Next/Previous Links block is attached to a page, not a section. <br/>No links will be displayed unless it is attached to a section, such as in a side-bar.") . "</div>";
     }
     $menu = $myNav->acceptVisitor(new GetMenuBelowSiteVisitor());
     if (!is_object($menu)) {
         throw new InvalidArgumentException("'" . $menu . "' is not a MenuOrganizerSiteComponent");
     }
     if (!$menu instanceof MenuOrganizerSiteComponent) {
         throw new InvalidArgumentException(get_class($menu) . " is not a MenuOrganizerSiteComponent");
     }
     ob_start();
     $numCells = $menu->getTotalNumberOfCells();
     for ($i = 0; $i < $numCells; $i++) {
         $child = $menu->getSubcomponentForCell($i);
         if (is_object($child) && $child->getComponentClass() == 'NavBlock' && $child->isActive()) {
             $activePos = $i;
             break;
         }
     }
     if (!isset($activePos)) {
         $activePos = 0;
     }
     print "\n<div class='next_previous_links'>";
     $harmoni = Harmoni::instance();
     $authZ = Services::getService('AuthZ');
     $idMgr = Services::getService('Id');
     $viewId = $idMgr->getId("edu.middlebury.authorization.view");
     for ($i = $activePos - 1; $i >= 0; $i--) {
         $child = $menu->getSubcomponentForCell($i);
         if (is_object($child) && $child->getComponentClass() == 'NavBlock' && $authZ->isUserAuthorized($viewId, $child->getQualifierId())) {
             // Found a previous nav
             print "\n\t<div style='float: left; padding-right: 5px;'>";
             print "\n\t\t<a href='" . $this->getUrlForComponent($child->getId()) . "'>";
             print "&laquo; " . $this->cleanHTML($child->getDisplayName());
             print "</a>";
             print "\n\t</div>";
             break;
         }
     }
     for ($i = $activePos + 1; $i < $numCells; $i++) {
         $child = $menu->getSubcomponentForCell($i);
         if (is_object($child) && $child->getComponentClass() == 'NavBlock' && $authZ->isUserAuthorized($viewId, $child->getQualifierId())) {
             // Found a next nav
             print "\n\t<div style='float: right; padding-left: 5px;'>";
             print "\n\t\t<a href='" . $this->getUrlForComponent($child->getId()) . "'>";
             print $this->cleanHTML($child->getDisplayName()) . " &raquo;";
             print "</a>";
             print "\n\t</div>";
             break;
         }
     }
     print "\n</div>";
     return ob_get_clean();
 }
    /**
     * Return the markup that represents the plugin.
     * Plugin writers should override this method with their own functionality
     * as needed.
     * 
     * @return string
     * @access public
     * @since 1/12/06
     */
    public function getMarkup()
    {
        ob_start();
        if ($this->getFieldValue('edit') && $this->canModify()) {
            $director = SiteDispatcher::getSiteDirector();
            $node = $director->getSiteComponentById($this->getId());
            $currentTarget = $this->getTargetNodeId();
            $node = $director->getSiteComponentById($this->getId());
            print "\n" . $this->formStartTagWithAction();
            $visitor = new UmbrellaVisitor();
            $node->acceptVisitor($visitor);
            print "<div>";
            print _('Chose a section or page:');
            print "<select name='" . $this->getFieldName('tagNode') . "'>";
            $this->writeUmbrellaSelect($visitor->getNodeData(), $currentTarget);
            print "</select>\n";
            print "<div class='tags_display_options'>" . _('Only tags from your selected section or page will be displayed') . "</div><br/>\n";
            print "<select name='" . $this->getFieldName('defaultSortMethod') . "'>";
            print "\n\t<option value='alpha' ";
            if ($this->readOption('defaultSortMethod') == 'alpha') {
                print "selected='selected'";
            }
            print ">" . _('sort tags alphabetically') . "</option>";
            print "\n\t<option value='freq' ";
            if ($this->readOption('defaultSortMethod') == 'freq') {
                print "selected='selected'";
            }
            print ">" . _('sort tags by frequency') . "</option>";
            print "</select>\n";
            print "<br/>";
            print "<select name='" . $this->getFieldName('defaultDisplayType') . "'>";
            print "\n\t<option value='cloud' ";
            if ($this->readOption('defaultDisplayType') == 'cloud') {
                print "selected='selected'";
            }
            print ">" . _('display as cloud') . "</option>";
            print "\n\t<option value='list' ";
            if ($this->readOption('defaultDisplayType') == 'list') {
                print "selected='selected'";
            }
            print ">" . _('display as list') . "</option>";
            print "</select>\n";
            print "<br/>";
            print "<select name='" . $this->getFieldName('defaultListLimit') . "'>";
            print "\n\t<option value='0' ";
            if ($this->readOption('defaultListLimit') == '0') {
                print "selected='selected'";
            }
            print ">" . _('in list show: all') . "</option>";
            for ($i = 5; $i < 25; $i = $i + 5) {
                print "\n\t<option value='{$i}' ";
                if (intval($this->readOption('defaultListLimit')) == $i) {
                    print "selected='selected'";
                }
                print ">" . str_replace('%1', $i, _('in list show: %1')) . "</option>";
            }
            for ($i = 25; $i <= 300; $i = $i + 25) {
                print "\n\t<option value='{$i}' ";
                if (intval($this->readOption('defaultListLimit')) == $i) {
                    print "selected='selected'";
                }
                print ">" . str_replace('%1', $i, _('in list show: %1')) . "</option>";
            }
            print "</select>\n";
            print "<br/>";
            print "<br/>";
            print "<input type='submit' value='Update' name='" . $this->getFieldName('submit') . "'>\n";
            print "\n\t<input type='button' value='" . _('Cancel') . "' onclick=" . $this->locationSendString() . "/>";
            print "</div>";
            print "</form>";
        } else {
            if ($this->canView()) {
                $items = array();
                $director = SiteDispatcher::getSiteDirector();
                $node = $director->getSiteComponentById($this->getTargetNodeId());
                $visitor = new TaggableItemVisitor();
                $items = $node->acceptVisitor($visitor);
                print "\n<div class='breadcrumbs' style='height: auto; margin-top: 1px; margin-bottom: 5px; border-bottom: 1px dotted; padding-bottom: 2px;'>";
                print str_replace('%1', $node->acceptVisitor(new BreadCrumbsVisitor($node)), _("Tags within: %1"));
                print "</div>";
                print "\n<div style='text-align: justify;' id='tag_cloud_container-" . $this->getId() . "'>";
                $tags = TagAction::getTagsFromItems($items);
                //SiteDispatcher::passthroughContext();
                print TagAction::getTagCloudDiv($tags, 'sitetag', TagAction::getDefaultStyles(), array(), array(null => array('node' => $this->getTargetNodeId())));
                //SiteDispatcher::forgetContext();
                ?>
 	
 	<script type="text/javascript">
 	// <![CDATA[
 	
 	var cloudParent = document.get_element_by_id('tag_cloud_container-<?php 
                print $this->getId();
                ?>
');
 	var clouds = document.get_elements_by_class('tag_cloud', cloudParent);
 	var cloud = TagCloud.forContainer(clouds[0]);
 	
 			<?php 
                if ($this->readOption('defaultListLimit') != 15) {
                    print "\n\tcloud.tagList.setLimit(" . $this->readOption('defaultListLimit') . ");";
                }
                if ($this->readOption('defaultSortMethod') == 'freq') {
                    print "\n\tcloud.orderFreq();";
                }
                if ($this->readOption('defaultDisplayType') == 'list') {
                    print "\n\tcloud.showList();";
                }
                ?>

 	// ]]>
 	</script>
 	
 			
 			<?php 
                print "</div>";
                if ($this->shouldShowControls()) {
                    print "\n<div style='text-align: right; white-space: nowrap;'>";
                    print "\n\t<a " . $this->href(array('edit' => 'true')) . ">" . _('edit') . "</a>";
                    print "\n</div>";
                }
                /* 	
                $visitor = new UmbrellaVisitor;
                $node->acceptVisitor($visitor);
                print "<br/><pre>";
                print_r($visitor->getNodeData());
                print "</pre><br/>\n";
                */
            }
        }
        return ob_get_clean();
    }