public function migrateJsonSteps() { $fh = new \ElggFile(); $fh->owner_guid = $this->getGUID(); $fh->setFilename('steps.json'); if (!$fh->exists()) { return false; } $steps = $fh->grabFile(); $steps = @json_decode($steps, true); foreach ($steps as $step) { $new_step = new WizardStep(); $new_step->container_guid = $this->getGUID(); $new_step->description = $step; $new_step->save(); } $fh->delete(); return true; }
/** * * @param WizardStep $step * @return Wizard */ public function addStep($step) { $this->steps[$step->getId()] = $step; $step->setStep(count($this->steps)); return $this; }
/** * Answer the step for choosing the content type to add. * * @return object WizardComponent * @access public * @since 6/1/07 */ function getNavStep() { $pluginManager = Services::getService('PluginManager'); $step = new WizardStep(); $step->setDisplayName(_("Create New Navigation")); $property = $step->addComponent("organizerId", new WHiddenField()); $property->setValue(RequestContext::value('organizerId')); $property = $step->addComponent("type", new WSaveWithChoiceButtonList()); $navTypes = $this->getNavTypes(); foreach ($navTypes as $i => $navArray) { ob_start(); print "\n<div>"; $icon = MYPATH . "/images/" . $navArray['icon']; print "\n\t<img src='" . $icon . "' width='300px' align='left' style='margin-right: 5px; margin-bottom: 5px;' alt='icon' />"; print " <strong>" . $navArray['name'] . "</strong>"; print "\n\t<div>" . $navArray['description'] . "</div>"; print "\n</div>"; print "\n<div style='clear: both;'></div>"; $property->addOption($navArray['type']->asString(), str_replace('%1', $navArray['name'], _('Create %1 >> ')), ob_get_clean()); if (!$i) { $property->setValue($navArray['type']->asString()); $set = true; } } // Create the step text ob_start(); print "\n<div>" . _("Select a Navigation type and click 'Create >>' or click 'Next' to choose a Content item to add to the menu:") . "<hr/>"; // print "\n"._("The title of content: "); print "\n<br /><br />[[type]]</div>[[organizerId]]"; $step->setContent(ob_get_clean()); return $step; }
/** * Answer the step for setting the parent of the asset * * @return object WizardStep * @access public * @since 12/15/05 */ function getParentStep() { $harmoni = Harmoni::instance(); $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("Id"); $supported = false; $multipleValuesExist = false; $commonParentId = null; $commonParent = null; $excluded = array(); for ($i = 0; $i < count($this->_assets); $i++) { $assetId = $this->_assets[$i]->getId(); $excluded[] = $assetId->getIdString(); try { $parents = $this->_assets[$i]->getParents(); $supported = true; if ($parents->hasNext()) { $parent = $parents->next(); $parentId = $parent->getId(); // If we are at the first asset and there is a parent, use it and continue if ($i == 0) { $commonParentId = $parentId; $commonParent = $parent; continue; } // if we are just now hitting an id after passing assets // without parents, then multiple values exist if ($i > 0 && $commonParentId == null) { $multipleValuesExist = true; continue; } // If we have different parent Ids... if (!$parentId->isEqual($commonParentId)) { $multipleValuesExist = true; unset($commonParentId); $commonParentId = null; unset($commonParent); $commonParent = null; continue; } } } catch (UnimplementedException $e) { } try { $descendentInfo = $this->_assets[$i]->getDescendentInfo(); $supported = true; while ($descendentInfo->hasNext()) { $info = $descendentInfo->next(); $childId = $info->getNodeId(); if (!in_array($childId->getIdString(), $excluded)) { $excluded[] = $childId->getIdString(); } } } catch (UnimplementedException $e) { } } if ($supported) { // :: Parent :: $step = new WizardStep(); $step->setDisplayName(_("Parent") . " (" . _("optional") . ")"); // Create the properties. $vProperty = $step->addComponent("parent", new WVerifiedChangeInput()); $property = $vProperty->setInputComponent(new WSelectList()); // Create the step text ob_start(); print "\n<h2>" . _("Parent <em>Asset</em>") . "</h2>"; print "\n" . _("Optionally select one of the <em>Assets</em> below if you wish to make these assets the children of another asset: "); print "\n<br />[[parent]]"; $step->setContent(ob_get_clean()); // Check for authorization to remove the existing parent. if (!$multipleValuesExist && is_object($commonParentId)) { // If we aren't authorized to change the parent, just use it as the only option. if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.remove_children"), $commonParentId)) { $property->addOption("NONE", _("None")); $property->setValue($commonParentId->getIdString()); $vProperty->setChecked(true); } else { $property->addOption($commonParentId->getIdString(), "- " . $commonParent->getDisplayName() . " (" . $commonParentId->getIdString() . ")"); $property->setValue($commonParentId->getIdString()); $vProperty->setChecked(true); return $step; } } else { if (!$multipleValuesExist) { $vProperty->setChecked(true); $property->addOption("NONE", _("None")); $property->setValue("NONE"); } else { $property->addOption("", _("(multiple values exist)")); $property->setValue(""); $vProperty->setChecked(false); } } $property->_startingDisplay = ""; $rootAssets = $this->getRootAssets(); while ($rootAssets->hasNext()) { $this->addAssetOption($property, $rootAssets->next(), $excluded); } return $step; } }
/** * Answer a wizard step for advanced theme editing. * * @return object WizardStep * @access protected * @since 5/15/08 */ protected function getAdvancedStep() { $component = $this->getSiteComponent(); $step = new WizardStep(); $step->setDisplayName(_("Advanced Editing")); $harmoni = Harmoni::instance(); ob_start(); print "\n<h2>" . _("Advanced Theme Editing") . "</h2>"; $theme = $component->getTheme(); if (!$theme->supportsModification()) { print "\n<p>" . _("You currently are using a read-only theme. You can make a copy of this theme for just this site that you can then modify.") . "</p>"; $about = _("Modifying a theme requires knowledge of %1Cascading Style Sheets (CSS)%2 and %3Hypertext Markup Language (HTML)%4"); $about = str_replace('%1', "<a href='http://www.w3schools.com/Css/css_intro.asp' target='_blank'>", $about); $about = str_replace('%2', "</a>", $about); $about = str_replace('%3', "<a href='http://www.w3schools.com/html/html_intro.asp' target='_blank'>", $about); $about = str_replace('%4', "</a>", $about); print "\n<p>" . $about . "</p>"; $property = $step->addComponent('create_copy', WSaveButton::withLabel(_("Create Local Theme Copy"))); print "[[create_copy]]"; $step->setContent(ob_get_clean()); return $step; } print "\n<div class='theme_edit_step'>"; $modSess = $theme->getModificationSession(); /********************************************************* * Information *********************************************************/ print "\n<h3>" . _("Theme Information") . "</h3>"; print "\n<table class='info_table'><tr><td>"; $property = $step->addComponent('display_name', new WSafeHtmlTextField()); $property->setSize(40); $property->setValue($theme->getDisplayName()); $property->setErrorRule(new WECRegex('[a-zA-Z0-9]+')); $property->setErrorText(_("You must specify a name.")); print "\n<h4>" . _("Display Name") . "</h4>\n[[display_name]]"; $property = $step->addComponent('description', new WSafeHtmlTextArea()); $property->setRows(10); $property->setColumns(40); $property->setValue($theme->getDescription()); print "\n<br/><h4>" . _("Description") . "</h4>\n[[description]]"; print "\n</td><td>"; $property = $step->addComponent('thumbnail', new WFileUploadField()); $property->setAcceptedMimetypes(array('image/png', 'image/jpeg', 'image/gif')); print "\n<h4>" . _("Thumbnail") . "</h4>\n[[thumbnail]]"; print "<div><br/>" . _("Current Thumbnail: ") . "<br/>"; try { $currentThumbnail = $theme->getThumbnail(); $property->setStartingDisplay($currentThumbnail->getBasename(), $currentThumbnail->getSize()); print "\n\t<img src='" . $harmoni->request->quickUrl('gui2', 'theme_thumbnail', array('theme' => $theme->getIdString(), 'rand' => rand(1, 10000))) . "' width='200px'/>"; } catch (UnknownIdException $e) { print "<em>" . _("none") . "</em>"; } print "</div>"; print "\n</td></tr></table>"; /********************************************************* * Global CSS *********************************************************/ print "\n<table class='info_table'><tr><td style='width: 350px;'>"; print "\n<h3>" . _("Theme Data") . "</h3>"; print "\n<p>" . _("In the text areas below, add the CSS and HTML for your theme.") . "</p>"; print "\n<p>" . _("The CSS snippets will be combined together in the order listed into a single file.") . "</p>"; print "\n<p>" . _("The HTML snippets will wrap the various components on the screen and must contain <code>[[CONTENT]]</code> placeholder for the content of the component. Any classes you want to refer to in the CSS will need to be added to the HTML snippets.") . "</p>"; $property = $step->addComponent('global_css', new WSafeCssTextArea()); $value = $modSess->getGlobalCss(); $property->setValue($value); $property->setColumns(40); $property->setWrap('off'); $property->setRows(min(40, max(20, substr_count($value, "\n") + 1))); print "\n<h4>" . _("Global CSS") . "</h4>\n[[global_css]]"; /********************************************************* * Images *********************************************************/ print "\n</td><td>"; print "\n<h3>" . _("Images") . "</h3>"; print "\n<p>" . _("You may upload images to your theme. These images must be JPG, PNG, or GIF images. To use them in your HTML or CSS, reference them with relative urls in an 'images' directory such as <code>images/background_image.jpg</code>.") . "</p>"; print "\n[[images]]"; $collection = $step->addComponent('images', new WRepeatableComponentCollection()); $collection->setContent('./images/[[path_prefix]]/[[image]] [[orig_path_prefix]]'); $property = $collection->addComponent('path_prefix', new WTextField()); $property->setSize('10'); $property->setErrorRule(new WECRegex('^([a-zA-Z0-9_-]+)?(\\/[a-zA-Z0-9_-]+)*$')); $property->setErrorText(_("Subdirectories can only contain letters, numbers, and underscore characters.")); $property = $collection->addComponent('orig_path_prefix', new WHiddenField()); $property = $collection->addComponent('image', new WFileUploadField()); $property->setAcceptedMimetypes(array('image/png', 'image/jpeg', 'image/gif')); foreach ($theme->getImages() as $image) { $collection->addValueCollection(array('path_prefix' => dirname($image->getPath()), 'orig_path_prefix' => dirname($image->getPath()), 'image' => array('name' => $image->getBasename(), 'size' => $image->getSize(), 'type' => $image->getMimeType(), 'starting_name' => $image->getBasename(), 'starting_size' => $image->getSize()))); } print "\n</td></tr></table>"; /********************************************************* * Other CSS and Templates *********************************************************/ print "\n<table class='theme_advanced_table'>"; foreach ($modSess->getComponentTypes() as $type) { // print "\n\t<tr>\n\t\t<th colspan='2'>".$type."</th>\n\t</tr>"; print "\n\t<tr>"; print "\n\t\t<th>" . $type . " CSS</th>"; print "\n\t\t<th>" . $type . " HTML</th>"; print "\n\t</tr>"; print "\n\t<tr>"; print "\n\t\t<td>[[" . $type . "-css]]</td>"; print "\n\t\t<td>[[" . $type . "-html]]</td>"; print "\n\t</tr>"; $cssProperty = $step->addComponent($type . '-css', new WSafeCssTextArea()); $value = $modSess->getCssForType($type); $cssLines = substr_count($value, "\n"); $cssProperty->setValue($value); $cssProperty->setColumns(40); $cssProperty->setWrap('off'); $htmlProperty = $step->addComponent($type . '-html', new WSafeHtmlTextArea()); $value = $modSess->getTemplateForType($type); $htmlLines = substr_count($value, "\n"); $htmlProperty->setValue($value); $htmlProperty->setColumns(60); $htmlProperty->setWrap('off'); $htmlProperty->setErrorRule(new WECRegex('(\\[\\[CONTENT\\]\\]|^$)')); $htmlProperty->setErrorText(_("Template HTML must contain a [[CONTENT]] placeholder or be blank.")); // Extend the text-areas to fit the content if needed. $numLines = max(10, $cssLines + 1, $htmlLines + 1); $numLines = min($numLines, 50); $cssProperty->setRows($numLines); $htmlProperty->setRows($numLines); } print "\n</table>"; /********************************************************* * Options *********************************************************/ $property = $step->addComponent('options', new WTextArea()); $property->setRows(40); $property->setColumns(100); $property->setWrap('off'); $property->setValue($modSess->getOptionsDocument()->saveXMLWithWhiteSpace()); $property->setErrorRule(new XmlSchemaRule(HARMONI . '/Gui2/theme_options.xsd')); print "\n<h3>" . _("Theme Options") . "</h3>"; $help = _("In the text area below you can add an XML document that describes any options for this theme. This document must conform to the %1. (View an example %2.)"); $schema = "<a href='" . $harmoni->request->quickURL('gui2', 'view_options_schema') . "' target='_blank'>" . _("options schema") . "</a>"; $example = "<a href='" . $harmoni->request->quickURL('gui2', 'view_options_example') . "' target='_blank'>" . _("options document") . "</a>"; print "\n<p>" . str_replace('%1', $schema, str_replace('%2', $example, $help)) . "</p>"; print "\n<p>" . _("Each option defines a set of choices for the user. These choices are composed of one or more settings. When a choice is used, all occurrances of the marker in the CSS and HTML above will be replaced with the value of that setting.") . "</p>"; print "\n[[options]]"; print "\n</div>"; $step->setContent(ob_get_clean()); return $step; }
/** * Displays the specified 'step' of the wizard * @param WizardStep $oStep The 'step' to display */ protected function DisplayStep(WizardStep $oStep) { $oPage = new SetupPage($oStep->GetTitle()); if ($oStep->RequiresWritableConfig()) { $sConfigFile = utils::GetConfigFilePath(); if (file_exists($sConfigFile)) { // The configuration file already exists if (!is_writable($sConfigFile)) { $oP = new SetupPage('Installation Cannot Continue'); $oP->add("<h2>Fatal error</h2>\n"); $oP->error("<b>Error:</b> the configuration file '" . $sConfigFile . "' already exists and cannot be overwritten."); $oP->p("The wizard cannot modify the configuration file for you. If you want to upgrade " . ITOP_APPLICATION . ", make sure that the file '<b>" . realpath($sConfigFile) . "</b>' can be modified by the web server."); $oP->output(); return; } } } $oPage->add_linked_script('../setup/setup.js'); $oPage->add_script("function CanMoveForward()\n{\n" . $oStep->JSCanMoveForward() . "\n}\n"); $oPage->add_script("function CanMoveBackward()\n{\n" . $oStep->JSCanMoveBackward() . "\n}\n"); $oPage->add('<form id="wiz_form" method="post">'); $oStep->Display($oPage); // Add the back / next buttons and the hidden form // to store the parameters $oPage->add('<input type="hidden" id="_class" name="_class" value="' . get_class($oStep) . '"/>'); $oPage->add('<input type="hidden" id="_state" name="_state" value="' . $oStep->GetState() . '"/>'); foreach ($this->aParameters as $sCode => $value) { $oPage->add('<input type="hidden" name="_params[' . $sCode . ']" value="' . htmlentities($value, ENT_QUOTES, 'UTF-8') . '"/>'); } $oPage->add('<input type="hidden" name="_steps" value="' . htmlentities(json_encode($this->aSteps), ENT_QUOTES, 'UTF-8') . '"/>'); $oPage->add('<table style="width:100%;"><tr>'); if (count($this->aSteps) > 0 && $oStep->CanMoveBackward()) { $oPage->add('<td style="text-align: left"><button id="btn_back" type="submit" name="operation" value="back"> << Back </button></td>'); } if ($oStep->CanMoveForward()) { $oPage->add('<td style="text-align:right;"><button id="btn_next" class="default" type="submit" name="operation" value="next">' . htmlentities($oStep->GetNextButtonLabel(), ENT_QUOTES, 'UTF-8') . '</button></td>'); } $oPage->add('</tr></table>'); $oPage->add("</form>"); $oPage->add('<div id="async_action" style="display:none;overflow:auto;max-height:100px;color:#F00;font-size:small;"></div>'); // The div may become visible in case of error // Hack to have the "Next >>" button, be the default button, since the first submit button in the form is the default one $oPage->add_ready_script(<<<EOF \$('form').each(function () { \tvar thisform = \$(this); \t\tthisform.prepend(thisform.find('button.default').clone().removeAttr('id').removeAttr('disabled').css({ \t\tposition: 'absolute', \t\tleft: '-999px', \t\ttop: '-999px', \t\theight: 0, \t\twidth: 0 \t})); }); \$('#btn_back').click(function() { \$('#wiz_form').data('back', true); }); \$('#wiz_form').submit(function() { \tif (\$(this).data('back')) \t{ \t\treturn CanMoveBackward(); \t} \telse \t{ \t\treturn CanMoveForward(); \t} }); \$('#wiz_form').data('back', false); WizardUpdateButtons(); EOF ); $oPage->output(); }
/** * Answer the step for setting the parent of the asset * * @return object WizardStep * @access public * @since 12/15/05 */ function getParentStep() { // :: Parent :: $step = new WizardStep(); $step->setDisplayName(_("Parent") . " (" . _("optional") . ")"); // Create the properties. $property = $step->addComponent("parent", new WSelectList()); // Create the step text ob_start(); print "\n<h2>" . _("Parent <em>Asset</em>") . "</h2>"; print "\n" . _("Optionally select one of the <em>Assets</em> below if you wish to make this asset a child of another asset: "); print "\n<br />[[parent]]"; $step->setContent(ob_get_clean()); $harmoni = Harmoni::instance(); $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("Id"); // Check for authorization to remove the existing parent. try { $parents = $this->_assets[0]->getParents(); if ($parents->hasNext()) { $parent = $parents->next(); $parentId = $parent->getId(); // If we aren't authorized to change the parent, just use it as the only option. if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.remove_children"), $parentId)) { $property->addOption("NONE", _("None")); $property->setValue($parentId->getIdString()); } else { $property->addOption($parentId->getIdString(), "- " . $parent->getDisplayName() . " (" . $parentId->getIdString() . ")"); $property->setValue($parentId->getIdString()); return $step; } } else { $property->addOption("NONE", _("None")); $property->setValue("NONE"); } } catch (UnimplementedException $e) { $property->addOption("NONE", _("None")); $property->setValue("NONE"); } $skip = array(); foreach ($this->_assets as $asset) { $assetId = $asset->getId(); $skip[] = $assetId->getIdString(); } $rootAssets = $this->getRootAssets(); while ($rootAssets->hasNext()) { $this->addAssetOption($property, $rootAssets->next(), $skip); } return $step; }
/** * Print out the displayType options * * @param object SiteComponent $siteComponent * @param object WizardStep $step * @return null * @access protected * @since 5/12/08 */ protected function printDisplayType(SiteComponent $siteComponent, WizardStep $step) { $property = $step->addComponent('displayType', new WSelectList()); $property->setValue($siteComponent->getDisplayType()); $property->addOption('Block_Standard', _('Standard Block')); $property->addOption('Block_Sidebar', _('Sidebar Block')); $property->addOption('Block_Alert', _('Alert Block')); $property->addOption('Header', _('Header')); $property->addOption('Footer', _('Footer')); print "\n\t\t\t\t<p style='white-space: nowrap; font-weight: bold;'>"; print "\n\t\t\t\t\t" . _('Look and feel of this content block: ') . "[[displayType]]"; print "\n\t\t\t\t</p>"; $property = $step->addComponent('headingDisplayType', new WSelectList()); $property->setValue($siteComponent->getHeadingDisplayType()); $property->addOption('Heading_1', _('Heading - Biggest')); $property->addOption('Heading_2', _('Heading - Big')); $property->addOption('Heading_3', _('Heading - Normal')); $property->addOption('Heading_Sidebar', _('Heading - For Sidebar')); print "\n\t\t\t\t<p style='white-space: nowrap; font-weight: bold;'>"; print "\n\t\t\t\t\t" . _('Look and feel of this content block\'s heading: ') . "[[headingDisplayType]]"; print "\n\t\t\t\t</p>"; }
/** * Add any additional site admins to a multi-select. * * @param object Wizard $wizard * @return void * @access protected * @since 1/28/08 */ protected function addSiteAdminStep(Wizard $wizard) { /********************************************************* * Owner step if multiple owners *********************************************************/ $step = new WizardStep(); $step->setDisplayName(_("Choose Admins")); $property = $step->addComponent("admins", new WMultiCheckList()); $agentMgr = Services::getService("Agent"); $i = 0; $owners = $this->getOwners(); foreach ($owners as $ownerId) { $i++; $owner = $agentMgr->getAgent($ownerId); $property->addOption($ownerId->getIdString(), htmlspecialchars($owner->getDisplayName())); $property->setValue($ownerId->getIdString()); } $property->setSize($i); // Create the step text ob_start(); print "\n<h2>" . _("Choose Site Admins") . "</h2>"; print "\n<p>" . _("The following users are listed as owners of this placeholder. Keep them selected if you would like them be administrators of this site or de-select them if they should not be administrators of this site. Any choice made now can be changed later through the 'Permissions' screen for the site."); print "\n<br />[[admins]]</p>"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_clean(); if ($i) { $step = $wizard->addStep("owners", $step); $wizard->makeStepRequired('owners'); } }
/** * Print out the displayType options * * @param object SiteComponent $siteComponent * @param object WizardStep $step * @return null * @access protected * @since 5/12/08 */ protected function printDisplayType(SiteComponent $siteComponent, WizardStep $step) { $property = $step->addComponent('displayType', new WSelectList()); $property->setValue($siteComponent->getDisplayType()); $property->addOption('Menu_Left', _('Menu on the Left')); $property->addOption('Menu_Right', _('Menu on the Right')); $property->addOption('Menu_Top', _('Menu on the Top')); $property->addOption('Menu_Bottom', _('Menu on the Bottom')); print "\n\t\t\t\t<p style='white-space: nowrap; font-weight: bold;'>"; print "\n\t\t\t\t\t" . _('Where is this menu positioned? ') . "[[displayType]]"; print "\n\t\t\t\t</p>"; }
/** * Answer a step for changing permissions. * * @return object WizardStep * @access public * @since 11/1/07 */ public function getPermissionsStep() { $step = new WizardStep(); $step->setDisplayName(_("Roles")); $property = $step->addComponent("perms_table", new RowRadioMatrix()); $roleMgr = SegueRoleManager::instance(); $authZ = Services::getService("AuthZ"); $idMgr = Services::getService("Id"); $component = $this->getSiteComponent(); $componentId = $idMgr->getId($component->getId()); // Add the options foreach ($roleMgr->getRoles() as $role) { $property->addOption($role->getIdString(), $role->getDisplayName(), $role->getDescription()); } // Make the whole property read-only if we can view but not modify authorizations if (!$authZ->isUserAuthorized($idMgr->getId("edu.middlebury.authorization.modify_authorizations"), $componentId)) { $property->setEnabled(false); } // Get a list of the parent components. $parents = array(); $parent = $component->getParentComponent(); while ($parent) { if ($parent->acceptVisitor(new IsAuthorizableVisitor())) { $parents[] = $parent; } $parent = $parent->getParentComponent(); } $tabs = ""; for ($i = count($parents) - 1; $i >= 0; $i--) { $parent = $parents[$i]; $parentId = $idMgr->getId($parent->getId()); // Everyone $agentId = $idMgr->getId('edu.middlebury.agents.everyone'); $everyoneRole = $roleMgr->getAgentsRole($agentId, $parentId)->getIdString(); $property->addField("everyone_" . $parent->getId(), $tabs . _("The World"), $everyoneRole); $property->addSpacerBefore("<br/>" . $tabs . $parent->getDisplayName()); // @todo This should be edu.middlebury.agents.institute $agentId = $idMgr->getId('edu.middlebury.institute'); $agentMgr = Services::getService("Agent"); $agent = $agentMgr->getGroup($agentId); $instituteRole = $roleMgr->getAgentsRole($agentId, $parentId)->getIdString(); $property->addField("institute_" . $parent->getId(), $tabs . $agent->getDisplayName(), $instituteRole); // Disable changing of parent roles foreach ($roleMgr->getRoles() as $role) { $property->makeDisabled('everyone_' . $parent->getId(), $role->getIdString()); $property->makeDisabled('institute_' . $parent->getId(), $role->getIdString()); } $tabs .= " "; // $property->addSpacer(); } // Everyone $agentId = $idMgr->getId('edu.middlebury.agents.everyone'); $property->addField("everyone", $tabs . _("The World"), $roleMgr->getAgentsRole($agentId, $componentId)->getIdString()); $property->addSpacerBefore("<br/>" . $tabs . $component->getDisplayName()); // Disable all options up to the max parent role. foreach ($property->getOptions() as $option) { if ($option->value == $everyoneRole) { break; } else { $property->makeDisabled('everyone', $option->value); } } //Institute $agentId = $idMgr->getId('edu.middlebury.institute'); $agentMgr = Services::getService("Agent"); $agent = $agentMgr->getGroup($agentId); $property->addField("institute", $tabs . $agent->getDisplayName(), $roleMgr->getAgentsRole($agentId, $componentId)->getIdString(), ">="); // Disable all options up to the max parent role. foreach ($property->getOptions() as $option) { if ($option->value == $instituteRole) { break; } else { $property->makeDisabled('institute', $option->value); } } // Make the everyone and institute groups unable to be given adminstrator privelidges $property->makeDisabled('everyone', 'admin'); $property->makeDisabled('institute', 'admin'); // $property->addSpacer(); // $property->addField("private", _("All Faculty"), 'no_access'); ob_start(); print "\n<h2>" . _("Roles") . "</h2>"; print "\n<p>"; print _("Here you can set roles for this component and its children. Roles are additive -- this means that you can add additional roles (but not remove them) for any children."); print "\n</p>\n"; print "[[perms_table]]"; $step->setContent(ob_get_clean()); return $step; }
/** * Answer the theme step * * @return object WizardStep * @access protected * @since 5/8/08 */ protected function getThemeStep() { $component = $this->getSiteComponent(); $step = new WizardStep(); $step->setDisplayName(_("Theme")); $property = $step->addComponent("theme", new WRadioListWithDelete()); $property->setValue($component->getTheme()->getIdString()); $themeMgr = Services::getService("GUIManager"); foreach ($themeMgr->getThemes() as $theme) { ob_start(); try { $thumb = $theme->getThumbnail(); $harmoni = Harmoni::instance(); print "\n\t<img src='" . $harmoni->request->quickUrl('gui2', 'theme_thumbnail', array('theme' => $theme->getIdString())) . "' style='float: left; width: 200px; margin-right: 10px;'/>"; } catch (UnimplementedException $e) { print "\n\t<div style='font-style: italic'>" . _("Thumbnail not available.") . "</div>"; } catch (OperationFailedException $e) { print "\n\t<div style='font-style: italic'>" . _("Thumbnail not available.") . "</div>"; } print "\n\t<p>" . $theme->getDescription() . "</p>"; // Delete Theme if ($theme->supportsModification()) { $modSess = $theme->getModificationSession(); if ($modSess->canModify()) { $allowDelete = true; } else { $allowDelete = false; } } else { $allowDelete = false; } print "\n\t<div style='clear: both;'> </div>"; $property->addOption($theme->getIdString(), "<strong>" . $theme->getDisplayName() . "</strong>", ob_get_clean(), $allowDelete); } ob_start(); print "\n<h2>" . _("Theme") . "</h2>"; print "\n<p>"; print _("Here you can set the theme for the site."); print "\n</p>\n"; print "[[theme]]"; $step->setContent(ob_get_clean()); return $step; }
/** * Answer the theme step * * @param * @return object WizardStep * @access protected * @since 8/13/08 */ protected function getThemeStep() { $step = new WizardStep(); $step->setDisplayName(_("Theme")); $property = $step->addComponent("theme", new WRadioListWithDelete()); $themeMgr = Services::getService("GUIManager"); foreach ($themeMgr->getThemeSources() as $source) { try { foreach ($source->getThemes() as $theme) { ob_start(); try { try { $thumb = $theme->getThumbnail(); $harmoni = Harmoni::instance(); print "\n\t<img src='" . $harmoni->request->quickUrl('gui2', 'theme_thumbnail', array('theme' => $theme->getIdString())) . "' style='float: left; width: 200px; margin-right: 10px;'/>"; } catch (UnimplementedException $e) { print "\n\t<div style='font-style: italic'>" . _("Thumbnail not available.") . "</div>"; } catch (OperationFailedException $e) { print "\n\t<div style='font-style: italic'>" . _("Thumbnail not available.") . "</div>"; } print "\n\t<p>" . $theme->getDescription() . "</p>"; // Delete Theme if ($theme->supportsModification()) { $modSess = $theme->getModificationSession(); if ($modSess->canModify()) { $allowDelete = true; } else { $allowDelete = false; } } else { $allowDelete = false; } print "\n\t<div style='clear: both;'> </div>"; $property->addOption($theme->getIdString(), "<strong>" . $theme->getDisplayName() . "</strong>", ob_get_contents(), $allowDelete); } catch (Exception $e) { } ob_end_clean(); } } catch (Exception $e) { } } if (defined('SEGUE_DEFAULT_SITE_THEME')) { $property->setValue(SEGUE_DEFAULT_SITE_THEME); } else { $property->setValue($themeMgr->getDefaultTheme()->getIdString()); } ob_start(); print "\n<h2>" . _("Theme") . "</h2>"; print "\n<p>"; print _("Here you can set the theme for the site. The theme is the 'look and feel' of your site. Most themes allow you to change the text and background colors once the site has been created. You can change your site's theme at any time in the future."); print "\n</p>\n"; print "[[theme]]"; $step->setContent(ob_get_clean()); return $step; }
register_error(elgg_echo('error:missing_data')); forward(REFERER); } $entity = false; if (!empty($guid)) { $entity = get_entity($guid); if (!$entity instanceof WizardStep) { register_error(elgg_echo('wizard:action:error:entity:wizard_step')); forward(REFERER); } } else { $container = get_entity($container_guid); if (!$container instanceof Wizard) { register_error(elgg_echo('wizard:action:error:entity')); forward(REFERER); } $entity = new WizardStep(); $entity->container_guid = $container->getGUID(); if (!$entity->save()) { register_error(elgg_echo('wizard:action:wizard_step:edit:error:create')); forward(REFERER); } } $entity->title = $title; $entity->description = $description; if ($entity->save()) { system_message(elgg_echo('wizard:action:wizard_step:edit:success')); } else { register_error(elgg_echo('save:fail')); } forward(REFERER);
/** * Answer the step for choosing the content type to add. * * @return object WizardComponent * @access public * @since 6/1/07 */ function getContentStep() { $pluginManager = Services::getService('PluginManager'); $step = new WizardStep(); $step->setDisplayName(_("Create New Content")); $property = $step->addComponent("organizerId", new WHiddenField()); $property->setValue(RequestContext::value('organizerId')); $property = $step->addComponent("type", new WSaveWithChoiceButtonList()); $plugins = $pluginManager->getEnabledPlugins(); $set = false; foreach ($plugins as $key => $pType) { ob_start(); print "\n<div>"; $icon = $pluginManager->getPluginIconUrl($pType); if ($icon) { print "\n\t<img src='" . $icon . "' width='300px' align='left' style='margin-right: 5px; margin-bottom: 5px;' alt='icon' />"; } try { $class = $pluginManager->getPluginClass($pType); $name = call_user_func(array($class, 'getPluginDisplayName')); } catch (UnknownIdException $e) { $name = $pType->getKeyword(); } print " <strong>" . $name . "</strong>"; print "\n\t<div>" . $pType->getDescription() . "</div>"; print "\n</div>"; print "\n<div style='clear: both;'></div>"; $property->addOption($key, str_replace('%1', $name, _('Create %1 >> ')), ob_get_clean()); if (!$set) { $property->setValue($key); $set = true; } } // Create the step text ob_start(); print "\n<div><strong>" . _("Select a Content Type:") . "</strong>"; // print "\n"._("The title of content: "); print "\n<br /><br />[[type]]</div>[[organizerId]]"; $step->setContent(ob_get_clean()); return $step; }