/** * 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" . "[[save_and_choose]]\n" . "<br/>[[cancel_and_choose]]\n" . "</td>\n" . "<td align='right' width='50%'>\n" . "[[_save]]\n" . "<br/>[[_cancel]]\n" . "</td></tr></table>" . "</div>\n" . "<hr/>\n" . "<div>\n" . "[[_steps]]" . "</div>\n"); $wizard->addComponent("choose_user", new ButtonPressedListener("edu.middlebury.segue.choose_user")); $button = $wizard->addComponent("save_and_choose", WSaveButton::withLabel("<< " . _("Save and Choose User"))); $button->addEvent("edu.middlebury.segue.choose_user"); $button = $wizard->addComponent("cancel_and_choose", WCancelButton::withLabel("<< " . _("Cancel and Choose User"))); $button->addEvent("edu.middlebury.segue.choose_user"); $step = $wizard->addStep("permissions", new WizardStep()); $step->addComponent("perms_table", $this->getPermissionsMatrix()); $agent = $this->getAgent(); if ($agent->isGroup()) { $type = _("group"); } else { $type = _("user"); } $title = str_replace("%1", $type, str_replace("%2", $agent->getDisplayName(), _("Roles for %1 '%2'"))); ob_start(); print "\n<h2>" . $title . "</h2>"; print "\n<p>"; print _("Roles are additive -- this means that you can add additional roles (but not remove them) for child-nodes."); print "\n</p>\n"; print "\n<p>"; print _("Note: Segue 2 does not currently support role-effective dates."); print "\n</p>\n"; print "\n<p>"; print _("Tip: Hold down the <em>SHIFT</em> key while clicking to revoke roles from child-nodes."); print "\n</p>\n"; print "[[perms_table]]"; $step->setContent(ob_get_clean()); return $wizard; }
/** * Create a new Wizard for this action. Caching of this Wizard is handled by * {@link getWizard()} and does not need to be implemented here. * * @return object Wizard * @access public * @since 5/8/07 */ 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"); $saveButton = $wizard->getSaveButton(); $saveButton->setLabel(_("Create >>")); $wizard->addStep("content", $this->getContentStep()); return $wizard; }
/** * 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 " " . $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 " " . $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 »") . "</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; }