Esempio n. 1
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" . "[[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;
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
 /**
  * Create the wizard
  * 
  * @return Wizard
  * @access public
  * @since 12/7/07
  */
 public function createWizard()
 {
     $wizard = SingleStepWizard::withDefaultLayout();
     $step = $wizard->addStep("slot", new WizardStep());
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("slots");
     $name = strtolower(RequestContext::value("name"));
     $harmoni->request->endNamespace();
     $slotMgr = SlotManager::instance();
     $slot = $slotMgr->getSlotByShortname($name);
     $wizard->slot = $slot;
     $property = $step->addComponent('type', new WSelectList());
     $property->setValue($slot->getType());
     foreach (array(Slot::custom, Slot::course, Slot::personal) as $type) {
         $property->addOption($type, ucfirst($type));
     }
     $property = $step->addComponent('name', new WTextField());
     $property->setValue($slot->getShortname());
     $property->setEnabled(false, true);
     $property = $step->addComponent('category', new WSelectList());
     $property->setValue($slot->getLocationCategory());
     foreach (SlotAbstract::getLocationCategories() as $category) {
         $property->addOption($category, ucfirst($category));
     }
     $property = $step->addComponent('quota', new WTextField());
     $property->setSize(10);
     if (!$slot->usesDefaultMediaQuota()) {
         $property->setValue($slot->getMediaQuota()->asString());
     }
     $property = $step->addComponent('owners', new WSearchList());
     $property->setSearchSource(new AgentSearchSource());
     $agentMgr = Services::getService("Agent");
     foreach ($slot->getOwners() as $ownerId) {
         $property->addValue(new AgentSearchResult($agentMgr->getAgentOrGroup($ownerId)));
     }
     ob_start();
     print "\n<h4>" . _("Edit Placeholder") . "</h4>";
     print "\n<p><strong>" . _("Owner Definition Type") . ":</strong> [[type]]</p>";
     print "<div style='margin-left: 10px;'>";
     print _("The 'Owner Definition Type' indicates to the system where to search for placeholder owners. 'Course' will force a lookup in the course information system. 'Personal' will match against a user's email address. 'Custom' will not do an external lookup. <br/><br/>Note: If there is a name collision between a 'Custom' placeholder and a 'Course' placeholder. Valid 'Course' owners will still have access to the placeholder.");
     print "</div>";
     print "\n<p><strong>" . _("Placeholder Name") . ":</strong> [[name]]</p>";
     print "<div style='margin-left: 10px;'>";
     print _("The placeholder name will be an identifier for the site. It must be globally unique. Choose wisely to avoid collisions between system-generated personal names and course names.");
     print "</div>";
     print "\n<p><strong>" . _("Location Category") . ":</strong> [[category]]</p>";
     print "<div style='margin-left: 10px;'>";
     print _("The 'Location Category' is the Segue location in which this site will be made available. In the default installation this is disregarded, however some installations will be divided into 'main' and 'community', or other combinations. This flag is what is used in that determination.");
     print "</div>";
     print "\n<p><strong>" . _("Media Library Quota") . ":</strong> [[quota]]</p>";
     print "<div style='margin-left: 10px;'>";
     print _("The 'Media Library Quota' is a limit on the size of media that can be uploaded to a Segue site. Quotas greater or smaller than the default can be set, leave blank for the default. Quotas can be specified in B, kB, MB, GB (e.g. 25MB).");
     print "</div>";
     print "\n<p><strong>" . _("Owners") . ":</strong> </p>";
     print "<div style='margin-left: 10px;'>";
     print _("Placeholder owners are people who can create a site for the placeholder and/or will be given full access to the site at the time of its creation. After the site has been created, changes to placeholder ownership will not change any roles or privileges.");
     print "</div>";
     print "[[owners]]";
     $step->setContent(ob_get_clean());
     return $wizard;
 }
Esempio n. 5
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;
 }