<?php /**/ /*cleaned*/?><?php

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
class HTML_2J_TABS_CSS {
	function edit( $content, $option, $lists) {
		$css_path  =  JPATH_SITE.DS."plugins".DS."system".DS."2j_tabs".DS.$lists['cur_file'] ;
		?>
		<form action="index2.php" method="post" name="adminForm_edit">
		<table class="adminform">
		<tr>
			<td align="right"><strong>Select CSS file:</strong> <?php echo $lists['file_select']; ?> <input type="submit" name="Edit" value="Edit" class="button"></td>
		</tr>
		<input type="hidden" name="option" value="<?php echo $option;?>" />

		<input type="hidden" name="task" value="css" />
		<input type="hidden" name="act" value="css" />
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<form action="index2.php" method="post" name="adminForm">
			<tr><th><?php echo $css_path; ?> (<b><?php echo is_writable($css_path) ? '<font color="green"> Writeable</font>' : '<font color="red"> Unwriteable</font>' ?></b>)</th></tr>

			<tr><td><textarea style="width:100%" cols="110" rows="25" name="filecontent" class="inputbox"><?php echo $content; ?></textarea></td></tr>
		</table>
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="act" value="css" />
		<input type="hidden" name="file_name_cc" value="<?php echo $lists['cur_file'];?>"/>
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>

	<?php
	}
}


class HTML_2J_TABS {

	function show( &$rows, &$lists, $pageNav, $option ) {
		?>
		<form action="index.php" method="post" name="adminForm">
		<table class="adminheading">
		<tr>
			<th><?php JText::_( '2J TABS: Items Manager'); ?></th>
		</tr>
		</table>

		<table class="adminlist">

		<thead>
		<tr>
			<th width="20">#</th>
			<th width="20"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" /></th>
			<th class="title">Name</th>
			<th width="10%" nowrap="nowrap">Section \ Category</th>
			<th width="10%" nowrap="nowrap">Tag in content</th>

		</tr>
		</thead>
		<tbody>
		<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row = &$rows[$i];
			JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES );
			$link 	= 'index.php?option=com_2j_tabs&task=editA&cid[0]='. $row->id;
			$row->checked_out = 0;
			$checked 	= JHTML::_('grid.checkedout',   $row, $i );
			?>
			<tr class="<?php echo 'row'. $k; ?>">
				<td align="center"><?php echo $pageNav->getRowOffset( $i ); ?></td>
				<td><?php echo $checked; ?></td>
				<td><a href="<?php echo $link; ?>" title="<?php echo JText::_( 'Edit' );?>::<?php echo $row->name; ?>"><?php echo $row->name; ?></a></td>

				<td><?php if(isset($row->cat_name)) echo $row->cat_name;?></td>
				<td align="center">{2jtabs_plugin <?php echo $row->id;?>}</td>
			</tr>
			<?php
			$k = 1 - $k;
		}
		?>
			</tbody>
			<tfoot>
				<tr>

					<td colspan="5">
						<?php echo $pageNav->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
		</table>

		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />

		<input type="hidden" name="hidemainmenu" value="0">
		<?php echo JHTML::_( 'form.token' ); ?>
		</form>
		<?php
	}


	function edit( &$row, &$lists, $option, $params ) {
		JRequest::setVar( 'hidemainmenu', 1 );

		JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES );
		?>
		<script language="javascript" type="text/javascript">

		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}

			// do field validation
			if (form.name.value == '') {
				alert( "Please fill in the name." );
			}  else {
				submitform( pressbutton );
			}
		}
		</script>
		<div class="col100">
		<form action="index2.php" method="post" enctype="multipart/form-data" name="adminForm" id="adminForm">
		<fieldset class="adminform">

			<legend><?php echo JText::_( 'Details' ); ?></legend>

		<table align="left" class="admintable">
		<tr>
			<td  width="170" class="key">Name</td>
			<td><label for="name"><input class="inputbox" type="text" size="40" name="name" value="<?php echo $row->name; ?>"></label></td>
		</tr>

		<tr>
			<td colspan="2" align="center"><div style="width: 700px;"><?php echo $params->render();?></div></td>

		</tr>
		</table>

		<input type="hidden" name="id" value="<?php echo $row->id; ?>">
		<input type="hidden" name="option" value="<?php echo $option; ?>">
		<input type="hidden" name="task" value="">
		<?php echo JHTML::_( 'form.token' ); ?>
		</fieldset>
		</div>
		</form>

	<?php
	}

}
?>