<?php include dirname(__FILE__) . '/crumb.html.php'; ?>
<?php $url = str_replace('admin.', '', $request->base()); ?>

<div class="panel">
    <div class="title">
        Edit Category - <a target="_blank" href="<?php echo htmlspecialchars($url); ?>product/index/<?php echo htmlspecialchars(category::get_path($form->id)); ?>">View</a>
    </div>
    <div class="content clear">
        <?php echo $form->render(array('method' => 'post', 'id' => 'category_edit_form')); ?>
    </div>
</div>

<div id="elfinder"></div>

<div>
    <a href="category/index/<?php echo htmlspecialchars($form->id); ?>">Cancel</a>
</div>

<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="admin/widget/elfinder/css/elfinder.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="admin/widget/elfinder/css/theme.css">
<script src="admin/widget/elfinder/js/elfinder.min.js"></script>
<script type="text/javascript" src="admin/widget/wysiwyg/jquery.rte.js"></script>
<script type="text/javascript" src="admin/widget/wysiwyg/jquery.rte.tb.js"></script>
<script type="text/javascript" src="admin/widget/wysiwyg/jquery.ocupload-1.1.4.js"></script>
<script type="text/javascript" src="admin/widget/ckeditor/ckeditor.js"></script>
<script src="admin/widget/ckeditor/_samples/sample.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var elf = $('#elfinder').elfinder({
            url: 'admin/widget/elfinder/php/connector.php',
            customData: {
                directory: 'category/<?php echo htmlspecialchars($category['path']); ?>/'
            },
            onlyMimes: ['image/png', 'image/jpeg', 'image/gif']
        }).elfinder('instance');
        
        $('#category_edit_form input[name=name]').bind('keyup', function() {
            $('#category_edit_form input[name=path]').val($(this).val().replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]/g, '-').toLowerCase());
        });
        
        CKEDITOR.replace('editor1');
        CKEDITOR.replace('editor2');
    });
</script>