예제 #1
0
    public static function _styles($styles)
    {
        $script = 'function addNewStyle() {
								var divnewstyle=window.document.getElementById("divnewstyle");
								var input = document.createElement(\'input\');
								var input2 = document.createElement(\'input\');
								input.type = \'text\';
								input2.type = \'text\';
								input.size = \'30\';
								input2.size = \'30\';
								input.name = \'otherstyles[classname][]\';
								input2.name = \'otherstyles[style][]\';
								input.setAttribute(\'style\', \'margin-top:4px;\');
								input2.setAttribute(\'style\', \'margin-top:4px; margin-left: 68px;\');
								input.value = "' . _JNEWS_TEMPLATE_STYLE_NEWC . '";
								input2.value = "' . _JNEWS_TEMPLATE_STYLE_NEWAPPLIED . '";
								divnewstyle.appendChild(document.createElement(\'br\'));
								divnewstyle.appendChild(input);
								divnewstyle.appendChild(input2);}

					function removeStyle( child ) {
							  var child = document.getElementById(\'child\');
					          var parent = document.getElementById(\'jNewsStyles\');
					          parent.removeChild(\'child\');
						}';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($script);
        ?>
		<div id="jNewsStyles" class="visible">
		<input type="hidden" value="0" name="stylechosen">
		<fieldset class="adminform" width="100%">
					<legend><?php 
        echo 'Styles';
        ?>
 </legend>
					<table width="100%">
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h1']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_TH1;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[style_h1]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h1']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h2']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_TH2;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[style_h2]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h2']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h3']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_TH3;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[style_h3]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h3']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h4']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_TH4;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[style_h4]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h4']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h5']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_TH5;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[style_h5]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h5']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h6']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_TH6;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[style_h6]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_h6']);
        ?>
"/></td>
						</tr>
						<tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_a']);
        ?>
">a</span></td>
							<td><input type="text" size="50" name="styles[style_a]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_a']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><ul style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_ul']);
        ?>
"><li style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_li']);
        ?>
">ul</li><li style="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_li']);
        ?>
">li</li></ul></td>
							<td><input type="text" size="50" name="styles[style_ul]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_ul']);
        ?>
"/>
							<br/><input type="text" size="50" name="styles[style_li]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['style_li']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_unsubscribe']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_UNSUB;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[aca_unsubscribe]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_unsubscribe']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_subscribe']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_SUB;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[aca_subscribe]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_subscribe']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_content']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_CONTENT;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[aca_content]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_content']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_title']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_CHEAD;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[aca_title]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_title']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_readmore']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_CREADMORE;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[aca_readmore]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_readmore']);
        ?>
"/></td>
						</tr>
						<tr>
							<td><span style="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_online']);
        ?>
"><?php 
        echo _JNEWS_TEMPLATE_STYLE_VONLINE;
        ?>
</span></td>
							<td><input type="text" size="50" name="styles[aca_online]" value="<?php 
        echo jNews_Templates::escapeVal(@$styles['aca_online']);
        ?>
"/></td>
						</tr>
						<?php 
        if ($GLOBALS[JNEWS . 'show_jcalpro'] and class_exists('jNews_Pro')) {
            $jcal .= '';
            $jcal .= '<tr><td><span style="' . jNews_Templates::escapeVal(@$styles['aca_jcalcontent']) . '">' . _JNEWS_TEMPLATE_STYLE_JCALCONTENT . '</span></td>';
            $jcal .= '<td><input type="text" size="30" name="styles[aca_jcalcontent]" value="' . jNews_Templates::escapeVal(@$styles['aca_jcalcontent']) . '"/></td></tr>';
            $jcal .= '<tr><td><span style="' . jNews_Templates::escapeVal(@$styles['aca_jcaltitle']) . '">' . _JNEWS_TEMPLATE_STYLE_JCALTITLE . '</span></td>';
            $jcal .= '<td><input type="text" size="30" name="styles[aca_jcaltitle]" value="' . jNews_Templates::escapeVal(@$styles['aca_jcaltitle']) . '"/></td></tr>';
            echo $jcal;
            unset($styles['aca_jcalcontent']);
            unset($styles['aca_jcaltitle']);
        }
        ?>
						<?php 
        unset($styles['aca_unsubscribe']);
        unset($styles['aca_subscribe']);
        unset($styles['aca_content']);
        unset($styles['aca_title']);
        unset($styles['aca_readmore']);
        unset($styles['aca_online']);
        unset($styles['style_a']);
        unset($styles['style_ul']);
        unset($styles['style_li']);
        unset($styles['style_h1']);
        unset($styles['style_h2']);
        unset($styles['style_h3']);
        unset($styles['style_h4']);
        unset($styles['style_h5']);
        unset($styles['style_h6']);
        unset($styles['color_bg']);
        if (!empty($styles) && $GLOBALS[JNEWS . 'level'] > 2) {
            foreach ($styles as $className => $style) {
                ?>
								<tr>
									<td>
										<span id="jnews<?php 
                echo $className;
                ?>
" style="<?php 
                echo jNews_Templates::escapeVal($style);
                ?>
"><?php 
                echo $className;
                ?>
</span>
									</td>
									<td>
										<input id="jnews<?php 
                echo $className;
                ?>
" type="text" size="50" name="styles[<?php 
                echo $className;
                ?>
]" value="<?php 
                echo jNews_Templates::escapeVal($style);
                ?>
"/>
									</td>

								</tr>
							<?php 
            }
        }
        ?>
						<tr>
					</table>
					<?php 
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            ?>
					<div id="divnewstyle"></div>
					<a href="javascript:void(0);" onclick='addNewStyle()'><?php 
            echo _JNEWS_TEMPLATE_STYLE_NEW;
            ?>
</a>
					<?php 
        }
        ?>
				</fieldset>
				</div>

		<?php 
    }