HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/templates/content.form.tpl
{template="header"}
<script type="text/javascript" src="../javascript/jquery.form.js"></script>
<script type="text/javascript" src="../javascript/jquery.field.js"></script>
<script type="text/javascript" src="{$config.siteURL}/js.php?f=admin.validator&amp;section={$section}&amp;a=1"></script>
<script>
$(document).ready(function() {

	$('.CancelButton').click(function(){
		if (confirm('{$lang.ConfirmCancelJS}')) {
			location.href = "index.php?section=content&action=view";
		}
	});

	$('.SaveAndAddDisabled').disabledBind('click', function(){
		alert(iwp.lang.get('CreateContentNoPermission'));
	});
});
</script>
<div id="SavePageFirst" title="Problem Saving {$ContentType.name_singular}" class="iDialog" style="display:none;"></div>
<form action="remote.php?section=content&amp;action=saveform"  enctype="multipart/form-data" name="frmContent" id="frmContent" method="post">
<input type="hidden" name="savemethod" id="savemethod" value="" />

{template="common.form.top"}


			<input type="button" name="saveonly" value="{$lang.Save}" class="FormButton"   onClick="$('#savemethod').val('');validateForm();" />
			<input type="button" name="saveandexit" value="{$lang.SaveAndExit}" class="FormButton"  onClick="$('#savemethod').val('andexit');validateForm();" />
			{if $canCreateContent}
				<input type="button" name="saveandadd" value="{$lang.SaveAndAddAnother}" class="FormButton" onClick="$('#savemethod').val('andadd');validateForm()" />
			{else}
				<input type="button" value="{$lang.SaveAndAddAnother}" class="FormButton SaveAndAddDisabled" disabled="disbaled" />
			{/if}
			<input type="button" value="{$lang.Cancel}" class="FormButton CancelButton" />

			</div>
		</td>
	  </tr>
<tr>
<td>
<script type="text/javascript">

jQuery(function($) {

    var options = {
        success  : showResponse,
        dataType : 'xml'
    };

    // bind form using 'ajaxForm'
    $('#frmContent').submit(function(){ RunCallbacks('beforePost'); }).ajaxForm(options);



	{$jsOnLoad}



	{if !is_blank($EmptyFields)}
		var emptyFields = {$EmptyFields};

		EmptyFields(emptyFields);
	{/if}

	$('#title').focus();



	$('#frmContent').submit(function() {
		// disable the save buttons so the content can't be saved twice
		// also a good indicator to the user that the page is working/loading
		$('input[type="button"][name*="save"]').attr('disabled', 'disabled');

		return true;
	});

});



String.prototype.countStr = function(s1) {
	return (this.length - this.replace(new RegExp(s1,'g'), '').length) / s1.length;
};

String.prototype.repeat = function(l){
	return new Array(l + 1).join(this);
};



function toggleMeta() {
	var cb    = $('#metaauto'),
	    metas = $('#metatitle_row, #metakeywords_row, #metadesc_row');

	cb.bind('click', function() {
		if (cb.get(0).checked) {
			metas.hide();
		} else {
			metas.show();
		}
	});

	cb.triggerHandler('click');
}

function insertCreateCategory() {
	$('#categories_row .FieldLabel').append('<br />&nbsp;&nbsp;&nbsp;&nbsp;(<a href="#" onclick="createCategory();">{$lang.CreateNewCat}</a>)');
}

function createCategory(){
	$.iModal({type: 'ajax', url: 'remote.php?section=content&action=QuickCreateCategoryForm', width: '450', title: '{$lang.CreateaCategory}', buttons: '<input type="submit" value="{$lang.SaveCategory}" class="FormButton" style=" float: right; font-weight:bold;" onClick="saveNewCategory();" /> <input type="button" value="Cancel" onclick="$.iModal.close();" class="FormButton" style="float: left;" />'});
}

function saveNewCategory(){
	$.getJSON('remote.php?section=content&action=SaveQuickCreateCategory&popup_parentid=' + escape($('#popup_parentid').val()) + '&popup_catname=' + escape($('#popup_catname').val()), function(json) {
		if(json.success){
			$('#MainMessage').successMessage('Category "'+json.catname+'" has been successfully saved and selected.');
			var reloadISelect = false;
			if($('#categories').hasClass('ISelector')){
				reloadISelect = true;
				$('#categories').remove();
				$('#categories_old').attr('id', 'categories');
			}

			if(json.parentid == 0){
				$('#categories').addOption(json.categoryid, json.catname);
			}else{
				var parentCatName = $('#categories option[value='+json.parentid+']').html();
				var nbspCount = parentCatName.countStr('&nbsp;');
				$('#categories option[value='+json.parentid+']').after('<option value="'+json.categoryid+'">'+ '&nbsp;'.repeat(nbspCount) +'&nbsp;&nbsp;&nbsp;&nbsp;' + json.catname+'</option>');
			}
			$.iModal.close();
			$('#categories').selectOptions(json.categoryid, true);
			$('#categories option[value='+json.categoryid+']').attr('selected', 'selected');

			if(reloadISelect){
				$('#categories').iselector();
				$('#categories').iselectorScrollTo(json.categoryid);
			}
		}else{
			alert(json.message);
		}
	});
}

function FieldName(field) {
	var lang = { {$fieldLangs} };
	return eval('lang.' + field);
}

// pre-submit callback
function validateForm() {
	var result    = false;
	var errormsgs = [];

	$('.validation_error').remove();

	{$formvalidate}

	if(errormsgs.length == 0){
		$('#frmContent').submit();
		$('#MessageTable').hide();
		return;
	}
	$('html').scrollTo( 'body', 500 );
	$('#MainMessage').errorMessage('{$lang.ContentSaveErrors|sprintf,$ContentType.name_singular}', errormsgs);

}

function showResponse(xml, statusText) {
	RunCallbacks('afterPost');

	// enable the save buttons once the submission is complete
	$('input[type="button"][name*="save"]').removeAttr('disabled');

	if ($('status', xml).text() == 1) {
		RunCallbacks('afterPostSuccess');

		$('#contentid').val($('contentid', xml).text());

		if ($('redirect', xml).text() == 1) {
			location.href = "index.php?section=content&action=view";
		} else if ($('andadd', xml).text() == 1) {
			location.href = "index.php?section=content&action=create&typeid={$ContentType.id}";
		} else {
			$('#MainMessage').successMessage({$lang.ContentItemSaved|sprintf,$ContentType.name_singular|iwp_FilterJavascriptString});
		}
	} else if ($('status', xml).text() == 0) {
		RunCallbacks('afterPostError');
		$('html').scrollTo( 'body', 500 );
		if($('errors', xml).text() == ""){
			var errors = ["Unknown error. Message received: " + $('message', xml).text()];
		}else{
			var errors = $('errors', xml).text();
			errors = $.evalJSON(errors);
		}

		setTimeout(function() {
			$('#MainMessage').errorMessage('{$lang.ContentSaveErrors|sprintf,$ContentType.name_singular}', errors);
		}, 5);

		setTimeout("EmptyFields(" +$('errorfields', xml).text()+ ");", 5);
	}
}

</script>

{* the form fields are generated dynamically *}
{$formfields}


{if sizeof($tpl.JSfiles) > 0}
	{foreach from=$tpl.JSfiles key=key item=file id=jsFileLoop}
			{if $tpl.JSfilesIF.$key !== false}
				<!--[if {$tpl.JSfilesIF.$key}]><script type="text/javascript" src="{$file}"></script><![endif]-->
			{else}
				<script type="text/javascript" src="{$file}"></script>
			{/if}
	{/foreach}
{/if}


			</td>
			</tr>
			</table><br />
			<div style="padding-left: 190px;">
			<input type="button" name="saveonly" value="{$lang.Save}" class="FormButton"   onClick="$('#savemethod').val('');validateForm();" />
			<input type="button" name="saveandexit" value="{$lang.SaveAndExit}" class="FormButton"  onClick="$('#savemethod').val('andexit');validateForm();" />
			{if $canCreateContent}
				<input type="button" name="saveandadd" value="{$lang.SaveAndAddAnother}" class="FormButton" onClick="$('#savemethod').val('andadd');validateForm()" />
			{else}
				<input type="button" value="{$lang.SaveAndAddAnother}" class="FormButton SaveAndAddDisabled" disabled="disbaled" />
			{/if}
			<input type="button" value="{$lang.Cancel}" class="FormButton CancelButton" />
	</div>
</div>
{template="footer"}