Beispiel #1
0
 /**
  * Read content files
  *
  * @return void
  *
  * @throws Exception
  */
 public function readContentElementFile()
 {
     NenoLog::log('Method readContentElementFile of NenoControllerGroupsElements called', 3);
     jimport('joomla.filesystem.file');
     NenoLog::log('Trying to move content element files', 3);
     $input = JFactory::getApplication()->input;
     $fileData = $input->files->get('content_element');
     $destFile = JFactory::getConfig()->get('tmp_path') . '/' . $fileData['name'];
     $extractPath = JFactory::getConfig()->get('tmp_path') . '/' . JFile::stripExt($fileData['name']);
     // If the file has been moved successfully, let's work with it.
     if (JFile::move($fileData['tmp_name'], $destFile) === true) {
         NenoLog::log('Content element files moved successfully', 2);
         // If the file is a zip file, let's extract it
         if ($fileData['type'] == 'application/zip') {
             NenoLog::log('Extracting zip content element files', 3);
             $adapter = JArchive::getAdapter('zip');
             $adapter->extract($destFile, $extractPath);
             $contentElementFiles = JFolder::files($extractPath);
         } else {
             $contentElementFiles = array($destFile);
         }
         // Add to each content file the path of the extraction location.
         NenoHelper::concatenateStringToStringArray($extractPath . '/', $contentElementFiles);
         NenoLog::log('Parsing element files for readContentElementFile', 3);
         // Parse element file(s)
         NenoHelperBackend::parseContentElementFile(JFile::stripExt($fileData['name']), $contentElementFiles);
         NenoLog::log('Cleaning temporal folder for readContentElementFile', 3);
         // Clean temporal folder
         NenoHelperBackend::cleanFolder(JFactory::getConfig()->get('tmp_path'));
     }
     NenoLog::log('Redirecting to groupselements view', 3);
     $this->setRedirect('index.php?option=com_neno&view=groupselements')->redirect();
 }
Beispiel #2
0
 /**
  * Display the view
  *
  * @param   string $tpl Template name
  *
  * @return void
  *
  * @throws Exception
  */
 public function display($tpl = null)
 {
     $this->langs = NenoHelper::getTargetLanguages(false);
     NenoHelperBackend::addSubmenu('');
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  *
  * @param   boolean $cachable  If Joomla should cache the response
  * @param   array   $urlParams URL parameters
  *
  * @return JController
  */
 public function display($cachable = false, $urlParams = array())
 {
     $input = $this->input;
     $view = $input->getCmd('view', 'dashboard');
     $app = JFactory::getApplication();
     if (NenoSettings::get('installation_completed') != 1 && $view != 'installation' && $view != 'debug' && $app->isAdmin()) {
         if ($view != 'dashboard') {
             $app->enqueueMessage(JText::_('COM_NENO_INSTALLATION_ERROR'), 'error');
         }
         $app->redirect('index.php?option=com_neno&view=installation');
     }
     $input->set('view', $view);
     // Ensure that a working language is set for some views
     $viewsThatRequireWorkingLanguage = array('groupselements', 'editor', 'strings');
     $showLanguagesDropDown = false;
     if (in_array($view, $viewsThatRequireWorkingLanguage)) {
         // Get working language
         $workingLanguage = NenoHelper::getWorkingLanguage();
         $languages = JFactory::getLanguage()->getKnownLanguages();
         $showLanguagesDropDown = true;
         if (empty($workingLanguage) || !in_array($workingLanguage, array_keys($languages))) {
             $url = JRoute::_('index.php?option=com_neno&view=setworkinglang&next=' . $view, false);
             $this->setRedirect($url);
             $this->redirect();
         }
     }
     NenoHelperBackend::setAdminTitle($showLanguagesDropDown);
     parent::display($cachable, $urlParams);
     return $this;
 }
Beispiel #4
0
 /**
  * Add the page title and toolbar.
  *
  * @return void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     JToolbarHelper::addNew('addGroup', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_ADD_GROUP'));
     JToolbarHelper::custom('moveelementconfirm.show', 'move', 'move', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_MOVE_ELEMENTS'), true);
     $toolbar = JToolbar::getInstance();
     $toolbar->addButtonPath(JPATH_NENO . '/button');
     $toolbar->appendButton('TC', NenoHelperApi::getTCAvailable());
     $this->extraSidebar = NenoHelperBackend::getSidebarInfobox('groupselements');
 }
Beispiel #5
0
 /**
  * Add the page title and toolbar.
  *
  * @return void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     JToolbarHelper::addNew('addGroup', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_ADD_GROUP'));
     JToolbarHelper::custom('moveelementconfirm.show', 'move', 'move', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_MOVE_ELEMENTS'), true);
     JToolbarHelper::custom('groupselements.scanForContent', 'loop', 'loop', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_SCAN_FOR_CONTENT'), true);
     JToolbarHelper::custom('groupselements.moveTranslationsToTarget', 'download', 'download', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_MOVE_TRANSLATED_CONTENT'), true);
     JToolbarHelper::custom('groupselements.checkIntegrity', 'cogs', 'cogs', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_CHECK_INTEGRITY'), true);
     JToolbarHelper::custom('groupselements.refreshWordCount', 'refresh', 'refresh', JText::_('COM_NENO_VIEW_GROUPSELEMENTS_BTN_REFRESH_WORD_COUNT'), true);
     $toolbar = JToolbar::getInstance();
     $toolbar->addButtonPath(JPATH_NENO . '/button');
     $toolbar->appendButton('TC', NenoHelperApi::getTCAvailable());
     $this->extraSidebar = NenoHelperBackend::getSidebarInfobox('groupselements');
 }
Beispiel #6
0
 /**
  * Display the view
  *
  * @param   string $tpl Template
  *
  * @return void
  *
  * @throws Exception This will happen if there are errors during the process to load the data
  *
  * @since 1.0
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     NenoHelperBackend::addSubmenu('externaltranslations');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Beispiel #7
0
 /**
  * Display the view
  *
  * @param   string $tpl Template
  *
  * @return void
  *
  * @throws Exception This will happen if there are errors during the process to load the data
  *
  * @since 1.0
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->tcNeeded = $this->get('TCNeeded');
     $this->comment = $this->get('Comment');
     $this->needsTc = NenoHelperApi::getTCAvailable() < $this->tcNeeded;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     NenoHelperBackend::addSubmenu('externaltranslations');
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Beispiel #8
0
 /**
  * Display the view
  *
  * @param   string $tpl Template
  *
  * @return void
  *
  * @throws Exception This will happen if there are errors during the process to load the data
  *
  * @since 1.0
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->isLanguageSwitcherPublished = $this->get('IsSwitcherPublished');
     if (!$this->isLanguageSwitcherPublished) {
         $this->positionField = $this->get('PositionField');
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     NenoHelperBackend::addSubmenu('dashboard');
     $toolbar = JToolbar::getInstance();
     $toolbar->addButtonPath(JPATH_NENO . '/button');
     $toolbar->appendButton('TC', NenoHelperApi::getTCAvailable());
     JToolbarHelper::custom('fixMenus', 'refresh', 'refresh', JText::_('COM_NENO_DASHBOARD_FIX_MENU_BUTTON'), false);
     JToolBarHelper::title(JText::_('COM_NENO_DASHBOARD_TITLE'), 'screen');
     $this->sidebar = JHtmlSidebar::render();
     $this->extraSidebar = NenoHelperBackend::getSidebarInfobox('dashboard');
     parent::display($tpl);
 }
Beispiel #9
0
 /**
  * Add the page title and toolbar.
  *
  * @return void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = NenoHelperBackend::getActions();
     JToolBarHelper::title(JText::_('COM_NENO_TITLE_GROUP_ELEMENT'), 'test.png');
     // If not checked out, can save the item.
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         JToolBarHelper::apply('groupelement.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('groupelement.save', 'JTOOLBAR_SAVE');
     }
     if ($canDo->get('core.create')) {
         JToolBarHelper::custom('groupelement.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('groupelement.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('groupelement.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('groupelement.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Beispiel #10
0
        echo mt_rand() / mt_getrandmax();
        ?>
"
											class="btn btn-small"><?php 
        echo JText::_('COM_NENO_JOBS_FETCH_BUTTON');
        ?>
</a>
									<?php 
    }
    ?>
								</div>
							</td>
						</tr>
					<?php 
}
?>
					<tr>
						<td colspan="9">
							<?php 
echo $this->pagination->getListFooter();
?>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</form>
</div>
<?php 
echo NenoHelperBackend::renderVersionInfoBox();
Beispiel #11
0
 /**
  * Fetch setup status
  *
  * @return void
  */
 public function getSetupStatus()
 {
     $setupState = NenoHelperBackend::getSetupState();
     echo json_encode($setupState);
     JFactory::getApplication()->close();
 }
Beispiel #12
0
 /**
  * Event thrown when some content change its state
  *
  * @param string  $context Component context
  * @param array   $pks     Primary key values of the element changed
  * @param integer $value   New state value
  *
  * @return void
  */
 public function onContentChangeState($context, $pks, $value)
 {
     if ($value == -2) {
         $tableName = NenoHelperBackend::getTableNameBasedOnComponentContext($context);
         if ($tableName !== false) {
             /* @var $table NenoContentElementTable */
             $table = NenoContentElementTable::load(array('table_name' => $tableName), false);
             foreach ($pks as $pk) {
                 $this->trashTranslations($table, $pk);
             }
         }
     }
 }
Beispiel #13
0
    echo NenoHelper::renderWordCountProgressBar($group->word_count, 1);
    ?>
</td>
						<td>
							<a href="#" class="modalgroupform">
								<?php 
    if (empty($group->assigned_translation_methods)) {
        ?>
									<?php 
        echo JText::_('COM_NENO_VIEW_GROUPSELEMENTS_ADD_TRANSLATION_METHOD');
        ?>
								<?php 
    } else {
        ?>
									<?php 
        echo NenoHelperBackend::renderTranslationMethodsAsCSV($group->assigned_translation_methods);
        ?>
								<?php 
    }
    ?>
							</a>
						</td>
						<td></td>
					</tr>
				<?php 
}
?>
			</table>

			<input type="hidden" name="task" value=""/>
			<input type="hidden" name="boxchecked" value="0"/>
Beispiel #14
0
 /**
  * {@inheritdoc}
  *
  * @param   array $data Data to save
  *
  * @return bool
  *
  * @throws Exception
  */
 public function save($data)
 {
     // If groups data has been saved, let's assign translation method
     if (parent::save($data)) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $workingLanguage = NenoHelper::getWorkingLanguage();
         $groupId = (int) $this->getState($this->getName() . '.id');
         $query->delete('#__neno_content_element_groups_x_translation_methods')->where(array('group_id = ' . $groupId));
         $languages = array($workingLanguage);
         if (!empty($data['languages'])) {
             $languages = array_merge($data['languages'], $languages);
         }
         $query->where('lang IN (' . implode(',', $db->quote($languages)) . ')');
         $db->setQuery($query);
         $db->execute();
         $query->clear()->insert('#__neno_content_element_groups_x_translation_methods')->columns(array('group_id', 'lang', 'translation_method_id', 'ordering'));
         $insert = false;
         if (!empty($data['translation_methods'])) {
             $ordering = 1;
             foreach ($data['translation_methods'] as $translationMethodId) {
                 if (!empty($translationMethodId)) {
                     $insert = true;
                     foreach ($languages as $language) {
                         $query->values($groupId . ',' . $db->quote($language) . ',' . $db->quote($translationMethodId) . ', ' . $ordering);
                     }
                     $ordering++;
                 }
             }
         }
         if ($insert) {
             $db->setQuery($query);
             $db->execute();
         }
         NenoHelperBackend::consolidateTranslationMethods($groupId, empty($data['translation_methods']) || $data['translation_methods'][0] == 0);
         return true;
     }
     return false;
 }
Beispiel #15
0
 /**
  * Check if it's possible to install a language
  *
  * @return bool
  */
 public function getIsPossibleToInstallLanguage()
 {
     $memoryDetails = NenoHelperBackend::getMemoryDetails();
     if (!empty($memoryDetails)) {
         return $memoryDetails['free_space'] == 0 || $memoryDetails['free_space'] > $memoryDetails['current_data_space'];
     }
     return true;
 }
Beispiel #16
0
 /**
  * Render view
  *
  * @param   null|string $tpl Template name
  *
  * @return mixed
  */
 public function display($tpl = null)
 {
     NenoHelperBackend::addSubmenu('');
     $this->sidebar = JHtmlSidebar::render();
     return parent::display($tpl);
 }
Beispiel #17
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   1.6
  */
 public function getOptions()
 {
     $options = NenoHelperBackend::getGroupOptions();
     return array_merge(parent::getOptions(), $options);
 }
Beispiel #18
0
    }
    .debug-header {
        height: 60px;
    }
</style>

<div id="j-sidebar-container" class="span2">
    <?php 
echo $this->sidebar;
?>
</div>
<div id="j-main-container" class="span10">
    <div class="control-group">
        <div class="debug-header">
            <div class="pull-right">
                <div style="text-align:right;"><button class="btn btn-info" id="select-all-btn">Select all</button></div>
                <div id="copy-help-text">Press CTRL+C to copy</div>
            </div>
            <H2>Debug report</h2>
        </div>

        <div class="controls">
            <textarea rows="40" id="debug-text"><?php 
echo NenoHelperBackend::printServerInformation(NenoHelperBackend::getServerInfo());
?>
</textarea>
        </div>
    </div>
</div>

Beispiel #19
0
				</div>
				<div class="center">
					<a href="#" class="btn btn-success">
						<?php 
echo JText::_('COM_NENO_EXTERNALTRANSLATION_BUY_TC_BUTTON');
?>
					</a>
				</div>
			</div>
		</div>

		<?php 
// Only show the jobs link if there are any jobs
?>
		<?php 
if (NenoHelperBackend::areThereAnyJobs()) {
    ?>
			<div class="information-box span11 pull-right alert alert-info">
				<div class="center">
					<div>
						<p class="left">
							<?php 
    echo JText::_('COM_NENO_EXTERNALTRANSLATION_JOBS_INTRO');
    ?>
							<br/>
							<a href="<?php 
    echo JRoute::_('index.php?option=com_neno&view=jobs');
    ?>
"><?php 
    echo JText::_('COM_NENO_EXTERNALTRANSLATION_JOBS_LINK');
    ?>
Beispiel #20
0
/**
 * @package    Neno
 *
 * @author     Jensen Technologies S.L. <*****@*****.**>
 * @copyright  Copyright (C) 2014 Jensen Technologies S.L. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access
defined('_JEXEC') or die;
// Make sure that the Neno package is defined.
if (!defined('JPATH_NENO')) {
    $nenoLoader = JPATH_LIBRARIES . '/neno/loader.php';
    if (file_exists($nenoLoader)) {
        JLoader::register('NenoLoader', $nenoLoader);
        // Register the Class prefix in the autoloader
        NenoLoader::init();
    }
}
if (!NenoHelperBackend::isDatabaseDriverEnabled()) {
    $app = JFactory::getApplication();
    $app->enqueueMessage('Please enable the plugin to use Neno', 'error');
    NenoLog::log('Plugin disabled in frontend', 1);
    $app->setUserState('com_plugins.plugins.filter.search', 'neno');
    $app->redirect('index.php?option=com_plugins');
}
// Include dependencies
jimport('joomla.application.component.controller');
$controller = JControllerLegacy::getInstance('Neno');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
Beispiel #21
0
 /**
  * Get all the tables of the component that matches with the Joomla naming convention.
  *
  * @param   NenoContentElementGroup $group             Component name
  * @param   string                  $tablePattern      Table Pattern
  * @param   bool                    $includeDiscovered Included tables that have been discovered already
  *
  * @return array
  */
 public static function getComponentTables(NenoContentElementGroup $group, $tablePattern = null, $includeDiscovered = true)
 {
     /* @var $db NenoDatabaseDriverMysqlx */
     $db = JFactory::getDbo();
     $tables = $group->isOtherGroup() ? NenoHelperBackend::getTablesNotDiscovered() : $db->getComponentTables($tablePattern === null ? $group->getGroupName() : $tablePattern);
     $result = array();
     for ($i = 0; $i < count($tables); $i++) {
         // Get Table name
         $tableName = self::unifyTableName($tables[$i]);
         $table = null;
         $tablesIgnored = self::getDoNotTranslateTables();
         if (!in_array($tableName, $tablesIgnored)) {
             if (!self::isTableAlreadyDiscovered($tableName)) {
                 $table = self::createTableInstance($tableName, $group);
             } elseif ($includeDiscovered) {
                 $table = NenoContentElementTable::load(array('table_name' => $tableName, 'group_id' => $group->getId()));
             }
         }
         if (!empty($table)) {
             $result[] = $table;
         }
     }
     return $result;
 }
Beispiel #22
0
<?php

/**
 * @package     Neno
 *
 * @author      Jensen Technologies S.L. <*****@*****.**>
 * @copyright   Copyright (C) 2014 Jensen Technologies S.L. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access
defined('_JEXEC') or die;
$document = JFactory::getDocument();
$version = NenoHelperBackend::getNenoVersion();
$document->addScript(JUri::root() . '/media/neno/js/multiselect.js?v=' . $version);
$document->addStyleSheet(JUri::root() . '/media/neno/css/multiselect.css?v=' . $version);
$isOverlay = isset($displayData['isOverlay']);
?>

<div class="multiselect simple-multiselect">
	<div>
		<a class="btn btn-toggle" data-toggle="toggle-<?php 
echo $displayData['type'];
?>
-multiselect" href="#">
			<?php 
echo JText::_('COM_NENO_SELECT_' . strtoupper($displayData['type']));
?>
			<span class="caret pull-right"></span>
		</a>

		<div id="toggle-<?php 
Beispiel #23
0
 /**
  * Load translation statuses for filter
  *
  * @return void
  */
 protected function getStatuses()
 {
     $this->statuses = NenoHelperBackend::getStatuses();
 }