File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/templates/categories.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="../javascript/admin.categories.js"></script>
<script type="text/javascript" src="{$config.siteURL}/js.php?f=admin.validator&section={$section}&a=1"></script>
<script type="text/javascript"><!--
AdminCategories.CategoryList = {$categoryAssoc};
AdminCategories.langUrlCategories = '{$lang.urlCategory}';
$(document).ready(function() {
var options = {
success: showResponse
};
$('#frmCategories').submit(function(){ RunCallbacks('beforePost'); return false; }).ajaxForm(options);
$('.CancelButton').click(function(){
if (confirm('{$lang.ConfirmCancelJS}')) {
location.href = "index.php?section=categories&action=view";
}
});
{$CatIconSelectionJQuery}
$('#name').bind('keyup', AdminCategories.UpdateCategoryURL);
$('#name').bind('focus', AdminCategories.UpdateCategoryURL);
$('#name').bind('blur', AdminCategories.UpdateCategoryURL);
$('#generateurl').bind('click', AdminCategories.UpdateCategoryURL);
$('#parentid').bind('click', AdminCategories.UpdateCategoryURL);
$('#parentid').bind('change', AdminCategories.UpdateCategoryURL);
AdminCategories.UpdateCategoryURL();
});
function FieldName(field) {
var lang = { {$fieldLangs} };
return eval('lang.' + field);
}
function validateForm(isExit) {
var result = false;
var errormsgs = [];
// Clean out any previous errors
$('.validation_error').remove();
// The validation entries coming through from the validation object
{$formvalidate}
// If we have no errors
if(errormsgs.length == 0) {
// Complete the submission
$('#MessageTable').hide();
$('#frmCategories').submit();
return;
}
// Otherwise we're displaying errors and waiting for next input
$('html').scrollTo( 'body', 500 );
ErrorMessage('{$lang.ContentSaveErrors|sprintf,"category"}', errormsgs);
}
function showResponse(xml, statusText) {
if($('status', xml).text() == 1){
if($('redirect', xml).text() == "true") {
window.top.location = "index.php?section=categories&action=view";
} else if ($('andadd', xml).text() == 1) {
location.href = "index.php?section=categories&action=create{if $parentid}&parentid={$parentid}{/if}";
} else {
$('#MainMessage').successMessage($('message', xml).text());
$('#categoryid').val($('categoryid', xml).text());
}
}else{
$('#MainMessage').errorMessage($('message', xml).text());
}
}
function ErrorMessage(error,arrMsgs){
var val = '';
if(arrMsgs.length > 0){
val = error+"<ul>";
for(i=0;i<arrMsgs.length;i++){
val += '<li>' + arrMsgs[i] + '</li>';
}
val += "</ul>";
}else{
val = error;
}
$('#MainMessage').errorMessage(val);
}
//--></script>
{template="common.form.top"}
<div name="categorystatus" id="categorystatus" style="display: none"></div>
<form action="remote.php?section=categories&action=saveedit" enctype="multipart/form-data" name="frmCategories" id="frmCategories" method="post">
<input type="hidden" name="savemethod" value="" id="savemethod" />
<input type="button" name="saveonly" id="saveonly" value="{$lang.Save}" class="FormButton" onclick="$('#savemethod').val('');validateForm(false);">
<input type="submit" name="saveandexit" id="saveandexit" value="{$lang.SaveAndExit}" class="FormButton" onclick="$('#savemethod').val('andexit'); validateForm(true); return false;">
<input type="button" name="saveandadd" value="{$lang.SaveAndAddAnother}" class="FormButton" onClick="$('#savemethod').val('andadd');validateForm()" />
<input type="button" value="{$lang.Cancel}" class="FormButton CancelButton" />
<div class="BodyContainer Intro">
{$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}
</div>
<input type="button" name="saveonly" id="saveonly" value="{$lang.Save}" class="FormButton" onclick="$('#savemethod').val(''); validateForm(false);">
<input type="submit" name="saveandexit" id="saveandexit" value="{$lang.SaveAndExit}" class="FormButton" onclick="$('#savemethod').val('andexit'); validateForm(true); return false;">
<input type="button" name="saveandadd" value="{$lang.SaveAndAddAnother}" class="FormButton" onClick="$('#savemethod').val('andadd'); validateForm();" />
<input type="button" value="{$lang.Cancel}" class="FormButton CancelButton" />
</form>
{template="footer"}