File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/templates/layout.form.tpl
{template="header"}
{capture name=chooseTemplateContainer}
<span id="dl_%%name%%" class="TemplateBox">
<div style="font-weight: bold; font-size: 14px; padding-bottom: 5px;">%%name%%</div>
<a class="open-preview" href='%%fullpreviewpath%%?height=300&width=300' title="%%name%%" id="preview_src_%%name%%">
<img src='%%thumbpath%%' style='border: 0px' width="200" height="150" id="preview_img_%%name%%"></a>
<div style="padding-top:5px;padding-bottom:5px;">
%%colorlist%%
</div>
<a href="#" onclick="javascript:DownloadTemplate('%%name%%', '%%version%%');" title="Template Download" style="text-decoration: none">
<input type="button" class="Button" value="%%buttontext%%" >
</a>
<br/>
</span>
{/capture}
<!-- start common top -->
{template="common.form.top"}
<!-- end common top -->
</div>
{if $config.AllowTestingCommands}{template="layout.form.testing"}{/if}
</td>
</tr>
</table>
<script type="text/javascript" src="../javascript/jquery.form.js"></script>
<!-- this js is used by headerimage and logo -->
<script type="text/javascript" src="../javascript/jquery/plugins/ajax.file.upload.js"></script>
<script type="text/javascript" src="../javascript/admin.layout.headerimage.js"></script>
<style type="text/css">
{$moduleIconsCss}
</style>
<script type="text/javascript">
<!--
// Global variables
{$declareJS}
var listCounter = 1;
var sourceLists = ['layoutListsMenus' ,{foreach from=$modulesList item=thisModule key=moduleId}'{$moduleId}ModuleBlocks',{/foreach} 'miscBlocks1', 'miscBlocks2', 'miscBlocks3', 'miscBlocks4', 'sysBlocks', 'miscBlocks5', 'miscBlocks6'];
var targetLists = ['layoutBoxLeft','layoutBoxTop','layoutBoxMiddle','layoutBoxRight','layoutBoxBottom'];
var layoutSections = ['layoutBoxLeft','layoutBoxTop','layoutBoxMiddle','layoutBoxRight','layoutBoxBottom'];
var tmpSavedDragID = '';
var tmpSavedCloneID = '';
var revertAction = '';
var hasPHPBlockPerm = {$hasPHPBlockPerm};
var startSystemBlocks = '';
var previousTemplate = '';
var CurrentTemplateVersion = '{$templateVersion}';
var CurrentSelectedTemplate = '{$config.template}';
var CurrentSelectedTemplateColor = '{$config.SiteColor}';
var NewTemplateVersion = '{$templateVersion}';
var reselectCurrentTemplate ='';
var currentTemplateNumber = 0;
var currentTemplate = '{$currentTemplate}';
var currentLayout = '{$currentTemplate}';
var layoutBlocksObject = {$templateColumns};
var templateColumns = {$templateColumns};
var selectedLayouts = {$selectedLayouts};
var defaultLayout = '{$defaultLayout}';
var WebsiteLayoutOptionsFor = '{$lang.WebsiteLayoutOptionsFor}';
chooseTemplateRow = {$chooseTemplateContainer|iwp_FilterJavascriptString};
{* Output the restricted sets into javascript *}
var restrictedSets = {
{foreach from=$restrictedSets key=section item=number id=restrictedLoop}
'layoutBox{$section|ucfirst}':{$number}{if !$restrictedLoop.last},{/if}
{/foreach}
};
jQuery(function($) {
// when a preview button is clicked, open the template preview window
$('.open-preview').bind('click', function() {
var a = $(this);
var img = new Image();
var win = $.fn.window.create({
title : a.attr('title')
});
// after the window is closed, do some house-keeping
win.jQuery().bind('windowAfterClose', function() {
// unbind the previewImage resize event after the window is closed so that
// when the window isn't open, the event isn't fired (if it is fired, it
// will cause JS errors)
$(window).unbind('resize.previewImage');
});
// after the image is loaded, open the window
img.onload = function() {
win.content(img);
win.getContent().css('text-align', 'center');
win.width(img.width).height(img.height);
// so we can refer to the orignal dimensions
var imgW = img.width;
var imgH = img.height;
$(window).bind('resize.previewImage', function() {
// we set the initial dimensions for a reference point
win.dimensions('75%', '60%');
var content = win.getContent();
var jqImage = content.find('img');
var coreImage = jqImage.get(0);
// reset the widht and height so it can auto-scale
jqImage.removeAttr('width').removeAttr('height');
// resize the height if necessary
if (content.height() < jqImage.height()) {
coreImage.height = win.getContent().height();
}
// resize the width if necessary
if (content.width() < jqImage.width()) {
// remove the previously set height so it will auto-scale
jqImage.removeAttr('height');
// set the width
coreImage.width = win.getContent().width();
}
// now reset the window dimensions so it perfectly wraps the image
win.dimensions(jqImage.width(), jqImage.height()).center();
});
// now open the window
win.open();
// resize it
$(window).trigger('resize.previewImage');
// hide the loader after the image is loaded, resized and the window is open
setTimeout(function() {
iwp.hideLoadingIndicator();
}, 100);
}
// show the loader before setting the src
iwp.showLoadingIndicator();
// set the src attribute after setting the onload event
img.src = a.attr('href');
return false;
});
});
function CheckLayoutChanges(){
if(!SiteLayout.HasMadeChanges) {
return true;
}
// specifically replacing " as it's from the language file so a literally can't be placed in it
if(confirm(iwp.lang.get('layoutChangesMadeSaveNow').replace('%s', $('#templatefile option[value='+currentTemplate+']').text()).replace(/\"\;/g, '"'))) {
// save the template
var tmpNextTemplate = $('#templatefile').val();
$('#templatefile').val(currentLayout);
$('#frmSiteLayout').submit();
$('#templatefile').val(tmpNextTemplate);
}
SiteLayout.HasMadeChanges = false;
return true;
}
function PermissionDenied () {
alert(iwp.lang.get('layoutNoPermission'));
}
function CheckTemplateVersion(){
// do the ajax request
$('#TemplateVersionCheck').html('<i><img src="images/loading.gif" /> Checking Version...</i>');
$.ajax({
url: 'remote.php?section=layout&action=CheckNewTemplateVersion&template='+ CurrentSelectedTemplate,
dataType: 'json',
error: function(){
$('#MainMessage').errorMessage({$lang.layoutTemplateDownloadNoData|iwp_FilterJavascriptString});
$('#TemplateVersionCheck').html('');
},
success: function(json) {
if(!json.success){
$('#MainMessage').errorMessage(json.message);
return;
}
if(json.hasnewversion){
NewTemplateVersion = json.newversion;
$('#TemplateVersionCheck').html('<img src="images/success.gif" align="absmiddle"> ' + iwp.lang.get('layoutNewVersionAvailable').replace('%s', json.newversion));
$('#TemplateVersionCheck').show(0);
$('#TemplateVersionCheck').css("background-color","#99FF66");
$('#TemplateVersionCheck').animate({ backgroundColor: '#F9F9F9' }, { queue: true, duration: 1000 });
$('#TemplateVersionCheckButton').hide();
$('#DownloadNewVersionButton').show();
}else{
$('#TemplateVersionCheck').html(iwp.lang.get('layoutAlreadyHaveLatestTemplate'));
}
}
});
}
function DownloadNewVersion(force) {
var download = false;
if (iwp.util.isDefined(force) && force == true) {
download = force;
} else {
download = confirm('{$lang.DownloadNewVersionWarning|iwp_js}');
}
if (download) {
_DownloadTemplate(CurrentSelectedTemplate, NewTemplateVersion, function(json){
$.fn.window.closeAll();
$('#TemplateVersionCheck').html(json.message);
RefreshSelectableTemplateList();
});
$('#TemplateVersionCheckButton').show();
$('#DownloadNewVersionButton').hide();
$('#CurrentTemplateHeading').text(CurrentSelectedTemplate + '(' + CurrentSelectedTemplateColor + ') - Version ' + NewTemplateVersion);
}
}
/**
* These are the options for all the sortable lists, it defines all the options like which box connects with what and any event functions.
*/
var fieldSortableOptions = {
connectWith : ['#layoutsContainer .layoutBoxLeft', '#layoutListsSaved', '#layoutsContainer .layoutBoxTop', '#sysBlocks', '#layoutsContainer .layoutBoxMiddle','#layoutsContainer .layoutBoxRight','#layoutsContainer .layoutBoxBottom',{foreach from=$modulesList item=thisModule key=moduleId}'#{$moduleId}ModuleBlocks',{/foreach} '#layoutListsMenus'],
placeholder : 'dropClass',
cursor : 'move',
cancel : '.ContentPlaceholder',
start : function (e, ui){
var fromListId = $(this).attr('id');
var itemId = ui.item.attr('id');
var newId = SiteLayout.RemoveCopyName(ui.item.attr('id')) + '_copy' + listCounter;
listCounter++;
$('#' + itemId).clone().attr('id', newId).insertAfter('#' + itemId).hide();
tmpSavedCloneID = newId;
tmpSavedDragID = itemId;
},
stop : function (e, ui) {
var fromListId = $(this).attr('id');
var toListId = $('#'+tmpSavedDragID).parent().attr('id');
var sendAction = '',
moduleAction ='',
moduleName ='',
sendURL = '',
blockInfo = '';
var tbHeight = '300';
var tbWidth = '600';
var toListChildrenCount = $('#'+toListId).children().size();
if (fromListId == toListId || in_array(fromListId, ['layoutBoxLeft', 'layoutBoxMiddle', 'layoutBoxRight', 'layoutBoxTop', 'layoutBoxBottom'])) {
$('#' + tmpSavedCloneID).remove();
return;
}
if (typeof restrictedSets[toListId] != 'undefined') {
if (toListChildrenCount > restrictedSets[toListId]) {
$('#'+tmpSavedCloneID).show();
$('#'+tmpSavedDragID).remove();
var restrictNumber = parseInt(restrictedSets[toListId]);
if (restrictNumber == 1) {
$('#MainMessage').warningMessage('{$lang.layoutBlocksInSectionRestrictedSingular|iwp.js}'.replace('%s',restrictNumber));
} else {
$('#MainMessage').warningMessage('{$lang.layoutBlocksInSectionRestricted|iwp.js}'.replace('%s', restrictNumber));
}
SiteLayout.RefreshOverlays();
return false;
}
}
// checking if the current item that was moved should be replaced in the previous list
// also if it has a pop-up box associated with it
// multiMenuItem - Means its from the 'Content & Images' section or a module block with a modal
if(in_array(fromListId, sourceLists) && ui.item.hasClass('multiMenuItem')) {
// We need to change the ID of the dragged block. The clone (which stayed in the original list) got a new ID,
// but in the code just below here, the lists will be reset by ResetMiscBlocks() which will restore the ID and
// clash with our block that we have just dragged, so we need to give this one a unique ID as well.
ui.item.attr('id',SiteLayout.RemoveCopyName(ui.item.attr('id'))+'_copy'+listCounter);
var newId = ui.item.attr('id');
tmpSavedDragID = ui.item.attr('id');
$('#miscBlocks1').sortable('destroy');
$('#miscBlocks2').sortable('destroy');
$('#miscBlocks3').sortable('destroy');
$('#miscBlocks4').sortable('destroy');
$('#miscBlocks5').sortable('destroy');
$('#miscBlocks6').sortable('destroy');
ResetMiscBlocks();
var buttons = '';
var boxTitle = '';
if(ui.item.hasClass('htmlBlock')){
sendAction = 'htmlBlock';
tbHeight = '200'
boxTitle = '{$lang.layoutAddaBlock}';
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" style=" float: right; font-weight:bold;" onClick="submitBlock();" /> <input type="button" value="{$lang.Cancel}" class="FormButton modalCloseAction" style="float: left;" />';
width = 450;
}else if(ui.item.hasClass('customContent')){
sendAction = 'customContent';
boxTitle = '{$lang.layoutAddaBlock}';
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" onClick="submitBlock();" style=" float: right;font-weight:bold;" /> <input type="button" value="{$lang.Cancel}" class="FormButton modalCloseAction" style="float: left;" />';
width = 550;
}else if(ui.item.hasClass('customImage')){
sendAction = 'customImage';
boxTitle = '{$lang.layoutAddanImageBlock}';
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" style="float: right;font-weight:bold;" onClick="submitBlock();" /><input type="button" value="{$lang.Cancel}" style="float: left;" class="FormButton modalCloseAction" />';
width = '350';
}else if(ui.item.hasClass('customPHP')){
sendAction = 'customPHP';
boxTitle = '{$lang.layoutAddCustomPHPBlock}';
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" style="float: right;font-weight:bold;" onClick="submitBlock();" /><input type="button" value="{$lang.Cancel}" style="float: left;" class="FormButton modalCloseAction" />';
width = 550;
}else if(ui.item.hasClass('childrenList')){
sendAction = 'layoutChildren';
boxTitle = '{$lang.layoutAddChildrenBlock}';
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" style="float: right;font-weight:bold;" onClick="submitBlock();" /><input type="button" value="{$lang.Cancel}" style="float: left;" class="FormButton modalCloseAction" />';
width = 550;
}else if(ui.item.hasClass('siblingsList')){
sendAction = 'layoutSiblings';
boxTitle = '{$lang.layoutAddSiblingsBlock}';
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" style="float: right;font-weight:bold;" onClick="submitBlock();" /><input type="button" value="{$lang.Cancel}" style="float: left;" class="FormButton modalCloseAction" />';
width = 550;
}else if(ui.item.hasClass('moduleHasPopup')){
var moduleBits = ui.item.attr('id');
moduleBits = moduleBits.split('_');
if(moduleBits[0] == 'module' && moduleBits[1].length > 0) {
moduleName = moduleBits[1];
blockName = moduleBits[2];
if (typeof SiteLayout.ModuleBlocks[moduleName] === 'object' && typeof SiteLayout.ModuleBlocks[moduleName][blockName] === 'object') {
blockInfo = SiteLayout.ModuleBlocks[moduleName][blockName];
moduleAction = blockInfo.action;
boxTitle = blockInfo.title;
buttons = '<input type="submit" value="{$lang.layoutBlockSave}" class="FormButton" style="float: right;font-weight:bold;" onclick="SiteLayout.ModuleBlocks.' + moduleName + '.' + blockName + '.SaveBlock();" /><input type="button" value="{$lang.Cancel}" style="float: left;" class="FormButton modalCloseAction" />';
width = blockInfo.width;
sendURL = 'remote.php?section=module&module=' + moduleName + '&action=' + moduleAction;
}
}
}
if (sendURL == '' && sendAction != '') {
sendURL = 'remote.php?section=layout&action=' + sendAction;
}
SiteLayout.tmpBlockType = sendAction;
if (sendURL != '') {
// create the window and set appropriate settings
var win = $.fn.window.create({
title : boxTitle,
width : width,
closeOnEscape : false,
uri : sendURL,
autoOpen : true
});
// if any of the close buttons are pressed, cancel the block move
win.buttons(buttons).jQuery().find('.modalClose, .modalCloseAction').unbind('click').bind('click', function() {
// show the temporary clone
$('#' + tmpSavedCloneID).show();
// cancel the block move
cancelBlockMove();
win.close();
});
SiteLayout.tmpBlockID = newId;
}
}else if(fromListId == 'layoutListsSaved'){
// check wasn't dragged into the same list, if so, destroy the clone!
if($('#'+tmpSavedDragID).parent().attr('id') == 'layoutListsSaved'){
$('#'+tmpSavedCloneID).remove();
}else{
$('#'+tmpSavedCloneID).show();
}
SetHasChanges();
$('#layoutListsSaved').sortable('destroy');
$('#layoutListsSaved').sortable(fieldSortableOptions);
{foreach from=$modulesList item=thisModule key=moduleId}
}else if(fromListId == '{$moduleId}ModuleBlocks' ){
// check wasn't dragged into the same list, if so, destroy the clone!
if($('#'+tmpSavedDragID).parent().attr('id') == '{$moduleId}ModuleBlocks'){
$('#'+tmpSavedCloneID).remove();
}else{
$('#'+tmpSavedCloneID).show();
}
SetHasChanges();
$('#{$moduleId}ModuleBlocks').sortable('destroy');
$('#'+tmpSavedCloneID).show();
$('#{$moduleId}ModuleBlocks').sortable(fieldSortableOptions);
{/foreach}
}else if(fromListId == 'sysBlocks'){
// check wasn't dragged into the same list, if so, destroy the clone!
if($('#'+tmpSavedDragID).parent().attr('id') == 'sysBlocks'){
$('#'+tmpSavedCloneID).remove();
}else{
$('#'+tmpSavedCloneID).show();
}
SetHasChanges();
$('#sysBlocks').sortable('destroy');
$('#'+tmpSavedCloneID).show();
$('#sysBlocks').sortable(sysFieldSortableOptions);
}else if(fromListId == 'layoutListsMenus'){
// check wasn't dragged into the same list, if so, destroy the clone!
if($('#'+tmpSavedDragID).parent().attr('id') == 'layoutListsMenus'){
$('#'+tmpSavedCloneID).remove();
}else{
$('#'+tmpSavedCloneID).show();
}
SetHasChanges();
$('#layoutListsMenus').sortable('destroy');
$('#layoutListsMenus').sortable(fieldSortableOptions);
}
}
};
var miscSortOptions = $.extend({}, fieldSortableOptions);
miscSortOptions.connectSelf = false;
fieldSortableOptions.helper = function(event, element){
return $(element).clone().appendTo('body');
}
var sysFieldSortableOptions = $.extend({}, fieldSortableOptions);
sysFieldSortableOptions.connectWith = ['.layoutBoxLeft', '.layoutBoxRight'];
/**
* This function opens up a window for editing a specific block item
*/
function EditBlock(id, type){
var id = parseInt(id);
if (id < 1){
return;
}
var tbHeight = '300';
var tbWidth = '600';
if (type == 'htmlBlock') {
tbHeight = '200'
} else if (type == 'customImage') {
tbHeight = '230'
tbWidth = '350';
}
// create the window
var win = $.fn.window.create({
uri : 'remote.php?section=layout&action=editBlock&blockid=' + id + '&type=' + type,
title : '{$lang.layoutEditaBlock}',
width : tbWidth,
autoOpen : true
});
// window buttons
var submitBtn = $('<button type="submit" style="font-weight: bold;">{$lang.layoutBlockSave}</button>');
var cancelBtn = $('<button type="button" style="float: left;">{$lang.Cancel}</button>');
// set button events
submitBtn.bind('click', submitBlock);
cancelBtn.bind('click', function() {
win.close();
});
// set the buttons and open it
win.buttons(submitBtn.add(cancelBtn));
}
function submitBlock() {
if (!$('#blockid').exists()) {
submitAddBlock();
} else {
var id = parseInt($('#blockid').val());
if (id < 1) {
submitAddBlock();
} else {
submitEditBlock(id);
}
}
}
/**
* This function is used when a user clicks the 'save' button when creating a block of any type in the window.
*/
function submitAddBlock() {
var blockType = SiteLayout.tmpBlockType;
var blockCurrentId = SiteLayout.tmpBlockID;
var data = {'blocktype': blockType};
switch(blockType){
case 'htmlBlock':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockNameRequired|iwp_js}');
return;
}
if($('#blockhtml').val() == ''){
alert('{$lang.layoutErrorBlockHTMLRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['blockhtml'] = $('#blockhtml').val();
break;
case 'layoutChildren':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockTitleRequired|iwp_js}');
return;
}
if($('#numberoflevels').val() == ''){
alert('{$lang.layoutErrorBlockNumLevelsRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['numberoflevels'] = $('#numberoflevels').val();
data['whattoshow'] = $('#layoutBlockChildrenPopup .whattoshow:checked').val();
data['contenttypes'] = $('#contenttypes').val().toString();
break;
case 'customPHP':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockNameRequired|iwp_js}');
return;
}
if($('#blockhtml').val() == ''){
alert('{$lang.layoutErrorBlockPHPRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['blockhtml'] = $('#blockhtml').val();
break;
case 'customContent':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockNameRequired|iwp_js}');
return;
}
if($('#blocktitle').val() == ''){
alert('{$lang.layoutErrorBlockTitleRequired|iwp_js}');
return;
}
$("#blockhtml").val(tinyMCE.get("blockhtml").getContent());
if($('#blockhtml').val() == ''){
alert('{$lang.layoutErrorBlockHTMLRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['title'] = $('#blocktitle').val();
data['blockhtml'] = $('#blockhtml').val();
break;
case 'customImage':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorImgBlockNameRequired|iwp_js}');
return;
}
if($('#blockimage').val() == ''){
alert('{$lang.layoutErrorImgBlockFileRequired|iwp_js}');
return;
}
submitImageAddBlock();
return;
}
$.post('remote.php?section=layout&action=saveblock', data, function(xml){
// post callback function
if($('status', xml).text() == 1 || $('status', xml).text() == '1'){
var newId = SiteLayout.tmpBlockType + '_' + $('newid', xml).text();
var cloneId = SiteLayout.RemoveCopyName(newId)+'_copy'+listCounter;
listCounter++;
$('#' + SiteLayout.tmpBlockID).html($($('newblockhtml', xml).text()).html()).attr('id', newId).addClass(newId);
$($('newblockhtml', xml).text()).appendTo('#layoutListsSaved');
$('#'+tmpSavedCloneID).show();
$('#MainMessage').successMessage(iwp.lang.get('layoutBlockSavedSuccess'));
SiteLayout.RefreshOverlays();
}
}, 'xml');
$.fn.window.closeAll();
}
/**
* This function is used when a user clicks the 'save' button when creating a block of any type in the window.
*/
function submitEditBlock(id){
var blockType = $('#blocktype').val().split("_");
var blockName = $('#blockname').val();
var data = {'blocktype': blockType, 'blockid': id};
switch (blockType[0]) {
case 'moduleBlock':
var module = blockType[1];
var moduleBlock = blockType[2];
SiteLayout.ModuleBlocks[module][moduleBlock].SaveEditBlock();
return;
break;
case 'htmlBlock':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockNameRequired|iwp_js}');
return;
}
if($('#blockhtml').val() == ''){
alert('{$lang.layoutErrorBlockHTMLRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['blockhtml'] = $('#blockhtml').val();
break;
case 'layoutChildren':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockTitleRequired|iwp_js}');
return;
}
if($('#numberoflevels').val() == ''){
alert('{$lang.layoutErrorBlockNumLevelsRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['numberoflevels'] = $('#numberoflevels').val();
data['whattoshow'] = $('#layoutBlockChildrenPopup .whattoshow:checked').val();
data['contenttypes'] = $('#contenttypes').val().toString();
break;
case 'customPHP':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockNameRequired|iwp_js}');
return;
}
if($('#blockhtml').val() == ''){
alert('{$lang.layoutErrorBlockPHPRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['blockhtml'] = $('#blockhtml').val();
break;
case 'customContent':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorBlockNameRequired|iwp_js}');
return;
}
if($('#blocktitle').val() == ''){
alert('{$lang.layoutErrorBlockTitleRequired|iwp_js}');
return;
}
$("#blockhtml").val(tinyMCE.get("blockhtml").getContent());
if($('#blockhtml').val() == ''){
alert('{$lang.layoutErrorBlockHTMLRequired|iwp_js}');
return;
}
data['name'] = $('#blockname').val();
data['title'] = $('#blocktitle').val();
data['blockhtml'] = $('#blockhtml').val();
break;
case 'customImage':
if($('#blockname').val() == ''){
alert('{$lang.layoutErrorImgBlockNameRequired|iwp_js}');
return;
}
submitImageAddBlock(id);
return;
}
blockType = blockType.join("_");
$.post('remote.php?section=layout&action=saveblock', data, function(xml){
// post callback function
if($('status', xml).text() == 1){
$('.' + blockType + '_' + id + ' span').text(blockName);
$('#MainMessage').successMessage('{$lang.layoutBlockSavedSuccess|iwp_js}');
}
}, 'XML');
$.fn.window.closeAll();
}
/**
* This is the function called to remove the block that was just moved over if no content was added or if they pressed the cancel button
*/
function cancelBlockMove() {
// remove the temporary block
$('#' + SiteLayout.tmpBlockID).remove();
// close all of the open windows
$.fn.window.closeAll();
}
/**
* This function scrolls the div that contains the list of current templates to the template number that is passed in. The counting starts from 1.
*/
function scrollToTemplate(templateNumber) {
$('#SelectableTemplateListOuterContainer').scrollLeft( parseInt((templateNumber * 220))-110-($('#SelectableTemplateListOuterContainer').width()/2) );
}
var firstTabsLoad = true;
function getTabIndexNumberByName(name) {
var i = 0;
$('ul.tabnav a').each(function(){
if ($(this).attr('href') == '#' + name) {
return false;
}
i++;
});
return i;
}
$(document).ready(function() {
// when the html has loaded, add the misc blocks, connect the sortables, check the columns
if({$TemplateCount} < 5){
$('#DownloadMoreTemplates').infoMessage(iwp.lang.get('layoutMoreTemplatesAvailable'));
}
var selectedTab = 0;
if ('{$forceTab}' != '') {
var selectedTab = '{$forceTab}';
selectedTab = getTabIndexNumberByName(selectedTab);
}
$('.HideTabsDuringLoad').removeClass('HideTabsDuringLoad');
$('#mainTabMenu').tabs({
show : function(Event, ui) {
if (ui.panel.id != 'sitelayout') {
$('.hideDiv').hide();
} else {
SiteLayout.RefreshOverlays();
}
if (ui.panel.id == 'templateselect') {
scrollToTemplate(currentTemplateNumber);
}
if (firstTabsLoad) {
firstTabsLoad = false;
}
},
selected : selectedTab
});
// set up default values
SiteLayout.CookiePrefix = '{$config.cookiePrefix}';
// select our default tab
SiteLayout.SelectTab(selectedTab);
// LoadItemsFromObject(templateColumns[currentTemplate]);
SiteLayout.SetupAccordian();
// lets set a default value we can revert using
startSystemBlocks = $('#sysBlocks').html();
var moduleLists = [ {foreach from=$modulesList item=thisModule key=moduleId id=moduleListLoop}'{$moduleId}ModuleBlocks'{if !$moduleListLoop.last},{/if}{/foreach} ];
SiteLayout.SetupSortableLists(moduleLists);
// make sure our data is all valid and clean
SiteLayout.SetupLayoutObject();
SiteLayout.SetupMiscBlocks();
// select a template so it shows the blocks and which sections are using the master template
SiteLayout.SelectLayout(currentLayout);
SiteLayout.CheckLayoutSet();
if(!hasPHPBlockPerm) {
$('.layoutItemCustomphp .layoutEditItem').css('display', 'none');
}
$('.useMasterOn').bind('mouseover', function(){ ShowQuickHelp(this, 'Using Master Layout', iwp.lang.get('layoutCurrentlyUsingMaster')); } );
// set up the ajax form
var options = {
success: saveFormReponse,
dataType: 'xml',
beforeSubmit: setupSaveFields
};
$('#frmSiteLayout').submit(function(){ setupSaveFields(); UnsetHasChanges(); });
$('#frmSiteLayout').ajaxForm(options);
$('#templatefile').bind('change', function () {
if(CheckLayoutChanges()){
SiteLayout.SelectLayoutFromField();
}
});
$('#clickToDownload').bind('click', function() { CheckNewTemplates(); });
$('.TemplateBox').bind('mouseout', function() {
$(this).removeClass('TemplateBoxOver');
$(this).addClass('TemplateBox');
});
$('.TemplateBox').bind('mouseover', function() {
$(this).addClass('TemplateBoxOver');
$(this).removeClass('TemplateBox');
});
{if $forceCheckDownload && $forceDownloadVersion != ''}
NewTemplateVersion = '{$forceDownloadVersion}';
DownloadNewVersion(true);
{/if}
});
// this is configured by the template config file
var layoutSets = {$layoutSetsJSON};
function DeleteBlock(deleteObj){
var id = SiteLayout.RemoveCopyName($(deleteObj).parents('.layoutListsMenusItem').attr('id'));
var sectionId = $(deleteObj).parents('.layoutListsAccordian').attr('id');
var blockName = $(deleteObj).parent().text();
blockName = blockName.replace(/^\s+|\s+$/g, '');
if(id.substr(0,4) == 'list') {
if(sectionId == 'layoutListsMenus') {
if(confirm('{$lang.layoutRemoveBlockFromEverywhere|iwp_js}'.replace('%s', blockName))) {
SiteLayout.HasMadeChanges = true;
$.getJSON('remote.php?section=layout&action=deletelist&listid=' + id, function(json){
if(json.success){
$('#outerLayoutsContainer .' + id).remove();
$('#MainMessage').successMessage('{$lang.layoutBlockRemovedSuccess|iwp_js}'.replace('%s', blockName));
}else{
$('#MainMessage').errorMessage('{$lang.layoutBlockRemovedError|iwp_js}'.replace('%s', blockName));
}
SiteLayout.RefreshOverlays();
});
}
}else{
if(confirm("{$lang.layoutConfirmRemoveListFromLayout}".replace('%s', blockName))) {
$(deleteObj).parents('.layoutListsMenusItem').remove();
}
}
}else{
if (sectionId == 'layoutListsSaved') {
// block is being deleted from the saved lists
if (confirm("{$lang.layoutBlockRemoveConfirm|iwp_js}".replace('%s', blockName))) {
SiteLayout.HasMadeChanges = true;
$.getJSON('remote.php?section=layout&action=deleteblock&blockid='+ id, function(json){
if (json.success) {
$('#outerLayoutsContainer .' + id).remove();
$('#MainMessage').successMessage('{$lang.layoutBlockRemovedSuccess|iwp_js}'.replace('%s', blockName));
} else {
$('#MainMessage').errorMessage('{$lang.layoutBlockRemovedError|iwp_js}'.replace('%s', blockName));
}
SiteLayout.RefreshOverlays();
});
}
} else {
// block is being deleted from the layout
if(confirm("{$lang.layoutConfirmRemoveBlockFromLayout}".replace('%s', blockName))){
$(deleteObj).parents('.layoutListsMenusItem').remove();
}
}
}
}
/**
* This function resets the 'misc blocks' section with the default list items.
* It should be used only when a list item is dragged out of the list because they can be added in multiple times
*/
function ResetMiscBlocks() {
$('#miscBlocks').html('<ul id="miscBlocks2" class="layoutListsAccordian" style="overflow: hidden;min-height: 20px;;"><li class="layoutListsMenusItem multiMenuItem customContent" id="customContent"><div id="type_customContent" class="layoutItemCustomContent typeDiv layoutBlockIconPosition"><div class="layoutDeleteItem deleteItem" onclick="DeleteList(this);"></div>{$lang.layoutCustomContentBlock}</div></li></ul>' +
'<ul id="miscBlocks1" class="layoutListsAccordian" style="overflow: hidden;min-height: 20px;"><li class="layoutListsMenusItem multiMenuItem htmlBlock layoutItemHtmlBlock" id="htmlBlock"><div id="type_htmlBlock" class="layoutItemHtmlblock typeDiv layoutBlockIconPosition"><div class="layoutDeleteItem deleteItem" onclick="DeleteList(this);" ></div>{$lang.layoutHTMLContentBlock}</div></li></ul>' +
'<ul id="miscBlocks3" class="layoutListsAccordian" style="overflow: hidden;min-height: 20px;"><li class="layoutListsMenusItem multiMenuItem customImage " id="customImage"><div id="type_imageBlock" class="layoutItemCustomImage typeDiv layoutBlockIconPosition"><div class="layoutDeleteItem deleteItem" onclick="DeleteList(this);" ></div>{$lang.layoutImageBlock}</div></li></ul>'
{if $hasPHPBlockPerm != 'false'} {* Yes, it's a string. It's used by JavaScript further up so needed to be output as a string. *}
+ '<ul id="miscBlocks4" class="layoutListsAccordian" style="overflow: hidden;min-height: 20px;"><li class="layoutListsMenusItem multiMenuItem customPHP" id="customPHP"><div id="type_phpBlock" class="layoutItemCustomPHP typeDiv layoutBlockIconPosition"><div class="layoutDeleteItem deleteItem" onclick="DeleteList(this);"></div>{$lang.layoutPHPBlock}</div></li></ul>'
{/if}
);
$('#listBlocks').html('<ul id="miscBlocks5" class="" style="overflow: hidden;min-height: 20px;"><li class="layoutListsMenusItem childrenList multiMenuItem" id="layoutChildren"> <div id="contentchildrendiv" class="layoutItemLayoutchildren typeDiv layoutBlockIconPosition"><div class="layoutDeleteItem deleteItem" onclick="DeleteBlock(this);"></div>{$lang.layoutChildrenBox}</div></li></ul>' +
'<ul id="miscBlocks6" class="" style="overflow: hidden;min-height: 20px;"><li class="layoutListsMenusItem contentArchive multiMenuItem" id="contentArchive"> <div id="contentarchivediv" class="layoutItemContentarchive typeDiv layoutBlockIconPosition"><div class="layoutDeleteItem deleteItem" onclick="DeleteBlock(this);"></div>{$lang.contentArchiveList}</div></li></ul>'
);
$('#miscBlocks1').sortable(fieldSortableOptions);
$('#miscBlocks2').sortable(fieldSortableOptions);
$('#miscBlocks3').sortable(fieldSortableOptions);
$('#miscBlocks4').sortable(fieldSortableOptions);
$('#miscBlocks5').sortable(fieldSortableOptions);
$('#miscBlocks6').sortable(fieldSortableOptions);
}
function ResetSystemBlocks(){
$('#sysBlocks').html(startSystemBlocks);
}
/**
* This function is used when the main form on the page is submitted via ajax and the response is returned.
* It processed the response XML and takes actions such as display a success message or an error message
*/
var styleGuideXmlErrors = '';
var validationErrors = '';
function saveFormReponse(xml, statusText) {
if($('status', xml).text() == 1){
if($('hasxmlerrors', xml).exists() && $('hasxmlerrors', xml).text() == 'yes'){
styleGuideXmlErrors = $('xmlerrors', xml).text();
validationErrors = $('xmlerrortitle', xml).text();
$('#xmlErrorsDiv').html(styleGuideXmlErrors);
$('#MainMessage').warningMessage('{$lang.layoutStyleGuideErrors|iwp_js} <a href="javascript:void(0);" onclick="ModalBoxInline(validationErrors,\'#xmlErrorsDiv\');">{$lang.layoutViewErrors}</a>.');
}else{
$('#MainMessage').successMessage('{$lang.layoutSavedSuccessfully|iwp_js}');
}
$.getJSON('remote.php?section=layout&action=gettemplatecolumns', function(json){ if(json.success) { templateColumns = json.columns; } } );
SiteLayout.RefreshOverlays();
}else if($('status', xml).text() == 0){
$('html').scrollTo( 'body', 500 );
var returntext = $('message', xml).text();
returntext = returntext.replace(/\"/g, "\\\"");
setTimeout("$(\"#MainMessage\").errorMessage(\"{$lang.layoutCouldNotSaveLayout|iwp_js} " + returntext + "\"); SiteLayout.RefreshOverlays();", 5);
}
return false;
}
/**
* This function is used when the submit button is used. It takes the columns on the page and saves them to an array that is submitted
*/
function setupSaveFields(layoutName){
if(typeof(templateName) == 'undefined'){
var layoutName = currentLayout;
}
var thisList = Array();
var position = '';
for(i=0;i<layoutSections.length;i++){
thisList = $('.'+layoutSections[i], $('#layoutsContainer')).sortable('toArray');
position = layoutSections[i].replace('layoutBox', '');
section = layoutSections[i];
if($('#hideDiv'+position).exists()){
thisList.unshift('usemaster');
}
if(typeof(layoutBlocksObject[layoutName]) == 'undefined'){
layoutBlocksObject[layoutName] = {};
layoutBlocksObject[layoutName][section] = Array();
}else{
if(typeof(layoutBlocksObject[layoutName][section]) == 'undefined'){
layoutBlocksObject[layoutName][section] = Array();
}
}
layoutBlocksObject[layoutName][section] = thisList;
$('#'+layoutSections[i]+'_hidden').val(thisList);
}
selectedLayouts[layoutName] = $('#layoutSet .layoutSetRadioFields:selected').val();
}
function UnsetHasChanges(){
window.onbeforeunload=null;
SiteLayout.HasMadeChanges = false;
}
function SetHasChanges(){
SiteLayout.HasMadeChanges = true;
window.onbeforeunload=CheckChanges;
}
function CheckChanges(e) {
if(!e) e = window.event;
//e.cancelBubble is supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = '{$lang.layoutUnsavedChanges|iwp_js}'; //This is displayed on the dialog
//e.stopPropagation works in Firefox.
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
}
UnsetHasChanges();
var MasterIsOn = false;
/**
* This function is used to handle the uploading of an image and saving of an image block
*/
function submitImageAddBlock(id) {
if (typeof(id) == 'indefined') {
var id = 0;
}
if ($('#blocknewwindow:checked').exists()) {
var newwindow = 1;
} else {
var newwindow = 0;
}
$.ajaxFileUpload({
url :'remote.php?section=layout&action=uploadCustomImage',
data : {
'blockname' : Url.encode($('#blockname').val()),
'blockalt' : Url.encode($('#blockalt').val()),
'blockurl' : Url.encode($('#blockurl').val()),
'newwindow' : newwindow,
'blockid' : id
},
secureuri : false,
fileElementId : 'blockimage',
dataType : 'xml',
beforeSend : function () {
var name = $('#blockimage').val().replace(/\\/g, '/');
name = name.split('/');
var pos = name.length;
var fileName = name[pos-1];
var idfileName = fileName.replace(/[^a-zA-Z0-9]/g, '');
if (fileName.length > 0) {
$('#uploadingBlockImage').show();
$('#uploadingBlockImage').infoMessage('{$lang.layoutPleaseWaitUploading|iwp_js}'.replace('%s', fileName));
}
},
success : function (xml, status) {
var name = $('file', xml).text().replace(/[^a-zA-Z0-9]/g, '');
if ($('status', xml).text() == 'success') {
// inserting a new block
if ($('method', xml).text() == "insert") {
$('#uploadingBlockImage').hide();
var newId = SiteLayout.tmpBlockType + '_' + $('newid', xml).text();
var cloneId = SiteLayout.RemoveCopyName(newId) + '_copy' + listCounter;
listCounter++;
$('#'+SiteLayout.tmpBlockID).html($($('newblockhtml', xml).text()).html()).attr('id', cloneId).addClass(newId);
$($('newblockhtml', xml).text()).appendTo('#layoutListsSaved');
$('#MainMessage').successMessage('{$lang.layoutBlockSavedSavePositionToo|iwp_js}');
// editing an old block
} else if($('method', xml).text() == "update") {
var newId = 'customImage_' + $('newid', xml).text();
var cloneId = SiteLayout.RemoveCopyName(newId) + '_copy' + listCounter;
listCounter++;
$('.' + newId).html($($('newblockhtml', xml).text()).html());
$('#MainMessage').successMessage('{$lang.layoutBlockSuccessfullyUpdated|iwp_js}');
}
$.fn.window.closeAll();
} else if($('status', xml).text() == 'error') {
alert($('message', xml).text());
}
SiteLayout.RefreshOverlays();
}
});
return false;
}
function SelectTemplate(TemplateID, template, color){
$.post('remote.php?section=layout&action=selecttemplate', {
template : template ,
color : color,
TemplateID : TemplateID
}, function(xml) {
if ($('status', xml).text() == 'success') {
reselectCurrentTemplate = function() {
SelectTemplate(TemplateID, template, color);
};
var TemplateID = $('templateid', xml).text();
currentTemplateNumber = parseInt($('#' + TemplateID + '_number').val());
scrollToTemplate(currentTemplateNumber);
$('.TemplateBoxOn').addClass('TemplateBox').removeClass('TemplateBoxOn');
$('.TemplateBox').bind('mouseout', function() {
$(this).removeClass('TemplateBoxOver');
$(this).addClass('TemplateBox');
});
$('.TemplateBox').bind('mouseover', function() {
$(this).addClass('TemplateBoxOver');
$(this).removeClass('TemplateBox');
});
$('#'+TemplateID).removeClass('TemplateBox').addClass('TemplateBoxOn');
$('#'+TemplateID).unbind('mouseover');
$('#'+TemplateID).unbind('mouseout');
var newTemplateText = '{$lang.layoutWebsiteNowUsingTemplate|iwp_js}'.replace('{template}' , $('template', xml).text()).replace('{color}', $('color', xml).text());
$('#templateSelectedMessage').html('<div class="Text" style="text-align: center">' + newTemplateText + '<br/><br/><input type="button" value="{$lang.OK}" class="Button" onclick="$.fn.window.closeAll();"></div>');
$('#CurrentTemplateHeading').html($('template', xml).text() + ' (' + $('color', xml).text() +') - Version '+ $('version', xml).text());
var img = $('#' + $('template', xml).text() + '_' + $('color', xml).text() + '_image').attr('src');
$('#CurrentTemplateImage').attr('src', img);
$('#CurrentTemplateImageLink').attr('href', '{$config.siteURL}/templates/' + $('template', xml).text() + '/previews/' + $('color', xml).text() + '.jpg');
$('#TemplateFilesLocated').html('{$lang.TemplateFilesLocated}' + $('template', xml).text());
if ($('input:radio[name=LogoOption]:checked').val() == 'create') {
HideLogoMessage = true;
UpdateLogoImage();
}
AdminHeaderImage.getHeaderImage();
CurrentTemplateVersion = $('version', xml).text();
CurrentSelectedTemplate = $('template', xml).text();
CurrentSelectedTemplateColor = $('color', xml).text();
$('#MainMessage').successMessage('{$lang.TemplateSelected}'.replace('%%TEMPLATE%%', $('template', xml).text()));
var numTextFields = parseInt($('textfields', xml).text(), 10);
if (numTextFields && typeof SetupTextFields == 'function') {
SetupTextFields(numTextFields);
}
} else {
var returntext = $('message', xml).text();
returntext = returntext.replace(/\"/g, "\\\"");
setTimeout("$(\"#MainMessage\").errorMessage(\"{$lang.layoutCouldNotSaveLayout|iwp_js} " + returntext + "\");", 5);
}
}, 'xml');
}
function ChangePaging(object, pagenumber) {
pagingId = object.selectedIndex;
pagingamount = object[pagingId].value;
document.location = 'index.php?section=layout&action=sitelayout&page=' + pagenumber + '&perpage='+ pagingamount;
}
function ChangeTplColor(itemName, colorName, colorHex, previewPath){
$('#preview_img_'+itemName).attr('src', previewPath + '/preview_' + colorName + '_thumb.jpg');
}
function CancelSiteLayout(){
if (confirm('{$lang.layoutConfirmCancel|iwp_js}')) {
location.reload(true);
}
}
function CheckNewTemplates(){
$('#TemplateGrid').html('');
$.ajax({
url: 'remote.php?section=layout&action=getAvailableTemplates',
dataType: 'json',
error: function(){
$('#DownloadTemplateIntro').fadeOut();
$('#DownloadTemplateIntro').text({$lang.layoutTemplateDownloadNoData|iwp_FilterJavascriptString});
$('#DownloadTemplateIntro').fadeIn();
},
success: function(data){
if(data.count == 0) {
$('#DownloadTemplateIntro').fadeOut();
$('#DownloadTemplateIntro').html(data.message);
$('#DownloadTemplateIntro').fadeIn();
return;
}
$.each(data.templates, function(i,item){
var thisTemplate = chooseTemplateRow;
thisTemplate = thisTemplate.replace(/%%name%%/g, item.name);
thisTemplate = thisTemplate.replace(/%%version%%/g, item.version);
var colorlist = '';
var first = true;
for(color in item.colors){
if(first){
thisTemplate = thisTemplate.replace(/%%fullpreviewpath%%/g, item.previewpath + '/preview_' + color + '.jpg');
thisTemplate = thisTemplate.replace(/%%thumbpath%%/g, item.previewpath + '/preview_' + color + '_thumb.jpg');
first = false;
}
colorlist += '<img class="Action" width="12" height="12" onclick=\'javascript:ChangeTplColor("'+ item.name+'", "' + color + '", "' + item.colors[color] + '", "'+item.previewpath +'");\' title="Preview template" style="border: 1px solid black; cursor: pointer; background-color: ' + item.colors[color] + '; margin-right: 2px; margin-top: 5px;" src="images/blank.gif"/>';
}
thisTemplate = thisTemplate.replace(/%%colorlist%%/g, colorlist);
thisTemplate = thisTemplate.replace(/%%buttontext%%/g, '{$lang.DownloadTemplate}');
$('#TemplateGrid').html($('#TemplateGrid').html() + thisTemplate);
});
$('#DownloadTemplateIntro').fadeOut();
$('#DownloadTemplateIntro').html(data.message);
$('#DownloadTemplateIntro').fadeIn();
}
});
}
function RefreshSelectableTemplateList () {
$('#SelectableTemplateListContainer').html('');
$.post('remote.php?section=layout&action=GetSelectableTemplates', function(xml){
$('#SelectableTemplateListContainer').html($('templatelist', xml).text());
$('#SelectableTemplateListContainer').css('width', (220 * parseInt($('templatecount', xml).text())) + 'px');
});
}
function _DownloadTemplate(name, version, callback){
var win = $.fn.window.create({
title : '{$lang.loading}',
content : '<div id="contentDiv" style="text-align: center;"><div class="Text">{$lang.layoutPleaseWaitTemplateDownloading}</div><img src="images/loadingAnimation.gif" width="220" height="19" ></div>',
autoOpen : true
});
$.ajax({
url : 'remote.php?section=layout&action=downloadtemplate&templateid=' + name + '&version=' + version,
dataType : 'json',
error : function() {
win.close();
alert({$lang.layoutTemplateDownloadNoData|iwp_FilterJavascriptString});
},
success : callback
});
}
function DownloadTemplate(name, version){
_DownloadTemplate(name, version, function(json) {
$.fn.window.closeAll();
if (json.success) {
$('#dl_' + json.template).hide('normal');
}
alert(json.message);
CheckNewTemplates();
RefreshSelectableTemplateList();
$('#mainTabMenu').tabs('select', getTabIndexNumberByName('templateselect'));
});
}
// -->
</script>
<div style="display: none" id="templateSelectedMessage"></div>
<div style="display: none" id="xmlErrorsDiv"></div>
<div id="mainTabMenu">
<ul class="tabnav">
{if iwp_HasPerm('core', 'template', 'choosetemplate')}
<li><a href="#templateselect">{$lang.TemplateSettings}</a></li>
{/if}
{if iwp_HasPerm('core', 'template', 'websitelayout')}
<li><a href="#sitelayout">{$lang.SiteLayout}</a></li>
{/if}
{if iwp_HasPerm('core', 'template', 'logo')}
<li><a href="#websitelogo">{$lang.LogoSettings}</a></li>
<li><a href="#headerimage">{$lang.layoutHeaderImageTabName}</a></li>
{/if}
{if iwp_HasPerm('core', 'template', 'downloadtemplate')}
{if !$whitelabel.DisableTemplateDownloading}
<li><a href="#templatedownloading">{$lang.DownloadTemplates}</a></li>
{/if}
{/if}
</ul>
</div>
{if iwp_HasPerm('core', 'template', 'choosetemplate')}
<!-- Start Template Settings -->
<div id="templateselect" class="HideTabsDuringLoad">
<div id="DownloadMoreTemplates" style="display: none; padding-top: 8px;"></div>
<br />
<table class="Panel" style="margin:0px;">
<tr>
<td class="Heading2" colspan="2">{$lang.CurrentTemplate}</td>
</tr>
<tr>
<td align="left" width="200" style="padding: 5px 5px 5px 10px;">
<a class="open-preview" href="{$config.siteURL}/templates/{$config.template}/previews/{$config.SiteColor}.jpg" title="{$lang.CurrentTemplate}: {$config.template} ({$config.SiteColor}) - Version {$templateVersion}" id="CurrentTemplateImageLink"><img src="{$config.siteURL}/thumbnail.php?tpl={$config.template}&color={$config.SiteColor}" border="0" id="CurrentTemplateImage"></a>
</td>
<td align="left" valign="top" style="padding:5px 5px 5px 10px;">
<div class="TemplateHeading" id="CurrentTemplateHeading">{$config.template} ({$config.SiteColor}) - Version {$templateVersion}</div>
<div id="TemplateFilesLocated">{$lang.TemplateFilesLocated}{$templateDirectory}</div><br>
<input type="button" style="" id="TemplateVersionCheckButton" value="{$lang.CheckNewVersion}" onclick="CheckTemplateVersion();" class="Button"/><input type="Button" class="Button" onClick="DownloadNewVersion();" value="{$lang.DownloadNewVersion}" id="DownloadNewVersionButton" style="display:none; font-weight: bold;"><input type="button" style="" id="TemplateReload" value="Reload Current Template" onclick="reselectCurrentTemplate();" class="Button"/>
<div id="TemplateVersionCheck"></div>
</td>
</tr>
</table>
<br />
<table class="Panel" style="margin:0px;">
<tr>
<td class="Heading2" colspan='2'>{$lang.ChooseTemplate}</td>
</tr>
</table>
<div id="SelectableTemplateListOuterContainer">
<div id="SelectableTemplateListContainer" style="width: {$TemplateCount|math,"220*%s"}px;">
{template="layout.form.templatelist"}
</div>
</div>
<div style="clear: both;"> </div>
</div>
<!-- End Template Settings -->
{/if}
{if iwp_HasPerm('core', 'template', 'websitelayout')}
<!-- Start Site Layout -->
<div id="sitelayout" class="HideTabsDuringLoad">
<form action="remote.php?section=layout&action=saveform" enctype="multipart/form-data" name="frmSiteLayout" id="frmSiteLayout" method="post">
<input type="hidden" name="layoutBoxTop" id="layoutBoxTop_hidden" value="" />
<input type="hidden" name="layoutBoxLeft" id="layoutBoxLeft_hidden" value="" />
<input type="hidden" name="layoutBoxMiddle" id="layoutBoxMiddle_hidden" value="" />
<input type="hidden" name="layoutBoxRight" id="layoutBoxRight_hidden" value="" />
<input type="hidden" name="layoutBoxBottom" id="layoutBoxBottom_hidden" value="" />
<div id="buttonRowLayout">
{$lang.WebsiteLayoutIntroduction}<br/><br/>
<input type="submit" name="submit" value="{$lang.SaveChanges}" class="Button" />
<input type="button" name="cancelButton" value="{$lang.Cancel}" class="Button" onclick="CancelSiteLayout();" />
</div>
<table class="Panel">
<tr>
<td class="Heading2" colspan='2'>{$lang.WebsiteLayoutDetails}</td>
</tr>
<tr >
<td class="FieldLabel" style="padding-top: 5px; padding-bottom: 2px; width: 240px;">
<span class="Required">*</span> {$lang.layoutSelectTemplateFile}:
</td>
<td style="padding-top: 5px; padding-bottom: 2px">
<select name="templatefile" id="templatefile">
<option value="home">{$lang.HomePage}</option>
<option value="master">{$lang.MasterLayout}</option>
<option value="user">{$lang.UserProfilePage}</option>
<option value="category">{$lang.ViewCategoryPage}</option>
<option value="rsspage">{$lang.RssFeedPage}</option>
<option value="search">{$lang.AdvancedSearchPage}</option>
<option value="error">{$lang.ErrorPages}</option>
<option value="external">{$lang.ExternalPage}</option>
<optgroup label="{$lang.ContentTypeLayouts}">
{foreach from=%admin_contenttypes.GetContentTypeList key=key id=contentTypeLoop item=row}
<option value="content_{$row.typeid}">{$row.name}</option>
{/foreach}
</optgroup>
{if $hasCategoryLayouts}
<optgroup label="{$lang.CategoryLayouts}">
{foreach from=$CategoryLayouts key=key id=catLayoutLoop item=row}
<option value="category_{$row.categoryid}">{$row.name}</option>
{/foreach}
</optgroup>
{/if}
{if $hasModuleLayouts}
<optgroup label="{$lang.ModuleLayouts}">
{foreach from=%modules.GetModulesWithLayouts key=key id=moduleLayoutLoop item=row}
<option value="module_{$row.codename}">{$row.name}</option>
{/foreach}
</optgroup>
{/if}
{if $hasContentLayouts}
<optgroup label="{$lang.ContentLayouts}">
{foreach from=$ContentLayouts key=key id=contentLayoutLoop item=row}
<option value="contentitem_{$row.contentid}">{$row.title}</option>
{/foreach}
</optgroup>
{/if}
</select>
</td>
</tr>
<tr>
<td class="FieldLabel">
<span class="Required">*</span> {$lang.SelectLayoutType}:
</td>
<td>
<select id="layoutSet" name="layoutSet" onChange="SiteLayout.CheckLayoutSet(true);" onClick="SetHasChanges();">
{foreach from=$layoutSetsRadioOptions key=name item=row id=radioLoop}
<option value="{$name}" id="{$name}" class="layoutSetRadioFields" {if $name == $layoutSelected.$currentTemplate}selected="selected"{/if} >{$row.displayName}</option>
{/foreach}
</select>
{if $layoutSelected.$currentTemplate == ""}
<script type="text/javascript">
$('#{$name}').attr('selected', 'selected');
</script>
{/if}
</td>
</tr>
<tr>
<td class="Gap" colspan='2'></td>
</tr>
</table>
<table class="Panel">
<tr>
<td class="Heading2" colspan=2 id="WebsiteLayoutOptionsFor">{$lang.WebsiteLayoutOptionsFor}</td>
</tr>
<tr>
<td style="padding-left: 20px;" colspan="2">
<br />
{$lang.layoutSiteLayoutIntro}
<br />
<br />
<div id="outerLayoutsContainer">
<div class="AccordianContainer">
<ul id="fieldTabs" class="ui-accordion-container AccordianList">
<li class="AccordianOverflow">
<a href='#' class="">{$lang.layoutCreateNewBlocks}</a>
<div>
<div id="miscBlocks" class="" style=""></div>
</div>
</li>
<li class="AccordianOverflow">
<a href='#' class="">{$lang.layoutSavedBlocks}</a>
<div>
<ul id="layoutListsSaved" class="layoutListsAccordian">
{$savedList}
</ul>
</div>
</li>
{if $areModulesWithBlocks}
{foreach from=$modulesList item=thisModule key=moduleId}
<li class="AccordianOverflow ModuleAccordianList">
<a href='#' class="">{$thisModule.name} </a>
<div>
<ul id="{$moduleId}ModuleBlocks" class="layoutListsAccordian">
{$thisModule.blocks}
</ul>
</div>
</li>
{/foreach}
{/if}
<li class="AccordianOverflow">
<a href='#' class="">{$lang.layoutMenusLists}</a>
<div class="">
<div class="layoutListsAccordian">
<div id="listBlocks" class="" style="">
</div>
<ul id="layoutListsMenus">
{$lists}
{$savedChildSiblingsList}
</ul>
</div>
</div>
</li>
<li class="AccordianOverflow">
<a href='#' class="">{$lang.layoutSystemBlocks}</a>
<div>
<ul id="sysBlocks" class="layoutListsAccordian">
<li class="layoutListsMenusItem" id="searchbox">
<div id="searchboxdiv" class="layoutSearch typeDiv layoutBlockIconPosition">
<div class="layoutDeleteItem" onclick="DeleteBlock(this);"></div>
{$lang.layoutSearchBlock}
</div>
</li>
<li class="layoutListsMenusItem" id="rssbox">
<div id="rssboxdiv" class="layoutRss typeDiv layoutBlockIconPosition">
<div class="layoutDeleteItem" onclick="DeleteBlock(this);"></div>
{$lang.layoutRssBlock}
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
<div style="float: left; width: 620px;" id="layoutsContainer">
<ul class="layoutBox layoutBoxTop" id="layoutBoxTop"></ul>
<a class="useMasterTemplateSmall topWidth useMasterOff" id="topUseMaster" href="javascript:SiteLayout.ToggleMasterLock('layoutBoxTop');"></a>
{capture name=middleBock trim=true}
<div class="middleWidth middleColumns">
<ul class="layoutBox layoutBoxMiddle" id="layoutBoxMiddle"></ul>
<a class="useMasterTemplate useMasterOff" id="middleUseMaster" href="javascript:SiteLayout.ToggleMasterLock('layoutBoxMiddle');"><span>{$lang.NotUsingMaster|iwp_js}</span></a>
</div>
{/capture}
{if $contentColumn == 1}
{$middleBock}
{/if}
<div class="leftWidth leftColumns">
<ul class="layoutBox layoutBoxLeft" id="layoutBoxLeft"></ul>
<a class="useMasterTemplate useMasterOff" id="leftUseMaster" href="javascript:SiteLayout.ToggleMasterLock('layoutBoxLeft');"><span>{$lang.NotUsingMaster|iwp_js}</span></a>
</div>
{if $contentColumn == 2}
{$middleBock}
{/if}
<div class="rightWidth rightColumns">
<ul class="layoutBox layoutBoxRight" id="layoutBoxRight"></ul>
<a class="useMasterTemplate useMasterOff" id="rightUseMaster" href="javascript:SiteLayout.ToggleMasterLock('layoutBoxRight');"><span>{$lang.NotUsingMaster|iwp_js}</span></a>
</div>
{if $contentColumn == 3}
{$middleBock}
{/if}
<ul class="layoutBox layoutBoxBottom" id="layoutBoxBottom"></ul>
<a class="useMasterTemplateSmall bottomWidth useMasterOff" id="bottomUseMaster" href="javascript:SiteLayout.ToggleMasterLock('layoutBoxBottom');"></a>
</div>
</div>
<br />
<div style="clear:both;"></div>
<br />
{$editorCode}
<br />
</td>
</tr>
</table>
</form>
</div>
<!-- End Site Layout -->
{/if}
{if iwp_HasPerm('core', 'template', 'logo')}
<!-- Start Logo Settings -->
<div id="websitelogo" class="HideTabsDuringLoad">
{template="layout.logo.form"}
</div>
<!-- End Logo Settings -->
<!-- Start headerimage Settings -->
<div id="headerimage" class="HideTabsDuringLoad">
{template="layout.headerimage.form"}
</div>
<!-- End headerimage Settings -->
{/if}
{if iwp_HasPerm('core', 'template', 'downloadtemplate') && !$whitelabel.DisableTemplateDownloading}
<!-- Start Template Downloading -->
<div id="templatedownloading" class="HideTabsDuringLoad">
<div id="DownloadTemplateIntro" class="Text" style="padding-bottom: 0;">
<a href="#" id="clickToDownload">{$lang.ClickToDownload}</a>. {$lang.DownloadTemplateIntro}
</div>
<div style="padding: 0px 0px 5px 10px; display: none;" class="Text" id="DownloadTemplateMessage"></div>
<div style="clear:both;" id="TemplateGrid"></div>
<br style="clear:both;" />
</div>
<!-- End Template Downloading -->
{/if}
</div>
{template="footer"}