<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<div style="display: block; min-height: 520px; overflow: auto;">
<table style="width: 100%;">
<tr>
<td valign="top" style="width: 310px;">
<%:Ajax.Toolbar("_toolbarForCategory")
.EnableDragAndDrop(true)
.ToolPane(pane =>
{
pane.AddIconTextButton(Html.Global("publishing","Home"), "ui-icon ui-icon-home", "window.open(\"" + Url.Action("Index", "Article", new {Area="Publishing" }) + "\");");
pane.AddSpliter();
pane.AddIconTextButton(Html.Global("publishing","AddSubCategory"), "ui-icon ui-icon-plus", " _viewer = $('#dna_cat_viewer'); uiHelper.blockUI(_viewer);$.get('" +
Url.Action("Create", "Category", new { Area = "Publishing" }) +
"',{id:$('#CategoryTree').treeview('option','selectedNode').element.attr('key')},function(htm){$('#dna_cat_viewer').html(htm); uiHelper.unblockUI(_viewer); });");
pane.AddSpliter();
pane.AddIconTextButton(Html.Global("RES_EDIT"), "ui-icon ui-icon-pencil", "_loadPublishingViews($('#CategoryTree').treeview('option','selectedNode'),\"" +
Url.Action("CatRoot", "Category", new { Area = "Publishing" }) + "\",\""+
Url.Action("Edit", "Category", new { Area = "Publishing" })+"\");"
);
})
.Render()
%>
<input id="_selectedKey" type="hidden" value="0" />
<div class="ui-widget-content" style="margin-top: 5px; min-height: 550px;">
<%:Ajax.TreeView("CategoryTree", new CategoryNodeProvider(), new TreeViewOptions()
{
BaseImageUrl= Url.Content("~/content/images/treeview/"),
EnableDragAndDrop = true,
OnNodeSelected = " _viewer = $('#dna_cat_viewer'); uiHelper.blockUI(_viewer);$.get('" +
Url.Action("ManageList", "Article", new { Area = "Publishing" }) +
"',{id:node.element.attr('key')},function(htm){$('#dna_cat_viewer').html(htm); uiHelper.unblockUI(_viewer); });",
OnNodeDropped = "$.post('" + Url.Action("Move", "Category", new { Area = "Publishing" }) +
"', { id: ui.node.attr('key'), pos: ui.position,parentID:ui.parentNode.attr('key') });"
})%>
</div>
</td>
<td valign="top">
<div id="dna_cat_viewer" class="ui-widget-content">
<% Html.RenderAction("CatRoot", "Category", new { Area = "Publishing" }); %>
</div>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function _loadPublishingViews(node, rootUrl, catUrl) {
var _key = node ? node.element.attr('key') : "0";
$('#_selectedKey').val(_key);
var _viewer = $('#dna_cat_viewer');
uiHelper.blockUI(_viewer);
var isRoot = false;
var selectedNode = $("#CategoryTree").treeview("option", "selectedNode");
if (selectedNode) {
if ($(selectedNode.element).parent().attr("id") == "CategoryTree") isRoot = true;
}
//if (_key == "0") {
if (isRoot) {
$('#dna_cat_viewer').load(rootUrl, function () { uiHelper.unblockUI(_viewer); });
return;
}
$('#dna_cat_viewer').load(catUrl + "/" + _key, function () { uiHelper.unblockUI(_viewer); });
}
</script>
<%:Html.StartupScripts() %>