Пример #1
0
 /**
  * Answer a component with help text
  * 
  * @return Component
  * @access public
  * @since 3/4/08
  */
 public function getMessage()
 {
     ob_start();
     print "<p>";
     print _("On this screen you can choose to import your Segue 1 sites into Segue 2.");
     print " " . _("This process will not change or delete your Segue 1 site.");
     print " " . _("You can only import sites into empty placeholders.");
     print "</p>";
     print "<p>";
     print str_replace('%1', Help::link('Copy Sites'), _("If you import a segue1 site more than once, redirects from old links will point at the most recent import of that site. If you wish to maintain old links and duplicate a site, import it once and then use the 'copy site' (%1) in the portal to make additional copies."));
     print "</p>";
     return new Block(ob_get_clean(), STANDARD_BLOCK);
 }
 /**
  * Answer a string of controls html to go along with this folder. In many cases
  * it will be empty, but some implementations may need controls for adding new slots.
  * 
  * @return string
  * @access public
  * @since 4/1/08
  */
 public function getControlsHtml()
 {
     $message = '';
     try {
         $this->createNewSlotIfRequested();
     } catch (OperationFailedException $e) {
         $message = $e->getMessage();
     }
     // Form
     if (PersonalSlot::hasPersonal()) {
         ob_start();
         $harmoni = Harmoni::instance();
         $authN = Services::getService("AuthN");
         $harmoni->request->startNamespace('personal_slot');
         $url = $harmoni->request->quickURL();
         print "<div style='float: left;'>";
         print "<strong>" . _("Create a new site") . " <span style='font-size: smaller;'>(" . Help::link('Portal') . ")</span>:</strong><br/>";
         print "<span style='font-size: smaller;'>" . _("1. Chose a name for the placeholder of your new site. <br/>2. Create a new site in that placeholder.") . "</span>";
         print "</div>";
         print "<div style='float: right;'>";
         print "\n<form class='add_slot_form' method='post' action='{$url}'>";
         print "<div style='text-align: center;'>" . _("Placeholder Name:") . "</div>";
         print PersonalSlot::getPersonalShortname($authN->getFirstUserId());
         print "-";
         print "\n\t<input type='text' name='" . RequestContext::name('slot_postfix') . "' value='' size='10'/>";
         print "\n\t<input type='submit' value='" . _('Create') . "'/>";
         if (strlen($message)) {
             print "\n\t<div class='error'>" . $message . "</div>";
         }
         print "\n</form>\n";
         print "\n\t</div>";
         print "\n\t<div class='no_float_spacer'>";
         $harmoni->request->endNamespace();
         return ob_get_clean();
     }
 }
Пример #3
0
?>

<textarea class="fixed" name="php" rows="10" cols="60">
<?php 
if (!empty($command)) {
    echo htmlspecialchars($command);
}
?>
</textarea>
<br />
<input type="submit" class="button" value="<?php 
echo _("Execute");
?>
">
<?php 
if ($conf['user']['online_help'] && $browser->hasFeature('javascript')) {
    ?>
    <?php 
    Help::javascript();
    ?>
    <td class="header" align="right"><?php 
    echo Help::link('admin', 'admin-phpshell');
    ?>
</td>
<?php 
}
?>

</form>
<?php 
require HORDE_TEMPLATES . '/common-footer.inc';
Пример #4
0
Util::pformInput();
?>
<textarea class="fixed" name="cmd" rows="10" cols="60">
<?php 
if (!empty($command)) {
    echo htmlspecialchars($command);
}
?>
</textarea>
<br />
<input type="submit" class="button" value="<?php 
echo _("Execute");
?>
">
<?php 
if ($conf['user']['online_help'] && $browser->hasFeature('javascript')) {
    ?>
    <?php 
    Help::javascript();
    ?>
    <td class="header" align="right"><?php 
    echo Help::link('admin', 'admin-cmdshell');
    ?>
</td>
<?php 
}
?>

</form>
<?php 
require HORDE_TEMPLATES . '/common-footer.inc';
 /**
  * Answer a block of HTML with help about WikiLinking
  *
  * @return string
  * @access private
  * @since 12/4/07
  */
 private function getWikiHelp()
 {
     ob_start();
     print "\n<div class='help_text'>";
     $message = _('<strong>Wiki linking (%1) :</strong> To link to a page on your site whose title is "Introduction" use &#91;&#91;Introduction&#93;&#93;. If no content with the title "Introduction" exists a link to create such content will be made. To see all titles used in this site, see: %2');
     $message = str_replace('%1', Help::link('wiki linking'), $message);
     //  		$message = str_replace('%2', SiteMap::link($this->getId()), $message);
     $message = str_replace('%2', 'Site Map', $message);
     print $message;
     print "\n</div>";
     return ob_get_clean();
 }
 /**
  * Answer the form for Adding new components
  * 
  * @param string $organizerId
  * @param integer $cellIndex
  * @param array $allowed Which component Types to allow addition of: segue::edu.middlebury::Block, segue::edu.middlebury::NavBlock
  * @return string The form HTML
  * @access public
  * @since 4/14/06
  */
 function getAddFormHTML($organizerId, $cellIndex, $allowed, $isMenu = FALSE)
 {
     ob_start();
     $harmoni = Harmoni::instance();
     print "\n\t<a style='text-align: center; display: inline;'";
     print " onclick='this.style.display=\"none\"; this.nextSibling.style.display=\"block\";'";
     print ">";
     if ($isMenu) {
         print "\n\t\t\t" . _("+ Page...");
     } else {
         print "\n\t\t\t" . _("+ Content");
     }
     print "\n\t</a>";
     print "<form action='";
     print $harmoni->request->quickURL('ui2', 'addComponent', array('returnNode' => SiteDispatcher::getCurrentNodeId(), 'returnAction' => $this->_action));
     print "' method='post' ";
     print " style='display: none' class='ui2_add_form'>";
     print "\n\t<input type='hidden' name='" . RequestContext::name('organizerId') . "' value='" . $organizerId . "'/>";
     if (!is_null($cellIndex)) {
         print "\n\t<input type='hidden' name='" . RequestContext::name('cellIndex') . "' value='" . $cellIndex . "'/>";
     }
     //print "\n\t<div class='block2Content' style='text-align: center;'";
     print "\n\t\t<select class='ui2_page_select' name='" . RequestContext::name('componentType') . "'>";
     $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<div style='white-space: nowrap;'>" . _("Title: ");
     if ($isMenu) {
         print "(" . Help::link('Adding Pages and Sections') . ")";
         print "\n\t\t\t<br/><input class='ui2_title_field_page' name='" . RequestContext::name('displayName') . "' type='text' size='20'/>";
     } else {
         print Help::link('Adding Content');
         print "\n\t\t\t<br/><input class='ui2_title_field_content' name='" . RequestContext::name('displayName') . "' type='text' size='20'/>";
     }
     print "\n\t\t</div>";
     print "\n\t\t<div style='white-space: nowrap; margin: 5px;'>";
     print "\n\t\t\t<input type='button' value='" . _('Create') . "'";
     print " onclick='";
     print "var hasTitle = false; ";
     print "var regex = /[^\\s\\n\\t]+/; ";
     print "for (var i = 0; i < this.form.elements.length; i++) { ";
     print "var elem = this.form.elements[i]; ";
     print "if (elem.name == \"" . RequestContext::name('displayName') . "\") { ";
     print "if (elem.value.match(regex)) { ";
     print "hasTitle = true;";
     print "}";
     print "}";
     print "}";
     print "if (!hasTitle) { ";
     print "alert(\"" . _("A title is required") . "\");";
     print "} else { ";
     print "this.form.submit();";
     print "}";
     print "' />";
     print "\n\t\t\t<input type='button' ";
     print "onclick='this.parentNode.parentNode.style.display=\"none\"; this.parentNode.parentNode.previousSibling.style.display=\"inline\";'";
     print " value='" . _("Cancel") . "'/>";
     print "\n\t\t</div>";
     print "</form>";
     return ob_get_clean();
 }
Пример #7
0
 /**
  * Create the wizard
  * 
  * @return object Wizard
  * @access public
  * @since 11/14/07
  */
 public function createWizard()
 {
     // Instantiate the wizard, then add our steps.
     $wizard = SingleStepWizard::withText("<div>\n" . "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n" . "<tr>\n" . "<td align='left' width='50%'>\n" . "[[_cancel]]\n" . "</td>\n" . "<td align='right' width='50%'>\n" . "</td></tr></table>" . "</div>\n" . "<hr/>\n" . "<div>\n" . "[[_steps]]" . "</div>\n");
     $wizard->_returnModule = RequestContext::value('returnModule');
     $wizard->_returnAction = RequestContext::value('returnAction');
     $cancelButton = $wizard->getChild('_cancel');
     $cancelButton->setLabel(_("Close"));
     $step = $wizard->addStep("agents", new WizardStep());
     ob_start();
     print "\n<h2>" . _("Roles") . "</h2>";
     print "\n<p>";
     print _("Choose a user or group to edit roles for.");
     print "\n</p>\n";
     $agentMgr = Services::getService("Agent");
     $idMgr = Services::getService("Id");
     $harmoni = Harmoni::instance();
     $roleMgr = SegueRoleManager::instance();
     $everyoneId = $idMgr->getId("edu.middlebury.agents.everyone");
     $instituteId = $idMgr->getId("edu.middlebury.institute");
     $membersId = $this->getSite()->getMembersGroup()->getId();
     $agents = array();
     $agents[] = $agentMgr->getGroup($everyoneId);
     $agents[] = $agentMgr->getGroup($instituteId);
     $agents[] = $agentMgr->getGroup($membersId);
     $agentIdsWithRoles = $roleMgr->getAgentsWithRoleAtLeast($roleMgr->getRole('reader'), $this->getSiteId(), true);
     foreach ($agentIdsWithRoles as $id) {
         if (!$id->isEqual($everyoneId) && !$id->isEqual($instituteId) && !$id->isEqual($membersId)) {
             // We ran into a case where roles weren't clearing when an agent
             // was deleted, log this issue and skip rather than crashing the
             // choose agent screen.
             try {
                 $agents[] = $agentMgr->getAgentOrGroup($id);
             } catch (UnknownIdException $e) {
                 HarmoniErrorHandler::logException($e, 'Segue');
             }
         }
     }
     if (count($agents)) {
         print "\n<table width='100%' class='search_results' cellspacing='0'>";
         $i = 0;
         foreach ($agents as $agent) {
             print "\n\t<tr class='search_result_item'>";
             print "\n\t\t<td class='color{$i}'>";
             print "\n\t\t\t<a href='#' onclick=\"AgentInfoPanel.run('" . addslashes($agent->getId()->getIdString()) . "', '" . addslashes($agent->getDisplayName()) . "', this); return false;\">";
             print $agent->getDisplayName();
             print "</a>";
             // print out site members
             if ($agent->getId()->isEqual($membersId)) {
                 $harmoni->request->forget('returnAction');
                 $harmoni->request->forget('returnModule');
                 $harmoni->request->forget('agent');
                 $url = SiteDispatcher::quickURL('agent', 'modify_members');
                 $harmoni->request->passthrough('returnAction');
                 $harmoni->request->passthrough('returnModule');
                 $harmoni->request->passthrough('agent');
                 print "\n\t\t\t <button onclick='window.location = \"{$url}\".urlDecodeAmpersands(); return false;'>" . _("Add/Remove Members") . "</button>";
                 print " (" . Help::link('Site-Members') . ")";
                 print "\n<br/>";
                 print "\n<span style='font-size: smaller'>";
                 print _("This is a custom group of users that are associated with this site. Users and groups can manually be made site-members or users can self-register using the 'Join Site' plugin if it is enabled.");
                 print "</span>";
                 $membersGroup = $this->getSite()->getMembersGroup();
                 $subGroups = $membersGroup->getGroups(true);
                 print "\n<table width='100%' class='search_results' cellspacing='0'>";
                 while ($subGroups->hasNext()) {
                     print "\n\t<tr class='search_result_item'>";
                     print "\n\t\t<td>";
                     print "&nbsp;&nbsp;" . $subGroups->next()->getDisplayName();
                     print "\n\t\t</td></tr>";
                 }
                 $members = $membersGroup->getMembers(false);
                 while ($members->hasNext()) {
                     print "\n\t<tr class='search_result_item'>";
                     print "\n\t\t<td>";
                     print "&nbsp;&nbsp;" . $members->next()->getDisplayName();
                     print "\n\t\t</td></tr>";
                 }
                 print "\n</table><br/>";
             }
             print "\n\t\t</td>";
             print "\n\t\t<td valign='top' class='color{$i}' style='text-align: right; white-space: nowrap;'>";
             $url = SiteDispatcher::quickURL('roles', 'modify', array('node' => SiteDispatcher::getCurrentNodeId(), 'agent' => $agent->getId()->getIdString()));
             print "\n\t\t\t<button onclick='window.location = \"{$url}\".urlDecodeAmpersands(); return false;'>" . _("Modify Roles &raquo;") . "</button>";
             print "\n\t\t</td>";
             print "\n\t</tr>";
             $i = intval(!$i);
         }
         print "\n</table>";
     }
     $property = $step->addComponent("search", new WSearchField());
     $property->setSearchSource(new AgentSearchSource());
     print "\n<div style='margin-top: 20px; border-top: 1px solid; padding: 5px;'>";
     print "\n<h3>" . _("Assign roles to other users/groups") . "</h3>";
     print _("Search for other users/groups.  Once found you will be able to assign roles to these other users/groups.  To assign roles to students in a class, type in the course code (e.g. span0101a-f08)") . "<br/><br/>";
     print _("User/group name: ") . " [[search]]";
     print "</div>";
     $step->setContent(ob_get_clean());
     return $wizard;
 }
Пример #8
0
?>

<textarea class="fixed" name="sql" rows="10" cols="60" wrap="hard">
<?php 
if (!empty($command)) {
    echo htmlspecialchars($command);
}
?>
</textarea>
<br />
<input type="submit" class="button" value="<?php 
echo _("Execute");
?>
">
<?php 
if ($conf['user']['online_help'] && $browser->hasFeature('javascript')) {
    ?>
    <?php 
    Help::javascript();
    ?>
    <td class="header" align="right"><?php 
    echo Help::link('admin', 'admin-sqlshell');
    ?>
</td>
<?php 
}
?>

</form>
<?php 
require HORDE_TEMPLATES . '/common-footer.inc';
Пример #9
0
 /**
  * Execute the Action
  * 
  * @param object Harmoni $harmoni
  * @return mixed
  * @access public
  * @since 4/25/05
  */
 function execute()
 {
     $harmoni = Harmoni::instance();
     $xLayout = new XLayout();
     $yLayout = new YLayout();
     $mainScreen = new Container($yLayout, BLANK, 1);
     if (defined('SEGUE_SITE_HEADER')) {
         $this->siteMessage = $mainScreen->add(new Component(str_replace('[[SITE_OWNER_MESSAGE]]', '', SEGUE_SITE_HEADER), BLANK, 1), "100%", null, CENTER, TOP);
     }
     // :: login, links and commands
     $this->headRow = $mainScreen->add(new Container($xLayout, BLANK, 1), "100%", null, CENTER, TOP);
     $rightHeadColumn = $this->headRow->add(new Container($yLayout, BLANK, 1), null, null, CENTER, TOP);
     $rightHeadColumn->add($this->getLoginComponent(), null, null, RIGHT, TOP);
     // BACKGROUND
     $backgroundContainer = $mainScreen->add(new Container($yLayout, BLOCK, BACKGROUND_BLOCK));
     // :: Top Row ::
     // The top row for the logo and status bar.
     $headRow = new Container($xLayout, HEADER, 1);
     // The logo
     $logo = new Component("\n<a href='" . MYPATH . "/'> <img src='" . LOGO_URL . "' \n\t\t\t\t\t\t\tstyle='border: 0px;' alt='" . _("Segue Logo'") . "/> </a>", BLANK, 1);
     $headRow->add($logo, null, null, LEFT, TOP);
     // Language Bar
     $harmoni->history->markReturnURL("polyphony/language/change");
     $languageText = "\n<form action='" . $harmoni->request->quickURL("language", "change") . "' method='post'>";
     $harmoni->request->startNamespace("polyphony");
     $languageText .= "\n\t<div style='text-align: right'>\n\t<select style='font-size: 10px' name='" . $harmoni->request->getName("language") . "'>";
     $harmoni->request->endNamespace();
     $langLoc = Services::getService('Lang');
     $currentCode = $langLoc->getLanguage();
     $languages = $langLoc->getLanguages();
     ksort($languages);
     foreach ($languages as $code => $language) {
         $languageText .= "\n\t\t<option value='" . $code . "'" . ($code == $currentCode ? " selected='selected'" : "") . ">";
         $languageText .= $language . "</option>";
     }
     $languageText .= "\n\t</select>";
     $languageText .= "\n\t<input class='button small' value='Set language' type='submit' />&nbsp;";
     $languageText .= "\n\t</div>\n</form>";
     $languageBar = new Component($languageText, BLANK, 1);
     $headRow->add($languageBar, null, null, LEFT, BOTTOM);
     // Pretty Login Box
     // 		$loginRow = new Container($yLayout, OTHER, 1);
     // 		$headRow->add($loginRow, null, null, RIGHT, TOP);
     // 		$loginRow->add($this->getLoginComponent(), null, null, RIGHT, TOP);
     //Add the headerRow to the backgroundContainer
     $backgroundContainer->add($headRow, "100%", null, LEFT, TOP);
     // :: Center Pane ::
     $centerPane = new Container($xLayout, BLANK, 1);
     $backgroundContainer->add($centerPane, "100%", null, LEFT, TOP);
     // Main menu
     $mainMenu = SegueMenuGenerator::generateMainMenu($harmoni->getCurrentAction());
     // use the result from previous actions
     if ($harmoni->printedResult) {
         $contentDestination = new Container($yLayout, OTHER, 1);
         $centerPane->add($contentDestination, null, null, LEFT, TOP);
         $contentDestination->add(new Block($harmoni->printedResult, 1), null, null, TOP, CENTER);
         $harmoni->printedResult = '';
     } else {
         $contentDestination = $centerPane;
     }
     // use the result from previous actions
     if (is_object($harmoni->result)) {
         $contentDestination->add($harmoni->result, null, null, CENTER, TOP);
     } else {
         if (is_string($harmoni->result)) {
             $contentDestination->add(new Block($harmoni->result, STANDARD_BLOCK), null, null, CENTER, TOP);
         }
     }
     $centerPane->add($mainMenu, "140px", null, LEFT, TOP);
     // Right Column
     // 		$rightColumn = $centerPane->add(new Container($yLayout, OTHER, 1), "140px", null, LEFT, TOP);
     // Basket
     // 		$basket = Basket::instance();
     // 		$rightColumn->add($basket->getSmallBasketBlock(), "100%", null, LEFT, TOP);
     // 		if (preg_match("/^(collection|asset)\.browse$/", $harmoni->getCurrentAction()))
     // 			$rightColumn->add(AssetPrinter::getMultiEditOptionsBlock(), "100%", null, LEFT, TOP);
     // :: Footer ::
     $footer = new Container(new XLayout(), BLANK, 1);
     if ($harmoni->getData('help_topic')) {
         $helpLink = Help::link($harmoni->getData('help_topic'));
     } else {
         $helpLink = Help::link();
     }
     $footer->add(new UnstyledBlock($helpLink), "50%", null, LEFT, BOTTOM);
     $footer->add(new UnstyledBlock(self::getVersionText()), "50%", null, RIGHT, BOTTOM);
     $mainScreen->add($footer, "100%", null, RIGHT, BOTTOM);
     if (defined('SEGUE_SITE_FOOTER')) {
         $mainScreen->add(new UnstyledBlock(SEGUE_SITE_FOOTER), "100%", null, CENTER, BOTTOM);
     }
     return $mainScreen;
 }
Пример #10
0
 /**
  * Add a step to set site-wide permissions.
  * 
  * @param object Wizard $wizard
  * @return void
  * @access protected
  * @since 8/13/08
  */
 protected function addRolesStep(Wizard $wizard)
 {
     $step = new WizardStep();
     $step->setDisplayName(_("Roles"));
     $rolesProperty = $step->addComponent('roles', new RowRadioMatrix());
     $roleMgr = SegueRoleManager::instance();
     // Add the options
     foreach ($roleMgr->getRoles() as $role) {
         if (!$role->isEqual($roleMgr->getRole('custom'))) {
             $rolesProperty->addOption($role->getIdString(), $role->getDisplayName(), $role->getDescription());
         }
     }
     // Add agents.
     $agentMgr = Services::getService("Agent");
     $idMgr = Services::getService("Id");
     // Super groups
     $agentsIds = array();
     $agentsIds[] = $idMgr->getId('edu.middlebury.agents.everyone');
     $agentsIds[] = $idMgr->getId('edu.middlebury.institute');
     foreach ($agentsIds as $agentId) {
         $agent = $agentMgr->getAgentOrGroup($agentId);
         $rolesProperty->addField($agentId->getIdString(), $agent->getDisplayName(), 'no_access');
     }
     $membersProperty = $step->addComponent('site_members', new MembershipButton($this->getSlot()->getShortname()));
     ob_start();
     print _("Site-Members");
     print " [[site_members]]";
     print " (" . Help::link('Site-Members') . ")";
     print "\n<div style='font-size: smaller; font-weight: normal; width: 300px;'>";
     print _("This is a custom group of users that are associated with this site. Users and groups can manually be made site-members or users can self-register using the 'Join Site' plugin if it is enabled.");
     print "</div>";
     $rolesProperty->addField('edu.middlebury.site-members.temp', ob_get_clean(), 'commenter');
     // Other owners
     foreach ($this->getOwners() as $agentId) {
         $agent = $agentMgr->getAgentOrGroup($agentId);
         $rolesProperty->addField($agentId->getIdString(), $agent->getDisplayName(), 'admin');
     }
     // Class
     if (method_exists($this->getSlot(), 'getCourse')) {
         try {
             $course = $this->getSlot()->getCourse();
             $rolesProperty->addField($course->getGroupId()->getIdString(), $course->getDisplayName(), 'no_access');
         } catch (Exception $e) {
             HarmoniErrorHandler::logException($e, 'Segue');
         }
     }
     $rolesProperty->makeDisabled('edu.middlebury.agents.everyone', 'admin');
     $rolesProperty->makeDisabled('edu.middlebury.institute', 'admin');
     // Search
     $property = $step->addComponent("search", new AddSiteAgentSearchField());
     $property->setRolesProperty($rolesProperty);
     // Create the step text
     ob_start();
     print "\n<h2>" . _("Site-wide Roles") . "</h2>";
     print "\n<p>" . _("Below you can set site-wide roles for users and groups over the entire site. Once the site is created you can use the <strong>Roles</strong> button (at the top of the page) to set the roles that users and groups have on various parts of the site.") . "</p>";
     print "\n<p><strong>" . _("Roles are always additive:") . "</strong></p> <ul><li>" . _("The Commenter role includes the Reader role, and the Author role is a superset of the Reader and Commenter roles. Click on the role-headings for more details.") . "</li><li>" . _("Groups and individuals can later be given additional roles on particular sections or pages of the site, but site-wide roles can not reduced on particular sections or pages.") . "</li></ul>";
     print "\n[[roles]]";
     print "\n<p>" . _("Search for users or groups:") . "[[search]]";
     print "\n<br/>" . _("<em>If you wish to give a role to a class, search for its course code, for example: </em> <code>span0101a-f08</code>");
     print "</p>";
     print "\n<div style='width: 400px'> &nbsp; </div>";
     $step->setContent(ob_get_clean());
     $step = $wizard->addStep("roles", $step);
     $wizard->makeStepRequired('roles');
 }
 /**
  * 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();
     $this->printMessages();
     switch ($this->getFieldValue('mode')) {
         case 'join':
             if ($this->currentUser->getId()->isEqual(new HarmoniId('edu.middlebury.agents.anonymous'))) {
                 // Prompt for login or registration
                 print "<h4>" . _("Please log in:") . "</h4>";
                 $action = new displayAction();
                 print "\n<div style='margin-left: 30px;'>";
                 print $action->getLoginFormHtml();
                 print "\n</div>";
                 print "<h4>" . _("Or create a visitor account:") . "</h4>";
                 print "\n<div style='margin-left: 30px;'>";
                 print $action->getVisitorRegistrationLink();
                 print "\n</div>";
             } else {
                 if ($this->isAwaitingApproval($this->currentUser->getId())) {
                     print _("Your request has already been submitted and is awaiting approval from the site administrator.");
                     print "\n<br/>";
                     print _("You will receive an email when your request is approved.");
                 } else {
                     // Add to the queue
                     $this->join();
                     print _("Your request has been submitted and is awaiting approval from the site administrator.");
                     print "\n<br/>";
                     print _("You will receive an email when your request is approved.");
                 }
             }
             break;
         default:
             if ($this->canModify()) {
                 print "<div style='float: right'>(" . Help::link('Site-Members') . ")</div>";
             }
             if ($this->isUserMember()) {
                 print "<button disabled='disabled'>" . _('Join Site') . "</button>";
             } else {
                 print "\n<button onclick='window.location = \"" . $this->url(array('mode' => 'join')) . "\".urlDecodeAmpersands();'>" . _('Join Site') . "</button>";
             }
             if ($this->canModify()) {
                 $awaitingApproval = $this->getAgentsAwaitingApproval();
                 if (count($awaitingApproval)) {
                     print "\n<h4>" . _('Awaiting Approval') . '</h4>';
                     print "\n<ul>";
                     foreach ($awaitingApproval as $agent) {
                         print "\n\t<li>";
                         print $agent->getDisplayName();
                         print "\n\t\t<a href='";
                         print $this->url(array('change' => 'approve', 'agent_id' => $agent->getId()->getIdString()));
                         print "'>" . _('Approve') . "</a>";
                         print "\n\t\t<a href='";
                         print $this->url(array('change' => 'deny', 'agent_id' => $agent->getId()->getIdString()));
                         print "'>" . _('Deny') . "</a>";
                         print "\n\t</li>";
                     }
                     print "\n</ul>";
                 } else {
                     print "\n<h4>" . _('No users are currently awaiting approval') . '</h4>';
                 }
             }
     }
     return ob_get_clean();
 }
Пример #12
0
 /**
  * Answer a links back to the main Segue pages
  * 
  * @return object GUIComponent
  * @access public
  * @since 1/12/07
  */
 function getSegueLinksComponent()
 {
     $harmoni = Harmoni::instance();
     ob_start();
     print "<div class='seguelinks'>";
     // Home
     print "<a href='" . $harmoni->request->quickURL('portal', 'list') . "' title='" . _("List of Segue sites") . "'>";
     print _("home") . "</a> | ";
     // Help
     print Help::link();
     // Site Map
     $siteMapUrl = $harmoni->request->quickURL("view", "map", array('node' => SiteDispatcher::getCurrentNodeId()));
     print " | <a target='_blank' href='" . $siteMapUrl . "'";
     print ' onclick="';
     print "var url = '" . $siteMapUrl . "'; ";
     print "window.open(url, 'site_map', 'width=700,height=600,resizable=yes,scrollbars=yes'); ";
     print "return false;";
     print '"';
     print ">" . _("map") . "</a>";
     // Tracking
     $trackingUrl = $harmoni->request->quickURL("participation", "actions", array('node' => SiteDispatcher::getCurrentNodeId()));
     print " | <a target='_blank' href='" . $trackingUrl . "'";
     print ' onclick="';
     print "var url = '" . $trackingUrl . "'; ";
     print "window.open(url, 'site_map', 'width=700,height=600,resizable=yes,scrollbars=yes'); ";
     print "return false;";
     print '"';
     print ">" . _("track") . "</a>";
     print "</div>";
     print $this->getExportControls();
     $ret = new Component(ob_get_clean(), BLANK, 2);
     return $ret;
 }
Пример #13
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();
 }
 /**
  * Answer a block of HTML with help about WikiLinking
  *
  * @return string
  * @access private
  * @since 12/4/07
  */
 private function getWikiHelp()
 {
     ob_start();
     print "\n<div class='help_text'>";
     $message = _('<strong>Wiki linking (%1) :</strong> To link to a page on your site whose title is "Introduction" use &#91;&#91;Introduction&#93;&#93;. If no content with the title "Introduction" exists a link to create such content will be made. To see all titles used in this site, see: %2');
     $message = str_replace('%1', Help::link('Wiki-Linking'), $message);
     //  		$message = str_replace('%2', SiteMap::link($this->getId()), $message);
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace(null);
     $siteMapUrl = $harmoni->request->quickUrl('view', 'map', array('node' => $this->getId()));
     $harmoni->request->endNamespace();
     $siteMapText = "<a target='site_map' href='" . $siteMapUrl . "' onclick=\"var url = '" . $siteMapUrl . "'; window.open(url, 'site_map', 'width=500,height=600,resizable=yes,scrollbars=yes'); return false;\">" . _("Site Map") . "</a>";
     $message = str_replace('%2', $siteMapText, $message);
     print $message;
     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()
 {
     $harmoni = Harmoni::instance();
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     // check if user is editor and thus can see link to participant information panel
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), SiteDispatcher::getCurrentNode()->getQualifierId())) {
         $this->_showTrackLink = true;
     } else {
         $this->_showTrackLink = false;
     }
     $this->addHeadJavascript('ParticipantPanel.js');
     $this->addHeadCss('Participation.css');
     ob_start();
     // get site admins
     $siteAdmins = $this->getSiteAdmins();
     // get all site members
     $group = $this->getNode()->getMembersGroup();
     //printpre ($group);
     // get all sub-groups in site members group
     $subgroups = $group->getGroups(false);
     // get member hidden groups
     $hiddenGroups = $this->getMembersHiddenGroups();
     if ($this->getFieldValue('edit') && $this->canModify()) {
         $harmoni = Harmoni::instance();
         $harmoni->request->startNamespace(null);
         $membersUrl = SiteDispatcher::quickURL('agent', 'modify_members', array('returnModule' => $this->getLocalModule(), 'returnAction' => $this->getLocalAction()));
         $rolesUrl = SiteDispatcher::quickURL('roles', 'modify', array('agent' => $group->getId()->getIdString(), 'returnModule' => $this->getLocalModule(), 'returnAction' => $this->getLocalAction()));
         $harmoni->request->endNamespace();
         print "\n<div class='participation_ext_link'><a href='" . $membersUrl . "'>" . _("Add/Edit Site-Members &raquo;") . "</a></div>";
         print "\n<div class='participation_ext_link'><a href='" . $rolesUrl . "'>" . _("View/Edit Roles of Site-Members &raquo;") . "</a></div>";
         print "<p>(" . Help::link('Site-Members') . ")</p>";
         print "\n" . $this->formStartTagWithAction();
         // print out sub group checkboxes
         if ($subgroups->hasNext()) {
             print "\n<div class='participant_group_header'>" . _("Show members of following groups:") . "</div>";
             while ($subgroups->hasNext()) {
                 $subgroup = $subgroups->next();
                 print "\n<div class='participant_list'>";
                 print "\n\t<input name='" . $this->getFieldName($subgroup->getId()->getIdString()) . "' value='true' type='checkbox' ";
                 if (!in_array($subgroup->getId()->getIdString(), $hiddenGroups)) {
                     print " checked";
                 }
                 print ">" . $subgroup->getDisplayName();
                 print "\n</div>";
             }
         }
         // print out Other Participants checkbox
         print "\n<div class='participant_list'>";
         print "\n\t<input name='" . $this->getFieldName('other_participants') . "' value='true' type='checkbox' ";
         if ($this->getOtherParticipantsDisplay() == "true") {
             print " checked";
         }
         print ">" . _("Show Other Participants");
         print "<br/>(" . _("i.e. those who are NOT site members") . ")";
         print "\n</div>";
         print "\n<div class='participation_buttons'>\n\t<input type='submit' value='Update' name='" . $this->getFieldName('submit') . "'>\n";
         print "\n\t<input type='button' value='" . _('Cancel') . "' onclick=" . $this->locationSendString() . "/></div>";
         print "</form>";
     } else {
         if ($this->canView()) {
             // Site Admins
             print "<div class='participant_header'>" . _("Site Administrators") . "</div>";
             print $this->printSiteAdminsIterator($siteAdmins);
             // Direct members of the group
             print "<div class='participant_header'>" . _("Site Members") . "</div>";
             print $this->printMemberIterator($group->getMembers(false));
             // Members of subgroups
             while ($subgroups->hasNext()) {
                 $subgroup = $subgroups->next();
                 print "<div class='participant_group_header'>" . $subgroup->getDisplayName() . "</div>";
                 if (!in_array($subgroup->getId()->getIdString(), $hiddenGroups)) {
                     print $this->printMemberIterator($subgroup->getMembers(false));
                 }
             }
             // Other Participants
             if ($this->getOtherParticipantsDisplay() == "true") {
                 $notPrintedParticipants = array();
                 foreach ($this->getView()->getParticipants() as $participant) {
                     if (!in_array($participant->getId()->getIdString(), $this->_printedParticipants)) {
                         $notPrintedParticipants[] = $participant;
                     }
                 }
                 print "<br/><div class='participant_header'>" . _("Other Participants") . "</div>";
                 print $this->printParticipants($notPrintedParticipants);
             }
             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>";
             }
         }
     }
     return ob_get_clean();
 }
Пример #16
0
 /**
  * Create the wizard
  * 
  * @return Wizard
  * @access public
  * @since 10/20/08
  */
 public function createWizard()
 {
     $wizard = SingleStepWizard::withDefaultLayout();
     $step = $wizard->addStep("members_step", new WizardStep());
     $harmoni = Harmoni::instance();
     $property = $step->addComponent('members', new WSearchList());
     $property->setSearchSource(new AgentSearchSource());
     $agentMgr = Services::getService("Agent");
     $childGroups = $this->getGroup()->getGroups(false);
     while ($childGroups->hasNext()) {
         $property->addValue(new AgentSearchResult($childGroups->next()));
     }
     $members = $this->getGroup()->getMembers(false);
     while ($members->hasNext()) {
         $property->addValue(new AgentSearchResult($members->next()));
     }
     ob_start();
     print "\n<h2>" . _("Edit Site Members") . "</h2>";
     print "\n<p>";
     print _("Site members are users and/or groups of users who are affiliated with the site.");
     print "\n</p>\n<p>";
     print _("By adding users and groups to the list of site members, these users can all be given the same roles in one step. Additional roles can always be given to individual users or groups as well.");
     print "</p>";
     print "<p>" . str_replace('%1', Help::link('Site-Members'), _("For more details, see: %1")) . "</p>";
     print "[[members]]";
     $step->setContent(ob_get_clean());
     return $wizard;
 }