| @@ 20-103 (lines=84) @@ | ||
| 17 | * |
|
| 18 | * @since 1.0 |
|
| 19 | */ |
|
| 20 | class LocaliseViewLanguage extends JViewLegacy |
|
| 21 | { |
|
| 22 | protected $state; |
|
| 23 | ||
| 24 | protected $item; |
|
| 25 | ||
| 26 | protected $form; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Display the view |
|
| 30 | * |
|
| 31 | * @param string $tpl The name of the template file to parse; automatically searches through the template paths. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function display($tpl = null) |
|
| 36 | { |
|
| 37 | jimport('joomla.client.helper'); |
|
| 38 | ||
| 39 | // Get the data |
|
| 40 | $this->state = $this->get('State'); |
|
| 41 | $this->item = $this->get('Item'); |
|
| 42 | $this->form = $this->get('Form'); |
|
| 43 | $this->formftp = $this->get('FormFtp'); |
|
| 44 | $this->ftp = JClientHelper::setCredentialsFromRequest('ftp'); |
|
| 45 | ||
| 46 | // Check for errors. |
|
| 47 | if (count($errors = $this->get('Errors'))) |
|
| 48 | { |
|
| 49 | JError::raiseError(500, implode("\n", $errors)); |
|
| 50 | ||
| 51 | return false; |
|
| 52 | } |
|
| 53 | ||
| 54 | // Set the toolbar |
|
| 55 | $this->addToolbar(); |
|
| 56 | ||
| 57 | // Display the view |
|
| 58 | parent::display($tpl); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Add the page title and toolbar. |
|
| 63 | * |
|
| 64 | * @return void |
|
| 65 | * |
|
| 66 | * @since 1.6 |
|
| 67 | */ |
|
| 68 | protected function addToolbar() |
|
| 69 | { |
|
| 70 | JFactory::getApplication()->input->set('hidemainmenu', true); |
|
| 71 | $canDo = JHelperContent::getActions('com_localise', 'component'); |
|
| 72 | ||
| 73 | $user = JFactory::getUser(); |
|
| 74 | $isNew = empty($this->item->id); |
|
| 75 | $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); |
|
| 76 | ||
| 77 | JToolbarHelper::title( |
|
| 78 | JText::sprintf( |
|
| 79 | 'COM_LOCALISE_HEADER_MANAGER', |
|
| 80 | $isNew ? JText::_('COM_LOCALISE_HEADER_LANGUAGE_NEW') : JText::_('COM_LOCALISE_HEADER_LANGUAGE_EDIT') |
|
| 81 | ), |
|
| 82 | 'icon-comments-2 langmanager' |
|
| 83 | ); |
|
| 84 | ||
| 85 | // If not checked out, can save the item. |
|
| 86 | if (!$checkedOut) |
|
| 87 | { |
|
| 88 | JToolbarHelper::apply('language.apply'); |
|
| 89 | JToolbarHelper::save('language.save'); |
|
| 90 | } |
|
| 91 | ||
| 92 | JToolBarHelper::cancel('language.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'); |
|
| 93 | JToolBarHelper::divider(); |
|
| 94 | ||
| 95 | if ($canDo->get('localise.create') && !$isNew) |
|
| 96 | { |
|
| 97 | JToolbarHelper::custom('language.copy', 'copy.png', 'copy.png', 'COM_LOCALISE_COPY_REF_TO_NEW_LANG', false); |
|
| 98 | JToolBarHelper::divider(); |
|
| 99 | } |
|
| 100 | ||
| 101 | JToolBarHelper::help('screen.language', true); |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||
| @@ 20-111 (lines=92) @@ | ||
| 17 | * |
|
| 18 | * @since 1.0 |
|
| 19 | */ |
|
| 20 | class LocaliseViewPackageFile extends JViewLegacy |
|
| 21 | { |
|
| 22 | protected $state; |
|
| 23 | ||
| 24 | protected $item; |
|
| 25 | ||
| 26 | protected $form; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Display the view |
|
| 30 | * |
|
| 31 | * @param string $tpl The name of the template file to parse; automatically searches through the template paths. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function display($tpl = null) |
|
| 36 | { |
|
| 37 | jimport('joomla.client.helper'); |
|
| 38 | ||
| 39 | // Get the data |
|
| 40 | $this->state = $this->get('State'); |
|
| 41 | $this->item = $this->get('Item'); |
|
| 42 | $this->form = $this->get('Form'); |
|
| 43 | $this->formftp = $this->get('FormFtp'); |
|
| 44 | $this->ftp = JClientHelper::setCredentialsFromRequest('ftp'); |
|
| 45 | ||
| 46 | // Check for errors. |
|
| 47 | if (count($errors = $this->get('Errors'))) |
|
| 48 | { |
|
| 49 | JError::raiseError(500, implode("\n", $errors)); |
|
| 50 | ||
| 51 | return false; |
|
| 52 | } |
|
| 53 | ||
| 54 | // Set the toolbar |
|
| 55 | $this->addToolbar(); |
|
| 56 | ||
| 57 | // Prepare the document |
|
| 58 | $this->prepareDocument(); |
|
| 59 | ||
| 60 | // Display the view |
|
| 61 | parent::display($tpl); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Add the page title and toolbar. |
|
| 66 | * |
|
| 67 | * @return void |
|
| 68 | * |
|
| 69 | * @since 1.6 |
|
| 70 | */ |
|
| 71 | protected function addToolbar() |
|
| 72 | { |
|
| 73 | JFactory::getApplication()->input->set('hidemainmenu', true); |
|
| 74 | ||
| 75 | $user = JFactory::getUser(); |
|
| 76 | $isNew = empty($this->item->id); |
|
| 77 | $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); |
|
| 78 | ||
| 79 | JToolbarHelper::title( |
|
| 80 | JText::sprintf( |
|
| 81 | 'COM_LOCALISE_HEADER_MANAGER', |
|
| 82 | $isNew ? JText::_('COM_LOCALISE_HEADER_FILEPACKAGE_NEW') : JText::_('COM_LOCALISE_HEADER_FILEPACKAGE_EDIT') |
|
| 83 | ), |
|
| 84 | 'icon-comments-2 langmanager' |
|
| 85 | ); |
|
| 86 | ||
| 87 | // If not checked out, can save the item. |
|
| 88 | if (!$checkedOut) |
|
| 89 | { |
|
| 90 | JToolbarHelper::apply('packagefile.apply'); |
|
| 91 | JToolbarHelper::save('packagefile.save'); |
|
| 92 | } |
|
| 93 | ||
| 94 | JToolbarHelper::custom('packagefile.download', 'out.png', 'out.png', 'COM_LOCALISE_TOOLBAR_PACKAGE_DOWNLOAD', false); |
|
| 95 | ||
| 96 | JToolBarHelper::cancel("packagefile.cancel", $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'); |
|
| 97 | JToolBarHelper::divider(); |
|
| 98 | JToolBarHelper::help('screen.packagefile', true); |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Prepare Document |
|
| 103 | * |
|
| 104 | * @return void |
|
| 105 | */ |
|
| 106 | protected function prepareDocument() |
|
| 107 | { |
|
| 108 | $document = JFactory::getDocument(); |
|
| 109 | $document->setTitle(JText::sprintf('COM_LOCALISE_TITLE', JText::_('COM_LOCALISE_TITLE_PACKAGE'))); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | ||