/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $dom) { // collect required data $id = $this->getID(); $name = $this->getFormName(); $value = $this->getValue($model); if ($value == null) { $value = $this->getDefault(); } $info = $this->getCfg('info'); $error = $this->getCfg('error'); $this->setCfg('class', 'OneFieldInput ' . $this->getCfg('class')); $events = $this->getEventsAsString(); $params = $this->getParametersAsString(); // show the input $dom->add('<input type="' . $this->_totf . '" id="' . $id . '" name="' . $name . '" value="' . $this->getLabel() . '"' . $events . $params . ' />' . "\n"); // extra info if (!is_null($info)) { $dom->add('<span id="' . $id . 'Info" class="OneInfo">' . $info . '</span>'); } // error message if (!is_null($error)) { $dom->add('<span id="' . $id . 'Error" class="OneError">' . $error . '</span>'); } }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $this->setCfg('class', 'OneFieldInput ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'totf' => $this->_totf, 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'required' => $this->isRequired() ? ' *' : '', 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $dom = One_Repository::createDom(); $dom->add('<div id="content-sliders-" class="pane-sliders"> <div style="display:none;"> <div></div> </div>'); foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('</div>'); One_Vendor::getInstance()->loadScript(preg_replace('!administrator(/?)$!', '', JURI::base()) . '/media/system/js/mootools-core.js', 'head', 30); One_Vendor::getInstance()->loadScript(preg_replace('!administrator(/?)$!', '', JURI::base()) . '/media/system/js/core.js', 'head', 31); One_Vendor::getInstance()->loadScript(preg_replace('!administrator(/?)$!', '', JURI::base()) . '/media/system/js/mootools-more.js', 'head', 32); One_Vendor::getInstance()->loadScriptDeclaration('new Fx.Accordion($$("div#content-sliders-.pane-sliders > .panel > h3.pane-toggler"), $$("div#content-sliders-.pane-sliders > .panel > div.pane-slider"), { onActive: function(toggler, i) { toggler.addClass("pane-toggler-down");toggler.removeClass("pane-toggler");i.addClass("pane-down");i.removeClass("pane-hide");Cookie.write("jpanesliders_content-sliders-",$$("div#content-sliders-.pane-sliders > .panel > h3").indexOf(toggler)); },onBackground: function(toggler, i) { toggler.addClass("pane-toggler");toggler.removeClass("pane-toggler-down");i.addClass("pane-hide");i.removeClass("pane-down");if($$("div#content-sliders-.pane-sliders > .panel > h3").length==$$("div#content-sliders-.pane-sliders > .panel > h3.pane-toggler").length) Cookie.write("jpanesliders_content-sliders-",-1); },duration: 300,opacity: false,alwaysHide: true});', 'onload', 10); One_Vendor::getInstance()->loadScriptDeclaration('new Fx.Accordion($$("div#content-sliders.pane-sliders .panel h3.pane-toggler"),$$("div#content-sliders.pane-sliders .panel div.pane-slider"), { onActive: function(toggler, i) { toggler.addClass("pane-toggler-down");toggler.removeClass("pane-toggler");i.addClass("pane-down");i.removeClass("pane-hide");Cookie.write("jpanesliders_content-sliderscom_content",$$("div#content-sliders.pane-sliders .panel h3").indexOf(toggler)); },onBackground: function(toggler, i) { toggler.addClass("pane-toggler");toggler.removeClass("pane-toggler-down");i.addClass("pane-hide");i.removeClass("pane-down"); }, duration: 300, display: 0, show: 0, alwaysHide:true, opacity: false});', 'onload', 11); $d->addDom($dom); }
protected function _render($model, One_Dom $d) { $output = ''; $captcha = $this->generateCaptcha(); $allowed = $this->allowedOptions(); $info = $this->getCfg('info'); $error = $this->getCfg('error'); $dom = One_Repository::createDom(); $config = array(); foreach ($this->getParameters() as $param => $value) { if ($allowed[$param] & 1) { $config[$param] = $value; } } $input = new One_Form_Widget_Scalar_Textfield('captcha', 'captcha', NULL, NULL, $config); $dom->add('<div class="OneCaptcha">'); $dom->add('<img src="' . $captcha . '" alt="captcha" />'); $input->render($model, $dom); if (is_null($info)) { //$output .= '<span id="' . $id . 'Info" class="OneInfo">' . $info . '</span>'; $dom->add('<span id="' . $id . 'Info" class="OneInfo">' . $info . '</span>'); } if (is_null($error)) { //$output .= '<span id="' . $id . 'Error" class="OneError">' . $error . '</span>'; $dom->add('<span id="' . $id . 'Error" class="OneError">' . $error . '</span>'); } $dom->add('</div>'); //return $output; $d->addDom($dom); }
protected function _render($model, One_Dom $d) { $id = $this->getID(); $name = $this->getFormName(); $label = $this->getLabel(); $info = $this->getCfg('info'); $error = $this->getCfg('error'); $dom = One_Repository::createDom(); $this->setCfg('class', 'OneFieldInput' . $this->getCfg('class')); $events = $this->getEventsAsString(); $params = $this->getParametersAsString(); //$output = ''; if (!is_null($label)) { //$output .= '<label class="OneFieldLabel" for="' . $id . '">' . $label . '</label>'."\n"; $dom->add('<label class="OneFieldLabel" for="' . $id . '">' . $label . '</label>' . "\n"); } //$output .= '<input type="'.$this->_totf.'" id="' . $id . '" name="' . $name . '"' . $events . $params . ' />'."\n"; $dom->add('<input type="' . $this->_totf . '" id="' . $id . '" name="' . $name . '"' . $events . $params . ' />' . "\n"); if (is_null($info)) { //$output .= '<span id="' . $id . 'Info" class="OneInfo">' . $info . '</span>'; $dom->add('<span id="' . $id . 'Info" class="OneInfo">' . $info . '</span>'); } if (is_null($error)) { //$output .= '<span id="' . $id . 'Error" class="OneError">' . $error . '</span>'; $dom->add('<span id="' . $id . 'Error" class="OneError">' . $error . '</span>'); } //return $output; $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $params = $this->getParametersAsString(); $events = $this->getEventsAsString(); $title = $this->getCfg('title'); $dom = One_Repository::createDom(); $dom->add('<div id="' . $id . '"' . $params . $events . '>' . "\n"); $dom->add('<h3 id="' . $id . '-title" class="jpane-toggler title"' . $params . $events . '><span>' . $title . '</span></h3>' . "\n"); $dom->add("<div class='jpane-slider content'>"); foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('</div></div>'); // add js declaration for the panel $options = '{'; $opt['onActive'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler-down\'); toggler.removeClass(\'jpane-toggler\'); }'; $opt['onBackground'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler\'); toggler.removeClass(\'jpane-toggler-down\'); }'; $opt['duration'] = 200; foreach ($opt as $k => $v) { if ($v) { $options .= $k . ': ' . $v . ','; } } if (substr($options, -1) == ',') { $options = substr($options, 0, -1); } $options .= '}'; // $dom->add('window.addEvent(\'domready\', function(){ new Accordion($$(\'.panel h3.jpane-toggler\'), $$(\'.panel div.jpane-slider\'), '.$options.'); });', '_onload'); One_Vendor::getInstance()->loadScriptDeclaration('window.addEvent(\'domready\', function(){ new Accordion($$(\'.panel h3.jpane-toggler\'), $$(\'.panel div.jpane-slider\'), ' . $options . '); });', 'onload', 10); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $op = $this->getOp($this->getCfg('optype')); $this->setCfg('class', 'OneFieldInput ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getName(), 'totf' => $this->_totf, 'op' => null !== $op ? $op->render() : NULL, 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Add a One_Dom instance to the instantiated One_Dom * * @param One_Dom $dom */ public function addDom(One_Dom $dom) { $data = $dom->getData(); foreach ($data as $section => $content) { foreach ($content as $item) { $this->add($item, $section); } } }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { if ($this->getCfg('showEmpty')) { $this->_options = array_merge(array('' => '---'), $this->_options); } $this->setCfg('class', 'OneFieldDropdown ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'required' => $this->isRequired() ? ' *' : '', 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'options' => $this->_options, 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $title = $this->getCfg('title'); $dom = One_Repository::createDom(); $dom->add('<div id="' . $id . '" class="tabbertab' . (trim($this->getCfg('default')) == 'default' ? ' tabbertabdefault' : '') . '"' . (trim($title) != '' ? ' title="' . $title . '"' : '') . '>' . "\n"); foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('</div>'); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $this->setCfg('class', 'OneFieldInput ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'required' => $this->isRequired() ? ' *' : '', 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast'), 'One::getInstance()->getUrl()' => One_Config::getInstance()->getUrl()); $dom = One_Repository::createDom(); $dom->add('<script type="text/javascript" src="' . One_Vendor::getInstance()->getSitePath() . '/js/ColorPicker2.js"></script>', '_head'); $dom->add('<script type="text/javascript"> var cp = new ColorPicker( "window" ); </script>', '_head'); $content = $this->parse($model, $data); $d->addDom($dom); $d->addDom($content); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $params = $this->getParametersAsString(); $events = $this->getEventsAsString(); $dom = One_Repository::createDom(); $dom->add('<div id="' . $id . '"' . $params . $events . '>' . "\n"); foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('</div>'); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { JHTML::_('behavior.modal'); JHTML::_('behavior.modal', 'a.modal-button'); $this->setCfg('class', 'OneFieldTextfield ' . $this->getCfg('class')); $path = preg_replace('{/|\\\\}', DIRECTORY_SEPARATOR, trim($this->getCfg('path'))); if (substr($path, -1, 1) != DIRECTORY_SEPARATOR) { $path .= DIRECTORY_SEPARATOR; } $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'required' => $this->isRequired() ? ' *' : '', 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'path' => $path, 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast'), 'oneUrl' => One_Config::getInstance()->getUrl()); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { if (!is_null($this->getCfg('options'))) { $this->_options = array(); $options = explode(';', $this->getCfg('options')); foreach ($options as $val) { $parts = explode('=', $val, 2); $this->_options[$parts[0]] = $parts[1]; } } if (is_null($this->getCfg('multiple'))) { $tmp = $this->_options; $this->_options = array('' => '---'); foreach ($tmp as $key => $val) { $this->_options[$key] = $val; } } $value = count($this->getValue()) == 0 ? $this->getDefault() : $this->getValue(); if (!is_array($value) && !is_null($value)) { $value = array($value); } else { if (is_null($value)) { $value = array(); } } $this->setCfg('class', 'OneFieldDropdown ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => !is_null($this->getCfg('multiple')) ? $this->getName() . '[]' : $this->getName(), 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'value' => $value, 'options' => $this->_options, 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $params = $this->getParametersAsString(); $events = $this->getEventsAsString(); $title = $this->getCfg('title'); $dom = One_Repository::createDom(); $dom->add('<div class="panel">' . "\n"); $dom->add('<h3 id="' . $id . '-title" class="pane-toggler title"' . $params . $events . '><a href="javascript:void(0);"><span>' . $title . '</span></a></h3>' . "\n"); $dom->add('<div class="pane-slider content">'); foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('</div></div>'); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $params = $this->getParametersAsString(); $events = $this->getEventsAsString(); $dom = One_Repository::createDom(); $dom->add('<fieldset id="' . $id . '"' . $params . $events . '>' . "\n"); if (trim($this->getCfg('legend')) != '') { $dom->add('<legend>' . $this->getCfg('legend') . '</legend>'); } foreach ($this->getContent() as $widget) { $dom->add($widget->render($model, $dom)); } $dom->add('</fieldset>' . "\n"); $d->addDom($dom); }
/** * Renders the Joomla-HTML widget. * This widget is too specific to render with One_Script and should not be rendered otherwise, * hence this does not use the One_Form_Container_Abstract::parse() function * * @param One_Model $model * @param One_Dom $d * @access protected */ protected function _render($model, One_Dom $d) { $editor = JFactory::getEditor(); JHTML::_('behavior.tooltip'); $width = $this->getParameter('width') ? $this->getParameter('width') : '100%'; $height = $this->getParameter('height') ? $this->getParameter('height') : '550'; //TODO: clean this up, should add a 'save editor' part for each control, multiple controls do not work now ob_start(); ?> <script language="javascript" type="text/javascript"> <!-- function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform( pressbutton ); return; } //save <?php echo $editor->save($this->getFormName()); ?> submitform( pressbutton ); } //--> </script> <?php echo preg_replace('/<div class="button2-left"><div class="translate">(.*?)(<\\/div><\\/div>)/is', '', $editor->display($this->getFormName(), $this->getValue($model), $width, $height, '75', '20')); $edit = ob_get_clean(); if (!is_null($this->getCfg('buttons')) && in_array($this->getCfg('buttons'), array('no', '0', 'false'))) { $edit = preg_replace('/<div class="button2-left">(.*?)(<\\/div><\\/div>)/is', '', $edit); } JHTML::_('behavior.modal'); JHTML::_('behavior.modal', 'a.modal-button'); $dom = One_Repository::createDom(); $dom->add('<span class="OneWidget clearfix">'); // should we show a label? if (!is_null($this->getLabel()) && !$this->getCfg('noLabel')) { $label = '<label class="OneFieldLabel" for="' . $this->getID() . '">' . $this->getLabel() . ($this->isRequired() ? ' *' : '') . '</label>' . "\n"; } // start with label? if ($label && !$this->getCfg('lblLast')) { $dom->add($label); } $app = JFactory::getApplication(); $jDoc = JFactory::getDocument(); $dom->add('<div class="OneWidgetEditor">'); $dom->add($edit); $dom->add('</div>'); // end with label? if ($label && $this->getCfg('lblLast')) { $dom->add($label); } $dom->add('</span>'); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $params = $this->getParametersAsString(); $events = $this->getEventsAsString(); $dom = One_Repository::createDom(); $dom->add('<blockquote id="' . $id . '"' . $params . $events . '>' . "\n"); foreach ($this->getContent() as $widget) { if ($widget instanceof One_Form_Widget_Abstract) { $dom->add($widget->render($model, $dom)); } else { $dom->add($widget); } } $dom->add('</blockquote>' . "\n"); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $dom) { $src = $this->getCfg('src'); if (trim($src) == '') { throw new One_Exception("A field of type 'nscript' should have a 'src'-attribute defining the nanoScript file to parse."); } One_Script_Factory::saveSearchPath(); One_Script_Factory::clearSearchPath(); $useLang = $this->getCfg('language'); if ('' == trim($useLang)) { $useLang = strtolower(One_Config::get('app.language')); } die('deprecated stuff found in ' . __FILE__ . ':' . __LINE); $cps = One_Config::getInstance()->getCustomPaths(); foreach ($cps as $cp) { One_Script_Factory::addSearchPath($cp . '/views/' . One_Config::get('app.name') . '/' . $model->getScheme()->getName() . '/language/' . $useLang . '/'); } foreach ($cps as $cp) { One_Script_Factory::addSearchPath($cp . '/views/' . One_Config::get('app.name') . '/' . $model->getScheme()->getName() . '/'); } $ns = new One_Script(); $ns->load($src); if (!$ns->isError()) { if ($this->getID()) { $ns->set('id', $this->getID()); } if ($this->getName()) { $ns->set('name', $this->getName()); } if ($this->getLabel()) { $ns->set('label', $this->getLabel()); } if ($this->getValue($model)) { $ns->set('value', $this->getValue($model)); } $ns->set('model', $model); $dom->add($ns->execute()); } else { throw new One_Exception($ns->error); } $dom->add($this->value); One_Script_Factory::restoreSearchPath(); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $rKeyvals = $this->getCfg('options'); if (null !== $rKeyvals) { // benedikt 17/04/09: code toegevoegd zodat de juiste labels & values gebruikt worden $rKeyvals = explode(';', $rKeyvals); $keyvals = array(); foreach ($rKeyvals as $val) { $tmp = explode('=', $val); $keyvals[$tmp[0]] = $tmp[1]; } } else { $keyvals = $this->getOptions(); } $this->setCfg('class', 'OneFieldRadiogroup ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'required' => $this->isRequired() ? ' *' : '', 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'options' => $keyvals, 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $this->setCfg('class', 'OneFieldInput ' . $this->getCfg('class')); $value = is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'value' => $value, 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'required' => $this->isRequired() ? ' *' : '', 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast'), 'oneUrl' => One_Config::getInstance()->getUrl(), 'vendorUrl' => One_Vendor::getInstance()->getSitePath(), 'path' => !is_null($this->getCfg('path')) ? $this->getCfg('path') : One_Config::getInstance()->getSiterootUrl(), 'isSimple' => !is_null($this->getCfg('simple')) ? 'yes' : 'no'); if ('' != trim($value)) { $salt = 'DR$8efatrA4reb66fr+ch5$Ucujach3phe9U@AqutR8hajuq47a6&5tucHu58aSt'; $encPath = base64_encode($this->getCfg('path') . '/' . $value); $forCheck = strlen($encPath); $check = md5($forCheck . $encPath . $salt); $encLabel = base64_encode($this->getLabel()); preg_match('/\\.([a-z0-9]+)$/i', $value, $matches); $extension = $matches[1]; $data['encPath'] = $encPath; $data['encLabel'] = $encLabel; $data['check'] = $check; $data['extension'] = $extension; } $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = md5($this->getID() . microtime(true)); $dom = One_Repository::createDom(); $dom->jqtabs = array(); $dom->jqtitles = array(); // add tabs foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('<div id="' . $id . '">' . "\n"); $dom->add('<ul>' . "\n"); foreach ($dom->jqtitles as $jqtab) { $dom->add('<li><a href="#' . $jqtab['id'] . '">' . $jqtab['title'] . '</a></li>'); } $dom->add('</ul>' . "\n"); foreach ($dom->jqtabs as $jqtab) { $dom->addDom($jqtab); } $dom->add("</div>"); $js .= ' <script type="text/javascript"> jQuery(function() { jQuery("#' . $id . '").tabs({ ajaxOptions: { error: function( xhr, status, index, anchor ) { $( anchor.hash ).html( "Error loading data" ); } } }); }); </script> '; $dom->add($js); $dom->jqtabs = NULL; $dom->jqtitles = NULL; $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $dom) { $src = $this->getCfg('code'); $ns = new One_Script(); if ($this->getID()) { $ns->set('id', $this->getID()); } if ($this->getName()) { $ns->set('name', $this->getName()); } if ($this->getLabel()) { $ns->set('label', $this->getLabel()); } if ($this->getValue($model)) { $ns->set('value', $this->getValue($model)); } $ns->set('model', $model); $s = $ns->executeString($src); $dom->add($s); $dom->add($this->value); One_Script_Factory::restoreSearchPath(); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $dom) { // collect required data $id = $this->getID(); $name = $this->getName(); $childScheme = $this->getCfg('scheme'); $dom->add('<script src="' . One_Config::getInstance()->getUrl() . 'lib/libraries/js/jquery.js" type="text/javascript"></script>', '_head'); $dom->add('<script type="text/javascript">jQuery.noConflict();</script>', 'head'); $dom->add('<script src="' . One_Config::getInstance()->getUrl() . 'lib/libraries/js/jquery/jquery.color.js" type="text/javascript"></script>', '_head'); $dom->add('<script src="' . One_Config::getInstance()->getUrl() . 'lib/libraries/js/jquery.simplemodal-1.3.3.js" type="text/javascript"></script>', '_head'); $dom->add('<script src="' . One_Config::getInstance()->getUrl() . 'lib/libraries/js/managerToolbar.js" type="text/javascript"></script>', '_head'); $dom->add('<link rel="stylesheet" href="' . One_Config::getInstance()->getUrl() . 'lib/libraries/js/toolbar.css" type="text/css" />', '_head'); $dom->add('<link rel="stylesheet" href="' . One_Config::getInstance()->getUrl() . 'lib/libraries/js/toolbar.ie6.css" type="text/css" />', '_head'); $content = '<div class="childPopupPanel"> <a href="#" onclick="jModal( \'' . $id . 'NsBox\', \'' . $childScheme . '\' ); return false;">Lookup</a> <div id="' . $id . 'NsBox"></div> </div>'; $dom->add($content); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { if ($this->getCfg('showEmpty')) { $keyvals = array(); $keyvals[''] = '---'; foreach ($this->_options as $key => $val) { $keyvals[$key] = $val; } $this->_options = $keyvals; } $value = count($this->getValue($model, $this->getCfg('role'))) == 0 ? $this->getDefault() : $this->getValue($model, $this->getCfg('role')); if (!is_array($value) && !is_null($value)) { $value = array($value); } else { if (is_null($value)) { $value = array(); } } $this->setCfg('class', 'OneFieldDropdown ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'required' => $this->isRequired() ? ' *' : '', 'value' => $value, 'options' => $this->_options, 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $rKeyvals = $this->getCfg('options'); if (trim($rKeyvals) != '') { $rKeyvals = explode(';', $rKeyvals); $keyvals = array(); foreach ($rKeyvals as $val) { $tmp = explode('=', $val); $keyvals[$tmp[0]] = $tmp[1]; } $this->_options = $keyvals; } if ($this->getCfg('showEmpty')) { $tmp = array('' => '---'); foreach ($this->_options as $key => $val) { $tmp[$key] = $val; } $this->_options = $tmp; } $this->setCfg('class', 'OneFieldDropdown ' . $this->getCfg('class')); $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'events' => $this->getEventsAsString(), 'params' => $this->getParametersAsString(), 'required' => $this->isRequired() ? ' *' : '', 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'options' => $this->_options, 'info' => $this->getCfg('info'), 'error' => $this->getCfg('error'), 'class' => $this->getCfg('class'), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast')); $dom = $this->parse($model, $data); $d->addDom($dom); }
/** * Render the output of the container and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $width = is_null($this->getCfg('width')) ? 400 : intval($this->getCfg('width')); $height = is_null($this->getCfg('height')) ? 300 : intval($this->getCfg('height')); $css = is_null($this->getCfg('css')) ? One_Vendor::getInstance()->getSitePath() . '/mootabs/mootabs1.2.css' : $this->getCfg('css'); $dom = One_Repository::createDom(); $dom->add('<script type="text/javascript" src="' . One_Vendor::getInstance()->getSitePath() . '/mootabs/mootabs1.2.js"></script>', '_head'); $dom->add('<script type="text/javascript"> function initMooTabs' . $id . '() { myTabs' . $id . ' = new mootabs( "' . $id . '", { changeTransition: "none", mouseOverClass: "over", width: ' . $width . ', height: ' . $height . ' } ); } window.addEvent("domready", initMooTabs' . $id . ' ); </script>', '_head'); $dom->add('<link href="' . $css . '" rel="stylesheet" type="text/css" />', '_head'); $dom->mootabs = array(); $dom->mootitles = array(); // add tabs foreach ($this->getContent() as $content) { $content->render($model, $dom); } $dom->add('<div id="' . $id . '">' . "\n"); $dom->add('<ul class="mootabs_title">' . "\n"); $active = ' class="active"'; foreach ($dom->mootitles as $mootab) { $dom->add('<li title="' . $mootab['id'] . '"' . $active . '>' . $mootab['title'] . '</li>'); $active = ''; } $dom->add('</ul>' . "\n"); foreach ($dom->mootabs as $mootab) { $dom->addDom($mootab); } $dom->add("</div>"); $dom->mootabs = NULL; $dom->mootitles = NULL; $d->addDom($dom); }
/** * Render the output of the widget and add it to the DOM * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $start = date('Y-m'); if (!is_null($this->getCfg('start'))) { $start = trim($this->getCfg('start')); } $data = array('id' => $this->getID(), 'name' => $this->getFormName(), 'required' => $this->isRequired() ? ' *' : '', 'value' => is_null($this->getValue($model)) ? $this->getDefault() : $this->getValue($model), 'label' => $this->getLabel(), 'lblLast' => $this->getCfg('lblLast'), 'start' => $start); $dom = $this->parse($model, $data); // add multidate.js $d->add('<script type="text/javascript" src="' . One_Config::getInstance()->getUrl() . 'lib/form/js/multidate.js"></script>' . "\n", '_head'); // define our multiDate JS object // onload create the calendar $script = 'multi' . ucfirst($this->getID()) . '.createCalendar();'; $d->add($script, '_onload'); $script = '<script type="text/javascript">var multi' . ucfirst($this->getID()) . ' = "";</script>'; $d->add($script); $d->addDom($dom); $script = '<script type="text/javascript">var multi' . ucfirst($this->getID()) . ' = new MultiDate( 2010, 4, "OneCalendar' . ucfirst($this->getID()) . '", "' . $this->getID() . '" );</script>'; $d->add($script); }
/** * Renders the HTML widget. * This widget is too specific to render with One_Script and should not be rendered otherwise, * hence this does not use the One_Form_Container_Abstract::parse() function * * @param One_Model $model * @param One_Dom $d */ protected function _render($model, One_Dom $d) { $id = $this->getID(); $name = $this->getFormName(); $value = $this->getValue($model); if (is_null($value)) { $value = $this->getDefault(); } $info = $this->getCfg('info'); $error = $this->getCfg('error'); $width = intval($this->getCfg('width')) ? 600 : intval($this->getCfg('width')); $height = intval($this->getCfg('height')) ? 300 : intval($this->getCfg('height')); $dom = One_Repository::createDom(); $this->setCfg('class', 'OneFieldHtml ' . $this->getCfg('class')); $events = $this->getEventsAsString(); $params = $this->getParametersAsString(); $theme = $this->getCfg('theme') ? $this->getCfg('theme') : "simple"; if (!is_null($this->getLabel())) { $label = '<label class="OneFieldLabel" for="' . $id . '" style="float: none;">' . $this->getLabel() . ($this->isRequired() ? ' *' : '') . '</label>' . "\n"; } if (strtolower($this->_editor) == 'joomla') { ob_start(); echo "<span class='OneWidget'>"; if ($label && !$this->getCfg('lblLast')) { echo $label; } $editor = JFactory::getEditor(); echo $editor->display($name, $value, $width, $height, '20', '60', array('image', 'pagebreak', 'readmore')); if ($label && $this->getCfg('lblLast')) { echo $label; } echo "</span>"; $result = ob_get_contents(); ob_end_clean(); $dom->add($result); $d->addDom($dom); } else { $head .= '<script type="text/javascript" src="' . JURI::root() . 'plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>'; $dom->add($head, '_head'); // @todo: tinyMCE.init in onload (��n keer) $main = '<script type="text/javascript"> tinyMCE.init({ theme : "' . $theme . '", language : "en", mode : "textareas", gecko_spellcheck : "true", editor_selector : "mce' . ucfirst($theme) . '", document_base_url : "' . JURI::root() . '", entities : "60,lt,62,gt", relative_urls : 1, remove_script_host : false, save_callback : "TinyMCE_Save", invalid_elements : "applet", extended_valid_elements : "a[class|name|href|target|title|onclick|rel],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],,hr[id|title|alt|class|width|size|noshade]", theme_advanced_toolbar_location : "top", theme_advanced_source_editor_height : "550", theme_advanced_source_editor_width : "750", directionality: "ltr", force_br_newlines : "false", force_p_newlines : "true", content_css : "' . JURI::root() . 'templates/ja_xenia/css/editor.css", debug : false, cleanup : true, cleanup_on_startup : false, safari_warning : false, plugins : "advlink, advimage, searchreplace,insertdatetime,emotions,media,advhr,table,fullscreen,directionality,layer,style", theme_advanced_buttons1_add : "fontselect", theme_advanced_buttons2_add : "search,replace,insertdate,inserttime,emotions,media,ltr,rtl,insertlayer,moveforward,movebackward,absolute,forecolor", theme_advanced_buttons3_add : "advhr,tablecontrols,fullscreen,styleprops", theme_advanced_disable : "help", plugin_insertdate_dateFormat : "%Y-%m-%d", plugin_insertdate_timeFormat : "%H:%M:%S", fullscreen_settings : { theme_advanced_path_location : "top" } }); function TinyMCE_Save(editor_id, content, node) { base_url = tinyMCE.settings[\'document_base_url\']; var vHTML = content; if (true == true){ vHTML = tinyMCE.regexpReplace(vHTML, \'href\\s*=\\s*"?\'+base_url+\'\', \'href="\', \'gi\'); vHTML = tinyMCE.regexpReplace(vHTML, \'src\\s*=\\s*"?\'+base_url+\'\', \'src="\', \'gi\'); vHTML = tinyMCE.regexpReplace(vHTML, \'mce_real_src\\s*=\\s*"?\', \'\', \'gi\'); vHTML = tinyMCE.regexpReplace(vHTML, \'mce_real_href\\s*=\\s*"?\', \'\', \'gi\'); } return vHTML; } </script>'; $dom->add($main, '_head'); $this->setCfg('class', 'mce' . ucfirst($theme) . ' ' . $this->getCfg('class')); $conf = $this->getParameters(); // @todo: why this line? // unset($conf['theme']); $dom->add("<span class='OneWidget'>"); // start with label? if ($label && !$this->getCfg('lblLast')) { $dom->add($label); } // render the required textarea $ta = new OneFormWidgetTextarea($id, $this->getOriginalName(), NULL, array_merge($conf, array('style' => "width:' . {$width} . 'px; height:' . {$height} . 'px;"))); $ta->render($model, $dom); // end with label? if ($label && $this->getCfg('lblLast')) { $dom->add($label); } $dom->add("</span>"); $script = 'tinyMCE.execCommand("mceAddControl", false, "' . $id . '");'; $dom->add($script, '_onload'); if (is_null($info)) { $dom->add('<span id="' . $id . 'Info" class="OneInfo">' . $info . '</span>'); } if (is_null($error)) { $dom->add('<span id="' . $id . 'Error" class="OneError">' . $error . '</span>'); } $onload = '<script type="text/javascript">tinyMCE.init();</script>'; $dom->add($onload); $d->addDom($dom); } }
/** * Renders the DOM or a section of the DOM * * @param $section The section to render, if $section equals NULL, all of the DOM will be rendered * @return string */ function render($section = null) { $result = ''; if ($section) { switch ($section) { case '_head': if (count($this->_data['_head']) > 0) { $document = JFactory::getDocument(); foreach ($this->_data['_head'] as $headpart) { // if this is a <script src=""></script> part preg_match("/<script(.*)src=\"(.*)\"(.*)><\\/script>/isU", $headpart, $matches); if (isset($matches[2])) { $document->addScript($matches[2]); continue; } // if this is a <script>var/function definitions</script> part unset($matches); preg_match("/<script(.*)>(.*)<\\/script>/isU", $headpart, $matches); if (isset($matches[2])) { $document->addScriptDeclaration($matches[2]); continue; } // if this is a <link href="" rel="" ...></link> part unset($matches); preg_match("/<link(.*)href=\"(.*)\"(.*)\\/>/isU", $headpart, $matches); if (isset($matches[2])) { $href = $matches[2]; unset($matches); preg_match("/<link(.*)type=\"(.*)\"(.*)\\/>/isU", $headpart, $matches); if ($matches[2]) { $type = $matches[2]; } unset($matches); preg_match("/<link(.*)rel=\"(.*)\"(.*)\\/>/isU", $headpart, $matches); if (isset($matches[2])) { $rel = $matches[2]; } $document->addStyleSheet($href); continue; } } } break; case '_onload': if (count($this->_data['_onload']) > 0) { $document = JFactory::getDocument(); $myFunction = ' function doOneContentOnloadActions() { '; foreach ($this->_data['_onload'] as $onloadpart) { $myFunction .= $onloadpart; } $myFunction .= ' } if(typeof(jQuery) !== "undefined") { jQuery(document).ready(function(){ doOneContentOnloadActions() }); } else{ window.addEvent("domready", function(){ doOneContentOnloadActions() }); }'; $document->addScriptDeclaration($myFunction); } break; default: $result = parent::render($section); break; } } else { foreach ($this->_data as $key => $section) { $result .= $this->render($key); } } return $result; }