<?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">
        <div>
            <?php echo $form->render(array('method' => 'post', 'id' => 'category_edit_form')); ?>
        </div>
        <div>
            <input id="file" name="file" type="file" />
            <button onclick="return ajaxFileUpload();">Upload</button>
            <div class="loading"></div>
            <div id="category_image"><?php if ($current['image']) : ?><img src="<?php echo htmlspecialchars(category::DIRECTORY . $current['image'] . '-s.jpg'); ?>" /><?php endif; ?></div>
        </div>
    </div>
</div>

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

<script type="text/javascript" src="admin/widget/upload/ajaxfileupload.js"></script>
<script type="text/javascript">
    var id = '<?php echo htmlspecialchars($form->id); ?>';
</script>
<script type="text/javascript" src="admin/category/widget/upload.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">
    /*$(document).ready(function() {
        $('.wysiwyg').rte({
            base_url: '<?php echo $request->base(); ?>',
            width: 800,
            height: 400,
            controls_rte: rte_toolbar,
            controls_html: html_toolbar
        });
    });*/
    
    $('#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());
    });
</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">
//<![CDATA[

        // This call can be placed at any point after the
        // <textarea>, or inside a <head><script> in a
        // window.onload event handler.

        // Replace the <textarea id="editor"> with an CKEditor
        // instance, using default configurations.
        CKEDITOR.replace( 'editor1' );

//]]>
</script>