public static function insertTemplate($editor) { ?> <table style="border: 1px solid #000; width: 100%;" cellpadding="10" cellspacing="5"> <tbody> <tr> <td> <?php $applyEditor = $editor->setContent($editor->_name, 'newbody'); $script = "function changeTemplate(newbody,newaltbody,template_id){\n\t\t\tif(newbody.length>2){" . $applyEditor . "}\n\t\t\tvar vartextarea =\$('altbody'); if(newaltbody.length>2){vartextarea.setHTML(newaltbody);}\n\t\t\tvar vartempid =\$('tempid'); vartempid.value = tempid;}\n\t\t\t"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($script); $templates = jNews_Templates::getTemplates(false, false, '', -1, 3); $i = 0; if (!empty($templates)) { foreach ($templates as $template) { $imgPath = $template->thumbnail; $img = jnews::imageResize($imgPath, 100, 100, $template->thumbnail); $html = ''; $html = '<a href="#" onclick="changeTemplate(document.getElementById(\'jnewshtmlcontent\').innerHTML, document.getElementById(\'jnewsaltbody\').innerHTML, ' . $template->template_id . ');">'; $html .= '<div style="margin:5px; float: left; border: 1px solid #000;">' . $img . '</div>'; $html .= '<div id="jnewshtmlcontent" style="display:none;">' . $template->body . '</div>'; $html .= '<div id ="jnewsaltbody" style="display:none;">' . $template->altbody . '</div>'; $html .= '</a>'; echo $html; $i = $i + 1; } } ?> </td> </tr> </tbody> </table> <?php }
public static function _attachment($thumbnail) { $display = '<script src="' . JNEWS_URL_INCLUDES . 'multifile.js"></script> <input id="my_file_element" type="file" name="file_1" > </input> <br /><b>' . _JNEWS_FILES . ':</b> <div id="files_list"></div> <script> var multi_selector = new MultiSelector( document.getElementById( "files_list" ), 1 ); multi_selector.addElement( document.getElementById( "my_file_element" ) ); </script>'; if (!empty($thumbnail)) { //$path = JNEWS_PATH_ADMIN_THUMBNAIL_SHOW. $thumbnail; $path = $thumbnail; $img = jnews::imageResize($path, '200', '200', $thumbnail); $display .= '<br>' . $img; $display .= '<br>' . jNews_Tools::toolTip($img, $thumbnail, '', '', $thumbnail); } return $display; }