<?php 
class jxToolBar
{
    function _default($directory)
    {
        JToolBarHelper::title( JText::_( 'JXplorer My Files' ), 'logo');
        jxToolBar::publish('jx_index', 1);
        jxToolBar::publish('jx_index', 0);
        
        $document =& JFactory::getDocument();

        $document->addScriptDeclaration( $js );
        
          $html = "<a href=\"javascript:void(0);\" onclick=\"javascript:".
            "if(document.adminForm.boxchecked.value==0){alert('".
            "Please make a selection from the list to change Permission');}".
            "else{chmEdit()}\" class=\"toolbar\">";
        $html .= "<span class=\"icon-32-chmod\" type=\"Standard\">";
        $html .= "</span>";
        $html .= JText::_('Chmod');
        $html .= "</a>";
        
        
        $bar = & JToolBar::getInstance();
        $bar->appendButton( 'Custom', $html, 'chmod' );
        
        JToolBarHelper::custom('download', 'download', NULL, JText::_('Download'), true, false );
        JToolBarHelper::divider();
        JToolBarHelper::custom('refresh', 'refresh', NULL, JText::_('Refresh'), false, false );
        if(jxInitialDirectory() != $directory)
        {
        		JToolBarHelper::custom('up', 'upload', NULL, JText::_('Level Up'), false, false );
        }
        jxToolBar::cmove();
        jxToolBar::edit();
        JToolBarHelper::custom('trash', 'trash2', NULL, JText::_('Trash'), true, false );
        JToolBarHelper::help( 'user' , 'com_jxplorer');
    }
    
    function recycle()
    {
        JToolBarHelper::title( JText::_( 'JXplorer Recycle Bin' ), 'trash.png');
        //JToolBarHelper::custom('back', 'back', NULL, JText::_('My Files'), false, false );
        JToolBarHelper::custom('restore', 'restore', NULL, JText::_('Restore'), true, false );
        JToolBarHelper::custom('delete', 'cancel', NULL, JText::_('Delete'), true, false );
        JToolBarHelper::custom('forever', 'empty', NULL, JText::_('Empty Bin'), false, false );
    }

    function config()
    {
		JToolBarHelper::title( JText::_( 'JXplorer Configuration' ), 'cpanel.png');
        JToolBarHelper::save('saveconfig');
        JToolBarHelper::apply('applyconfig');
        JToolBarHelper::cancel();
    }
    
    function upload()
    {
        JToolBarHelper::title( JText::_( 'JXplorer Upload' ), 'upload');
        JToolBarHelper::custom('goto', 'forward', NULL, JText::_('Go to'), false, false );
        JToolBarHelper::custom('uploadfiles', 'upload2', NULL, JText::_('Upload'), false, false );
        JToolBarHelper::cancel();
    }
    function editfile()
    {
        JToolBarHelper::title( JText::_( 'JXplorer Edit File' ), 'backup.png');
        JToolBarHelper::back();
        JToolBarHelper::save('savefile');
        JToolBarHelper::apply('applyfile');
        JToolBarHelper::cancel();
    }
    function copymove()
    {
        JToolBarHelper::title( JText::_( 'JXplorer Copy / Move File' ), 'backup.png');
        JToolBarHelper::back();
        JToolBarHelper::custom('copy', 'copy', NULL, JText::_('Copy'), false, false );
        JToolBarHelper::custom('move', 'move', NULL, JText::_('Move'), false, false );
        JToolBarHelper::cancel();
    }
    
    function close($task='cancel', $string = 'Cancel')
    {
        $html = "<a href=\"javascript:void(0);\" onclick=\"javascript:".
            "document.adminForm.filter_order.value='';submitbutton('$task')\" class=\"toolbar\">";
        $html .= "<span class=\"icon-32-cancel\" type=\"Standard\">";
        $html .= "</span>";
        $html .= jcText::_($string);
        $html .= "</a>";
        $bar = & JToolBar::getInstance();
        $bar->appendButton( 'Custom', $html, 'close' );
    }
    function edit()
    {
        $html = "<a href=\"javascript:void(0);\" onclick=\"javascript:".
            "if(document.adminForm.boxchecked.value==0){alert('".
            "Please make a selection from the list to Delete');}".
            "else{jcEdit()}\" class=\"toolbar\">";
        $html .= "<span class=\"icon-32-edit\" type=\"Standard\">";
        $html .= "</span>";
        $html .= jcText::_('Edit');
        $html .= "</a>";
        
        $bar = & JToolBar::getInstance();
        $bar->appendButton( 'Custom', $html, 'edit' );
    }
    function cmove()
    {
        $html = "<a href=\"javascript:void(0);\" onclick=\"javascript: ".
        "jxCopyMove()\" class=\"toolbar\">";
        $html .= "<span class=\"icon-32-copy\" type=\"Standard\">";
        $html .= "</span>";
        $html .= jcText::_('Copy/Move');
        $html .= "</a>";
        
        $bar = & JToolBar::getInstance();
        $bar->appendButton( 'Custom', $html, 'addnew' );
    }
    function delete($table)
    {
        $document =& JFactory::getDocument();
        
        $html = "<a href=\"javascript:void(0);\" onclick=\"javascript:".
            "if(document.adminForm.boxchecked.value==0){alert('".
            "Please make a selection from the list to Delete');}".
            "else{if(confirm('".jcText::_('Are you sure you whant to delete this items?')."')){jcDelete('$table');}}\" class=\"toolbar\">";
        $html .= "<span class=\"icon-32-delete\" type=\"Standard\" id=\"bar_delete\">";
        $html .= "</span>";
        $html .= jcText::_('Delete');
        $html .= "</a>";
        
        $bar = & JToolBar::getInstance();
        $bar->appendButton( 'Custom', $html, 'delete' );
    }
    
    function publish($table, $publish)
    {
        $document =& JFactory::getDocument();
        
        $html = "<a href=\"javascript:void(0);\" onclick=\"javascript:".
            "if(document.adminForm.boxchecked.value==0){alert('".
            "Please make a selection from the list to (Un)publish');}".
            "else{jcPublish(".($publish ? 0 : 1).", '$table');}\" class=\"toolbar\">";
        $html .= "<span class=\"icon-32-".(!$publish ? 'un' : null)."publish\" type=\"Standard\" id=\"bar_publish$publish\">";
        $html .= "</span>";
        $html .= !$publish ? jcText::_('Unpublish') : jcText::_('Publish');
        $html .= "</a>";
        
        $bar = & JToolBar::getInstance();
        $bar->appendButton( 'Custom', $html, 'publish' );
    }
}

 ?>