/** * Render an insertbutton element * * @access public */ function fetchElementImplicit($field, $label, $withjs = true) { if ($withjs) { $js = "// <![CDATA[\n function insertAtCursor(myField, myValue) {\n if (document.selection) {\n // IE support\n myField.focus();\n sel = document.selection.createRange();\n sel.text = myValue;\n } else if (myField.selectionStart || myField.selectionStart == '0') {\n // MOZILLA/NETSCAPE support\n var startPos = myField.selectionStart;\n var endPos = myField.selectionEnd;\n myField.value = myField.value.substring(0, startPos)\n + myValue\n + myField.value.substring(endPos, myField.value.length);\n } else {\n myField.value += myValue;\n }\n }\n function jInsertEditorText(text, editor) {\n insertAtCursor(\$(editor), text);\n }\n // ]]>\n "; $doc =& JFactory::getDocument(); $doc->addScriptDeclaration($js); } JHTML::_('behavior.modal', 'a.modal-button'); $link = 'index.php?option=com_avreloaded&view=insert&tmpl=component&e_name=' . $field; $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_($label)); $button->set('name', 'image'); $button->set('options', "{handler: 'iframe', size: {x: 600, y: 650}}"); return JElementInsertButton::_renderButton($button); }
/** * Track view display method * @return void **/ function display($tpl = null) { AvrGenericHelper::addCSS('.icon-48-avreloaded {background-image:url(' . JURI::root() . '/administrator/components/com_avreloaded/assets/avreloaded-48x48.png);}'); // Get data from the model $track =& $this->get('Track'); $data = JRequest::getVar('data', ''); $isNew = empty($track->file); $text = $isNew ? JText::_('New') : JText::_('Edit'); JToolBarHelper::title($text . ' ' . JText::_('AVR_TITLE_TRACK') . ' - AllVideos Reloaded', 'avreloaded'); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { // for existing items the button is renamed `close` JToolBarHelper::cancel('cancel', 'Close'); } JToolBarHelper::help('track', true); $list = array(JHTML::_('select.option', '', '- ' . JText::_('AVR_SELECT_NONE') . ' -')); foreach (split(',', 'gif,flv,jpg,mp3,png,rtmp,swf') as $type) { $list[] = JHTML::_('select.option', $type, $type); } $types = JHTML::_('select.genericlist', $list, 'type', 'class="inputbox" size="1" ', 'value', 'text', $track->type); $mbutton = JElementInsertButton::fetchElementImplicit('mtext&playlist=1&noplists=1', JText::_('AVR Media'), false); $ibutton = $this->_imgButton(); $root = AvrGenericHelper::rootURI(true) . '/'; $aloc = AvrGenericHelper::getAloc(true) . '/'; $vloc = AvrGenericHelper::getVloc(true) . '/'; $this->assignRef('types', $types); $this->assignRef('track', $track); $this->assignRef('data', $data); $this->assignRef('ibutton', $ibutton); $this->assignRef('mbutton', $mbutton); $this->assignRef('aloc', $aloc); $this->assignRef('vloc', $vloc); $this->assignRef('root', $root); parent::display($tpl); }