Example #1
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $state = $this->get('State');
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('licenses');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_LICENSES'), 'jdlicenses');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('license.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('license.edit');
         JToolBarHelper::divider();
         JToolBarHelper::checkin('licenses.checkin');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('licenses.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('licenses.unpublish', 'JTOOLBAR_UNPUBLISH', true);
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList(JText::_('COM_JDOWNLOADS_DELETE_LIST_ITEM_CONFIRMATION'), 'licenses.delete', 'COM_JDOWNLOADS_TOOLBAR_REMOVE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('help.licenses', true);
 }
Example #2
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = JDownloadsHelper::getActions();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     $title = $isNew ? JText::_('COM_JDOWNLOADS_LICEDIT_ADD') : JText::_('COM_JDOWNLOADS_LICEDIT_EDIT');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . $title, 'jdlicenses');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('license.apply');
         JToolBarHelper::save('license.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::save2new('license.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('license.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('license.cancel');
     } else {
         JToolBarHelper::cancel('license.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('help.license', true);
 }
Example #3
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('templates');
     // set the correct text in title for every layout type
     switch ($this->jd_tmpl_type) {
         case '1':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP1');
             break;
         case '2':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP2');
             break;
         case '3':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP3');
             break;
         case '4':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP4');
             break;
         case '5':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP5');
             break;
         case '6':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP6');
             break;
         case '7':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP7');
             break;
         default:
             $layout_type = '';
     }
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_BACKEND_CPANEL_TEMPLATES_NAME') . ': ' . $layout_type, 'jdlayouts');
     JToolBarHelper::custom('templates.cancel', 'list.png', 'list.png', JText::_('COM_JDOWNLOADS_LAYOUTS'), false, false);
     JToolBarHelper::divider();
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('template.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('template.edit');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList(JText::_('COM_JDOWNLOADS_DELETE_LIST_ITEM_CONFIRMATION'), 'templates.delete', 'COM_JDOWNLOADS_TOOLBAR_REMOVE');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::divider();
         JToolBarHelper::custom('templates.activate', 'publish', 'publish', JText::_('COM_JDOWNLOADS_BACKEND_TEMPLIST_MENU_TEXT_ACTIVE'), true, false);
         JToolBarHelper::checkin('templates.checkin');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::custom('layouts.install', 'upload.png', 'upload.png', JText::_('COM_JDOWNLOADS_LAYOUTS_IMPORT_LABEL'), false, false);
         JToolBarHelper::custom('templates.export', 'download.png', 'download.png', JText::_('COM_JDOWNLOADS_LAYOUTS_EXPORT_LABEL'), true, false);
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('help.templates', true);
 }
Example #4
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = JDownloadsHelper::getActions();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     // set the correct text in title for every layout type
     switch ($this->jd_tmpl_type) {
         case '1':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP1');
             break;
         case '2':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP2');
             break;
         case '3':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP3');
             break;
         case '4':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP4');
             break;
         case '5':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP5');
             break;
         case '6':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP6');
             break;
         case '7':
             $layout_type = JText::_('COM_JDOWNLOADS_BACKEND_TEMP_TYP7');
             break;
     }
     $title = $isNew ? JText::_('COM_JDOWNLOADS_BACKEND_TEMPEDIT_ADD') . ': ' . $layout_type : JText::_('COM_JDOWNLOADS_BACKEND_TEMPEDIT_EDIT') . ': ' . $layout_type;
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . $title, 'jdlayouts');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('template.apply');
         JToolBarHelper::save('template.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::save2new('template.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('template.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('template.cancel');
     } else {
         JToolBarHelper::cancel('template.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('help.template', true);
 }
Example #5
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('info');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_TERMS_OF_USE'), 'jdinfo');
     JToolBarHelper::divider();
     JToolBarHelper::help('help.jdownloads', true);
 }
Example #6
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $state = $this->get('State');
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('layouts');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_BACKEND_CPANEL_TEMPLATES_NAME'), 'jdlogo');
     JToolBarHelper::divider();
     JToolBarHelper::help('help.layouts', true);
 }
Example #7
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('files');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_FILESLIST_TITLE_FILES_UPLOAD'), 'jdupload');
     JToolBarHelper::custom('uploads.files', 'files32.png', 'files32.png', JText::_('COM_JDOWNLOADS_FILES'), false, true);
     JToolBarHelper::custom('uploads.downloads', 'downloads32.png', 'downloads32.png', JText::_('COM_JDOWNLOADS_DOWNLOADS'), false, false);
     JToolBarHelper::divider();
     JToolBarHelper::help('help.uploads', true);
 }
Example #8
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('restore');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_RESTORATION'), 'jdrestore');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jdownloads');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('help.restore', true);
 }
Example #9
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('backup');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_BACKUP'), 'jdbackup');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::custom('backup.runbackup', 'new', 'new', JText::_('COM_JDOWNLOADS_BACKUP_CREATE_LINK_LABEL'), false, false);
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_jdownloads');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('help.backup', true);
 }
Example #10
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('files');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_FILES'), 'jdfiles');
     JToolBarHelper::custom('files.uploads', 'upload32.png', 'upload32.png', JText::_('COM_JDOWNLOADS_FILESLIST_TITLE_FILES_UPLOAD'), false, true);
     JToolBarHelper::custom('files.downloads', 'downloads32.png', 'downloads32.png', JText::_('COM_JDOWNLOADS_DOWNLOADS'), false, false);
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList(JText::_('COM_JDOWNLOADS_DELETE_LIST_ITEM_CONFIRMATION'), 'files.delete', 'COM_JDOWNLOADS_TOOLBAR_REMOVE');
         JToolBarHelper::divider();
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('help.files', true);
 }
Example #11
0
 /**
  * Add the page title and toolbar.
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $state = $this->get('State');
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JDownloadsHelper::addSubmenu('categories');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_CATEGORIES'), 'jdcategories');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('category.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('category.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('categories.publish', 'COM_JDOWNLOADS_PUBLISH', true);
         JToolBarHelper::unpublish('categories.unpublish', 'COM_JDOWNLOADS_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::checkin('categories.checkin');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList(JText::_('COM_JDOWNLOADS_DELETE_LIST_ITEM_CONFIRMATION'), 'categories.delete', 'COM_JDOWNLOADS_TOOLBAR_REMOVE');
         JToolBarHelper::divider();
     }
     // Add a batch button
     if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         // Instantiate a new JLayoutFile instance and render the batch button
         $layout = new JLayoutFile('joomla.toolbar.batch');
         $dhtml = $layout->render(array('title' => $title));
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::custom('categories.rebuild', 'refresh.png', 'refresh_f2.png', 'COM_JDOWNLOADS_REBUILD', false);
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('help.categories', true);
 }
Example #12
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     JRequest::setVar('hidemainmenu', true);
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     //JDownloadsHelper::addSubmenu('templates');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_BACKEND_EDIT_LANG_TITLE_EDIT'), 'jdlogo');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::save('languageedit.save');
         JToolBarHelper::cancel('languageedit.cancel');
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_jdownloads');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('help.languageedit', true);
 }
Example #13
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $state = $this->get('State');
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     JDownloadsHelper::addSubmenu('logs');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_LOGS_TITLE_HEAD'), 'jdlogs');
     if ($canDo->get('core.edit')) {
         JToolBarHelper::custom('logs.blockip', 'cancel.png', 'cancel.png', JText::_('COM_JDOWNLOADS_BACKEND_LOG_LIST_BLOCK_IP'), true);
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList(JText::_('COM_JDOWNLOADS_DELETE_LIST_ITEM_CONFIRMATION'), 'logs.delete', 'COM_JDOWNLOADS_TOOLBAR_REMOVE');
         JToolBarHelper::divider();
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('help.logs', true);
 }
Example #14
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $state = $this->get('State');
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('../components/com_jdownloads/assets/css/jdownloads_buttons.css');
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     $document->addScriptDeclaration('function openWindow (url) {
     fenster = window.open(url, "_blank", "width=550, height=480, STATUS=YES, DIRECTORIES=NO, MENUBAR=NO, SCROLLBARS=YES, RESIZABLE=NO");
     fenster.focus();
     }');
     $document->addScriptDeclaration('function getSelectedText( frmName, srcListName ) {
                                      var form = eval( \'document.\' + frmName );
                                      var srcList = eval( \'form.\' + srcListName );
                                      i = srcList.selectedIndex;
                                      if (i != null && i > -1) {
                                         return srcList.options[i].text;
                                      } else {
                                         return null;
                                      }
                                      }');
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_BACKEND_CPANEL_SETTINGS'), 'jdconfig');
     if ($canDo->get('edit.config')) {
         JToolBarHelper::apply('config.apply');
         JToolBarHelper::save('config.save');
         JToolBarHelper::cancel('config.cancel');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jdownloads');
         JToolBarHelper::divider();
     }
     if ($canDo->get('edit.config')) {
         JToolBarHelper::help('help.config', true);
     }
 }
Example #15
0
 /**
  * Add the page title and toolbar.
  *
  * 
  */
 protected function addToolbar()
 {
     global $jlistConfig;
     require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
     $state = $this->get('State');
     $canDo = JDownloadsHelper::getActions();
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
     $document->addScriptDeclaration('function openWindow (url) {
     fenster = window.open(url, "_blank", "width=550, height=480, STATUS=YES, DIRECTORIES=NO, MENUBAR=NO, SCROLLBARS=YES, RESIZABLE=NO");
     fenster.focus();
     }');
     // view menu only when we have not to work with an update
     if (!$jlistConfig['old.jd.release.found']) {
         JDownloadsHelper::addSubmenu('jdownloads');
     }
     JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . JText::_('COM_JDOWNLOADS_CPANEL'), 'jdlogo');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jdownloads');
         JToolBarHelper::divider();
     }
     JToolBarHelper::help('help.jdownloads', true);
 }
Example #16
0
 * @version 2.5  
 * @copyright (C) 2007 - 2013 - Arno Betz - www.jdownloads.com
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
 * 
 * jDownloads is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
defined('_JEXEC') or die('Restricted access');
global $jlistConfig;
JHtml::_('behavior.tooltip');
JHTML::_('behavior.formvalidation');
// JHtml::_('behavior.formvalidator'); Joomla >= 3.4
jimport('joomla.html.html.tabs');
$canDo = JDownloadsHelper::getActions();
if ($canDo->get('edit.config')) {
    ?>

<form action="<?php 
    echo JRoute::_('index.php?option=com_jdownloads');
    ?>
" method="post" name="adminForm" id="adminForm">

<?php 
    echo JHtml::_('tabs.start', 'jdlayout-sliders-config', array('useCookie' => 1));
    echo JHtml::_('tabs.panel', JText::_('COM_JDOWNLOADS_BACKEND_SETTINGS_TABTEXT_DOWNLOADS'), 'downloads');
    ?>

<table width="100%" border="0">
    <tr>
Example #17
0
    /**
     * Add the page title and toolbar.
     *
     * 
     */
    protected function addToolbar()
    {
        global $jlistConfig;
        require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
        JRequest::setVar('hidemainmenu', true);
        $user = JFactory::getUser();
        $isNew = $this->item->file_id == 0;
        $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
        $canDo = JDownloadsHelper::getActions($this->item->file_id, 'download');
        $document = JFactory::getDocument();
        $document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
        $document->addScriptDeclaration('
        // dynamically add a new image file upload field when the prior generated fields is used
        // used in backend edit download page
        function add_new_image_file(field)
        {
            // Get the number of files previously uploaded.
            var count = parseInt(document.getElementById(\'image_file_count\').value);
            var sum = parseInt(document.getElementById(\'sum_listed_images\').value);
            var max = parseInt(document.getElementById(\'max_sum_images\').value);
            
            // Get the name of the file that has just been uploaded.
            var file_name = document.getElementById("file_upload_thumb["+count+"]").value;
           
            // Hide the file upload control containing the information about the picture that was just uploaded.
            document.getElementById(\'new_file_row\').style.display = "none";
            document.getElementById(\'new_file_row\').id = "new_file_row["+count+"]";
           
            // Get a reference to the table containing the uploaded pictures.       
            var table = document.getElementById(\'files_table\');
           
            // Insert a new row with the file name and a delete button.
            var row = table.insertRow(table.rows.length);
            row.id = "inserted_file["+count+"]";
            var cell0 = row.insertCell(0);
            cell0.innerHTML = \'<input type="text" disabled="disabled" name="inserted_file[\'+count+\']" value="\'+file_name+\'" size="40" /><input type="button" name="delete[\'+count+\']" value="' . JTEXT::_('COM_JDOWNLOADS_REMOVE') . '" onclick="delete_inserted_image_field(this)">\';
           
            // Increment count of the number of files uploaded.
            ++count;
            if (count+sum < max){
                // Insert a new file upload control in the table.
                var row = table.insertRow(table.rows.length);
                row.id = "new_file_row";
                var cell0 = row.insertCell(0);
                cell0.innerHTML = \'<input type="file" name="file_upload_thumb[\'+count+\']" id="file_upload_thumb[\'+count+\']" size="40" accept="image/gif,image/jpeg,image/jpg,image/png" onchange="add_new_image_file(this)" />\';   
            }
            // Update the value of the file hidden input tag holding the count of files uploaded.
            document.getElementById(\'image_file_count\').value = count;
        }

        // user will remove the files they have previously added
        // used in backend edit download page
        function delete_inserted_image_field(field)
        {
            // Get the field name.
            var name = field.name;
            
            // Extract the file id from the field name.
            var id = name.substr(name.indexOf(\'[\') + 1, name.indexOf(\']\') - name.indexOf(\'[\') - 1);
           
            // Hide the row displaying the uploaded file name.
            document.getElementById("inserted_file["+id+"]").style.display = "none";
               
            // Get a reference to the uploaded file control.
            var control = document.getElementById("file_upload_thumb["+id+"]");
           
            // Remove the new file control.
            control.parentNode.removeChild(control);
            
            // check that we have always a input field when we remove a other file
            var found = false;
            for (var i = 0; i <= 30; i++){
                 if (document.adminForm.elements["file_upload_thumb["+i+"]"]) {
                    found = true;
                 }
            }
            if (!found) add_new_image_file(field);
        }');
        $title = $isNew ? JText::_('COM_JDOWNLOADS_BACKEND_FILESEDIT_ADD') : JText::_('COM_JDOWNLOADS_BACKEND_FILESEDIT_EDIT');
        JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . $title, 'jddownloads');
        // If not checked out, can save the item.
        if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
            JToolBarHelper::apply('download.apply');
            JToolBarHelper::save('download.save');
        }
        if (!$checkedOut && $canDo->get('core.create')) {
            JToolBarHelper::save2new('download.save2new');
        }
        // If an existing item, can save to a copy.
        if (!$isNew && $canDo->get('core.create')) {
            JToolBarHelper::save2copy('download.save2copy');
        }
        if (empty($this->item->id)) {
            JToolBarHelper::cancel('download.cancel');
        } else {
            JToolBarHelper::cancel('download.cancel', 'COM_JDOWNLOADS_TOOLBAR_CLOSE');
        }
        JToolBarHelper::divider();
        JToolBarHelper::help('help.download', true);
    }