function SlideOrderedRepeatableComponentCollection() { parent::WOrderedRepeatableComponentCollection(); $this->_addButton->setLabel(_("Add a Text-Slide")); $this->_addFromBasketButton = WEventButton::withLabel(dgettext("polyphony", "Create Slides from Selection")); $this->_addFromBasketButton->setParent($this); }
function WAgentBrowser() { $this->_searchField = new WTextField(); $this->_searchField->setSize(20); $this->_searchButton = WEventButton::withLabel(dgettext("polyphony", "Go")); $agentManager = Services::getService("Agent"); $searchTypes = $agentManager->getAgentSearchTypes(); $this->_searchTypeSelector = new WSelectList(); $count = 0; while ($searchTypes->hasNext()) { $type = $searchTypes->next(); $this->_searchTypeSelector->addOption(urlencode($type->asString()), $type->asString()); $this->_searchTypeSelector->setValue(urlencode($type->asString())); $count++; } if ($count < 2) { $this->_oneType = true; } $this->_searchField->setParent($this); $this->_searchButton->setParent($this); $this->_searchTypeSelector->setParent($this); }
/** * Adds a new element to the end of the list. * @param boolean $removable Can this collection be removed by the user? * @access private * @return void */ function &_addElement($removable = true) { if ($this->_max != -1 && $this->_num == $this->_max - 1) { return; } // clone our base set (the getChildren() array) $newArray = array(); $base = $this->getChildren(); foreach (array_keys($base) as $key) { $newArray[$key] = $base[$key]->copy(); $newArray[$key]->setParent($this); } $newArray["_remove"] = WEventButton::withLabel($this->_removeLabel); $newArray["_remove"]->setParent($this); $newArray["_remove"]->addOnClick("ignoreValidation(this.form);"); $newArray["_remove"]->setEnabled($removable, !$removable); $this->_collections[$this->_nextId] =& $newArray; $idManager = Services::getService("Id"); $this->_orderedSet->addItem($idManager->getId(strval($this->_nextId))); $this->_nextId++; $this->_num++; $this->rebuildPositionSelects(); return $newArray; }
/** * Answer the markup for a set of search results * * @param string $fieldName * @param array $results An array of WSearchResult objects * @return string * @access public * @since 11/27/07 */ public function getResultsMarkup($fieldName, $results) { $harmoni = Harmoni::instance(); if (count($results)) { print "\n\t<table id='" . RequestContext::name($fieldName) . "_output' class='search_results' cellspacing='0'>"; $colorKey = 0; foreach ($results as $result) { print "\n\t\t<tr class='search_result_item '>"; print "\n\t\t\t<td class='color" . $colorKey . "'>"; print $result->getMarkup(); print "\n\t\t\t</td>"; print "\n\t\t\t<td class='action_button color" . $colorKey . "'>"; // Create a button for each result. if (!isset($this->buttons[$result->getIdString()])) { $this->buttons[$result->getIdString()] = WEventButton::withLabel('+'); $this->buttons[$result->getIdString()]->setParent($this->parent); } print $this->buttons[$result->getIdString()]->getMarkup($fieldName . '_' . $this->getKey($result->getIdString())); print "\n\t\t\t</td>"; print "\n\t\t</tr>"; $colorKey = intval(!$colorKey); } print "\n\t</table>"; } }
/** * Adds a new element to the end of the list. * @param boolean $removable Can this collection be removed by the user? * @access private * @return void */ function &_addElement($removable = true) { if ($this->_max != -1 && $this->_num == $this->_max - 1) { return; } // clone our base set (the getChildren() array) $newArray = array(); $base = $this->getChildren(); foreach (array_keys($base) as $key) { $newArray[$key] = $base[$key]->copy(); $newArray[$key]->setParent($this); } $newArray["_remove"] = WEventButton::withLabel($this->_removeLabel); $newArray["_remove"]->setParent($this); $newArray["_remove"]->addOnClick("ignoreValidation(this.form);"); if (!$this->_enabled && $this->_enabledSticky) { $newArray["_remove"]->setEnabled(false, true); } else { $newArray["_remove"]->setEnabled($removable, !$removable); } $this->_collections[] =& $newArray; $this->_num++; return $newArray; }
/** * This adds an iframe to the page that previews the frame, plus a button to refresh the view * * @return void * @access public * @since 8/8/06 */ function addIFrame($theStep) { //@todo It wouldn't be all that hard to add a series of three radio buttons, each allowing a new theme. It would be really cool and quite useful. //@todo I'm not sure if its a good idea or easy, but here's an idea--every time the user changes something, the thing relods, probably through javascript. I suspect it would make work frustratingly slow and be difficult though. $s = ""; $harmoni = Harmoni::instance(); $url = $harmoni->request->quickURL("gui", "test_page", array("theme" => theme_editorAction_wizardId . "__theme")); $refreshButton = $theStep->addComponent('refresh_preview', WEventButton::withLabel(_('Refresh...'))); $s .= "<hr />"; $s .= "\n\t<table width='100%'><tr>"; $s .= "\n\t\t<td align='left'><h2>Preview: </h2></td>"; $s .= "\n\t\t<td align='right'>Refresh preview: [[refresh_preview]]</td>"; $s .= "</tr></table>"; $s .= "\n\t\t<div style='background-color: #FFF'>"; $s .= "\n\t\t\t<iframe src='" . $url . "'width='100%' height='700' frameborder=1 scrolling='auto'>"; $s .= "\n\t\t\t\t<a href='" . $url . "'>Preview</a>"; $s .= "\n\t\t\t</iframe>"; $s .= "\n\t\t</div>"; return $s; }