/**
  * Create wizard steps for editing the values of the specified Record and
  * add them to the wizard.
  * 
  * @param object $record
  * @param object $wizard The wizard to add the steps to.
  * @param array $partStructures An ordered array of the partStructures to include.
  * @return void
  * @access public
  * @since 10/19/04
  */
 function createWizardStepsForPartStructures(Record $record, Wizard $wizard, array $partStructures)
 {
     ArgumentValidator::validate($partStructures, ArrayValidatorRuleWithRule::getRule(ExtendsValidatorRule::getRule("PartStructure")));
     $recordStructure = $record->getRecordStructure();
     $recordStructureId = $recordStructure->getId();
     /* build an interface for editing this record! */
     $m = '';
     $step = $wizard->addStep("record", new WizardStep());
     $step->setDisplayName(dgettext("polyphony", "Edit Record"));
     // Go through each of the PartStructures and create a component for it
     foreach (array_keys($partStructures) as $key) {
         $partStructure = $partStructures[$key];
         $m .= $this->_addComponentForPartStructure($step, $record, $partStructure);
         $m .= "<br/>";
     }
     $step->setContent($m);
 }
예제 #2
0
 /**
  * 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'> &nbsp; </div>";
     $step->setContent(ob_get_contents());
     ob_end_clean();
     if ($i) {
         $step = $wizard->addStep("owners", $step);
         $wizard->makeStepRequired('owners');
     }
 }
예제 #3
0
 /**
  * Add the Template step to the wizard
  * 
  * @param object Wizard $wizard
  * @return void
  * @access protected
  * @since 6/10/08
  */
 protected function addTemplateStep(Wizard $wizard)
 {
     ob_start();
     $step = new WizardStep();
     $step->setDisplayName(_("Choose Template"));
     print "\n<h2>" . _("Choose Template") . "</h2>";
     print "\n<p>" . _("Templates are site 'starting points'. Each template provides you with a different starting set of sections and pages to help you get started. These pages can be renamed or deleted and new pages can always be added.") . "</p>";
     $property = $step->addComponent('template', new WRadioList());
     $templateMgr = Segue_Templates_TemplateManager::instance();
     $templates = $templateMgr->getTemplates();
     if (!count($templates)) {
         throw new OperationFailedException("No templates available.");
     }
     $property->setValue($templates[0]->getIdString());
     foreach ($templates as $template) {
         ob_start();
         try {
             $thumb = $template->getThumbnail();
             $harmoni = Harmoni::instance();
             $url = $harmoni->request->quickUrl('templates', 'template_thumbnail', array('template' => $template->getIdString()));
             print "\n\t<img src='" . $url . "' style='float: left; width: 200px; margin-right: 10px;' alt='" . _('Template thumbnail') . "' ";
             print " onclick=\"";
             print "var templatePreview = window.open('{$url}', 'template_preview', 'toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500'); ";
             print "templatePreview.focus();";
             print "\" ";
             print "/>";
         } 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>" . $template->getDescription() . "</p>";
         print "\n\t<div style='clear: both;'> &nbsp; </div>";
         $property->addOption($template->getIdString(), "<strong>" . $template->getDisplayName() . "</strong>", ob_get_clean());
     }
     print '[[template]]';
     $step->setContent(ob_get_contents());
     ob_end_clean();
     $step = $wizard->addStep("template_step", $step);
     $wizard->makeStepRequired('template_step');
 }
 /**
  * Create wizard steps for editing the values of the specified Record and
  * add them to the wizard.
  * 
  * @param object $record
  * @param object $wizard The wizard to add the steps to.
  * @return void
  * @access public
  * @since 10/19/04
  */
 function createWizardSteps(Record $record, Wizard $wizard)
 {
     $recordStructure = $record->getRecordStructure();
     // Get all the parts
     $partIterator = $record->getParts();
     $parts = array();
     while ($partIterator->hasNext()) {
         $part = $partIterator->next();
         $partStructure = $part->getPartStructure();
         $partStructureId = $partStructure->getId();
         $parts[$partStructureId->getIdString()] = $part;
     }
     $step = $wizard->addStep("record", new WizardStep());
     $step->setDisplayName($recordStructure->getDisplayName());
     ob_start();
     $component = $step->addComponent("file_upload", new WFileUploadField());
     print "\n<em>" . _("Upload a new file or change file properties.") . "</em>\n<hr />";
     print "\n<br /><strong>";
     if ($parts['FILE_NAME']->getValue()) {
         print _("New file (optional)");
     } else {
         print _("File");
     }
     print ":</strong>";
     print "\n[[file_upload]]";
     $component = $step->addComponent("file_name", new WTextField());
     $component->setValue($parts['FILE_NAME']->getValue());
     $component = $step->addComponent("use_custom_filename", new WCheckBox());
     $component->setValue(false);
     $component = $step->addComponent("file_size", new WTextField());
     $size = ByteSize::withValue($parts['FILE_SIZE']->getValue());
     $component->setValue($size->asString());
     $component->setEnabled(FALSE, TRUE);
     //
     // 		$component =$step->addComponent("size_from_file", new WCheckBox());
     // 		$component->setValue(false);
     $component = $step->addComponent("mime_type", new WTextField());
     $component->setValue($parts['MIME_TYPE']->getValue());
     $component = $step->addComponent("use_custom_type", new WCheckBox());
     $component->setValue(false);
     // Dimensions
     $dimensionComponent = new WTextField();
     $dimensionComponent->setSize(8);
     $dimensionComponent->setStyle("text-align: right");
     $dimensionComponent->setErrorRule(new WECRegex("^([0-9]+px)?\$"));
     $dimensionComponent->setErrorText(_("Must be a positive integer followed by 'px'."));
     $dimensionComponent->addOnChange("validateWizard(this.form);");
     $dim = $parts['DIMENSIONS']->getValue();
     $component = $step->addComponent("height", $dimensionComponent->shallowCopy());
     if ($dim[1]) {
         $component->setValue($dim[1] . 'px');
     }
     $component = $step->addComponent("use_custom_height", new WCheckBox());
     $component->setValue(false);
     $component = $step->addComponent("width", $dimensionComponent->shallowCopy());
     if ($dim[0]) {
         $component->setValue($dim[0] . 'px');
     }
     $component = $step->addComponent("use_custom_width", new WCheckBox());
     $component->setValue(false);
     // Thumnail Upload
     $component = $step->addComponent("thumbnail_upload", new WFileUploadField());
     $component = $step->addComponent("thumbnail_mime_type", new WTextField());
     $component->setValue($parts['THUMBNAIL_MIME_TYPE']->getValue());
     $component = $step->addComponent("use_custom_thumbnail_type", new WCheckBox());
     $component->setValue(false);
     // Thumbnail dimensions
     $thumDim = $parts['THUMBNAIL_DIMENSIONS']->getValue();
     $component = $step->addComponent("thumbnail_height", $dimensionComponent->shallowCopy());
     if ($thumDim[1]) {
         $component->setValue($thumDim[1] . 'px');
     }
     $component = $step->addComponent("use_custom_thumbnail_height", new WCheckBox());
     $component->setValue(false);
     $component = $step->addComponent("thumbnail_width", $dimensionComponent->shallowCopy());
     if ($thumDim[0]) {
         $component->setValue($thumDim[0] . 'px');
     }
     $component = $step->addComponent("use_custom_thumbnail_width", new WCheckBox());
     $component->setValue(false);
     print "\n<p>" . _("Change properties of the uploaded file to custom values:");
     print "\n<table border='1'>";
     print "\n<tr>";
     print "\n\t<th>";
     print "\n\t\t" . _("Property") . "";
     print "\n\t</th>";
     print "\n\t<th>";
     print "\n\t\t" . _("Use Custom Value") . "";
     print "\n\t</th>";
     print "\n\t<th>";
     print "\n\t\t" . _("Custom Value") . "";
     print "\n\t</th>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("File Name") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_filename]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[file_name]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("File Size") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     // 		print "\n\t\t[[size_from_file]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[file_size]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Mime Type") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_type]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[mime_type]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Width") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_width]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[width]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Height") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_height]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[height]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Thumbnail") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t &nbsp; ";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n[[thumbnail_upload]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Thumbnail Mime Type") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_thumbnail_type]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[thumbnail_mime_type]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Thumbnail Width") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_thumbnail_width]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[thumbnail_width]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n<tr>";
     print "\n\t<td>";
     print "\n\t\t" . _("Thumbnail Height") . "";
     print "\n\t</td>";
     print "\n\t<td align='center'>";
     print "\n\t\t[[use_custom_thumbnail_height]]";
     print "\n\t</td>";
     print "\n\t<td>";
     print "\n\t\t[[thumbnail_height]]";
     print "\n\t</td>";
     print "\n</tr>";
     print "\n</table>";
     print "\n</p>";
     $step->setContent(ob_get_contents());
     ob_end_clean();
 }