<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$language.lblAdmin} : {$language.lbladminSettings} :  {$language.lblEnableDesignMode}</title>
{include file='CommonStyles.tpl'}
{include file='CommonCustomStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/inner-formlisting.css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/right-menu.css" />
<script type="text/javascript" src="{$common_js}/uploadImage.plugin.js"></script>
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script>
<link href="{$view_styles}/jqueryui.plugin.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="{$view_styles}/styles.css" type="text/css" />
<script type="text/javascript" src="{$view_javascript}/editor.page.js"></script>
<script type="text/javascript">
{literal}
$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$(".Top_menu ul li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$(".Top_menu ul li").click(function() {
		$(".Top_menu ul li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	
	$("#exp-col-but").click(function(){
     if($('.left_BoX').css('width')=="100%")
     {
         $('#demo-contentBox').animate({'width' : '100%'}, {duration: 'slow'});
		 $('#test .left_BoX').animate({'width':'100%'},{duration:'slow'});
         $("#exp-col-but").attr('class', 'expand-div');
    }else{
         $('#demo-contentBox').animate({'width' : "0px"}, {duration: 'slow'});
		 $('.left_BoX').animate({'width':'98%'},{duration:'slow'});
         $("#exp-col-but").attr('class', 'collapse-div');
    }
    return false;});

});
 {/literal}
 
 var typekeyActive	=	"{$typekeyActive}";
 
 {literal}
$(document).ready(function(){
 $(document).on('click',".tabhead",function() {         
  $(".tabhead").removeClass('active');  
  $(this).addClass("active");
  $(".tab-content").hide();
  var selected_tab = $(this).attr("rel");  
  $('#'+selected_tab).show(); 
   $("#typekeyActive").val(selected_tab);
 });
 $("#"+typekeyActive).addClass("active");
 $("#"+typekeyActive).show();
 
  $(document).on('click',".middele-arw.expand",function() {         
  $(".middele-arw").removeClass('expand');  
  $(this).addClass("collaps");
  $(".sidebar").hide();
  $(".Editor_lft").css("width","98%");
 });
 $(document).on('click',".middele-arw.collaps",function() {         
  $(".middele-arw").removeClass('collaps');  
  $(this).addClass("expand");
  $(".sidebar").show();
  $(".Editor_lft").css("width","65%");
 });
  {/literal}
 
 var fullwidth	=	"{$width|default:''}";
 
 {literal}
 

 // to get full width of image
  $(".fileuploader_field").css("width",fullwidth+"px");
 
});

{/literal}
</script>
</head>
<body>
<div class="outer_container"> {include file='CommonTop.tpl'} 
  <!--End:Header Container--> 
  <!--*************************************************START CONTAINER SECTION*************************************************-->
  <div class="content_container2 clearfix"> 
    
    <!--End: Right Block-->
    <div>
      <div id="common_message" ></div>
      {form->start name="formTemplateEditor" method="post"}
      {form->hidden name="typekeyActive" value=$typekeyActive}
      {form->hidden name="filenameactive" value=$filenameactive}
      {form->hidden name="filepathactive" value=$filepathactive}
      
      {if $typekeyActive!='IMAGE'}
      {form->validate name="validateEditor"  validate_event="no" validate="editor->required" error=$language.errRequired}
      {/if}
      <div class="Editor_blk clearfix">
        <div class="Editor_lft">
          <div class="editor-heder-section">
            <div class="fixing_right btn-controller">
              <ul class="clearfix">
                <li> {html->anchor caption="{$language.lblCancel}"  class="cancel-btn " href="editor/template/type/{$typekeyActive}/key/{$filekey}/tsort/{$tsortkey}/ssort/{$ssortkey}/jsort/{$jsortkey}/isort/{$isortkey}/lsort/{$lsortkey}/"}
                  {assign var="urlredirect" value=$siteUrl}
                  {if $previewactive!=''}
                  {assign var="urlredirect" value=$urlredirect|cat:"/"|cat:$previewactive}
                  {/if} </li>
                <li> {html->anchor href=$urlredirect name="preview" priv_href="product/preview/" class="preview-btn  " target="_blank" content="{$language.lblPreview}"}</li>
                <li>
                  <input type="submit" name="editorSubmit" class="save-btn  " value="{$language.lblSave}">
                </li>
              </ul>
            </div>
            {$language.lblFileName} : <span>{$filenameactive}</span><br />
              {$language.lblFilePath} :  <span>{$filepathactive}</span><br />
            {if $viewold!=1}
            {html->anchor class="linktext" caption="{$language.lblOlderVersion}" href="editor/template/type/{$typekeyActive}/key/{$filekey}/tsort/{$tsortkey}/ssort/{$ssortkey}/jsort/{$jsortkey}/isort/{$isortkey}/lsort/{$lsortkey}/v/1/"}
            {else}
            {html->anchor class="
            <linktext></linktext>
            " caption="{$language.lblCurrent}" href="editor/template/type/{$typekeyActive}/key/{$filekey}/tsort/{$tsortkey}/ssort/{$ssortkey}/jsort/{$jsortkey}/isort/{$isortkey}/lsort/{$lsortkey}/"}
            {/if} </div>
          <div id="editor">{if $typekeyActive=='IMAGE'}
            <div class="image_deatils">
              <ul>
                <li>{$language.lblFileType} : <strong>{$ext}</strong></li>
                <li>{$language.lblWidth} : {$width|default:''}px</li>
                <li>{$language.lblHeight} : {$height}px</li>
              </ul>
            </div>
            <div align="center" class="image">{if $viewold!=1}
              {form->upload_image name="imageFile" delete_button="no" path="{$imagePath}" file="{$filenameactive}" width="auto" validate="imageFile->isFileType->{$ext}" error=$language.errFileType validate_event="submit" size_caption=$language.lblMaximumFileSize}
              {else} 
              <!-- <img src="{$view_public_path}/uploads/filebackup/{$filtoeditDefault}" />
    --> 
    
    {form->upload_image name="imageFile" file="{$filtoeditDefault}" path="{$imagePath}" delete_button="no" width="auto" validate="imageFile->isFileType->{$ext}" error=$language.errFileType validate_event="submit" size_caption=$language.lblMaximumFileSize}
              
              {/if}
              <div class="clear"></div>
              <span class="smalltext">{$language.lblClickImage}</span> </div>
            {/if}</div>
        </div>
        <div class="middele-arw expand"> <a href="javascript:void(0);"></a> </div>
        <div class="sidebar">
          <div class="tabs">
            <ul class="clearfix">
              {foreach from=$fullFilesTypes item='fileHead'}
              <li class="tab-listing"><a href="javascript:void(0);" rel="{$fileHead}" {if $typekeyActive==$fileHead}class="tabhead active"{else} class="tabhead"{/if}>{$fileHead}</a> </li>
              {/foreach}
            </ul>
            {foreach from=$fileFullPath key='kk' item='filetype'}
            <div class="tab-content" id="{$kk}" style="display:none;"> 
            {form->start name="formTemplateEditorSearch" method="post"}
            {form->hidden name="typekeySearch" value=$kk}
              <div class="search clearfix"> {form->submit name="searchSubmit" value="Go"}{form->textbox name="search_{$kk}" class="auto-box" id="autocomplete"}{$filetype|@count}  items </div>
              {form->close} 
              <!---------sort ---------------->
              
              <div class="filetypehead"> 
                {assign var="namesort" value="a"}
                {assign var="datesort" value="d"}
                {assign var="namesortclass" value="sortable"}
                {assign var="datesortclass" value="sortable"}
				{assign var="sortfilekey" value="0"}
              {if $kk=='TPL'}
                {*$language.lblTemplates*}
                <div class="sortby"> <span class="fixing_right">
                {if $tsortkey=='d'}
                	{assign var="datesort" value="ddesc"}
                    {assign var="datesortclass" value="sortacnt"}
                {/if}
                {if $tsortkey=='ddesc'}
                 {assign var="datesortclass" value="sortdcnt"}
                {/if}
                {if $tsortkey=='a'}
                	{assign var="namesort" value="adesc"}
                    {assign var="namesortclass" value="sortacnt"}
                {/if}
                 {if $tsortkey=='adesc'}
                 {assign var="namesortclass" value="sortdcnt"}
                 {/if}
                 
                 {if $typekeyActive==$kk}
                 {assign var="sortfilekey" value=$filekey}
                 {/if}
                {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/tsort/{$datesort}/ssort/{$ssortkey}/jsort/{$jsortkey}/lsort/{$lsortkey}/isort/{$isortkey}/" content="{$language.lblModified} <span class={$datesortclass}></span>"}</span> 
                {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/tsort/{$namesort}/ssort/{$ssortkey}/jsort/{$jsortkey}/lsort/{$lsortkey}/isort/{$isortkey}/" content="{$language.lblName} <span class={$namesortclass}></span>"} </div>
                {else if $kk=='LANGUAGE'}
                {*$language.lblLangauges*}
                <div class="sortby"> <span class="fixing_right"> 
                {if $lsortkey=='d'}
                	{assign var="datesort" value="ddesc"}
                    {assign var="datesortclass" value="sortacnt"}
                {/if}
                {if $lsortkey=='ddesc'}
                 {assign var="datesortclass" value="sortdcnt"}
                {/if}
                {if $lsortkey=='a'}
                	{assign var="namesort" value="adesc"}
                    {assign var="namesortclass" value="sortacnt"}
                {/if}
                 {if $lsortkey=='adesc'}
                 {assign var="namesortclass" value="sortdcnt"}
                 {/if}
                 {if $typekeyActive==$kk}
                 {assign var="sortfilekey" value=$filekey}
                 {/if}
                {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/lsort/{$datesort}/tsort/{$tsortkey}/ssort/{$ssortkey}/jsort/{$jsortkey}/isort/{$isortkey}/" content="{$language.lblModified} <span class={$datesortclass}></span>"}</span> 
                {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/lsort/{$namesort}/tsort/{$tsortkey}/ssort/{$ssortkey}/jsort/{$jsortkey}/isort/{$isortkey}/" content="{$language.lblName}  <span class={$namesortclass}></span>"} </div>
                {else if $kk=='CSS'} 
                {*$language.lblStyles*}
                {if $lsortkey=='d'}
                	{assign var="datesort" value="ddesc"}
                    {assign var="datesortclass" value="sortacnt"}
                {/if}
                {if $lsortkey=='ddesc'}
                 {assign var="datesortclass" value="sortdcnt"}
                {/if}
                {if $lsortkey=='a'}
                	{assign var="namesort" value="adesc"}
                    {assign var="namesortclass" value="sortacnt"}
                {/if}
                 {if $lsortkey=='adesc'}
                 {assign var="namesortclass" value="sortdcnt"}
                 {/if}
                 {if $typekeyActive==$kk}
                 {assign var="sortfilekey" value=$filekey}
                 {/if}
                <div class="sortby "> <span class="fixing_right">{html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/ssort/{$datesort}/tsort/{$tsortkey}/jsort/{$jsortkey}/lsort/{$lsortkey}/isort/{$isortkey}/" content="{$language.lblModified} <span class={$datesortclass}></span>"}</span> {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/ssort/{$namesort}/tsort/{$tsortkey}/jsort/{$jsortkey}/lsort/{$lsortkey}/isort/{$isortkey}/" content="{$language.lblName} <span class={$namesortclass}></span>"} </div>
                {else if $kk=='JS'}{*$language.lblJavascripts*}
                {if $jsortkey=='d'}
                	{assign var="datesort" value="ddesc"}
                    {assign var="datesortclass" value="sortacnt"}
                {/if}
                {if $jsortkey=='ddesc'}
                 {assign var="datesortclass" value="sortdcnt"}
                {/if}
                {if $jsortkey=='a'}
                	{assign var="namesort" value="adesc"}
                    {assign var="namesortclass" value="sortacnt"}
                {/if}
                 {if $jsortkey=='adesc'}
                 {assign var="namesortclass" value="sortdcnt"}
                 {/if}
                 {if $typekeyActive==$kk}
                 {assign var="sortfilekey" value=$filekey}
                 {/if}

                <div class="sortby"> <span class="fixing_right"> 
                {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/jsort/{$datesort}/tsort/{$tsortkey}/ssort/{$ssortkey}/lsort/{$lsortkey}/isort/{$isortkey}/" content="{$language.lblModified} <span class={$datesortclass}></span>"}</span> 
                {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/jsort/{$namesort}/tsort/{$tsortkey}/ssort/{$ssortkey}/lsort/{$lsortkey}/isort/{$isortkey}/" content="{$language.lblName}  <span class={$namesortclass}></span>"} </div>
                {else}{*$language.lblImages*}
                {if $isortkey=='d'}
                	{assign var="datesort" value="ddesc"}
                    {assign var="datesortclass" value="sortacnt"}
                {/if}
                {if $isortkey=='ddesc'}
                 {assign var="datesortclass" value="sortdcnt"}
                {/if}
                {if $isortkey=='a'}
                	{assign var="namesort" value="adesc"}
                    {assign var="namesortclass" value="sortacnt"}
                {/if}
                 {if $isortkey=='adesc'}
                 {assign var="namesortclass" value="sortdcnt"}
                 {/if}
                 {if $typekeyActive==$kk}
                 {assign var="sortfilekey" value=$filekey}
                 {/if}

                <div class="sortby"> <span class="fixing_right"> {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/jsort/{$jsortkey}/isort/{$datesort}/tsort/{$tsortkey}/ssort/{$ssortkey}/lsort/{$lsortkey}/" content="{$language.lblModified} <span class={$datesortclass}></span>"}</span> {html->anchor href="editor/template/type/{$kk}/key/{$sortfilekey}/isort/{$namesort}/jsort/{$jsortkey}/tsort/{$tsortkey}/ssort/{$ssortkey}/lsort/{$lsortkey}/" content="{$language.lblName}  <span class={$namesortclass}></span>"} </div>
                {/if} </div>
              <!--  sort end -->
              <div id="{$kk}" class="files-list" >
                <ul>
                  {assign var="typekey" value=$kk}
                  {foreach from=$filetype key='k' item='file'}
                  {assign var="selectedclass" value=""}
                {if $filekey==$k && $typekey==$typekeyActive}
                {assign var="selectedclass" value="active"}
                 {/if}
                  <li class="files-listing"> <span class="fixing_right">{$file.modifiedDate|date_format:$date_format}</span> {html->anchor href="editor/template/type/{$typekey}/key/{$k}/tsort/{$tsortkey}/ssort/{$ssortkey}/jsort/{$jsortkey}/isort/{$isortkey}/lsort/{$lsortkey}/" content="{$file.filename}" class="{$selectedclass}"} </li>
                  {/foreach}
                </ul>
              </div>
            </div>
            {/foreach} </div>
        </div>
        {if $typekeyActive!='IMAGE'}
        {assign var="mode" value="javascript"}
        {if $typekeyActive=='TPL'} {assign var="mode" value="html"} {else if $typekeyActive=='LANGUAGE'}{assign var="mode" value="xml"}
        {else if $typekeyActive=='CSS'}   {assign var="mode" value="css"}    {/if} 
        <script src="{$view_javascript}/src/ace.js" type="text/javascript" charset="utf-8"></script> 
        <script>
var jmode	=	"{$mode}";
window.onload = function() {
var editor = ace.edit("editor");
var textarea = $('textarea[name="editor"]').hide();
editor.setTheme("ace/theme/clouds");
editor.getSession().setMode("ace/mode/"+jmode);
editor.getSession().setValue(textarea.val());
editor.getSession().on('change', function(){
  textarea.val(editor.getSession().getValue());
});
};
</script> 
        {form->textarea name="editor" style="display:none" validate_submit="yes" value=$filtoeditDefault} 
        {/if} </div>
      <br />
      {form->close} 
      <!--End: left Block--> 
      
    </div>
  </div>
</div>

<!--End:Outer Container--> 
{include file='CommonJavaScriptBottom.tpl'} 

{form->validate_script form="formTemplateEditor"}
{html->messages_script id="common_message"}
</body>
</html>