File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/templates/categories.view.tpl
{template="header"}
{if iwp_HasPerm('core', 'categories', 'delete', '*')}
{capture name=CustomButtons}
<input type="button" name="IndexCreateButton" value="{$lang.$CreateItem}" id="IndexCreateButton" class="Button" onClick="document.location.href='index.php?section={$section}&action=create'" />
<input type="button" id="DeleteSelectedButton" value="{$lang.DeleteSelected}" class="Button" {if $CategoryListCount == 0}disabled="disabled"{/if} />
{/capture}
{/if}
{template="common.view.top"}
<style type="text/css">
{$ExtraCSS}
</style>
<script type="text/javascript">
<!--
function categoryDeleteBoxDoubleClick (cb) {
// this implements double-clicking on a checked node to uncheck all child nodes
cb.checked = !cb.checked;
if (!cb.checked) {
var li = $(cb).parents('li.SortableRow')[0]; // get closest parent li node
$(li).find('.deleteBox').attr('checked', false); // find and uncheck all children checkbox nodes
}
}
function categoryDeleteBoxClick (cb) {
var cb = $(cb);
var checked = cb.attr('checked');
if (checked) {
// if checking, check all child nodes
var li = $(cb).parents('li.SortableRow')[0]; // get closest parent li node
$(li).find('.deleteBox').attr('checked', true); // find and tick all children checkbox nodes
} else {
// if unchecking, uncheck all parent nodes
var parents = $(cb).parents('li.SortableRow'); // find the list of parent li nodes
for (var i = parents.length; i--;) {
var child = $(parents[i]).find('.deleteBox')[0]; // find each li node's first checkbox
$(child).attr('checked', false); // ... and untick it
}
}
}
function findValue(li) {
if( li == null ) return alert("No match!");
if( !!li.extra ) var sValue = li.extra[0];
else var sValue = li.selectValue;
return sValue;
}
function selectItem(li) {
findValue(li);
}
function formatItem(row) {
return row[0];
}
$(document).ready(function() {
{if iwp_HasPerm('core', 'categories', 'delete', '*')}
$('#DeleteSelectedButton').click(function(){
$('#bulkaction').val('delete');
BulkAction('categories', 'ListForm');
});
{/if}
});
function ConfirmDelete() {
return confirm('{$lang.CategoryConfirmDelete}');
}
function DeleteCategory_confirm(type) {
$.post(
'remote.php?section=categories&action=delete',
{ catid: deleteId, deltype: type },
function (response) {
if($('status', response).text() == 1) {
$('#MainMessage').successMessage($('message', response).text());
$('#catListDiv').html($('catlist', response).text());
CreateSortableList();
} else {
$('#MainMessage').errorMessage($('message', response).text());
}
}
);
}
function RunBulkEntry() {
$("#dialogConfirm").text('Are you sure you want to delete the selected categories?');
$("#dialogConfirm").dialog({
autoOpen: false,
modal: true,
overlay: {
'background-color': 'black',
opacity: '0.75',
'-webkit-opacity': '0.75',
'-moz-opacity': '0.75'
},
buttons: {
"No, don't delete the categories":
function() { $("#dialogConfirm").dialog("destroy"); },
"Yes, delete the selected categories only":
function() { ConfirmDeleteMultiple('single'); $("#dialogConfirm").dialog("destroy"); },
"Yes, delete the categories and their sub-categories":
function() { ConfirmDeleteMultiple('all'); $("#dialogConfirm").dialog("destroy"); }
}
});
$("#dialogConfirm").css('display', 'block');
$("#dialogConfirm").dialog("open");
}
var sendQuery = '';
function ConfirmDeleteMultiple(type) {
sendQuery = '';
$("form :checkbox[name='cats[]'][checked]").each(function() {
sendQuery += '&cats[]='+$(this).val();
});
$.post(
'remote.php?section=categories&action=delete' + sendQuery,
{ deltype: type },
function (response) {
if($('status', response).text() == 1) {
$('#MainMessage').successMessage($('message', response).text());
$('#catListDiv').html($('catlist', response).text());
CreateSortableList();
} else {
$('#MainMessage').errorMessage($('message', response).text());
}
}
);
}
{if $CategoryListCount == 0}
$(function(){
$('#MainMessage').infoMessage({$lang.PromptToCreateCategory|iwp_FilterJavascriptString});
});
{/if}
//-->
</script>
<div title="Confirmation" class="iDialog" style="display: none;" id="dialogConfirm"></div>
<div class="BodyContainer Intro">
<form name="ListForm" id="ListForm" action="index.php?section=categories&action=view" method="post">
<input type="hidden" name="bulkaction" id="bulkaction" value="" />
<table class="OuterPanel">
<tr>
<td style="display:{$DisplayGrid};">
<table class="GridPanel SortableGrid AutoExpand" cellspacing="0" cellpadding="0" border="0" id="IndexGrid" style="width:100%;" >
<tr class="Heading3">
<td align="Center"><input type="checkbox" name="masterCheckbox" id="masterCheckbox" onClick="toggleCheckboxes(this,'ListForm');"></td>
<td> </td>
{foreach from=$DisplayFields key=k item=field id=fieldsHeaderLoop}
{if $field.display}
<td nowrap="nowrap" style="width: {$field.width};">
<div style="width: {$field.width};">
{capture name=tmp}Categories_{$field.name}{/capture}
{capture name=tmplang}{$lang.$tmp}{/capture}
{$tmplang}
{if $field.sortable }
<a title="{$lang.SortByAsc|sprintf,$tmplang}" href="index.php?section={$section}&action={$action}&sortdir=asc&field={$field.name}"><img src='images/{if $SortField == $field.dbfield && $SortDir == 'asc'}active_{/if}sortup.gif' border="0"></a>
<a title="{$lang.SortByDesc|sprintf,$tmplang}" href="index.php?section={$section}&action={$action}&sortdir=desc&field={$field.name}"><img src='images/{if $SortField == $field.dbfield && $SortDir == 'desc'}active_{/if}sortdown.gif' border="0"></a>
{/if}
</div>
</td>
{/if}
{/foreach}
<td nowrap="nowrap"><div style="width:180px;">
{$lang.Action}
</div></td>
</tr>
</table>
<div id="catListDiv">
{template="category.row"}
</div>
</td>
</tr>
</table>
</form>
</div>
<script type="text/javascript" src="../javascript/jquery/plugins/interface.js"></script>
<script type="text/javascript" src="../javascript/jquery/plugins/inestedsortable.js"></script>
<script type="text/javascript"><!--
var updatingSortables = false;
var updateTimeout = null;
function CreateSortableList() {
$('#CategoryList').NestedSortable({
accept: 'SortableRow',
noNestingClass: "no-nesting",
opacity: .8,
helperclass: 'SortableRowHelper',
onChange: function(serialized) {
updatingSortables = true;
if(updateTimeout != null) window.clearTimeout(updateTimeout);
$('#CategoryList').find('.deleteBox').attr('checked', false); // uncheck all delete checkboxes
$.ajax({
url: 'remote.php?section=categories&action=order',
type: 'POST',
dataType: 'xml',
data: serialized[0].hash,
success: function(response) {
var status = $('status', response).text();
var message = $('message', response).text();
if(status == 0) {
$('#MainMessage').errorMessage(message);
} else {
$('#MainMessage').successMessage(message);
}
if(document.all) {
// IE has problems here - it breaks on sortable lists so for now we just
// refresh the current page
window.location.reload();
}
}
});
},
onStop: function() {
if(document.all && updatingSortables == false) {
// IE has problems here - it breaks on sortable lists so for now we just
// refresh the current page
updateTimeout = window.setTimeout(function() { window.location.reload(); }, 100);
}
},
autoScroll: true,
handle: '.sort-handle'
});
}
$(document).ready(function() {
CreateSortableList();
});
//--></script>
{template="footer"}