function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { $html = parent::render($blockContent); $html .= '<div id="' . $this->id . '" style="display: none;"></div>'; return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { $html = parent::render($blockContent); $html .= "<div id=\"{$this->id}\"></div>"; return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } if ($this->value === NULL) { $formattedValue = ''; } else { $dateTimeObject = new WFDateTime($this->value); $formattedValue = $dateTimeObject->format('m/d/Y'); } // render the tab's content block $html = parent::render($blockContent); $html .= ' <input type="text" id="' . $this->id . '" name="' . $this->id . '" value="' . $formattedValue . '" ' . ($this->width ? "style=\"width: {$this->width};\"" : NULL) . ' /><img id="' . $this->id . '-show" src="' . $this->getWidgetWWWDir() . '/calbtn.gif" width="18" height="18" alt="Calendar" style="margin: 0 0 1px 3px" valign="bottom" /> <div id="' . $this->id . '-container" style="visibility: hidden"> <div class="hd">' . $this->title . '</div> <div class="bd"> <div id="' . $this->id . '-cal"></div> </div> </div> '; return $html; }
function restoreState() { // must call super parent::restoreState(); try { $this->datePicker->restoreState(); $this->timePicker->restoreState(); $this->timezonePicker->restoreState(); if ($this->datePicker->hasErrors() or $this->timePicker->hasErrors() or $this->timezonePicker->hasErrors()) { return; } } catch (Exception $e) { die('should not happen. someone is mis-behaving.'); } $datePartEntered = $this->datePicker->value() !== NULL; $timePartEntered = trim($this->timePicker->value()) != ''; if (!$datePartEntered and !$timePartEntered) { $this->value = NULL; return; } // parse & validate date $datePart = date_parse($this->datePicker->value()); if ($datePart === false) { $this->addError(new WFError("Invalid date.")); } else { if ($datePart['error_count']) { foreach ($datePart['errors'] as $err) { $this->addError(new WFError("The date you entered is invalid")); } } } // parse & validate time if (!$timePartEntered) { $this->addError(new WFError("Please enter a time.")); } else { $timePart = date_parse($this->timePicker->value()); if ($timePart === false) { $this->addError(new WFError("Invalid time.")); } else { if ($timePart['error_count']) { foreach ($timePart['errors'] as $err) { $this->addError(new WFError("The time you entered is invalid")); } } } } try { // calculate timezone $tz = $this->timezonePicker->value(); if ($tz == NULL or $tz === self::SELECT_TIMEZONE_LABEL) { if ($this->requireTimezone) { $this->addError(new WFError("Please select a timezone.")); } else { $tz = new DateTimeZone(date_default_timezone_get()); } } else { $tz = new DateTimeZone($tz); } // assemble datetime+timezone if (count($this->errors()) === 0) { try { $this->setValue(new WFDateTime("{$datePart['year']}-{$datePart['month']}-{$datePart['day']} {$timePart['hour']}:{$timePart['minute']}:{$timePart['second']}", $tz)); } catch (Exception $e) { $this->addError(new WFError("Couldn't create datetime: " . $e->getMessage())); } } } catch (Exception $e) { $this->addError(new WFError("The timezone you entered is invalid")); } }
/** * This is a hack... * @todo Do we need a WFObject::keyExists() function or similar that can "check" for a binding without having to call the accessor? or WFObject::canSetKey()? Or do binding need to have a "readyonly" or "writeonly" option? */ function valueForUndefinedKey($key) { switch ($key) { case 'menuItemsMenuPath': case 'menuItemsNestedArray': return NULL; // we never return a value here, but we need to make it seem that we're a legitimate property so that bindings will work. break; } return parent::valueForUndefinedKey($key); }
function render($blockContent = NULL) { if ($blockContent === NULL) { return NULL; } if ($this->hidden) { return NULL; } else { $initialStyle = $this->hideWhileLoading ? 'style="display:none;"' : NULL; $html = parent::render($blockContent); $html .= "\n<div id=\"{$this->id}\" class=\"yui-navset\" {$initialStyle}>"; $html .= "\n<ul class=\"yui-nav\">"; foreach ($this->tabRenderOrder as $tabId => $tab) { $html .= "<li class=\"" . ($this->getSelectedTabId() === $tabId ? ' selected' : NULL) . "\"><a href=\"#" . $tabId . "\"><em>" . $tab->label() . "</em></a></li>"; } $html .= "\n</ul>"; $html .= "\n<div class=\"yui-content\">{$blockContent}</div>"; $html .= "\n</div>"; return $html; } }
function render($blockContent = NULL) { $localTF = $this->textFieldId === NULL; if ($localTF) { $this->textFieldId = $this->getInternalTextFieldId(); } if ($this->hidden) { return NULL; } else { // render the tab's content block $html = parent::render($blockContent); if ($localTF) { $html .= '<input style="float: left;" type="text" name="' . $this->textFieldId . '" id="' . $this->textFieldId . '" value="' . htmlentities($this->value) . '" />'; } $html .= ' <div style="width: auto; margin: 0 auto; padding: 0 1px; overflow: hidden;"> <div id="' . $this->id . '_sample" style="float: left; border: 1px solid black; width: 1.25em; height: 1.25em; margin: 0px 7px; visibility: hidden;" ></div> <input style="float: left;" type="button" value="Pick Color" id="' . $this->id . '_trigger" /> </div> <div id="' . $this->id . '" class="yui-picker-panel" style="display: none"> <div class="hd">Please choose a color:</div> <div class="bd"> <div class="yui-picker" id="' . $this->id . '-yui-picker"></div> </div> <div class="ft"></div> </div> '; return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { if ($this->buildModuleProgrammatically) { // if buildModuleProgrammatically, the dom el with the real ID can't be there when we call new YAHOO.widget.Module or YUI will use that el and it won't truly be programmatic. // but we still need a dom element to use to bootstrap our code as part of our YUI loading infrastructure (see base class onContentReady), // so we manufacture one with a different id. // @todo we can probable get rid of this hack and use initializeWaitsForID === NULL as a flag to *not* hang things on onContentReady(). $this->initializeWaitsForID = "{$this->id}_bootstrap"; } $html = parent::render($blockContent); // determine body html $bodyHTML = $blockContent === NULL ? $this->body : $blockContent; // set up basic HTML -- in order to prevent a "flash of content" for non-visible content, we must make it visibility: hidden // however, while that prevents the content from being SEEN, you will still see BLANK space where it goes, thus we must also set display: none // YUI's show()/hide() functions to display the module content work differently depending on the module's class... // show()/hide() on Module toggles display: none|block... on subclasses toggles visibility: visible|hidden // thus we need to use a different mechanism to prevent the "Flash of content" and "blank space" issues completely. $visibility = NULL; if (!$this->visible) { if (get_class($this) == 'WFYAHOO_widget_Module') { $visibility = " style=\"display: none;\""; } else { $visibility = " style=\"display: none; visibility: hidden;\""; } } if ($this->buildModuleProgrammatically === false) { $html .= "\n<div id=\"{$this->id}\"{$visibility}>\n <div class=\"hd\">" . $this->header . "</div>\n <div class=\"bd\">" . $bodyHTML . "</div>\n <div class=\"ft\">" . $this->footer . "</div>\n</div>\n"; } else { $html .= "<div id=\"{$this->initializeWaitsForID}\" style=\"display:none;\"></div>"; } return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { if ($this->enableDragDropTree) { $this->yuiloader()->addModule('treeviewdd', 'js', NULL, WFWebApplication::webDirPath(WFWebApplication::WWW_DIR_FRAMEWORK) . '/js/yahoo-treeviewdd.js', array('treeview', 'dragdrop'), NULL, NULL, NULL); $this->yuiloader()->yuiRequire('treeviewdd'); } // set up basic HTML $html = parent::render($blockContent); $html .= "<div id=\"{$this->id}_status\" style=\"display: none;\"></div><div id=\"{$this->id}\"></div>\n"; return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { if ($this->animation !== NULL) { $this->yuiloader()->yuiRequire('animation'); } $html = parent::render($blockContent); $html .= "<div id=\"{$this->id}\" style=\"display: none;\">{$blockContent}</div>"; return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { // render the tab's content block $html = parent::render($blockContent); $html .= ' <div id="' . $this->id . '_uiElements" style="display: inline;"> <div id="' . $this->id . '_uploaderContainer"> <div id="' . $this->id . '" style="width: 75px; height: 1.5em; position: absolute; z-index: 2;">Unable to load Flash content. The YUI Uploader requires Flash Player 9.0.45 or higher.</div> <div id="' . $this->id . '_selectFilesLink" style="z-index:1"> <a id="' . $this->id . '_browseTrigger" >' . $this->addButtonLabel . '</a> </div> </div> <div id="' . $this->id . '_uploadFilesLink"> <a id="' . $this->id . '_uploadTrigger" >' . $this->uploadButtonLabel . '</a> </div> </div> <div id="' . $this->id . '_progress"></div> <div id="' . $this->id . '_fileList" style="display: none; border: 1px solid;"></div> '; return $html; } }
function render($blockContent = NULL) { if ($this->hidden) { return NULL; } else { // sanity checks if ($this->datasource === NULL) { throw new WFException("No datasource defined."); } if ($this->nullPlaceholder) { $this->setOnEvent('focus do j:PHOCOA.widgets.' . $this->id . '.handleFocus()'); $this->setOnEvent('blur do j:PHOCOA.widgets.' . $this->id . '.handleBlur()'); } $html = parent::render($blockContent); $myAutoCompleteContainer = "WFYAHOO_widget_AutoComplete_{$this->id}_autocomplete"; $html .= "\n<style type=\"text/css\">\n#{$this->initializeWaitsForID} {\n position: relative;\n width: {$this->width};\n margin-right: 12px; /* to compensate for browser dressing of input */\n height: {$this->height};\n}\n#{$this->id} {\n width: 100%;\n height: {$this->height};\n}\n#{$this->id}_acToggle {\n position: absolute;\n left: {$this->width};\n padding-left: 5px;\n}\n#{$myAutoCompleteContainer} {\n top: {$this->height};\n}\n.yui-ac .yui-button {vertical-align:middle; }\n.yui-ac .yui-button button {\n background: url({$this->getWidgetWWWDir()}/ac-arrow-rt.png) center center no-repeat;\n} \n.yui-ac .open .yui-button button {background: url({$this->getWidgetWWWDir()}/ac-arrow-dn.png) center center no-repeat} \n</style>\n "; $html .= "\n <div id=\"{$this->initializeWaitsForID}\">"; if ($this->inputType == self::INPUT_TYPE_TEXTFIELD) { $html .= "<input id=\"{$this->id}\" name=\"{$this->id}\" type=\"text\" value=\"" . htmlspecialchars($this->value) . "\" " . ($this->nullPlaceholder ? ' placeholder="' . htmlspecialchars($this->nullPlaceholder) . '" ' : NULL) . ($this->tabIndex ? ' tabIndex="' . $this->tabIndex . '" ' : NULL) . $this->classHTML() . " />"; } else { if ($this->inputType == self::INPUT_TYPE_TEXTAREA) { $html .= "<textarea id=\"{$this->id}\" name=\"{$this->id}\"" . $this->classHTML() . ">" . htmlspecialchars($this->value) . "</textarea>"; } else { throw new WFException("inputType must be either INPUT_TYPE_TEXTFIELD or INPUT_TYPE_TEXTAREA."); } } if ($this->enableToggleButton) { $html .= "<span id=\"{$this->id}_acToggle\"></span>"; } $html .= "<div id=\"{$myAutoCompleteContainer}\"></div>\n </div>"; if ($this->nullPlaceholder) { $escapedNullPlaceholder = json_encode($this->nullPlaceholder); $html .= '<script> PHOCOA.namespace("widgets.' . $this->id . '"); PHOCOA.widgets.' . $this->id . '.hasFocus = false; PHOCOA.widgets.' . $this->id . '.handleFocus = function(e) { PHOCOA.widgets.' . $this->id . '.hasFocus = true; if ($F(\'' . $this->id . '\') === ' . $escapedNullPlaceholder . ') { $(\'' . $this->id . '\').value = ""; } $(\'' . $this->id . '\').removeClassName("phocoaWFSearchField_PlaceholderText"); }; PHOCOA.widgets.' . $this->id . '.handleBlur = function(e) { PHOCOA.widgets.' . $this->id . '.hasFocus = false; PHOCOA.widgets.' . $this->id . '.handlePlaceholder(); }; PHOCOA.widgets.' . $this->id . '.handlePlaceholder = function() { if (!PHOCOA.widgets.' . $this->id . '.hasFocus) { if ($F(\'' . $this->id . '\') === \'\') { $(\'' . $this->id . '\').value = ' . $escapedNullPlaceholder . '; $(\'' . $this->id . '\').addClassName("phocoaWFSearchField_PlaceholderText"); } } }; PHOCOA.widgets.' . $this->id . '.getValue = function() { var qField = $(\'' . $this->id . '\'); var qVal = null; if (qField.getAttribute("placeholder") !== $F(qField)) { qVal = $F(qField); } return qVal; }; // perform initial check on search field value PHOCOA.widgets.' . $this->id . '.handlePlaceholder();' . $this->getListenerJS() . '</script>'; } return $html; } }