예제 #1
0
 /**
  * Answer a links back to the main Segue pages
  * 
  * @return object GUIComponent
  * @access public
  * @since 1/12/07
  */
 function getCommandsComponent()
 {
     $harmoni = Harmoni::instance();
     ob_start();
     print "<div class='commands'>";
     print "<a href='";
     print SiteDispatcher::quickURL('view', 'html');
     print "' title='" . _("Go to View-Mode") . "'>";
     print _("view") . "</a>";
     print " | <a href='";
     print SiteDispatcher::quickURL('ui2', 'editview');
     print "' title='" . _("Go to Edit-Mode") . "'>";
     print _("edit") . "</a>";
     print " | " . _("header/footer");
     print " | <a href='";
     print SiteDispatcher::quickURL('ui2', 'arrangeview');
     print "' title='" . _("Go to Arrange-Mode") . "'>";
     print _("arrange") . "</a>";
     // Add permissions button
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     // 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<a href='#' onclick='window.location = \"{$url}\".urlDecodeAmpersands(); return false;'>";
         print _("roles") . "</a>";
     }
     print " | " . self::getUiSwitchForm();
     print "</div>";
     $ret = new Component(ob_get_clean(), BLANK, 2);
     return $ret;
 }
예제 #2
0
 /**
  * Visit a Block
  * 
  * @param object BlockSiteComponent $siteComponent
  * @return mixed
  * @access public
  * @since 8/31/07
  */
 public function visitBlock(BlockSiteComponent $siteComponent)
 {
     // check to see if user is authorized to view block
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_comments"), $idManager->getId($siteComponent->getId()))) {
         return;
     }
     $harmoni = Harmoni::instance();
     //get all comments for site component
     $commentsManager = CommentManager::instance();
     $comments = $commentsManager->getAllComments($siteComponent->getAsset());
     while ($comments->hasNext()) {
         $comment = $comments->next();
         $item = $this->addItem(new RSSItem());
         $item->setTitle($comment->getSubject());
         $item->setLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())) . "#comment_" . $comment->getIdString(), true);
         $item->setPubDate($comment->getModificationDate());
         $agentMgr = Services::getService("Agent");
         $agent = $comment->getAuthor();
         $item->setAuthor($agent->getDisplayName());
         $item->setCommentsLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())));
         $pluginMgr = Services::getService("PluginManager");
         $plugin = $pluginMgr->getPlugin($comment->getAsset());
         $item->setDescription($plugin->executeAndGetMarkup());
         // MediaFile eclosures.
         try {
             foreach ($plugin->getRelatedMediaFiles() as $file) {
                 $item->addEnclosure($file->getUrl(), $file->getSize()->value(), $file->getMimeType());
             }
         } catch (UnimplementedException $e) {
         }
     }
 }
 /**
  * Answer the plugin content for a block
  * 
  * @param object BlockSiteComponent $block
  * @return string
  * @access public
  * @since 1/7/08
  */
 function getPluginContent($block)
 {
     if ($block->getId() != $this->_node->getId()) {
         return parent::getPluginContent($block);
     }
     $harmoni = Harmoni::instance();
     $pluginManager = Services::getService('PluginManager');
     $plugin = $pluginManager->getPlugin($block->getAsset());
     if (!strlen(RequestContext::value('late_rev'))) {
         return _("No version specified");
     }
     $lateVersion = $plugin->getVersion(RequestContext::value('late_rev'));
     if (RequestContext::value('early_rev')) {
         $earlyVersion = $plugin->getVersion(RequestContext::value('early_rev'));
     } else {
         $earlyVersion = $lateVersion->getPrecedingVersion();
     }
     ob_start();
     // 		print "\n<h3 class='diff_title'>"._("Selected Versions")."</h3>";
     print "\n<a href='";
     $browseHistoryUrl = SiteDispatcher::quickURL($harmoni->request->getRequestedModule(), 'view_history', array('node' => SiteDispatcher::getCurrentNodeId(), 'early_rev' => RequestContext::value('early_rev'), 'late_rev' => RequestContext::value('late_rev')));
     print $browseHistoryUrl;
     $harmoni->history->markReturnUrl('revert_' . $block->getId(), $browseHistoryUrl);
     print "'>";
     print "\n<input type='button' value='" . _('&laquo; Choose Versions') . "'/>";
     print "</a>";
     print "\n<table class='version_compare'>";
     print "\n\t<thead>";
     print "\n\t\t<tr>";
     print "\n\t\t\t<th>";
     print $this->getHeadingBlock($earlyVersion);
     print "\n\t\t\t</th>";
     print "\n\t\t\t<th>";
     print $this->getHeadingBlock($lateVersion);
     print "\n\t\t\t</th>";
     print "\n\t\t</tr>";
     print "\n\t</thead>";
     print "\n\t<tbody>";
     print "\n\t\t<tr>";
     print "\n\t\t\t<td>";
     print $earlyVersion->getMarkup();
     print "\n\t\t\t</td>";
     print "\n\t\t\t<td>";
     print $lateVersion->getMarkup();
     print "\n\t\t\t</td>";
     print "\n\t\t</tr>";
     print "\n\t</tbody>";
     print "\n</table>";
     print "\n<h3 class='diff_title'>" . _("Changes") . "</h3>";
     print $plugin->getVersionDiff($earlyVersion->getVersionXml(), $lateVersion->getVersionXml());
     return ob_get_clean();
 }
예제 #4
0
 /**
  * Add the site header gui components
  * 
  * @return Component
  * @access public
  * @since 4/7/08
  */
 public function getSiteHeader()
 {
     $harmoni = Harmoni::instance();
     ob_start();
     $harmoni->request->startNamespace('polyphony-tags');
     print "\n<form action='" . SiteDispatcher::quickURL(null, null, array('tag' => RequestContext::value('tag'))) . "' method='post' style='display: inline;'>";
     print "\n\t<select name='" . RequestContext::name('num_tags') . "'";
     print " onchange='this.form.submit()'>";
     $options = array(50, 100, 200, 400, 600, 1000, 0);
     foreach ($options as $option) {
         print "\n\t\t<option value='" . $option . "' " . ($option == $this->getNumTags() ? " selected='selected'" : "") . ">" . ($option ? $option : _('all')) . "</option>";
     }
     print "\n\t</select>";
     print "\n</form>";
     $harmoni->request->endNamespace();
     return new Block(str_replace('%1', ob_get_clean(), _("Showing top %1 tags")), STANDARD_BLOCK);
 }
예제 #5
0
 /**
  * Print out a row.
  * 
  * @param Participation_Action $action
  * @return string
  * @access public
  * @since 1/30/09
  */
 public function printAction(Participation_Action $action)
 {
     // determine color of current row
     if ($this->_rowColor == "#F6F6F6") {
         $rowColor = "#FFFFFF";
         $this->_rowColor = "#FFFFFF";
     } else {
         $rowColor = "#F6F6F6";
         $this->_rowColor = "#F6F6F6";
     }
     ob_start();
     // time
     print "\n\t\t\t<td valign='top' class='participation_row' style='white-space: nowrap; background-color: " . $rowColor . ";'>" . $action->getTimeStamp()->format("Y-m-d g:i a") . "\n\t\t\t</td>";
     // contributor
     $participant = $action->getParticipant()->getId()->getIdString();
     print "\n\t\t\t<td valign='top'  class='participation_row' style='white-space: nowrap; background-color: " . $rowColor . ";'><a href='";
     print SiteDispatcher::quickURL('participation', 'actions', array('node' => $this->_node->getId(), 'sort' => $this->_sortValue, 'direction' => $this->_reorder, 'participant' => $participant, 'role' => $this->_role)) . "'>";
     print $action->getParticipant()->getDisplayName();
     print "</a>";
     print "\n\t\t\t</td>";
     // role
     print "\n\t\t\t<td valign='top' class='participation_row' style='white-space: nowrap; background-color: " . $rowColor . ";'>" . $action->getCategoryDisplayName() . "</td>";
     // contribution
     print "\n\t\t\t<td valign='top' class = 'participation_row' style='background-color: " . $rowColor . ";'>";
     print $action->getTargetDisplayName();
     print "\n\t\t\t</td>";
     // pushdown icon link
     $pushDownUrl = "<div class='pushdown'><a href='" . $action->getTargetUrl() . "'";
     $pushDownUrl .= " onclick=\"if (window.opener) { window.opener.location = this.href;";
     $pushDownUrl .= "return false; }\" title='" . _("review this in site") . "'>";
     $pushDownUrl .= "\n\t\t\t<img src='" . MYPATH . "/images/pushdown.png' alt='site link' style='border: 0; vertical-align: middle;'/></a></div>";
     print "\n\t\t\t<td valign='top' class = 'participation_row' style='white-space: nowrap; background-color: " . $rowColor . ";'>";
     print $pushDownUrl;
     print "\n\t\t\t</td>";
     return ob_get_clean();
 }
예제 #6
0
 /**
  * Print out a row.
  * 
  * @param Participation_Participant $participant
  * @return string
  * @access public
  * @since 1/30/09
  */
 public function printAction(Participation_Participant $participants)
 {
     $participant = $participants->getId()->getIdString();
     $participantView = new Participation_Participant($this->_view, $participants->getId());
     // determine color of current row
     if ($this->_rowColor == "#F6F6F6") {
         $rowColor = "#FFFFFF";
         $this->_rowColor = "#FFFFFF";
     } else {
         $rowColor = "#F6F6F6";
         $this->_rowColor = "#F6F6F6";
     }
     ob_start();
     print "\n\t\t<tr>";
     print "\n\t\t\t<td class='participant_row' style='background-color: " . $rowColor . "'>";
     print "<a href='";
     print SiteDispatcher::quickURL('participation', 'actions', array('node' => $this->_node->getId(), 'sort' => 'timestamp', 'direction' => 'DESC', 'participant' => $participant)) . "'>";
     print $participants->getDisplayName();
     print "</a>";
     print "\n\t\t\t</td>";
     print "\n\t\t\t<td class='participant_row' style='background-color: " . $rowColor . "'>";
     print "<a href='";
     print SiteDispatcher::quickURL('participation', 'actions', array('node' => $this->_node->getId(), 'sort' => 'timestamp', 'direction' => 'DESC', 'participant' => $participant, 'role' => 'commenter')) . "'>";
     print $participantView->getNumActionsByCategory('commenter');
     print "</a>";
     print "\n\t\t\t</td>";
     print "\n\t\t\t<td class='participant_row' style='background-color: " . $rowColor . "'>";
     print "<a href='";
     print SiteDispatcher::quickURL('participation', 'actions', array('node' => $this->_node->getId(), 'sort' => 'timestamp', 'direction' => 'DESC', 'participant' => $participant, 'role' => 'author')) . "'>";
     print $participantView->getNumActionsByCategory('author');
     print "</a>";
     print "\n\t\t\t</td>";
     print "\n\t\t\t<td class='participant_row' style='background-color: " . $rowColor . "'>";
     print "<a href='";
     print SiteDispatcher::quickURL('participation', 'actions', array('node' => $this->_node->getId(), 'sort' => 'timestamp', 'direction' => 'DESC', 'participant' => $participant, 'role' => 'editor')) . "'>";
     print $participantView->getNumActionsByCategory('editor');
     print "</a>";
     print "\n\t\t\t</td>";
     print "\n\t\t</tr>";
     return ob_get_clean();
 }
예제 #7
0
 /**
  * Answer an 'add new component' link
  * 
  * @param string $title
  * @param string $display
  * @param object SiteComponent $startingSiteComponent
  * @return string
  * @access public
  * @since 12/3/07
  */
 public function getAddLink($title, $display, SiteComponent $startingComponent)
 {
     ArgumentValidator::validate($title, NonZeroLengthStringValidatorRule::getRule());
     ArgumentValidator::validate($display, NonZeroLengthStringValidatorRule::getRule());
     $harmoni = Harmoni::instance();
     ob_start();
     print "<a href='";
     $harmoni->request->startNamespace(null);
     try {
         print SiteDispatcher::quickURL($this->addModule, $this->addAction, array('title' => $title, 'refNode' => $startingComponent->getId()));
     } catch (NullArgumentException $e) {
         print $harmoni->request->quickURL($this->addModule, $this->addAction, array('title' => $title, 'node' => $startingComponent->getId(), 'refNode' => $startingComponent->getId()));
     }
     $harmoni->request->endNamespace();
     print "'";
     print " title=\"" . str_replace('%1', strip_tags($title), _("Add '%1' as a new component.")) . "\"";
     print ">";
     print $display;
     print " ?</a>";
     return ob_get_clean();
 }
예제 #8
0
 /**
  * Answer the interface markup needed to display the comments attached to the
  * given asset.
  * 
  * @param object Asset $asset
  * @return string
  * @access public
  * @since 7/3/07
  */
 function getMarkup($asset)
 {
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace('comments');
     if (RequestContext::value('order')) {
         $this->setDisplayOrder(RequestContext::value('order'));
     }
     if (RequestContext::value('displayMode')) {
         $this->setDisplayMode(RequestContext::value('displayMode'));
     }
     try {
         if (RequestContext::value('create_new_comment')) {
             $comment = $this->createRootComment($asset, HarmoniType::fromString(RequestContext::value('plugin_type')));
             $comment->updateSubject(RequestContext::value('title'));
             $comment->enableEditForm();
         }
         if (RequestContext::value('reply_parent') && RequestContext::value('plugin_type')) {
             $idManager = Services::getService('Id');
             $comment = $this->createReply($idManager->getId(RequestContext::value('reply_parent')), HarmoniType::fromString(RequestContext::value('plugin_type')));
             $comment->updateSubject(RequestContext::value('title'));
             $comment->enableEditForm();
         }
         if (RequestContext::value('delete_comment')) {
             $idManager = Services::getService('Id');
             try {
                 $this->deleteComment($idManager->getId(RequestContext::value('delete_comment')));
             } catch (Exception $e) {
                 // In case we have a delete_comment id in the url that no longer exists,
                 // just catch any exceptions. See the following bug:
                 // http://sourceforge.net/tracker/index.php?func=detail&aid=1798996&group_id=82171&atid=565234
             }
         }
     } catch (PermissionDeniedException $e) {
         $messages = $e->getMessage();
     }
     $this->addHead();
     ob_start();
     if (isset($messages)) {
         print "\n<div class='error'>" . $messages . "</div>";
     }
     if ($this->canComment($asset->getId())) {
         // New comment
         print "\n<div style='float: left;'>";
         $url = SiteDispatcher::mkURL();
         $url->setValue('create_new_comment', 'true');
         print "\n\t<button ";
         print "onclick=\"CommentPluginChooser.run(this, '" . $url->write() . "#" . RequestContext::name('current') . "', ''); return false;\">";
         print _("New Post") . "</button>";
         print "\n<div class='comment_help'>";
         print _("Discussion posts can be edited or deleted until they are replied-to.");
         print " (" . Help::link('Discussion') . ")";
         print "</div>";
         print "\n</div>";
     }
     if ($this->canViewComments($asset->getId())) {
         // print the ordering form
         if ($this->isSortingEnabled()) {
             print "\n\n<form action='" . SiteDispatcher::quickURL() . "#" . RequestContext::name('top') . "' method='post'  style='float: right; text-align: right;'>";
             print "\n\t\t<select name='" . RequestContext::name('displayMode') . "'>";
             print "\n\t\t\t<option value='threaded'" . ($this->getDisplayMode() == 'threaded' ? " selected='selected'" : "") . ">";
             print _("Threaded") . "</option>";
             print "\n\t\t\t<option value='flat'" . ($this->getDisplayMode() == 'flat' ? " selected='selected'" : "") . ">";
             print _("Flat") . "</option>";
             print "\n\t\t</select>";
             print "\n\t\t<select name='" . RequestContext::name('order') . "'>";
             print "\n\t\t\t<option value='" . ASC . "'" . ($this->getDisplayOrder() == ASC ? " selected='selected'" : "") . ">";
             print _("Oldest First") . "</option>";
             print "\n\t\t\t<option value='" . DESC . "'" . ($this->getDisplayOrder() == DESC ? " selected='selected'" : "") . ">";
             print _("Newest First") . "</option>";
             print "\n\t\t</select>";
             print "\n\t<input type='submit' value='" . _("Change") . "'/>";
             print "\n</form>";
             print "\n<div style='clear: both;'> &nbsp; </div>";
         }
         // Print out the Comments
         print "\n<div id='" . RequestContext::name('comments') . "'>";
         if ($this->getDisplayMode() == 'flat') {
             $comments = $this->getAllComments($asset, $this->getDisplayOrder());
         } else {
             $comments = $this->getRootComments($asset, $this->getDisplayOrder());
         }
         while ($comments->hasNext()) {
             $comment = $comments->next();
             // If this is a work in progress that has not had content added yet,
             // do not display it.
             if ($comment->hasContent() || $comment->isAuthor()) {
                 print $comment->getMarkup($this->getDisplayMode() == 'threaded' ? true : false);
             }
         }
         print "\n</div>";
     } else {
         print "\n<div>" . _("You are not authorized to view discussion posts.") . "</div>";
     }
     $harmoni->request->endNamespace();
     return ob_get_clean();
 }
예제 #9
0
 /**
  * Return the URL that this action should return to when completed.
  * 
  * @return string
  * @access public
  * @since 11/14/07
  */
 function getReturnUrl()
 {
     $wizard = $this->getWizard($this->cacheName);
     $harmoni = Harmoni::instance();
     $chooseUserListener = $wizard->getChild('choose_user');
     if ($chooseUserListener->wasPressed()) {
         return SiteDispatcher::quickURL('roles', 'choose_agent');
     } else {
         if (RequestContext::value('returnModule')) {
             $module = RequestContext::value('returnModule');
         } else {
             $module = 'ui1';
         }
         if (RequestContext::value('returnAction')) {
             $action = RequestContext::value('returnAction');
         } else {
             $action = 'editview';
         }
         $harmoni->request->forget('returnAction');
         $harmoni->request->forget('returnModule');
         $harmoni->request->forget('agent');
         return SiteDispatcher::quickURL($module, $action);
     }
 }
예제 #10
0
 /**
  * Print the history link
  * 
  * @param SiteComponent $siteComponent
  * @return void
  * @access public
  * @since 6/04/08
  */
 function printHistoryLink(SiteComponent $siteComponent)
 {
     print "\n\t\t\t\t<tr><td class='ui2_settingborder'>";
     print "\n\t\t\t\t<div class='ui2_settingtitle'>";
     print _('Edit History: ') . "\n\t\t\t\t</div>";
     print "\n\t\t\t\t</td><td class='ui2_settingborder'>";
     print "\n\t\t\t\t\t";
     print "<a href='";
     $harmoni = Harmoni::instance();
     $harmoni->history->markReturnURL('view_history_' . $siteComponent->getId());
     print SiteDispatcher::quickURL('versioning', 'view_history', array("node" => $siteComponent->getId(), 'returnModule' => $harmoni->request->getRequestedModule(), 'returnAction' => $harmoni->request->getRequestedAction()));
     print "'>";
     print _("view history");
     print " &raquo;</a>";
     print "\n\t\t\t\t</td></tr>";
 }
 /**
  * Answer the detail url of a block
  * 
  * @param string $id
  * @return string
  * @access public
  * @since 5/18/07
  */
 function getDetailUrl($id)
 {
     $harmoni = Harmoni::instance();
     return SiteDispatcher::quickURL($harmoni->request->getRequestedModule(), 'editview', array("node" => $id));
 }
예제 #12
0
 /**
  * Answer the Url for this component id.
  *
  * Note: this is clunky that this object has to know about harmoni and 
  * what action to target. Maybe rewrite...
  * 
  * @param string $id
  * @return string
  * @access public
  * @since 4/4/06
  */
 function getUrlForComponent($id)
 {
     $harmoni = Harmoni::instance();
     $origUrl = $harmoni->history->getReturnURL('view_history_' . $this->_node->getId());
     $module = $harmoni->request->getModuleFromUrl($origUrl);
     if ($module == false) {
         $module = 'ui1';
     }
     $action = $harmoni->request->getActionFromUrl($origUrl);
     if ($action == false) {
         $action = 'view';
     }
     return SiteDispatcher::quickURL($module, $action, array("node" => $id));
 }
예제 #13
0
 /**
  * Execute the action
  * 
  * @return mixed
  * @access public
  */
 public function execute()
 {
     try {
         if (!$this->isAuthorizedToExecute()) {
             throw new PermissionDeniedException();
         }
         ob_start();
         $harmoni = Harmoni::instance();
         $component = SiteDispatcher::getCurrentNode();
         $site = SiteDispatcher::getCurrentRootNode();
         $slotMgr = SlotManager::instance();
         $slot = $slotMgr->getSlotBySiteId($site->getId());
         $exportDirname = $slot->getShortname() . "-html";
         $exportDir = DATAPORT_TMP_DIR . "/" . $exportDirname;
         $archivePath = DATAPORT_TMP_DIR . '/' . $exportDirname . ".zip";
         if (file_exists($exportDir)) {
             $changedTime = filemtime($exportDir);
             // If the export is more than an hour old, trash it.
             if ($changedTime < time() - 3600) {
                 $this->deleteRecursive($exportDir);
             } else {
                 throw new AlreadyExportingException("Another export of this site is in progress (data written last on " . date('r', $changedTime) . ").  Please wait. <br/><br/>The other export will be force-quit if it does not finish in " . round((3600 - (time() - $changedTime)) / 60) . " minutes.");
             }
         }
         mkdir($exportDir);
         // Do the export
         $urlParts = parse_url(MYURL);
         $urlPrefix = rtrim($urlParts['path'], '/');
         $include = array($urlPrefix . '/gui2', $urlPrefix . '/images', $urlPrefix . '/javascript', $urlPrefix . '/polyphony', $urlPrefix . '/repository', $urlPrefix . '/plugin_manager', $urlPrefix . '/rss', $urlPrefix . '/dataport/html/site/' . $slot->getShortname());
         if (defined('WGET_PATH')) {
             $wget = WGET_PATH;
         } else {
             $wget = 'wget';
         }
         $command = $wget . " -r --page-requisites --html-extension --convert-links --no-directories -e robots=off " . "--directory-prefix=" . escapeshellarg($exportDir . '/content') . " " . "--include=" . escapeshellarg(implode(',', $include)) . " " . "--header=" . escapeshellarg("Cookie: " . session_name() . "=" . session_id()) . " " . escapeshellarg(SiteDispatcher::quickURL('dataport', 'html', array('site' => $slot->getShortname())));
         // 			throw new Exception($command);
         // Close the session. If we don't, a lock on the session file will
         // cause the request initiated via wget to hang.
         session_write_close();
         exec($command, $output, $exitCode);
         if ($exitCode) {
             throw new Exception('Wget Failed. ' . implode("\n", $output));
         }
         // Copy the main HTML file to index.html
         copy($exportDir . '/content/' . $slot->getShortname() . '.html', $exportDir . '/content/index.html');
         // Copy the index.html file up a level to make it easy to find
         file_put_contents($exportDir . '/index.html', preg_replace('/(src|href)=([\'"])([^\'"\\/]+)([\'"])/', '$1=$2content/$3$4', file_get_contents($exportDir . '/content/index.html')));
         // Zip up the result
         $archive = new ZipArchive();
         if ($archive->open($archivePath, ZIPARCHIVE::CREATE) !== TRUE) {
             throw new Exception("Could not create zip archive.");
         }
         $this->addDirectoryToZip($archive, $exportDir, $exportDirname);
         $archive->close();
         // Remove the directory
         $this->deleteRecursive($exportDir);
         if ($output = ob_get_clean()) {
             print $output;
             throw new Exception("Errors occurred, output wasn't clean.");
         }
         header("Content-Type: application/zip;");
         header('Content-Disposition: attachment; filename="' . basename($archivePath) . '"');
         header('Content-Length: ' . filesize($archivePath));
         print file_get_contents($archivePath);
         // Clean up the archive
         unlink($archivePath);
     } catch (PermissionDeniedException $e) {
         $this->deleteRecursive($exportDir);
         if (file_exists($archivePath)) {
             unlink($archivePath);
         }
         return new Block(_("You are not authorized to export this component."), ALERT_BLOCK);
     } catch (AlreadyExportingException $e) {
         return new Block($e->getMessage(), ALERT_BLOCK);
     } catch (Exception $e) {
         $this->deleteRecursive($exportDir);
         if (file_exists($archivePath)) {
             unlink($archivePath);
         }
         throw $e;
     }
     error_reporting(0);
     exit;
 }
 /**
  * get url of node that action is applied to
  * 
  * @return string
  * @access public
  * @since 1/23/09
  */
 public function getTargetUrl()
 {
     $url = SiteDispatcher::quickURL('versioning', 'compare_versions', array('node' => $this->_node->getId(), 'late_rev' => $this->_version->getVersionId()));
     return $url;
 }
예제 #15
0
 /**
  * Print Node info html
  * 
  * @param object SiteComponent $siteComponent
  * @return void
  * @access protected
  * @since 3/17/08
  */
 protected function printNodeInfo(SiteComponent $siteComponent, $inMenu = false)
 {
     $harmoni = Harmoni::instance();
     print $this->getTabs() . "\t";
     if ($siteComponent->getId() == SiteDispatcher::getCurrentNodeId()) {
         print "<div class='info current'>";
     } else {
         print "<div class='info'>";
     }
     print $this->getTabs() . "\t\t";
     print "<div class='title'>";
     $nodeUrl = SiteDispatcher::quickURL('view', 'html', array('node' => $siteComponent->getId()));
     if (!$inMenu) {
         print "<a href='" . $nodeUrl . "' ";
         print ' onclick="';
         print "if (window.opener) { ";
         print "window.opener.location = this.href; ";
         print "return false; ";
         print '}" ';
         print " title='" . _("View this node") . "'>";
     }
     print $siteComponent->getDisplayName();
     if (!$inMenu) {
         print "</a>";
     }
     print "</div>";
     $nodeDescription = HtmlString::withValue($siteComponent->getDescription());
     $nodeDescription->stripTagsAndTrim(5);
     print $this->getTabs() . "\t\t";
     print "<div class='description'>" . $nodeDescription->stripTagsAndTrim(20) . "</div>";
     print $this->getTabs() . "\t";
     print "</div>";
 }
예제 #16
0
 /**
  * Return the URL that this action should return to when completed.
  * 
  * @return string
  * @access public
  * @since 4/28/05
  */
 function getReturnUrl()
 {
     $harmoni = Harmoni::instance();
     if (isset($this->_siteId) && $this->_siteId) {
         return SiteDispatcher::quickURL($harmoni->request->getRequestedModule(), "editview", array("node" => $this->_siteId));
     } else {
         return $harmoni->request->quickURL('portal', "list");
     }
 }
예제 #17
0
 /**
  * Execute
  * 
  * @return mixed
  * @access public
  * @since 2/14/08
  */
 public function buildContent()
 {
     $actionRows = $this->getActionRows();
     ob_start();
     print "<p>";
     if (isset($_SERVER['HTTP_REFERER'])) {
         print "<a href='" . strip_tags($_SERVER['HTTP_REFERER']) . "'>&laquo;" . _("Go Back") . "</a>";
     }
     print "</p>";
     print "\n\t<p>" . str_replace('%1', strip_tags(RequestContext::value('title')), _("<strong><em>%1</em></strong> does not yet exist.")) . '</p>';
     $harmoni = Harmoni::instance();
     $refNode = $this->getRefNode();
     // If the user isn't authorized to add-children here, they aren't authorized
     // above us, so don't show the form.
     $authZ = Services::getService('AuthZ');
     $idManager = Services::getService("Id");
     try {
         $organizer = process_add_wiki_componentAction::getOrganizerForComponentType($refNode, new Type('SeguePlugins', 'edu.middlebury', 'TextBlock'));
         $canAddContent = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId());
     } catch (OperationFailedException $e) {
         $canAddContent = false;
     }
     try {
         $organizer = process_add_wiki_componentAction::getOrganizerForComponentType($refNode, new Type('segue-multipart', 'edu.middlebury', 'ContentPage_multipart'));
         $canAddPages = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId());
     } catch (OperationFailedException $e) {
         $canAddPages = false;
     }
     if ($canAddContent || $canAddPages) {
         print "\n<form action='" . SiteDispatcher::quickURL('ui2', 'process_add_wiki_component') . "' method='post'>";
         print "\n\t<input type='hidden' name='" . RequestContext::name('displayName') . "' value='" . strip_tags(RequestContext::value('title')) . "'/>";
         print "\n\t<input type='hidden' name='" . RequestContext::name('refNode') . "' value='" . $refNode->getId() . "'/>";
         print "\n\t<p>";
         print _("Create as new ");
         print "\n\t\t<select class='ui2_page_select' name='" . RequestContext::name('componentType') . "'>";
         $allowed = array();
         if ($canAddPages) {
             $allowed[] = _("Pages and Sections");
             $allowed[] = new Type('segue-multipart', 'edu.middlebury', 'ContentPage_multipart');
             $allowed[] = new Type('segue-multipart', 'edu.middlebury', 'SubMenu_multipart');
             $allowed[] = new Type('segue-multipart', 'edu.middlebury', 'SidebarSubMenu_multipart');
             $allowed[] = new Type('segue-multipart', 'edu.middlebury', 'SidebarContentPage_multipart');
         }
         if ($canAddContent) {
             $allowed[] = _("Content Blocks");
             $pluginManager = Services::getService("PluginManager");
             $allowed = array_merge($allowed, $pluginManager->getEnabledPlugins());
         }
         $inCat = false;
         foreach ($allowed as $type) {
             if (is_string($type)) {
                 if ($inCat) {
                     print "\n\t\t\t</optgroup>";
                 }
                 $inCat = true;
                 print "\n\t\t\t<optgroup label='{$type}'>";
             } else {
                 $this->printTypeOption($type);
             }
         }
         if ($inCat) {
             print "\n\t\t\t</optgroup>";
         }
         print "\n\t\t</select> ";
         print "\n\t\t &nbsp; <input type='submit' value='Go &raquo;'/>";
         print "\n\t</p>";
         print "\n</form>";
     } else {
         print "<p>" . _("You are not authorized to create this new page.") . "</p>";
     }
     $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
 }
예제 #18
0
 /**
  * Answer controls for MenuOrganizer SiteComponents
  * 
  * @param SiteComponent $siteComponent
  * @return string
  * @access public
  * @since 4/17/06
  */
 public function visitMenuOrganizer(MenuOrganizerSiteComponent $siteComponent)
 {
     // 		$this->controlsStart($siteComponent);
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     $harmoni = Harmoni::instance();
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $siteComponent->getQualifierId())) {
         $url = SiteDispatcher::quickURL('ui1', 'editMenu', array('node' => $siteComponent->getId(), 'returnNode' => SiteDispatcher::getCurrentNodeId(), 'returnAction' => $this->action));
         ob_start();
         print "\n\t\t\t\t<div style='text-align: center;'>";
         print "\n\t\t\t\t\t<a href='" . $url . "'>";
         print _("[ menu display options ]");
         print "</a>";
         print "\n\t\t\t\t</div>";
         $controls = ob_get_clean();
     } else {
         $controls = '';
     }
     return $controls;
     // 		return $this->controlsEnd($siteComponent);
 }
 /**
  * get url of node that action is applied to
  * 
  * @return string
  * @access public
  * @since 1/23/09
  */
 public function getTargetUrl()
 {
     return SiteDispatcher::quickURL('view', 'html', array('node' => $this->_node->getId()));
 }
 /**
  * Answer the Url for this component id.
  *
  * Note: this is clunky that this object has to know about harmoni and 
  * what action to target. Maybe rewrite...
  * 
  * @param string $id
  * @return string
  * @access public
  * @since 4/4/06
  */
 protected function getUrlForComponent($id)
 {
     $harmoni = Harmoni::instance();
     if ($harmoni->request->getRequestedModule() == 'versioning') {
         $origUrl = $harmoni->history->getReturnURL('view_history_' . SiteDispatcher::getCurrentNodeId());
         $module = $harmoni->request->getModuleFromUrl($origUrl);
         if ($module == false) {
             $module = 'ui1';
         }
         $action = $harmoni->request->getActionFromUrl($origUrl);
         if ($action == false) {
             $action = 'view';
         }
     } else {
         $module = $harmoni->request->getRequestedModule();
         $action = $harmoni->request->getRequestedAction();
     }
     return SiteDispatcher::quickURL($module, $action, array("node" => $id));
 }
 /**
  * Answer the url to return to
  * 
  * @return string
  * @access public
  * @since 5/8/07
  */
 function getReturnUrl()
 {
     $harmoni = Harmoni::instance();
     $harmoni->request->forget("returnNode");
     $harmoni->request->forget("returnModule");
     $harmoni->request->forget("returnAction");
     if ($harmoni->request->get("returnModule")) {
         $returnModule = $harmoni->request->get("returnModule");
     } else {
         $returnModule = 'ui1';
     }
     return SiteDispatcher::quickURL($returnModule, $harmoni->request->get("returnAction"), array('node' => $harmoni->request->get("returnNode")));
 }
예제 #22
0
 /**
  * Print info about a Slot
  * 
  * @param object Slot $slot
  * @return void
  * @access private
  * @since 3/13/08
  */
 private function printSlotInfo(Slot $slot)
 {
     $harmoni = Harmoni::instance();
     if ($slot->siteExists()) {
         $asset = $slot->getSiteAsset();
         try {
             $authZ = Services::getService('AuthZ');
             $idMgr = Services::getService('Id');
             if (!$authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.view'), $slot->getSiteId())) {
                 print "\n<div class='site_info'>";
                 print "\n\t<div class='site_description'>";
                 print _("A site has been created for this placeholder, but you do not have authorization to view it.");
                 print "</div>";
                 print "\n</div>";
                 return;
             }
         } catch (UnknownIdException $e) {
         }
         $viewUrl = SiteDispatcher::quickURL('view', 'html', array('site' => $slot->getShortname()));
         print "\n<div class='site_info'>";
         print "\n\t<div class='site_title'>";
         print "\n\t\t<a href='" . $viewUrl . "' target='_blank'>";
         print "\n\t\t\t<strong>" . HtmlString::getSafeHtml($asset->getDisplayName()) . "</strong>";
         print "\n\t\t</a>";
         print "\n\t</div>";
         $description = HtmlString::withValue($asset->getDescription());
         $description->trim(25);
         print "\n\t<div class='site_description'>" . $description->asString() . "</div>";
         print "\n</div>";
     }
     print "\n\t<div class='slotname'>";
     print $slot->getShortname();
     print "\n\t</div>";
 }
 /**
  * Return the browser to the page from whence they came
  * 
  * @return void
  * @access public
  * @since 10/16/06
  */
 function returnToCallerPage()
 {
     $harmoni = Harmoni::instance();
     if (!($returnAction = RequestContext::value('returnAction'))) {
         $returnAction = 'editview';
     }
     if (isset($this->newIdToSendTo)) {
         $node = $this->newIdToSendTo;
     } else {
         $node = RequestContext::value('returnNode');
     }
     RequestContext::locationHeader(SiteDispatcher::quickURL($harmoni->request->getRequestedModule(), $returnAction, array("node" => $node)));
 }
예제 #24
0
 /**
  * Answer an HTML block of export controls.
  * 
  * @param Id $assetId
  * @param optional Slot $slot
  * @return string
  */
 public function getExportControls(Id $assetId, Slot $slot = null, Slot $sitesTrueSlot = null)
 {
     if (!defined('DATAPORT_ENABLE_EXPORT_REDIRECT') || !DATAPORT_ENABLE_EXPORT_REDIRECT) {
         return '';
     }
     $authZ = Services::getService('AuthZ');
     $idMgr = Services::getService('Id');
     ob_start();
     if (!empty($slot)) {
         $this->printMigrationStatus($slot);
     }
     // Export controls
     if ($authZ->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $assetId)) {
         print "\n\t<div class='portal_list_controls portal_list_export_controls'>\n\t\t";
         $controls = array();
         if (isset($sitesTrueSlot)) {
             $params = array('site' => $sitesTrueSlot->getShortname());
         } else {
             $params = array('node' => $assetId->getIdString());
         }
         if ($this->isExportEnabled('html')) {
             $control = "<a href='" . SiteDispatcher::quickURL('dataport', 'export_html', $params) . "' onclick='new ArchiveStatus(this, \"" . SiteDispatcher::quickURL('dataport', 'check_html_export', $params) . "\");'>" . _("export HTML archive") . "</a>";
             if (!empty($GLOBALS['dataport_export_types']['html']['help'])) {
                 $control .= " (<a href='" . $GLOBALS['dataport_export_types']['html']['help'] . "' target='_blank'>help</a>)";
             }
             $controls[] = $control;
         }
         if ($this->isExportEnabled('wordpress')) {
             $control = "<a href='" . SiteDispatcher::quickURL('dataport', 'wordpress', $params) . "'>" . _("export for wordpress") . "</a>";
             if (!empty($GLOBALS['dataport_export_types']['wordpress']['help'])) {
                 $control .= " (<a href='" . $GLOBALS['dataport_export_types']['wordpress']['help'] . "' target='_blank'>help</a>)";
             }
             $controls[] = $control;
         }
         if ($this->isExportEnabled('files')) {
             $control = "<a href='" . SiteDispatcher::quickURL('dataport', 'files', $params) . "'>" . _("export files") . "</a>";
             if (!empty($GLOBALS['dataport_export_types']['files']['help'])) {
                 $control .= " (<a href='" . $GLOBALS['dataport_export_types']['files']['help'] . "' target='_blank'>help</a>)";
             }
             $controls[] = $control;
         }
         print implode("\n\t\t | ", $controls);
         print "\n\t</div>";
     }
     $export = ob_get_clean();
     if ($export) {
         return "\n<div class='export_controls'>" . $export . "</div>";
     } else {
         return '';
     }
 }
예제 #25
0
 /**
  * Answer the url to return to
  * 
  * @return string
  * @access public
  * @since 5/19/08
  */
 function getReturnUrl()
 {
     if (isset($this->createdCopy) && $this->createdCopy) {
         $harmoni = Harmoni::instance();
         return SiteDispatcher::quickURL('ui1', 'theme_options', array('wizardSkipToStep' => "advanced"));
     } else {
         return parent::getReturnUrl();
     }
 }
예제 #26
0
 /**
  * Return the URL that this action should return to when completed.
  * 
  * @return string
  * @access public
  * @since 11/14/07
  */
 function getReturnUrl()
 {
     $harmoni = Harmoni::instance();
     $wizard = $this->getWizard($this->getCacheName());
     if (RequestContext::value('returnModule')) {
         $module = RequestContext::value('returnModule');
     } else {
         if (isset($wizard->_returnModule) && $wizard->_returnModule) {
             $module = $wizard->_returnModule;
         } else {
             $module = 'ui1';
         }
     }
     if (RequestContext::value('returnAction')) {
         $action = RequestContext::value('returnAction');
     } else {
         if (isset($wizard->_returnAction) && $wizard->_returnAction) {
             $action = $wizard->_returnAction;
         } else {
             $action = 'editview';
         }
     }
     $harmoni->request->forget('returnAction');
     $harmoni->request->forget('returnModule');
     $harmoni->request->forget('agent');
     return SiteDispatcher::quickURL($module, $action);
 }
예제 #27
0
 /**
  * Answer the url to return to
  * 
  * @return string
  * @access public
  * @since 6/4/07
  */
 function getReturnUrl()
 {
     if (isset($this->_newIsNav) && $this->_newIsNav && isset($this->_newId)) {
         $harmoni = Harmoni::instance();
         return SiteDispatcher::quickURL('ui1', 'editNav', array('node' => $this->_newId, 'returnAction' => $harmoni->request->get("returnAction"), 'returnNode' => $this->_newId));
     } else {
         return parent::getReturnUrl();
     }
 }
예제 #28
0
 /**
  * Answer a menu for the tagging system
  * 
  * @return string
  * @access public
  * @since 11/8/06
  */
 public function getTagsMenu()
 {
     $harmoni = Harmoni::instance();
     $tagManager = Services::getService("Tagging");
     ob_start();
     print "<div class='tagging_header'>" . _("Other Tags") . "</div>";
     print "<div class='tagging_options'>";
     print _("...added by ");
     // all tags on node by you
     if (!$this->isAnonymous()) {
         if ($harmoni->getCurrentAction() != 'tags.usernode') {
             $url = SiteDispatcher::quickURL('tags', 'usernode', array('agent_id' => $tagManager->getCurrentUserIdString(), 'tag' => RequestContext::value('tag')));
             print "<a href='" . $url . "'>" . str_replace('%1', RequestContext::value('tag'), _("you")) . "</a> / ";
         } else {
             if ($harmoni->getCurrentAction() == 'tags.usernode') {
                 print "<strong>" . _("you") . "</strong> / ";
             } else {
                 print _("you / ");
             }
         }
     }
     // all tags on node by everyone
     if ($harmoni->getCurrentAction() != 'tags.node') {
         $url = SiteDispatcher::quickURL('tags', 'node', array('agent_id' => $tagManager->getCurrentUserIdString(), 'tag' => RequestContext::value('tag')));
         print "<a href='" . $url . "'>" . str_replace('%1', RequestContext::value('tag'), _("everyone")) . "</a>";
     } else {
         if ($harmoni->getCurrentAction() == 'tags.node') {
             print "<strong>" . _("everyone") . "</strong>";
         } else {
             print _("everyone");
         }
     }
     $node = SiteDispatcher::getCurrentNode();
     $context = str_replace('%2', $node->acceptVisitor(new BreadCrumbsVisitor($node)), _("%2"));
     print _(" within: ") . $context;
     print "</div>";
     print "<div class='tagging_options'>";
     // all tags in site by you
     print _("...added by ");
     // all tags in site by you
     if (!$this->isAnonymous()) {
         if ($harmoni->getCurrentAction() != 'tags.usersite') {
             $url = SiteDispatcher::quickURL('tags', 'usersite', array('agent_id' => $tagManager->getCurrentUserIdString(), 'tag' => RequestContext::value('tag')));
             print "<a href='" . $url . "'>" . str_replace('%1', RequestContext::value('tag'), _("you")) . "</a> / ";
         } else {
             if ($harmoni->getCurrentAction() == 'tags.usersite') {
                 print "<strong>" . _("you") . "</strong> / ";
             } else {
                 print _("you / ");
             }
         }
     }
     // all tags in site by everyone
     if ($harmoni->getCurrentAction() != 'tags.site') {
         $url = SiteDispatcher::quickURL('tags', 'site', array('agent_id' => $tagManager->getCurrentUserIdString(), 'tag' => RequestContext::value('tag')));
         print "<a href='" . $url . "'>" . str_replace('%1', RequestContext::value('tag'), _("everyone")) . "</a>";
     } else {
         if ($harmoni->getCurrentAction() == 'tags.site') {
             print "<strong>" . _("everyone") . "</strong>";
         } else {
             print _("everyone");
         }
     }
     $node = SiteDispatcher::getCurrentRootNode();
     $context = str_replace('%2', $node->acceptVisitor(new BreadCrumbsVisitor($node)), _("%2"));
     print _(" within: ") . $context;
     print "</div>";
     print "<div class='tagging_options'>";
     print _("...added by ");
     // all tags from all segue by you
     if (!$this->isAnonymous()) {
         if ($harmoni->getCurrentAction() != 'tags.usersegue') {
             $url = SiteDispatcher::quickURL('tags', 'usersegue', array('agent_id' => $tagManager->getCurrentUserIdString(), 'tag' => RequestContext::value('tag')));
             print "<a href='" . $url . "'>" . str_replace('%1', RequestContext::value('tag'), _("you")) . "</a> / ";
         } else {
             if ($harmoni->getCurrentAction() == 'tags.usersegue') {
                 print "<strong>" . _("you") . "</strong> / ";
             } else {
                 print _("you / ");
             }
         }
     }
     // all tags from all segue by everyone
     if ($harmoni->getCurrentAction() != 'tags.segue') {
         $url = SiteDispatcher::quickURL('tags', 'segue', array('agent_id' => $tagManager->getCurrentUserIdString(), 'tag' => RequestContext::value('tag')));
         print "<a href='" . $url . "'>" . str_replace('%1', RequestContext::value('tag'), _("everyone")) . "</a>";
     } else {
         if ($harmoni->getCurrentAction() == 'tags.segue') {
             print "<strong>" . _("everyone") . "</strong>";
         } else {
             print _("everyone");
         }
     }
     print _(" within: <br/> all of Segue");
     print "</div>";
     $tagsMenu = ob_get_clean();
     return $tagsMenu;
 }
예제 #29
0
 /**
  * Answer the markup for this comment.
  * 
  * @param boolean $showThreadedReplies
  * @return string
  * @access public
  * @since 7/5/07
  */
 function getMarkup($showThreadedReplies)
 {
     $harmoni = Harmoni::instance();
     ob_start();
     print "\n\t<div class='comment' id='comment_" . $this->getIdString() . "'>";
     print "<a name='" . $this->getIdString() . "'></a>";
     if ($this->_enableEditForm) {
         print "<a name='" . RequestContext::name('current') . "'></a>";
     }
     print "\n\t\t<div class='comment_display'>";
     print "\n\t\t\t<form class='comment_controls' action='#' method='get'>";
     $controls = array();
     if ($this->canModify()) {
         ob_start();
         print "\n\t\t\t\t<a href='#' onclick=\"this.parentNode.nextSibling.style.display='none'; this.parentNode.nextSibling.nextSibling.style.display='block'; return false;\">" . _("edit subject") . "</a>";
         $controls[] = ob_get_clean();
         ob_start();
         $deleteUrl = SiteDispatcher::mkURL();
         $deleteUrl->setValue('delete_comment', $this->getIdString());
         print "\n\t\t\t\t<a ";
         print "href='" . $deleteUrl->write() . "#" . RequestContext::name('top') . "'";
         print " onclick=\"";
         print "if (!confirm('" . _("Are you sure that you want to delete this comment?") . "')) { ";
         print "return false; ";
         print "}";
         print "\">" . _("delete") . "</a>";
         $controls[] = ob_get_clean();
     }
     if ($this->hasContent() && $this->canReply()) {
         ob_start();
         $replyUrl = SiteDispatcher::mkURL();
         $replyUrl->setValue('reply_parent', $this->getIdString());
         print "\n\t\t\t\t<a href='#' onclick=\"CommentPluginChooser.run(this, '" . $replyUrl->write() . "#" . RequestContext::name('current') . "', '" . rawurlencode(_('Re: ') . $this->getSubject()) . "'); return false;\">" . _("reply") . "</a>";
         $controls[] = ob_get_clean();
     }
     print implode(" | ", $controls);
     print "\n\t\t\t</form>";
     print "<div class='comment_title'";
     if ($this->canModify()) {
         print " onclick=\"this.style.display='none'; this.nextSibling.style.display='block'; this.nextSibling." . RequestContext::name('subject') . ".focus();\"";
     }
     print ">";
     print $this->getSubject();
     print "\n\t\t\t</div>";
     if ($this->canModify()) {
         print "<form action='" . SiteDispatcher::quickURL() . "#" . RequestContext::name('top') . "'" . " method='post'";
         print " style='display: none;'";
         print " onsubmit=\"";
         print "updateCommentSubject (this, this.previousSibling); ";
         print "this.style.display='none'; ";
         print "this.previousSibling.style.display='block'; ";
         print "return false; \"";
         print ">";
         print "\n\t\t\t\t<input type='text' name='" . RequestContext::name('subject') . "' value=\"" . $this->getSubject() . "\"/>";
         print "\n\t\t\t\t<input type='hidden' name='" . RequestContext::name('comment_id') . "' value=\"" . $this->getIdString() . "\"/>";
         print "\n\t\t\t\t<input type='submit' name='" . RequestContext::name('submit') . "' value=\"" . _("Update Subject") . "\"/>";
         print "\n\t\t\t\t<input type='button' name='" . RequestContext::name('cancel') . "' value=\"" . _("Cancel") . "\" onclick=\"this.parentNode.style.display='none'; this.parentNode.previousSibling.style.display='block'; return false;\"/>";
         print "\n\t\t\t</form>";
     }
     print "\n\t\t\t<div class='comment_byline'>";
     $author = $this->getAuthor();
     $date = $this->getCreationDate();
     $dateString = $date->dayOfWeekName() . " " . $date->monthName() . " " . $date->dayOfMonth() . ", " . $date->year();
     $time = $date->asTime();
     print str_replace('%1', $author->getDisplayName(), str_replace('%2', $dateString, str_replace('%3', $time->string12(), _("by %1 on %2 at %3"))));
     print "\n\t\t\t</div>";
     print "\n\t\t\t<div class='comment_body'>";
     print $this->getBody();
     print "\n\t\t\t</div>";
     print "\n\t\t</div>";
     if ($showThreadedReplies) {
         print "\n\t\t<div class='comment_replies'>";
         $replies = $this->getReplies(ASC);
         while ($replies->hasNext()) {
             $reply = $replies->next();
             // If this is a work in progress that has not had content added yet,
             // do not display it.
             if ($reply->hasContent() || $reply->isAuthor()) {
                 print "\n\t\t\t\t<img src='" . MYPATH . "/images/reply_indent.png' class='reply_icon' alt='" . _('reply') . "'/>";
                 print "\n\t\t\t<div class='comment_reply'>";
                 print $reply->getMarkup(true);
                 print "\n\t\t\t</div>";
             }
         }
         print "\n\t\t</div>";
     }
     print "\n\t</div>";
     return ob_get_clean();
 }
예제 #30
0
 /**
  * Answer the Url for this component id.
  *
  * Note: this is clunky that this object has to know about harmoni and 
  * what action to target. Maybe rewrite...
  * 
  * @param string $id
  * @return string
  * @access public
  * @since 4/4/06
  */
 function getUrlForComponent($id)
 {
     $harmoni = Harmoni::instance();
     return SiteDispatcher::quickURL($harmoni->request->getRequestedModule(), $harmoni->request->getRequestedAction(), array("node" => $id));
 }