/** * 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/11/07 */ function createWizard() { // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); $wizard->addStep("display", $this->getDisplayOptionsStep()); 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/9/08 */ function createWizard() { // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); $wizard->addStep("options", $this->getOptionsStep()); $wizard->addStep("advanced", $this->getAdvancedStep()); 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 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); //$courseManager = Services::getService("CourseManagement"); //$canonicalCourseIterator =$courseManager->getCanonicalCourses(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Select options for the new term:")); //displayname $titleProp = $step->addComponent("displayname", new WTextField()); $titleProp->setErrorText("<nobr>" . _("A value for this field is required.") . "</nobr>"); $titleProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // Create the type chooser. $select = new WSelectList(); $typename = "term"; $dbHandler = Services::getService("DBHandler"); $query = new SelectQuery(); $query->addTable('cm_' . $typename . "_type"); $query->addColumn('id'); $query->addColumn('keyword'); $res = $dbHandler->query($query); while ($res->hasMoreRows()) { $row = $res->getCurrentRow(); $res->advanceRow(); $select->addOption($row['id'], $row['keyword']); } $typeProp = $step->addComponent("termtype", $select); //$courseManager = Services::getService("CourseManagement"); //$select->addOption('',"Canonical Course Type"); /*$select->addOption('can',"Canonical Course Type"); $select->addOption('can_stat',"Canonical Course Status Type"); $select->addOption('offer',"Course Offering Type"); $select->addOption('offer_stat',"Course Offering Status Type"); $select->addOption('section',"Course Section Type"); $select->addOption('section_stat',"Course Section Status Type"); $select->addOption('enroll_stat',"Enrollment Status Type"); $select->addOption('grade',"Course Grading Type"); $select->addOption('term',"Term Type");*/ //$select->setValue(''); //$typeProp->setErrorText("<nobr>"._("A value for this field is required.")."</nobr>"); //$typeProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // Create the display name // Create the step text ob_start(); print "\n<font size=+2><h2>" . _("Term creator") . "</h2></font>"; print "\n<h2>" . _("Keyword") . "</h2>"; print "\n" . _("The name of the <em>term</em>: "); print "\n<br />[[displayname]]"; print "\n<h2>" . _("Type") . "</h2>"; print "\n" . _("Please choose a type of <em>term</em>: "); print "\n<br />[[termtype]]"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_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 6/5/07 */ function createWizard() { // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withText("<div>\n" . "[[_stepsBar]]" . "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n" . "<tr>\n" . "<td align='left' width='50%'>\n" . "[[_cancel]]<br/>\n" . "[[_prev]]" . "</td>\n" . "<td align='right' width='50%'>\n" . "<br/>\n" . "[[_next]]" . "</td></tr></table>" . "</div>\n" . "<hr/>\n" . "<div>\n" . "[[_steps]]" . "</div>\n"); $saveButton = $wizard->getSaveButton(); $saveButton->setLabel(_("Create >>")); $wizard->addStep("nav", $this->getNavStep()); $step = $this->getContentStep(); $step->setDisplayName(_("Create New Menu Content")); $wizard->addStep("content", $step); 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 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); //$courseManager = Services::getService("CourseManagement"); //$canonicalCourseIterator =$courseManager->getCanonicalCourses(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Please choose the name and type for this type:")); // Create the type chooser. $select = new WSelectList(); //$select->addOption('',"Canonical Course Type"); $select->addOption('can', "Canonical Course Type"); $select->addOption('can_stat', "Canonical Course Status Type"); $select->addOption('offer', "Course Offering Type"); $select->addOption('offer_stat', "Course Offering Status Type"); $select->addOption('section', "Course Section Type"); $select->addOption('section_stat', "Course Section Status Type"); $select->addOption('enroll_stat', "Enrollment Status Type"); $select->addOption('grade', "Course Grading Type"); $select->addOption('term', "Term Type"); //$select->setValue(''); $typeProp = $step->addComponent("typetype", $select); //$typeProp->setErrorText("<nobr>"._("A value for this field is required.")."</nobr>"); //$typeProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // Create the title $titleProp = $step->addComponent("keyword", new WTextField()); $titleProp->setErrorText("<nobr>" . _("A value for this field is required.") . "</nobr>"); $titleProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // Create the description $descriptionProp = $step->addComponent("description", WTextArea::withRowsAndColumns(10, 30)); // Create the step text ob_start(); print "\n<font size=+2><h2>" . _("Type creator") . "</h2></font>"; print "\n<h2>" . _("Type") . "</h2>"; print "\n" . _("Please choose a type of <em>type</em> to create: "); print "\n<br />[[typetype]]"; print "\n<h2>" . _("Keyword") . "</h2>"; print "\n" . _("The keyword of the <em>type</em>: "); print "\n<br />[[keyword]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("The optional description of the <em>type</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_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 9/24/07 */ function createWizard() { // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); $wizard->addStep("namedesc", $this->getTitleStep()); // try { // $wizard->addStep("permissions", $this->getPermissionsStep()); // } catch (PermissionDeniedException $e) { // // } $wizard->addStep("theme", $this->getThemeStep()); $wizard->addStep("display", $this->getDisplayOptionsStep()); $wizard->addStep("header", $this->getHeaderStep()); 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 = SimpleStepWizard::withDefaultLayout(); $wizard->addStep("namedesc", $this->getTitleStep()); // try { // $wizard->addStep("permissions", $this->getPermissionsStep()); // } catch (PermissionDeniedException $e) { // // } $wizard->addStep("display", $this->getDisplayOptionsStep()); // $wizard->addStep("status", $this->getStatusStep()); $wizard->addConfimLeavingMessage(_("Click 'Save' or 'Cancel' to leave this wizard and 'Next' or 'Previous' to move around in it. Otherwise, unsubmitted changes may be lost.")); 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 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); $step = $wizard->addStep("themesettings", new WizardStep()); $step->setDisplayName(_("Test")); $actionlist = $step->addComponent("colorwheel", new WColorWheel()); $actionlist = $step->addComponent("textfield", new WTextField()); ob_start(); print "[[colorwheel]]"; $step->setContent(ob_get_contents()); ob_end_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 4/28/05 */ function createWizard() { $repository = $this->getRepository(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Step One :: $stepOne = $wizard->addStep("namedesc", new WizardStep()); $stepOne->setDisplayName(_("Name & Description")); // Create the properties. $displayNameProp = $stepOne->addComponent("display_name", new WTextField()); $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); $displayNameProp->setErrorText(_("A value for this field is required.")); $descriptionProp = $stepOne->addComponent("description", WTextArea::withRowsAndColumns(5, 30)); $formatProp = $stepOne->addComponent("format", new WTextField()); $formatProp->setValue("Plain Text - UTF-8 encoding"); $formatProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); $formatProp->setErrorText(_("A value for this field is required.")); $formatProp->setSize(25); // Create the step text ob_start(); print "\n<h2>" . _("Name") . "</h2>"; print "\n" . _("The Name for this Schema: "); print "\n<br />[[display_name]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("The Description for this Schema: "); print "\n<br />[[description]]"; print "\n<h2>" . _("Format") . "</h2>"; print "\n" . _("The format of data that is entered into the fields: "); print "\n<br /><em>" . _("'Plain Text - ASCII encoding', 'XML', etc.") . "</em>"; print "\n<br />[[format]]"; print "\n<div style='width: 400px'> </div>"; $stepOne->setContent(ob_get_contents()); ob_end_clean(); // :: Add Elements :: $elementStep = $wizard->addStep("elementstep", new WizardStep()); $elementStep->setDisplayName(_("Fields")); $multField = $elementStep->addComponent("elements", new WOrderedRepeatableComponentCollection()); $multField->setAddLabel(_("Add New Field")); $multField->setRemoveLabel(_("Remove Field")); $property = $multField->addComponent("display_name", new WTextField()); $property->setErrorRule(new WECNonZeroRegex("[\\w]+")); $property->setErrorText(_("A value for this property is required.")); $property->setSize(20); $property = $multField->addComponent("description", WTextArea::withRowsAndColumns(2, 30)); $property = $multField->addComponent("type", new WSelectList()); $defaultType = new Type("Repository", "edu.middlebury.harmoni", "shortstring"); $property->setValue(urlencode(HarmoniType::typeToString($defaultType, " :: "))); // We are going to assume that all RecordStructures have the same PartStructureTypes // in this Repository. This will allow us to list PartStructureTypes before // the RecordStructure is actually created. $recordStructures = $repository->getRecordStructures(); if (!$recordStructures->hasNext()) { throwError(new Error("No RecordStructures available.", "Concerto")); } $dmpType = new Type("RecordStructures", "edu.middlebury.harmoni", "DataManagerPrimatives", "RecordStructures stored in the Harmoni DataManager."); $orderedTypes = array("Repository :: edu.middlebury.harmoni :: shortstring" => _("Short String ----- text with max-length of 256 characters"), "Repository :: edu.middlebury.harmoni :: string" => _("String ---------- text with unlimited length"), "Repository :: edu.middlebury.harmoni :: datetime" => _("Date [and Time] -- a date or more precise point in time"), "Repository :: edu.middlebury.harmoni :: integer" => _("Integer --------- a whole number: 1, 2, 3, etc"), "Repository :: edu.middlebury.harmoni :: float" => _("Float ----------- a decimal/scientific-notation number"), "Repository :: edu.middlebury.harmoni :: boolean" => _("Boolean --------- true or false (yes/no)"), "Repository :: edu.middlebury.harmoni :: blob" => _("BLOB ----------- Binary Large OBject, for binary data"), "Repository :: edu.middlebury.harmoni :: okitype" => _("O.K.I. Type ------ 'domain :: authority :: keyword' triplet")); $unorderedTypes = array(); while ($recordStructures->hasNext()) { // we want just the datamanager structure types, so just // get the first structure that has Format "DataManagerPrimatives" $tmpRecordStructure = $recordStructures->next(); if ($dmpType->isEqual($tmpRecordStructure->getType())) { $types = $tmpRecordStructure->getPartStructureTypes(); while ($types->hasNext()) { $type = $types->next(); $typeString = $type->asString(" :: "); if (!array_key_exists($typeString, $orderedTypes)) { $unorderedTypes[$typeString] = $typeString; } } break; } } foreach ($orderedTypes as $typeString => $desc) { $property->addOption(urlencode($typeString), $desc); } foreach ($unorderedTypes as $typeString => $desc) { $property->addOption(urlencode($typeString), $desc); } $property = $multField->addComponent("mandatory", new WCheckBox()); $property->setChecked(false); $property->setLabel(_("yes")); $property = $multField->addComponent("repeatable", new WCheckBox()); // $property->setChecked(false); $property->setLabel(_("yes")); // $property =$multField->addComponent( // "populatedbydr", // new WCheckBox()); // $property->setChecked(false); // $property->setLabel(_("yes")); $property = $multField->addComponent("authoritative_values", WTextArea::withRowsAndColumns(10, 40)); // We don't have any PartStructures yet, so we can't get them. ob_start(); print "\n<table border=\"0\">"; print "\n<tr><td>"; print _("DisplayName") . ": "; print "\n</td><td>"; print "[[display_name]]"; print "\n</td></tr>"; print "\n<tr><td>"; print _("Description") . ": "; print "\n</td><td>"; print "[[description]]"; print "\n</td></tr>"; print "\n<tr><td style='color: red;'>"; print _("Type") . "... "; print "\n *</td><td>"; print "[[type]]"; print "\n</td></tr>"; print "\n<tr><td>"; print _("isMandatory? "); print "\n</td><td>"; print "[[mandatory]]"; print "\n</td></tr>"; print "\n<tr><td style='color: red;'>"; print _("isRepeatable? "); print "\n *</td><td>"; print "[[repeatable]]"; print "\n</td></tr>"; // print "\n<tr><td>"; // print _("isPopulatedByRepository? "); // print "\n</td><td>"; // print "[[populatedbydr]]"; // print "\n</td></tr>"; print "\n<tr><td>"; print _("Authoritative Values: "); print "\n</td><td>"; print "[[authoritative_values]]"; print "\n</td></tr>"; print "</table>"; $multField->setElementLayout(ob_get_contents()); ob_end_clean(); ob_start(); print "<h2>" . _("Fields") . "</h2>"; print "\n<p>" . _("Here you can modify the properties of fields and add new fields to the schema.") . "</p>"; print "\n<p>" . _("<strong>Important:</strong> Properties marked with an asterisk (<span style='color: red'>*</span>) can not be changed after the field is created.") . "</p>"; print "[[elements]]"; $elementStep->setContent(ob_get_contents()); ob_end_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 4/28/05 */ function createWizard() { $idManager = Services::getService("Id"); $setManager = Services::getService("Sets"); $repositoryManager = Services::getService("Repository"); $repository = $repositoryManager->getRepository($idManager->getId("edu.middlebury.concerto.exhibition_repository")); $slideshowAsset = $repository->getAsset($idManager->getId(RequestContext::value('slideshow_id'))); // Instantiate the wizard, then add our steps. // fetch current slideshow slides HERE!!! $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Title & Description")); // Create the properties. $displayNameProp = $step->addComponent("display_name", new WTextField()); $displayNameProp->setValue($slideshowAsset->getDisplayName()); $displayNameProp->setErrorText("<nobr>" . _("A value for this field is required.") . "</nobr>"); $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // $displayNameProp->setDefaultValue(_("Default Asset Name")); // $displayNameProp->setErrorString(" <span style='color: #f00'>* "._("The name must not start with a space.")."</span>"); $descriptionProp = $step->addComponent("description", WTextArea::withRowsAndColumns(5, 30)); $descriptionProp->setValue($slideshowAsset->getDescription()); // $descriptionProp->setDefaultValue(_("Default Asset description.")); // Create the step text ob_start(); print "\n<h2>" . _("Title") . "</h2>"; print "\n" . _("The title of this <em>SlideShow</em>: "); print "\n<br />[[display_name]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("A description of this <em>SlideShow</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_clean(); // :: Slides :: $slideStep = $wizard->addStep("slidestep", new WizardStep()); $slideStep->setDisplayName(_("Slides")); $multField = $slideStep->addComponent("slides", new SlideOrderedRepeatableComponentCollection()); $multField->setStartingNumber(0); $multField->setRemoveLabel(_("Remove Slide")); $property = $multField->addComponent("slideId", new AssetComponent()); $property->setParent($multField); $property = $multField->addComponent("title", new WTextField()); $property->setSize(20); $property = $multField->addComponent("caption", WTextArea::withRowsAndColumns(5, 30)); $property = $multField->addComponent("text_position", new WSelectList()); $property->setValue("right"); $property->addOption("right", _("text on right")); $property->addOption("left", _("text on left")); $property->addOption("bottom", _("text on bottom")); $property->addOption("top", _("text on top")); $property->addOption("none", _("no text (media-only)")); $property->addOption("center", _("text centered (no-media)")); $property = $multField->addComponent("show_target_metadata", new WCheckBox()); $property->setChecked(false); $property->setLabel(_("Display metadata from media?")); ob_start(); print "\n<table border=\"0\">"; print "\n<tr><td>"; print _("Title") . ": "; print "\n</td><td>"; print "[[title]]"; print "\n</td></tr>"; print "\n<tr><td>"; print _("Caption") . ": "; print "\n</td><td>"; print "[[caption]]"; print "\n</td></tr>"; print "\n<tr><td>"; print _("Text Position") . ": "; print "\n</td><td>"; print "[[text_position]]"; print "\n</td></tr>"; print "\n<tr><td>"; print "[[show_target_metadata]]"; print "\n</td><td>"; print "\n</td></tr>"; print "</table>"; $multField->setElementLayout(ob_get_contents()); ob_end_clean(); ob_start(); print "<h2>" . _("Slides") . "</h2>"; print "[[slides]]"; $slideStep->setContent(ob_get_contents()); ob_end_clean(); // Add the current assets to the list. $textPositionId = $idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.text_position"); $showMetadataId = $idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.display_metadata"); $targetId = $idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure.edu.middlebury.concerto.slide_record_structure.target_id"); $slideIterator = $slideshowAsset->getAssets(); $slideOrder = $setManager->getPersistentSet($slideshowAsset->getId()); $orderedSlides = array(); $orderlessSlides = array(); while ($slideIterator->hasNext()) { $slideAsset = $slideIterator->next(); $slideId = $slideAsset->getId(); /* // DEBUG $records =$slideAsset->getRecordsByRecordStructure($idManager->getId("Repository::edu.middlebury.concerto.exhibition_repository::edu.middlebury.concerto.slide_record_structure")); $myCrapRecord =$records->next(); require_once(POLYPHONY."/main/library/DataManagerGUI/SimpleRecordPrinter.class.php"); SimpleRecordPrinter::printRecord($myCrapRecord->_record); // END */ $collection = array(); $collection['slideId'] = $slideId; //->getIdString(); $collection['title'] = $slideAsset->getDisplayName(); $collection['caption'] = $slideAsset->getDescription(); $textPositionIterator = $slideAsset->getPartValuesByPartStructure($textPositionId); if ($textPositionIterator->hasNext()) { $textPosition = $textPositionIterator->next(); $collection['text_position'] = $textPosition->asString(); } else { $collection['text_position'] = "right"; } $showMetadataIterator = $slideAsset->getPartValuesByPartStructure($showMetadataId); if ($showMetadataIterator->hasNext()) { $showMetadata = $showMetadataIterator->next(); $collection['show_target_metadata'] = $showMetadata->value(); } else { $collection['show_target_metadata'] = FALSE; } $assetIdIterator = $slideAsset->getPartValuesByPartStructure($targetId); if ($assetIdIterator->hasNext()) { $id = $assetIdIterator->next(); $rule = NonzeroLengthStringValidatorRule::getRule(); if ($rule->check($id->asString())) { $collection['_assetId'] = new HarmoniId($id->asString()); } } if ($slideOrder->isInSet($slideId)) { $orderedSlides[$slideOrder->getPosition($slideId)] = $collection; } else { $orderlessSlides[] = $collection; } } // add them in order ksort($orderedSlides); foreach ($orderedSlides as $slide) { $multField->addValueCollection($slide); } foreach ($orderlessSlides as $slide) { $multField->addValueCollection($slide); } // :: Effective/Expiration Dates :: // $step =$wizard->addStep("datestep", new WizardStep()); // $step->setDisplayName(_("Effective Dates")." ("._("optional").")"); // // // Create the properties. // $property =$step->addComponent("effective_date", new WTextField()); // // $property->setDefaultValue(); // // $property->setErrorString(" <span style='color: #f00'>* "._("The date must be of the form YYYYMMDD, YYYYMM, or YYYY.")."</span>"); // // $property =$step->addComponent("expiration_date", new WTextField()); // // $property->setDefaultValue(); // // $property->setErrorString(" <span style='color: #f00'>* "._("The date must be of the form YYYYMMDD, YYYYMM, or YYYY.")."</span>"); // // // Create the step text // ob_start(); // print "\n<h2>"._("Effective Date")."</h2>"; // print "\n". // _("The date that this <em>Slide-Show</em> becomes effective: "); // print "\n<br />[[effective_date]]"; // // print "\n<h2>"._("Expiration Date")."</h2>"; // print "\n"._("The date that this <em>Slide-Show</em> expires: "); // print "\n<br />[[expiration_date]]"; // $step->setContent(ob_get_contents()); // ob_end_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 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); $idManager = Services::getService("Id"); $repositoryManager = Services::getService("Repository"); $repository = $repositoryManager->getRepository($idManager->getId("edu.middlebury.concerto.exhibition_repository")); $exhibitionAsset = $repository->getAsset($idManager->getId(RequestContext::value('exhibition_id'))); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Title & Description")); // Create the properties. $displayNameProp = $step->addComponent("display_name", new WTextField()); $displayNameProp->setErrorText("<nobr>" . _("A value for this field is required.") . "</nobr>"); $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // $displayNameProp->setDefaultValue(_("Default Asset Name")); // $displayNameProp->setErrorString(" <span style='color: #f00'>* "._("The name must not start with a space.")."</span>"); $descriptionProp = $step->addComponent("description", WTextArea::withRowsAndColumns(5, 30)); // $descriptionProp->setDefaultValue(_("Default Asset description.")); // Create the step text ob_start(); print "\n<h2>" . _("Title") . "</h2>"; print "\n" . _("The title of this <em>SlideShow</em>: "); print "\n<br />[[display_name]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("A description of this <em>SlideShow</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_clean(); // :: Slides :: $slideStep = $wizard->addStep("slidestep", new WizardStep()); $slideStep->setDisplayName(_("Slides")); $multField = $slideStep->addComponent("slides", new SlideOrderedRepeatableComponentCollection()); $multField->setStartingNumber(0); $multField->setRemoveLabel(_("Remove Slide")); $property = $multField->addComponent("title", new WTextField()); $property->setSize(20); $property = $multField->addComponent("caption", WTextArea::withRowsAndColumns(5, 30)); $property = $multField->addComponent("text_position", new WSelectList()); $property->setValue("right"); $property->addOption("right", _("text on right")); $property->addOption("left", _("text on left")); $property->addOption("bottom", _("text on bottom")); $property->addOption("top", _("text on top")); $property->addOption("none", _("no text (media-only)")); $property->addOption("center", _("text centered (no-media)")); $property = $multField->addComponent("show_target_metadata", new WCheckBox()); $property->setChecked(false); $property->setLabel(_("Display metadata from media?")); ob_start(); print "\n<table border=\"0\">"; print "\n<tr><td>"; print _("Title") . ": "; print "\n</td><td>"; print "[[title]]"; print "\n</td></tr>"; print "\n<tr><td>"; print _("Caption") . ": "; print "\n</td><td>"; print "[[caption]]"; print "\n</td></tr>"; print "\n<tr><td>"; print _("Text Position") . ": "; print "\n</td><td>"; print "[[text_position]]"; print "\n</td></tr>"; print "\n<tr><td>"; print "[[show_target_metadata]]"; print "\n</td><td>"; print "\n</td></tr>"; print "</table>"; $multField->setElementLayout(ob_get_contents()); ob_end_clean(); ob_start(); print "<h2>" . _("Slides") . "</h2>"; print "[[slides]]"; $slideStep->setContent(ob_get_contents()); ob_end_clean(); // :: Effective/Expiration Dates :: // $step =$wizard->addStep("datestep", new WizardStep()); // $step->setDisplayName(_("Effective Dates")." ("._("optional").")"); // // // Create the properties. // $property =$step->addComponent("effective_date", new WTextField()); // // $property->setDefaultValue(); // // $property->setErrorString(" <span style='color: #f00'>* "._("The date must be of the form YYYYMMDD, YYYYMM, or YYYY.")."</span>"); // // $property =$step->addComponent("expiration_date", new WTextField()); // // $property->setDefaultValue(); // // $property->setErrorString(" <span style='color: #f00'>* "._("The date must be of the form YYYYMMDD, YYYYMM, or YYYY.")."</span>"); // // // Create the step text // ob_start(); // print "\n<h2>"._("Effective Date")."</h2>"; // print "\n"._("The date that this <em>Slide-Show</em> becomes effective: "); // print "\n<br />[[effective_date]]"; // // print "\n<h2>"._("Expiration Date")."</h2>"; // print "\n"._("The date that this <em>Slide-Show</em> expires: "); // print "\n<br />[[expiration_date]]"; // $step->setContent(ob_get_contents()); // ob_end_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 4/28/05 */ function createWizard() { // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Step One :: $stepOne = $wizard->addStep("namedesc", new WizardStep()); $stepOne->setDisplayName(_("Name & Description")); // Create the properties. $displayNameProp = $stepOne->addComponent("display_name", new WTextField()); $displayNameProp->setErrorText(_("A value for this field is required.")); $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); $descriptionProp = $stepOne->addComponent("description", WTextArea::withRowsAndColumns(10, 80)); // Create the step text ob_start(); print "\n<h2>" . _("Name") . "</h2>"; print "\n" . _("The Name for this <em>Collection</em>: "); print "\n<br />[[display_name]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("The Description for this <em>Collection</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $stepOne->setContent(ob_get_contents()); ob_end_clean(); // :: Step Two :: $stepTwo = $wizard->addStep("type", new WizardStep()); $stepTwo->setDisplayName(_("Type")); // Create the properties. $property = $stepTwo->addComponent("type_domain", new WTextField()); $property->setValue(_("Collections")); $property->setErrorRule(new WECNonZeroRegex("[\\w]+")); $property->setErrorText(_("A value for this field is required.")); $property = $stepTwo->addComponent("type_authority", new WTextField()); $property->setValue(_("Concerto")); $property->setErrorRule(new WECNonZeroRegex("[\\w]+")); $property->setErrorText(_("A value for this field is required.")); $property = $stepTwo->addComponent("type_keyword", new WTextField()); $property->setValue(_("Generic Collection")); $property->setErrorRule(new WECNonZeroRegex("[\\w]+")); $property->setErrorText(_("A value for this field is required.")); $property = $stepTwo->addComponent("type_description", WTextArea::withRowsAndColumns(3, 50)); $property->setValue(_("This is a <em>Collection</em> of unspecified type.")); // create the text ob_start(); print "<h2>" . _("Type") . "</h2>"; print "\n" . _("All <em>Collections</em> have an immutable type. This type can be used to catagorize <em>Collections</em>, but is not necessary."); print "\n<table>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Domain") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_domain]]"; print "\n\t\t</td>\n\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Authority") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_authority]]"; print "\n\t\t</td>\n\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Keyword") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_keyword]]"; print "\n\t\t</td>\n\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Description") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_description]]"; print "\n\t\t</td>\n\t</tr>"; print "\n</table>"; $stepTwo->setContent(ob_get_contents()); ob_end_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 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); /********************************************************* * Asset thumbnails: Generate a text string and attach to * the wizard for later retrieval. *********************************************************/ ob_start(); $assetIds = array(); for ($i = 0; $i < count($this->_assets); $i++) { $asset = $this->_assets[$i]; $assetId = $asset->getId(); $assetIds[] = $assetId->getIdString(); } $params = array(); $params["assetIds"] = implode(",", $assetIds); for ($i = 0; $i < count($this->_assets) && $i < 10; $i++) { $asset = $this->_assets[$i]; $assetId = $asset->getId(); $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($asset); if ($thumbnailURL !== FALSE) { $thumbSize = "100px"; print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto; float: left; text-align: center;'>"; print "\n\t\t<img src='{$thumbnailURL}' class='thumbnail thumbnail_image' alt='Thumbnail Image' border='0'"; print " onclick='Javascript:window.open("; print '"' . VIEWER_URL . "?&source="; print urlencode($harmoni->request->quickURL('asset', "viewAssetsXml", $params)); print '&start=' . $i . '", '; print '"_blank", '; print '"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500"'; print ")'"; print " style='max-height: {$thumbSize}; max-width: {$thumbSize}; vertical-align: middle; cursor: pointer;'"; print " />"; print "\n</div>"; } } if ($i < count($this->_assets)) { print "\n<div style='height: {$thumbSize}; width: {$thumbSize}; margin: auto; float: left; text-align: center; vertical-align: middle;'>"; print _(" (and ") . (count($this->_assets) - $i) . _(" more) "); print "\n</div>"; } $wizard->assetThumbnails = ob_get_clean(); /********************************************************* * :: Asset Properties :: *********************************************************/ $wizard->addStep("assetproperties", $this->getAssetPropertiesStep()); /********************************************************* * :: Record Structures :: *********************************************************/ $repository = $this->getRepository(); $repositoryId = $this->getRepositoryId(); if (!$repository) { throw new Exception("Repository not found"); } // Get the set of RecordStructures so that we can print them in order. $setManager = Services::getService("Sets"); $recStructSet = $setManager->getPersistentSet($repositoryId); // File Record Id $idManager = Services::getService("Id"); $fileRecStructId = $idManager->getId('FILE'); $remoteFileRecStructId = $idManager->getId('REMOTE_FILE'); // First, lets go through the info structures listed in the set and print out // the info records for those structures in order. while ($recStructSet->hasNext()) { $recStructId = $recStructSet->next(); if (in_array($recStructId->getIdString(), $this->_recStructsToIgnore)) { continue; } if ($recStructId->isEqual($fileRecStructId)) { if ($fileRecordStep = $this->getFileRecordsStep()) { $wizard->addStep("filestep", $fileRecordStep); } } else { if ($recStructId->isEqual($remoteFileRecStructId)) { if ($fileRecordStep = $this->getRemoteFileRecordsStep()) { $wizard->addStep("remotefilestep", $fileRecordStep); } } else { $recStruct = $repository->getRecordStructure($recStructId); $wizard->addStep($recStructId->getIdString(), $this->getRecordStructureStep($recStruct)); } } } /********************************************************* * :: Content :: *********************************************************/ $step = $this->getAssetContentStep(); if (!is_null($step)) { $wizard->addStep("contentstep", $step); } /********************************************************* * :: Content :: *********************************************************/ $step = $this->getParentStep(); if (!is_null($step)) { $wizard->addStep("parentstep", $step); } $wizard->initialState = $wizard->getAllValues(); 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 4/28/05 */ function createWizard() { $repository = $this->getRepository(); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Name & Description")); // Create the properties. $displayNameProp = $step->addComponent("display_name", new WTextField()); // $displayNameProp->setErrorText("<nobr>"._("A value for this field is required.")."</nobr>"); // $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); // $displayNameProp->setDefaultValue(_("Default Asset Name")); // $displayNameProp->setErrorString(" <span style='color: #f00'>* "._("The name must not start with a space.")."</span>"); $descriptionProp = $step->addComponent("description", WTextArea::withRowsAndColumns(5, 30)); // $descriptionProp->setDefaultValue(_("Default Asset description.")); // Create the step text ob_start(); print "\n<h2>" . _("Name") . "</h2>"; print "\n" . _("The Name for this <em>Asset</em>: "); print "\n<br />[[display_name]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("The Description for this <em>Asset</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_clean(); // :: Type Step :: $step = $wizard->addStep("typestep", new WizardStep()); $step->setDisplayName(_("Type" . " (" . _("optional") . ")")); // Create the properties. $selectProperty = $step->addComponent("type", new WSelectOrNew()); // Default Types $defaultTypes = array(); $defaultTypes[] = new Type("Asset Types", "edu.middlebury", "Generic Asset", "This is an <em>Asset</em> of unspecified type."); $defaultTypes[] = new Type("Asset Types", "edu.middlebury", "Image", "Assets of this type represent an image."); $defaultTypes[] = new Type("Asset Types", "edu.middlebury", "Document", "Assets of this type represent an non-image document."); $defaultTypes[] = new Type("Asset Types", "edu.middlebury", "Audio", "Assets of this type represent an audio recording."); $defaultTypes[] = new Type("Asset Types", "edu.middlebury", "Video", "Assets of this type represent an video recording."); $defaultTypes[] = new Type("Asset Types", "edu.middlebury", "Container", "Assets of this type primarily serve as containers to hold other Assets, possibly for organizational purposes. Similar to a 'folder' or 'directory' on a filesystem."); foreach ($defaultTypes as $type) { $typeString = $type->asString(); $typeKey = urlencode($typeString); $selectProperty->addOption($typeKey, $typeString); } // Types in the repository $assetTypes = $repository->getAssetTypes(); while ($assetTypes->hasNext()) { $assetType = $assetTypes->next(); $typeKey = urlencode($assetType->asString()); $selectProperty->addOption($typeKey, $assetType->asString()); } $selectProperty->setValue(urlencode($defaultTypes[0]->asString())); $newTypeProperty = $selectProperty->setNewComponent(new WComponentCollection()); $property = $newTypeProperty->addComponent("type_domain", new WTextField()); $property->setStartingDisplayText(_("e.g. Asset Types")); $property = $newTypeProperty->addComponent("type_authority", new WTextField()); $property->setStartingDisplayText(_("e.g. Concerto")); $property = $newTypeProperty->addComponent("type_keyword", new WTextField()); $property->setStartingDisplayText(_("e.g. Generic Asset")); $property = $newTypeProperty->addComponent("type_description", WTextArea::withRowsAndColumns(5, 30)); $property->setStartingDisplayText(_("e.g. This is an <em>Asset</em> of unspecified type.")); // create the text for the new type property. ob_start(); print "\n<table>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Domain") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_domain]]"; print "\n\t\t</td>\n\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Authority") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_authority]]"; print "\n\t\t</td>\n\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Keyword") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_keyword]]"; print "\n\t\t</td>\n\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print "<strong>" . _("Description") . ": </strong>"; print "\n\t\t</td>"; print "\n\t\t<td>"; print "\n[[type_description]]"; print "\n\t\t</td>\n\t</tr>"; print "\n</table>"; $newTypeProperty->setContent(ob_get_contents()); ob_end_clean(); // create the text for the step ob_start(); print "<h2>" . _("Type") . "</h2>"; print "\n" . _("All <em>Assets</em> have an immutable type. This type can be used to catagorize <em>Assets</em>, but is not necessary."); print "\n<br />" . _("Select a type here or select <em>* New Value *</em> create a new one:"); print "\n[[type]]"; $step->setContent(ob_get_contents()); ob_end_clean(); // // // :: Content :: // $step =$wizard->addStep("contentstep", new WizardStep()); // $step->setDisplayName(_("Content")." ("._("optional").")"); // // $property =$step->addComponent("content", WTextArea::withRowsAndColumns(20,50)); // // // Create the step text // ob_start(); // print "\n<h2>"._("Content")."</h2>"; // print "\n"._("This is an optional place to put content for this <em>Asset</em>. <br />If you would like more structure, you can create new schemas to hold the <em>Asset's</em> data."); // print "\n<br />[[content]]"; // print "\n<div style='width: 400px'> </div>"; // $step->setContent(ob_get_contents()); // ob_end_clean(); // :: Effective/Expiration Dates :: // $step =$wizard->addStep("datestep", new WizardStep()); // $step->setDisplayName(_("Effective Dates")." ("._("optional").")"); // // // Create the properties. // $property =$step->addComponent("effective_date", new WTextField()); // // $property->setDefaultValue(); // // $property->setErrorString(" <span style='color: #f00'>* "._("The date must be of the form YYYYMMDD, YYYYMM, or YYYY.")."</span>"); // // $property =$step->addComponent("expiration_date", new WTextField()); // // $property->setDefaultValue(); // // $property->setErrorString(" <span style='color: #f00'>* "._("The date must be of the form YYYYMMDD, YYYYMM, or YYYY.")."</span>"); // // // Create the step text // ob_start(); // print "\n<h2>"._("Effective Date")."</h2>"; // print "\n"._("The date that this <em>Asset</em> becomes effective: "); // print "\n<br />[[effective_date]]"; // // print "\n<h2>"._("Expiration Date")."</h2>"; // print "\n"._("The date that this <em>Asset</em> expires: "); // print "\n<br />[[expiration_date]]"; // $step->setContent(ob_get_contents()); // ob_end_clean(); // :: Parent :: $step = $wizard->addStep("parentstep", new WizardStep()); $step->setDisplayName(_("Parent") . " (" . _("optional") . ")"); // Create the properties. $property = $step->addComponent("parent", new WSelectList()); $harmoni = Harmoni::instance(); $property->addOption("NONE", _("None")); $rootAssets = $this->getRootAssets(); while ($rootAssets->hasNext()) { $this->addAssetOption($property, $rootAssets->next()); } if (RequestContext::value('parent')) { $property->setValue(RequestContext::value('parent')); } else { $property->setValue("NONE"); } // Create the step text ob_start(); print "\n<h2>" . _("Parent <em>Asset</em>") . "</h2>"; print "\n" . _("Select one of the <em>Assets</em> below if you wish to make this new asset a child of another asset: "); print "\n<br />[[parent]]"; $step->setContent(ob_get_contents()); ob_end_clean(); return $wizard; }
/** * Returns a new SimpleStepWizard with the default layout including all the buttons. * @param optional string $pre Some text to put before the layout text. * @access public * @return ref object * @static */ static function withDefaultLayout($pre = '') { return parent::withText($pre . "<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" . "[[_save]]\n" . "</td></tr></table>" . "</div>\n" . "<hr/>\n" . "<div>\n" . "[[_steps]]" . "</div>\n", "SingleStepWizard"); }
/** * 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 4/28/05 */ function createWizard() { // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Name & Description")); $browser = $step->addComponent("agents", new WAgentBrowser()); $browser->addActionOption("edit_properties", _("Edit Properties")); $browser->addActionOption("edit_authorizations", _("Edit Authorizations")); $browser->addActionOption("revoke_authorizations", _("Clear All Authorizations")); $browser->addActionOption("create_group", _("Create Group...")); $browser->addActionOption("delete", _("Delete")); $step->setContent("[[agents]]"); 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 4/28/05 */ function createWizard() { $repository = $this->getRepository(); $repositoryId = $this->getRepositoryId(); $harmoni = Harmoni::instance(); $idManager = Services::getService("Id"); $authZManager = Services::getService("AuthZ"); $returnUrl = $harmoni->request->mkURLWithPassthrough(); $returnUrl->setValue("wizardSkipToStep", "schema"); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Step One :: $stepOne = $wizard->addStep("namedesc", new WizardStep()); $stepOne->setDisplayName(_("Name & Description")); // Create the step text ob_start(); $displayNameProp = $stepOne->addComponent("display_name", new WTextField()); $displayNameProp->setValue($repository->getDisplayName()); $displayNameProp->setErrorText(_("A value for this field is required.")); $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); print "\n<h2>" . _("Name") . "</h2>"; print "\n" . _("The Name for this <em>Collection</em>: "); print "\n<br />[[display_name]]"; $fieldname = RequestContext::name('description'); $descriptionProp = $stepOne->addComponent("description", WTextArea::withRowsAndColumns(10, 80)); $descriptionProp->setValue($repository->getDescription()); print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("The Description for this <em>Collection</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $stepOne->setContent(ob_get_contents()); ob_end_clean(); // :: Schema Selection :: $selectStep = $wizard->addStep("schema", new WizardStep()); $selectStep->setDisplayName(_("Schema Selection")); // get an iterator of all RecordStructures $recordStructures = $repository->getRecordStructures(); $setManager = Services::getService("Sets"); $set = $setManager->getPersistentSet($repositoryId); ob_start(); print "<h2>" . _("Select Cataloging Schemas") . "</h2>"; print "\n<p>" . _("Select which cataloging schemas you wish to appear during <em>Asset</em> creation and editing. <em>Assets</em> can hold data in any of the schemas, but only the ones selected here will be available when adding new data.") . "</p>"; if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_rec_struct"), $repositoryId)) { $fieldname = RequestContext::name('create_schema'); $button = $selectStep->addComponent("_create_schema", WSaveButton::withLabel(_("Save Changes and Create a New Schema"))); print "\n<p>" . _("If none of the schemas listed below fit your needs, please click the button below to save your changes and create a new schema.") . "</p>"; print "\n[[_create_schema]]"; } print "\n<br /><table border='1'>"; print "\n\t<tr>"; print "\n\t<th>" . _("Display Name") . "</th>"; print "\n\t<th>" . _("Description") . "</th>"; print "\n\t<th>" . _("Order/Position") . "</th>"; print "\n\t</tr>"; // Get the number of info structures $numRecordStructures = 0; while ($recordStructures->hasNext()) { $recordStructure = $recordStructures->next(); $numRecordStructures++; } $assetContentStructureId = $idManager->getId("edu.middlebury.harmoni.repository.asset_content"); $recordStructures = $repository->getRecordStructures(); while ($recordStructures->hasNext()) { $recordStructure = $recordStructures->next(); $recordStructureId = $recordStructure->getId(); // Don't list the asset Content structure. if ($recordStructureId->isEqual($assetContentStructureId)) { continue; } // Create the properties. // 'in set' property $fieldname = "schema_" . str_replace(".", "__", $recordStructureId->getIdString()); $property = $selectStep->addComponent($fieldname, new WCheckBox()); if ($set->isInSet($recordStructureId)) { $property->setChecked(true); } else { $property->setChecked(false); } $property->setLabel($recordStructure->getDisplayName()); $property->setStyle("font-weight: 900;"); // Order property $orderFieldName = $fieldname . "_position"; $property = $selectStep->addComponent($orderFieldName, new WSelectList()); if ($set->isInSet($recordStructureId)) { $property->setValue(strval($set->getPosition($recordStructureId) + 1)); } else { $property->setValue(0); } print "\n<tr><td valign='top'>"; print "\n\t[[{$fieldname}]]"; // print "\n\t<strong>".a."</strong>"; $description = HtmlString::withValue($recordStructure->getDescription()); $description->trim(100); // trim to 100 words print "\n</td><td valign='top'>\n\t<div style='font-style: italic'>" . $description->asString() . "</div>"; $harmoni->history->markReturnURL("concerto/collection/edit/" . $repositoryId->getIdString(), $returnUrl); $links = array(); // Schema Details ob_start(); print " <a href='"; print $harmoni->request->quickURL("schema", "view", array("collection_id" => $repositoryId->getIdString(), "recordstructure_id" => $recordStructureId->getIdString(), "__skip_to_step" => 2)); print "'>" . _("Details") . "</a>"; $links[] = ob_get_clean(); // Schema Edit if (method_exists($recordStructure, 'createPartStructure') && (preg_match("/^Repository::.+\$/i", $recordStructureId->getIdString()) && ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_rec_struct"), $repositoryId) || $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $repositoryId)) || ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_rec_struct"), $idManager->getId("edu.middlebury.authorization.root")) || $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $repositoryId)))) { $harmoni->history->markReturnURL("concerto/schema/edit-return/" . $recordStructureId->getIdString(), $returnUrl); ob_start(); print "<a href='"; print $harmoni->request->quickURL("schema", "edit", array("collection_id" => $repositoryId->getIdString(), "recordstructure_id" => $recordStructureId->getIdString())); print "'>" . _("Edit") . "</a>"; $links[] = ob_get_clean(); } // Schema Copy $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (method_exists($recordStructure, 'createPartStructure') && (preg_match("/^Repository::.+\$/i", $recordStructureId->getIdString()) && $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.convert_rec_struct"), $repositoryId) || $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.convert_rec_struct"), $idManager->getId("edu.middlebury.authorization.root")))) { $button = $selectStep->addComponent("duplicate_schema__" . str_replace('.', '_', $recordStructureId->getIdString()), WSaveButton::withLabel(_("Duplicate Schema Only"))); $button->addConfirm(_("Are you sure that you wish to duplicate this Schema?")); $links[] = "[[duplicate_schema__" . str_replace('.', '_', $recordStructureId->getIdString()) . "]]"; if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $repositoryId)) { $button = $selectStep->addComponent("duplicate_copy_records__" . str_replace('.', '_', $recordStructureId->getIdString()), WSaveButton::withLabel(_("Duplicate Schema and Records"))); $button->addConfirm(_("Are you sure that you wish to duplicate this Schema\\nand all Records that use it?")); $links[] = "[[duplicate_copy_records__" . str_replace('.', '_', $recordStructureId->getIdString()) . "]]"; } $harmoni->history->markReturnURL("concerto/schema/duplicate-return/" . $recordStructureId->getIdString(), $returnUrl); } // Schema Delete $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (method_exists($recordStructure, 'createPartStructure') && (preg_match("/^Repository::.+\$/i", $recordStructureId->getIdString()) && $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.delete_rec_struct"), $repositoryId) || $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.delete_rec_struct"), $idManager->getId("edu.middlebury.authorization.root")))) { $button = $selectStep->addComponent("_delete_schema__" . str_replace('.', '_', $recordStructureId->getIdString()), WSaveButton::withLabel(_("Delete"))); $button->addConfirm(_("Are you sure that you wish to delete this Schema\\nand Records in all Assets in this Collection that use it?")); $button->addConfirm(_("This Schema can only be deleted if there are no Records\\nin any other Collection that use it.\\n\\nAre you sure that there are no Records that use this Schema?\\n\\nContinue to delete?")); $harmoni->history->markReturnURL("concerto/schema/delete-return/" . $recordStructureId->getIdString(), $returnUrl); $links[] = "[[_delete_schema__" . str_replace('.', '_', $recordStructureId->getIdString()) . "]]"; } print implode(" | ", $links); print "\n</td><td valign='top'>"; print "\n\t[[{$orderFieldName}]]"; for ($i = 0; $i <= $numRecordStructures; $i++) { // print "\n\t\t<option value='$i' [['$orderFieldname' == '$i'|selected='selected'|]]>".(($i)?$i:"")."</option>"; $property->addOption($i, $i ? $i : ""); } print "\n</td></tr>"; } print "\n</table>"; $selectStep->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 4/28/05 */ function createWizard() { $harmoni = Harmoni::instance(); $harmoni->request->startNamespace('modify_exhibition'); $harmoni->request->passthrough('exhibition_id'); $idManager = Services::getService("Id"); $repositoryManager = Services::getService("Repository"); $exhibitionRepositoryId = $idManager->getId("edu.middlebury.concerto.exhibition_repository"); $repository = $repositoryManager->getRepository($exhibitionRepositoryId); $asset = $repository->getAsset($idManager->getId(RequestContext::value('exhibition_id'))); // Instantiate the wizard, then add our steps. $wizard = SimpleStepWizard::withDefaultLayout(); // :: Name and Description :: $step = $wizard->addStep("namedescstep", new WizardStep()); $step->setDisplayName(_("Name & Description")); // Create the properties. $displayNameProp = $step->addComponent("display_name", new WTextField()); $displayNameProp->setErrorText("<nobr>" . _("A value for this field is required.") . "</nobr>"); $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+")); $displayNameProp->setValue($asset->getDisplayName()); $descriptionProp = $step->addComponent("description", WTextArea::withRowsAndColumns(5, 30)); $descriptionProp->setValue($asset->getDescription()); // Create the step text ob_start(); print "\n<h2>" . _("Name") . "</h2>"; print "\n" . _("The Name for this <em>Exhibition</em>: "); print "\n<br />[[display_name]]"; print "\n<h2>" . _("Description") . "</h2>"; print "\n" . _("The Description for this <em>Exhibition</em>: "); print "\n<br />[[description]]"; print "\n<div style='width: 400px'> </div>"; $step->setContent(ob_get_contents()); ob_end_clean(); // :: Effective/Expiration Dates :: $step = $wizard->addStep("datestep", new WizardStep()); $step->setDisplayName(_("Effective Dates") . " (" . _("optional") . ")"); // Create the properties. $property = $step->addComponent("effective_date", new WTextField()); $date = $asset->getEffectiveDate(); if (is_object($date)) { $property->setValue($date->asString()); } $property = $step->addComponent("expiration_date", new WTextField()); $date = $asset->getExpirationDate(); if (is_object($date)) { $property->setValue($date->asString()); } // Create the step text ob_start(); print "\n<h2>" . _("Effective Date") . "</h2>"; print "\n" . _("The date that this <em>Exhibition</em> becomes effective: "); print "\n<br />[[effective_date]]"; print "\n<h2>" . _("Expiration Date") . "</h2>"; print "\n" . _("The date that this <em>Exhibition</em> expires: "); print "\n<br />[[expiration_date]]"; $step->setContent(ob_get_contents()); ob_end_clean(); $harmoni->request->endNamespace(); return $wizard; }
/** * Tells the wizard component to update itself - this may include getting * form post data or validation - whatever this particular component wants to * do every pageload. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @return boolean - TRUE if everything is OK * @access public * @since 1/14/08 */ public function update($fieldName) { $this->recordStepVisit(); $ok = parent::update($fieldName); $this->recordStepVisit(); return $ok; }