Example #1
0
    public static function createTemplate(&$template, $form)
    {
        if (!class_exists('JHtmlBehavior')) {
            jimport('joomla.html.html.behavior');
        }
        $tagjs = "function insertTag(tag){ try{if(jInsertEditorText(tag,'template_body')){ return true;}else{jInsertEditorText(tag,'alt_body'); return true}} catch(err){alert('Your editor does not enable jNews to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;}}";
        if (!isset($template)) {
            $template = new stdClass();
        }
        //we change the permission of the template
        //if we not change the permission to writable(755) the images won't show
        @($mediacomjNewsTemplatesdir = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS . $template->namekey);
        @chmod(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS . $template->namekey, 0755);
        $template->name = isset($template->name) ? $template->name : '';
        $template->namekey = isset($template->namekey) ? $template->namekey : '';
        $template->published = isset($template->published) ? $template->published : 0;
        $template->premium = isset($template->premium) ? $template->premium : 0;
        $template->thumbnail = isset($template->thumbnail) ? $template->thumbnail : '';
        $template->description = isset($template->description) ? $template->description : '';
        $template->availability = isset($template->availability) ? $template->availability : '1';
        $template->body = isset($template->body) ? $template->body : '';
        $template->altbody = isset($template->altbody) ? $template->altbody : '';
        $template->styles = isset($template->styles) ? $template->styles : '';
        $template->csstyle = isset($template->csstyle) ? $template->csstyle : '';
        $editor = JFactory::getEditor();
        //		if(!$GLOBALS[JNEWS.'disabletooltip']){
        if (version_compare(JVERSION, '3.0.0', '<')) {
            JHTML::_('behavior.tooltip');
        } else {
            JHtml::_('behavior.tooltip');
        }
        $text = str_replace('"', '&quot;', $template->name);
        $namekey = str_replace('"', '&quot;', $template->namekey);
        if (function_exists('htmlspecialchars_decode')) {
            $text = htmlspecialchars_decode($text, ENT_NOQUOTES);
            $namekey = htmlspecialchars_decode($namekey, ENT_NOQUOTES);
        } elseif (function_exists('html_entity_decode')) {
            $text = html_entity_decode($text, ENT_NOQUOTES);
            $namekey = html_entity_decode($namekey, ENT_NOQUOTES);
        }
        $readOnlyNamekey = !empty($namekey) ? 'READONLY' : '';
        $styles = $template->styles;
        $styles['color_bg'] = !empty($styles) && isset($styles['color_bg']) ? $styles['color_bg'] : '#FFFFFF';
        $styles['cssfile'] = !empty($styles) && isset($styles['cssfile']) ? $styles['cssfile'] : '';
        $templateHTML['name'] = '<input type="text" name="template_name" class="inputbox" size="40" maxlength="64" value="' . $text . '" />';
        $templateHTML['namekey'] = '<input type="text" name="template_namekey" class="inputbox" size="40" maxlength="64" value="' . $namekey . '" ' . $readOnlyNamekey . ' />';
        $templateHTML['publish'] = jnews::HTML_BooleanList('confirmed', 'class="inputbox"', $template->published);
        $templateHTML['premium'] = jnews::HTML_BooleanList('premium', 'class="inputbox"', $template->premium);
        $templateHTML['bgcolor'] = jnews::colorPicker('styles[color_bg]', 15, $styles['color_bg']);
        $templateHTML['thumbnail'] = jNews_TemplatesHTML::_attachment($template->thumbnail);
        $templateHTML['description'] = '<br/><textarea rows="5" cols="45" name="description">' . $template->description . '</textarea><br/>';
        unset($styles['cssfile']);
        $templateHTML['cssfile'] = '<div id="cssfile" style="display:none;"><input type="text" name="styles[cssfile]" style="margin: 2px 0 2px 2px;" class="inputbox" size="45" value="' . jNews_Templates::escapeVal(@$styles['cssfile']) . '" />';
        $templateHTML['cssfile'] .= '<input type="button" onclick="javascript:hideMainMenu(); submitbutton(\'apply\')" style="margin: 2px 0 2px 2px;" name="Process External CSS" class="button" value="' . _JNEWS_EXTERNALCSS_PROCESS . '"></div>';
        //		}
        //remove empty classname
        unset($styles['']);
        echo $form['main'];
        ?>
			<table cellpadding="1" cellspacing="0" border="0" width="99%">
				<tbody>
					<tr>
						<td width="20%" valign="top">
							<fieldset style="margin-top:7px;">
								<?php 
        echo jnews::beginingOfTable('jnewstable');
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_NAME, _JNEWS_TEMPLATE_NAME_T, $templateHTML['name']);
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_ALIAS, _JNEWS_TEMPLATE_NAMEKEY_T, $templateHTML['namekey']);
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_PUBLISH, _JNEWS_TEMPLATE_PUBLISH_T, $templateHTML['publish']);
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_DEFAULT, _JNEWS_TEMPLATE_DEFAULT_T, $templateHTML['premium']);
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_BG, _JNEWS_TEMPLATE_BG_T, $templateHTML['bgcolor']);
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_UPLOAD, _JNEWS_TEMPLATE_UPLOAD_T, $templateHTML['thumbnail']);
        echo jnews::miseEnHTML(_JNEWS_TEMPLATE_DESC, _JNEWS_TEMPLATE_DESC_T, $templateHTML['description']);
        echo jnews::endOfTable();
        ?>
							</fieldset>
						</td>
						<td width="49%" valign="top">
								<?php 
        $switchjs = 'function switchContent() {
										        	var option=[\'jNewsStyles\',\'jNewsCSSTextbox\'];
										        	for(var i=0; i<option.length; i++){
											        	obj=document.getElementById(option[i]);
											        	obj.className=(obj.className=="visible")? "hidden" : "visible";
											       	}
											       	var form = document.adminForm;
											       	if(form.stylechosen.value == \'0\'){form.stylechosen.value = 1}else{form.stylechosen.value = 0}
										       	 }
										        function showInput() {
													var el = document.getElementById(\'cssfile\');
													if ( el.style.display != \'none\' ) {
														el.style.display = \'none\';
													}
													else {
														el.style.display = \'\';
														el.focus();
													}
												}';
        $jnewscss = '.visible {display:block;}
											     .hidden {display:none;}';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($switchjs . $tagjs);
        $doc->addStyleDeclaration($jnewscss);
        //echo '<a name="cssfileindex">';
        jNews_TemplatesHTML::_styles($styles);
        //add the specific style
        //echo '</a>';
        echo '<div id="jNewsCSSTextbox" style="padding: 4px;" class="hidden">' . jNews_TemplatesHTML::_csstextbox($template->csstyle) . '</div>';
        echo '<div class="button2-left">';
        echo '<div class="blank"><a href="#" style="cursor: hand;" onclick="switchContent()" title="Toggle Template Styling" >' . _JNEWS_CSS_TOGGLESTYLE . '</a></div>';
        echo '</div>';
        //									echo '<div class="button2-left">';
        //									echo '<div class="blank"><a href="#cssfileindex" style="cursor: hand;" onclick="showInput()" title="Click to Input External CSS" >'._JNEWS_EXTERNALCSS_LINK.'</a></div>';
        //									echo '</div>';
        echo $templateHTML['cssfile'];
        ?>
						</td>
					</tr>
					<tr>
						<td colspan="2" width="100%">
							<fieldset class="jnewscss">
								<legend>
									<?php 
        echo _JNEWS_HTML_VERSION;
        ?>
								</legend>
								<?php 
        echo $editor->display('template_body', $template->body, '99%', '800', '75', '50', true);
        ?>
							</fieldset>
							<fieldset class="jnewscss">
								<legend><?php 
        echo _JNEWS_NONHTML_VERSION;
        ?>
</legend>
								<textarea name="alt_body" rows="20" cols="70" style="width: 100%; height: 400px;"><?php 
        echo $template->altbody;
        ?>
</textarea>
							</fieldset>
						</td>
					</tr>
				</tbody>
			</table>
		<?php 
        echo JHTML::_('behavior.keepalive');
    }
Example #2
0
 public static function about()
 {
     echo '<table width="100%" align="left"><tr>';
     echo '<td>';
     echo '<form action="index.php" method="post" name="adminForm" id="adminForm">';
     jnews::beginingOfTable('jnewstable');
     jnews::miseEnPage('Description', '', constant('_JNEWS_DESC_' . strtoupper($GLOBALS[JNEWS . 'type'])));
     jnews::miseEnPage('Developers', '', 'Evelyn Lopez, Mary Michelle Piquero, Gerald R. Zalsos, Ebony Grace Ursua, Mary Grace Arabis, Gino Tayo, <br/>Glenn Jaime Chan, Adel Fomar Dulanas, Lalene Cababat, Jhen Bontilao');
     jnews::miseEnPage('Contributor', '', 'Amir Ben Avraham, Christelle Gesset & Adrien Baborier');
     jnews::miseEnPage('Captcha Contributor', '', 'Sorin Rosen');
     jnews::miseEnPage('Designer', '', 'Rochel Abrasaldo');
     jnews::miseEnPage('CB Integration', '', 'Mikko R&ouml;nkk&ouml;');
     jnews::miseEnPage('Add-ons', '', 'Kyle Witt');
     jnews::miseEnPage('Language Translation', '', '');
     jnews::miseEnPage('Brazilian_portuguese', '', 'Navsoft');
     jnews::miseEnPage('Danish', '', 'Joergen Floes');
     jnews::miseEnPage('Dutch', '', 'Tromp Wezelman & Bart Bevers');
     jnews::miseEnPage('Finnish', '', 'Tero Kankaanperä');
     jnews::miseEnPage('French', '', 'Christelle Gesset');
     jnews::miseEnPage('German', '', 'David Freund & Frank Jansen');
     jnews::miseEnPage('Hebrew', '', 'Eszter Somos & Adam Segev');
     jnews::miseEnPage('Hungarian', '', 'Zolt&aacute;n Varanka');
     jnews::miseEnPage('Italian', '', 'Maria Luisa Rossari');
     jnews::miseEnPage('Norwegian', '', '<a href="http://www.timeoffice.com" target="_blank">Irma Rustad</a>');
     jnews::miseEnPage('Polish', '', 'Andrzej Herzberg');
     jnews::miseEnPage('Portuguese', '', 'Ricardo Sim&otilde;es');
     jnews::miseEnPage('Simplified Chinese', '', '<a href="http://www.joomlagate.com" target="_blank">Baijianpeng</a>');
     jnews::miseEnPage('Spanish', '', '<a href="http://www.eaid.org" target="_blank">Jorge Pasco</a>');
     jnews::miseEnPage('Swedish', '', 'Janne Karlsson');
     jnews::miseEnPage('Turkish', '', 'Anonymous');
     jnews::miseEnPage('CSS class to style attribute', '', '<a href="http://classes.verkoyen.eu/css_to_inline_styles" target="_NEW">http://classes.verkoyen.eu/css_to_inline_styles</a>');
     jnews::miseEnPage(' ', '', '   ');
     jnews::miseEnPage(_JNEWS_VERSION, '', jnews::version());
     jnews::miseEnPage(' ', '', '   ');
     jnews::miseEnPage(_JNEWS_DESC_HOME, '', '<a href="' . $GLOBALS[JNEWS . 'homesite'] . '" target="_blank">' . JNEWS_HOME_SITE . '</a>');
     jnews::miseEnPage(_JNEWS_MENU_HELP, '', '<a href="' . JNEWS_HOME_SITE . '/index.php?option=com_content&Itemid=67&catid=93&id=8241&lang=en&view=article" target="_blank">Documentation</a>');
     jnews::miseEnPage(_JNEWS_MENU_LIVE_SUPPORT, '', '<a href="' . JNEWS_HOME_SITE . '/live-support" target="_blank">Help</a>');
     jnews::miseEnPage(_JNEWS_MENU_LEARN, '', '<a href="http://demo.joobi.co/" target="_blank">Education Center</a>');
     jnews::miseEnPage('Copyrights', '', 'jNews <i>Your Communciation Partner</i>, &copy; Joobi Limited');
     jnews::miseEnPage(_JNEWS_LICENSE, '', '<a href="http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=single-license" target="_blank">&copy; Joobi Limited</a>');
     jnews::endOfTable();
     backHTML::formEnd();
     echo '</td>';
     echo '<td width="380px">';
     $logo = 'jnews_logo' . (!empty($GLOBALS[JNEWS . 'type']) ? '_' . strtolower($GLOBALS[JNEWS . 'type']) : '') . '.png';
     echo '<a href="http://www.joobi.co" target="_blank"><img src="http://www.joobi.co/images/' . $logo . '" alt="jNews Logo" border="0" align="center" /></a>';
     echo '</td>';
     echo '</tr></table>';
 }
Example #3
0
    public static function cbSettings()
    {
        $lists['cb_plugin'] = jnews::HTML_BooleanList("config['cb_plugin']", 'class="inputbox"', $GLOBALS[JNEWS . 'cb_plugin']);
        $lists['cb_showname'] = jnews::HTML_BooleanList("config['cb_showname']", 'class="inputbox"', $GLOBALS[JNEWS . 'cb_showname']);
        $lists['cb_checkLists'] = jnews::HTML_BooleanList("config['cb_checkLists']", 'class="inputbox"', $GLOBALS[JNEWS . 'cb_checkLists']);
        $lists['cb_showHTML'] = jnews::HTML_BooleanList("config['cb_showHTML']", 'class="inputbox"', $GLOBALS[JNEWS . 'cb_showHTML']);
        $lists['cb_defaultHTML'] = jnews::HTML_BooleanList("config['cb_defaultHTML']", 'class="inputbox"', $GLOBALS[JNEWS . 'cb_defaultHTML']);
        ?>
		<fieldset class="jnewscss">
		<legend><?php 
        echo _JNEWS_CB_INTEGRATION;
        ?>
</legend>
		<?php 
        jnews::beginingOfTable('jnewstable');
        if ($GLOBALS[JNEWS . 'cb_pluginInstalled'] == 0) {
            if (!jnews::checkCBPlugin()) {
                jnews::miseEnPage(jnews::WarningIcon(_JNEWS_CB_PLUGIN_NOT_INSTALLED), ' ', '<span style="color: rgb(255, 0, 0);">' . _JNEWS_CB_PLUGIN_NOT_INSTALLED . '</span>');
            }
        }
        jnews::miseEnPage(_JNEWS_CB_PLUGIN, _JNEWS_CB_PLUGIN_TIPS, $lists['cb_plugin']);
        jnews::miseEnPage(_JNEWS_CB_LISTS, _JNEWS_CB_LISTS_TIPS, "<input class=\"inputbox\" type=\"text\" name=\"config['cb_listIds']\" size=\"30\" value=\"" . $GLOBALS[JNEWS . 'cb_listIds'] . "\" >");
        jnews::miseEnPage(_JNEWS_CB_INTRO, _JNEWS_CB_INTRO_TIPS, "<textarea  name=\"config['cb_intro']\" rows=\"3\" cols=\"40\" >" . $GLOBALS[JNEWS . 'cb_intro'] . "</textarea>");
        jnews::miseEnPage(_JNEWS_CB_SHOW_NAME, _JNEWS_CB_SHOW_NAME_TIPS, $lists['cb_showname']);
        jnews::miseEnPage(_JNEWS_CB_LIST_DEFAULT, _JNEWS_CB_LIST_DEFAULT_TIPS, $lists['cb_checkLists']);
        jnews::miseEnPage(_JNEWS_CB_HTML_SHOW, _JNEWS_CB_HTML_SHOW_TIPS, $lists['cb_showHTML']);
        jnews::miseEnPage(_JNEWS_CB_HTML_DEFAULT, _JNEWS_CB_HTML_DEFAULT_TIPS, $lists['cb_defaultHTML']);
        jnews::endOfTable();
        echo '</fieldset>';
    }