id; $onchange = (string) $this->element['onchange']; $size = ($v = $this->element['size']) ? ' size="' . $v . '"' : ''; $class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"'; $required = ($v = $this->element['required']) ? ' required="required"' : ''; // Initialize some field attributes. $attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : ''; $attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : ''; $idA = 'phFileNameModal'; // If external image, we don't need the filename will be required $extId = (int) $this->form->getValue('extid'); if ($extId > 0) { $readonly = ' readonly="readonly"'; $attr = ''; return ''; } /*$script = array(); $script[] = ' function phocaSelectFileName_'.$this->id.'(title) {'; $script[] = ' document.getElementById("'.$this->id.'").value = title;'; $script[] = ' '.$onchange; $script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');'; $script[] = ' }'; JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));*/ HTMLHelper::_('jquery.framework'); /* JFactory::getDocument()->addScriptDeclaration(' function phocaSelectFileName_' . $this->id . '(name) { document.getElementById("' . $this->id . '").value = name; jQuery(\'#'.$idA.'\').modal(\'toggle\'); } ');*/ $script = array(); $script[] = ' function phocaSelectFileName_'.$this->id.'(title) {'; $script[] = ' document.getElementById("'.$this->id.'").value = title;'; $script[] = ' '.$onchange; //$script[] = ' jModalClose();'; $script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');'; //$script[] = ' SqueezeBox.close();'; //$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');'; $script[] = ' }'; // Add the script to the document head. Factory::getDocument()->addScriptDeclaration(implode("\n", $script)); $html[] = '
'; $html[] = ''; $html[] = '' . ' ' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . ''; $html[] = '
'. "\n"; $html[] = HTMLHelper::_( 'bootstrap.renderModal', $idA, array( 'url' => $link, 'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME'), 'width' => '', 'height' => '', 'modalWidth' => '80', 'bodyHeight' => '80', 'footer' => '
' ) ); /* //readonly="readonly" $html[] = ''; $html[] = '' . ' ' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . ''; $html[] = HTMLHelper::_( 'bootstrap.renderModal', $idA, array( 'url' => $link, 'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME'), 'width' => '700px', 'height' => '400px', 'modalWidth' => '80', 'bodyHeight' => '70', 'footer' => '' ) );*/ // We don't use hidden field name, we can edit it the filename form field, there are three ways of adding filename: // - manually typed // - selected by image select box // - added per YouTube import // // The name="' . $this->name . '" is used above in standard input form // //$html[] = ''; return implode("\n", $html); } }