<?php
/* id="csslevel"
Plugin Name: skin-editor
Plugin URI: http://www.dennisonwolfe.com/
Description: This editor creates a unique custom folder for every new site created on wpmu.
		The custom folder is create in (\wp-content\themes\thesis_[version]\custom\skins) and it\'s name is the same as the site name.
		You can use this folder to customize the site without affecting the other sites
Version: 1.0.1
Author: Dennison+Wolfe Internet Group
Author URI: http://www.dennisonwolfe.com/
*/

/*  Copyright 2010  Dennison+Wolfe Internet Group  (email : tyler@dennisonwolfe.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

//  include('D:\xampp\htdocs\dwdining\wp-content\info\debug.php');
//=== debugger($wpdb->dmtable);

$mainPlugFile = __FILE__;
// error_reporting(E_ALL & ~(E_STRICT|E_NOTICE|E_WARNING|E_DEPRECATED));
// ini_set("display_errors", 1);
include("skin-functions.php");

function skin_forms(){
?>		
<div id="skineditor_admin" class="wrap">
	<?php screen_icon(); ?>
	<h2>Skin editor</h2>
	<ul id="tabs" class="skineditor_tabs">
		<li><a href="#frmAddSTheme">Add Skin</a></li>
		<li><a href="#frmAddVariation">Add Variation</a></li>			
		<li><a href="">Client view</a></li>
		<li><a href="">Skin view</a></li>
		<li><a href="#frmActivate">Assign Skin/Variation</a></li>
		<li><a href="#frmEdit">Edit Skin/Variation</a></li>
	</ul>
	<div class="clear"></div>
	<div id="info_message" class="info-msg"></div>	
	<p>	
	<div id="frmAddSTheme">
	<form method="get" accept-charset="utf-8" action="">
		<input type="hidden" name="action" value="skineditor_addSubTheme"/>
		<table class='widefat skins'>
			<thead>
				<tr>
					<th > Add Skin: &nbsp;&nbsp;&nbsp;<small style="color: #AAAAAA;">this is a thesis sub theme</small></th>
					<th ></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td width='280px'>
						<select id='ddlThemesTypes' name='ddlThemesTypes' class='widefat widthz' >
							<option value='thesis_18' selected='selected'>thesis_18</option>
							<option value='thesis_17'>thesis_17</option>
							<option value='thesis_16'>thesis_16</option>
						</select>
					</td>
					<td align='left'>		
						<small style="color: #AAAAAA; ">(Template to be used)</small>
					</td>
				</tr>
				<tr>
					<td width='280px'>
						<input type="text" id="txtDescription" name="txtDescription" value="type Description here" class="widthz" 
						onfocus="if (this.value == 'type Description here') {this.value = '';}" 
						onblur="if (this.value == '') {this.value = 'type Description here';}"/>
					</td>
					<td align='right'>		
						
					</td>
				</tr>
				<tr>
					<td width='280px'>
						<input type="text" id="txtSubTheme" name="txtSubTheme" value="type skin name here" class="widthz"  
						onfocus="if (this.value == 'type skin name here') {this.value = '';}" 
						onblur="if (this.value == '') {this.value = 'type skin name here';}"/>
					</td>
					<td align='right'>		
						<div  onmouseover="this.style.cursor='pointer'" id="btSubTheme" name="btSubTheme" class="button" style="width:93px; margin-top:1px;">
							Add Skin
						</div>
						<div  onmouseover="this.style.cursor='pointer'" id="btActs" name="btActs" class="button" style="display: none; width:93px; margin-top:1px;">
							Activate Skin
						</div>
					</td>
				</tr>		
			</tbody>
		</table>
	</form>
	</div>
	</p>
	<p>
	<div id="frmAddVariation" >		
	<form method="get" accept-charset="utf-8" action="">
		<input type="hidden" name="action" value="skineditor_addVariation"/>	
		<table id="tbAddVariation" class='widefat skins' cellspacing= '10px'>
			<thead>
				<tr>
					<th > Add Variations: &nbsp;<small style="color: #AAAAAA; ">for a Skin</small></th>
					<th ></th>
				</tr>
			</thead>
			<tbody>
				<tr >
					<td width='450px' >
						<div style="margin-top: 10px;">
							<strong>existing skins</strong>
						</div>
					</td>
					<td >		
						
					</td>
				</tr>				
				<tr>
					<td >
					
					<div id="listSubThemes">
						<?php fillListSubThemes('ddlSubThemes'); ?>
					</div>
					<div id="listSubThemes-desc">
						<small style="color: #AAAAAA; ">(select a skin to be used)</small>
					</div>
					<div class="clear"></div>
						<div style="margin-top: 15px; margin-bottom: 5px;">
							<strong>existing variations</strong>
							&nbsp;&nbsp;&nbsp;<small style="color: #AAAAAA;">for selected skin above</small>
						</div>								
					<div id="listVariation" >
						<?php fillListVariation('lstVariations'); ?>
					</div>
					</td>
					<td>		
						
					</td>
				</tr>
				<tr ><td><p>&nbsp;</p></td><td></td></tr>
				<tr >
					<td width='280px'>
						
					</td>
					<td >		
						
					</td>
				</tr>
				<tr>
					<td width='280px'>
						<input type="text" id="txtVariations" name="txtVariations" value="type variation name here" class="widthz"  
						onfocus="if (this.value == 'type variation name here') {this.value = '';}" 
						onblur="if (this.value == '') {this.value = 'type variation name here';}"/>
					</td>
					<td align='right'>		
						<div onmouseover="this.style.cursor='pointer'" id="btVariations" name="btVariations" class="button" style="width:93px; margin-top:1px;">
							Add Variations
						</div>
					</td>
				</tr>		
			</tbody>
		</table>
	</form>
	</div>
	</p>
	<p>		
	<div id="frmActivate" >		
	<form id="formActivate" method="get" accept-charset="utf-8" action="">
		<input type="hidden" name="action" value="skineditor_activate"/>
		<table class='widefat skins'>
			<thead>
				<tr>
					<th width='120px'> Activate Variation for site: </th>
					<th ></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td colspan="2">								
						<div id="filter" >									
							<input type="text" id="txtUrl" name="txtUrl" value="type here to filter domains"  
							onfocus="if (this.value == 'type here to filter domains') {this.value = '';}" class="widthz"
							onblur="if (this.value == '') {this.value = 'type here to filter domains';}"/>
						</div>								
						<div id="listUrl" >
							<?php fillListDomain('ddlUrl'); ?>
						</div>
						
						<div class="clear"></div>
					</td>							
				</tr>
				<tr>
					<td width='640px'>
						<div id="listSTAct" >
							<?php fillListSubThemes('ddlSTAct'); ?>
						</div>
						<div id="listVAct" >
							<?php fillListVariation('ddlVAct', null, null, true); ?>
						</div>
						<div class="clear"></div>
					</td>
					<td align='right'>
						<div onmouseover="this.style.cursor='pointer'" id="btDeactivate" name="btDeactivate" class="button" >
							Deactivate
						</div>
						<div style="display:none" onmouseover="this.style.cursor='pointer'" id="btActivate" name="btActivate" class="button">
							Activate
						</div>
					</td>
				</tr>
			</tbody>
		</table>
		<div id="hiddenUrl" ></div>
	</form>
	</div>								
	</p>
	<p>
	<div id="frmEdit" >		
	<form id="formEdit" method="get" accept-charset="utf-8" action="">
		<input type="hidden" name="action" value="skineditor_edit"/>
		<table class='widefat skins'>
			<thead>
				<tr>
					<th width='120px'> Edit CSS or Function Files: </th>							
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>
						<div id="error_message"></div>
					</td>
				</tr>
				<tr>
					<td>
						<div>
							<div>
								<div id="filterEdit" class="select-dropdown">									
									<input type="text" id="txtUrlEdit" name="txtUrlEdit" value="type here to filter domains"  
									onfocus="if (this.value == 'type here to filter domains') {this.value = '';}"
									onblur="if (this.value == '') {this.value = 'type here to filter domains';}"/>
								</div>
								<div id="listUrlEdit" class="select-dropdown">
									<?php fillListDomain('ddlUrlEdit'); ?>
								</div>
								<div class="clear"></div>
							</div>
							<div>
								<div id="listSTEdit" class="select-dropdown">
									<?php fillListSubThemes('ddlSTEdit'); ?>
								</div>
								<div id="listVEdit" class="select-dropdown">
									<?php fillListVariation('ddlVEdit', null, null, true); ?>
								</div>
								<div class="clear"></div>
							</div>
						</div>
					</td>					
				</tr>
				<tr>
					<td>
						<div style="margin-top: 10px;">
							<strong>Customization level</strong>
						</div>
					</td>	
				</tr>
				<tr>
					<td>
						<div>
							<div class="css-options">									
								<label>Thesis custom files<input type="radio" name="csslevel" value="custom" /></label>
							</div>
							<div class="css-options">
								<label>Skin files<input type="radio" name="csslevel" value="subtheme" /></label>	
							</div>
							<div class="css-options">
								<label>Variation files<input type="radio" name="csslevel" value="variation" /></label>
							</div>
							<div class="css-options">
								<label>Site level files<input type="radio" name="csslevel" value="sitelevel" /></label>
							</div>
							<div class="clear"></div>
						</div>
					</td>	
				</tr>
				<tr>
					<td>
						<div style="margin-top: 10px;">
							<strong>File Type</strong>
						</div>
					</td>	
				</tr>
				<tr>
					<td>
						<div>
							<div  class="css-options">									
								<label>Edit css files<input type="radio" name="optFiles" value="cssfile" /></label>
							</div>
							<div class="css-options">
								<label>Edit function files<input type="radio" name="optFiles" value="functionfile" /></label>	
							</div>
							<div  onmouseover="this.style.cursor='pointer'" id="btEditText" name="btEditText" class="button">
								Edit File
							</div>
							<div class="clear"></div>
						</div>
					</td>		
				</tr>
				<tr class="border-tops">
					<td>
						<div  id="info_message_edit" class="info-msg"></div>
						<div class="txtarea">
							<textarea id="txtcontent" name="txtcontent">	</textarea>
						</div>
					</td>	
				</tr>
				<tr>
					<td>
						<div  onmouseover="this.style.cursor='pointer'" id="btSaveText" name="btSaveText" class="button">
							Save File
						</div>
						<div  id="saved_msg"></div>
						<div class="clear"></div>
					</td>		
				</tr>
			</tbody>
		</table>		
	</form>
	</div>								
	</p>		
</div>
<?php		
}
?>