예제 #1
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->canDo = JUDownloadHelper::getActions('com_judownload');
     $this->groupCanDoManage = JUDownloadHelper::checkGroupPermission("comment.edit");
     $this->groupCanDoDelete = JUDownloadHelper::checkGroupPermission("comments.delete");
     $this->rootComment = JUDownloadFrontHelperComment::getRootComment();
     foreach ($this->items as &$item) {
         $this->ordering[$item->parent_id][] = $item->id;
     }
     $this->addToolBar();
     if (JUDownloadHelper::isJoomla3x()) {
         $layout = JFactory::getApplication()->input->get('layout', '');
         if ($layout != 'modal') {
             $this->filterForm = $this->get('FilterForm');
             $this->activeFilters = $this->get('ActiveFilters');
         }
     }
     parent::display($tpl);
     $this->setDocument();
 }
예제 #2
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->canDo = JUDownloadHelper::getActions('com_judownload');
     $this->addToolBar();
     if (JUDownloadHelper::isJoomla3x()) {
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
     }
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('J1'));
     $options[] = JHtml::_('select.option', '2', JText::_('J2'));
     $options[] = JHtml::_('select.option', '3', JText::_('J3'));
     $options[] = JHtml::_('select.option', '4', JText::_('J4'));
     $options[] = JHtml::_('select.option', '5', JText::_('J5'));
     $options[] = JHtml::_('select.option', '6', JText::_('J6'));
     $options[] = JHtml::_('select.option', '7', JText::_('J7'));
     $options[] = JHtml::_('select.option', '8', JText::_('J8'));
     $options[] = JHtml::_('select.option', '9', JText::_('J9'));
     $options[] = JHtml::_('select.option', '10', JText::_('J10'));
     $this->f_levels = $options;
     $optionsPublished = array();
     $optionsPublished[] = JHtml::_('select.option', '1', JText::_('COM_JUDOWNLOAD_PUBLISHED'));
     $optionsPublished[] = JHtml::_('select.option', '0', JText::_('COM_JUDOWNLOAD_UNPUBLISHED'));
     $this->published_options = $optionsPublished;
     parent::display($tpl);
     $this->setDocument();
 }
예제 #3
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $app = JFactory::getApplication();
     if ($app->input->get('layout') == null) {
         $app->redirect('index.php?option=com_judownload&view=listcats');
     }
     $this->items = $this->get('Items');
     $this->state = $this->get('State');
     $this->authors = $this->get('Authors');
     $this->pagination = $this->get('Pagination');
     if ($app->input->get('layout') == 'copy') {
         JToolBarHelper::title(JText::_('COM_JUDOWNLOAD_COPY_DOCUMENTS'), 'copy-documents');
         JToolBarHelper::apply('documents.copyDocuments', 'JTOOLBAR_APPLY');
         JToolBarHelper::cancel('document.cancel', 'JTOOLBAR_CANCEL');
     } elseif ($app->input->get('layout') == 'move') {
         JToolBarHelper::title(JText::_('COM_JUDOWNLOAD_MOVE_DOCUMENTS'), 'move-documents');
         JToolBarHelper::apply('documents.moveDocuments', 'JTOOLBAR_APPLY');
         JToolBarHelper::cancel('document.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::title(JText::_('COM_JUDOWNLOAD_DOCUMENTS'), 'documents');
         $this->totalDocs = $this->get('Total');
         $this->setDocument();
     }
     if (JUDownloadHelper::isJoomla3x() && $app->input->get('layout') == 'modal') {
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
     }
     parent::display($tpl);
 }
예제 #4
0
 public function __set($name, $value)
 {
     switch ($name) {
         case 'height':
         case 'width':
         case 'assetField':
         case 'authorField':
         case 'asset':
             $this->{$name} = (string) $value;
             break;
         case 'buttons':
             $value = (string) $value;
             if ($value == 'true' || $value == 'yes' || $value == '1') {
                 $this->buttons = true;
             } elseif ($value == 'false' || $value == 'no' || $value == '0') {
                 $this->buttons = false;
             } else {
                 $this->buttons = explode(',', $value);
             }
             break;
         case 'hide':
             $value = (string) $value;
             $this->hide = $value ? explode(',', $value) : array();
             break;
         case 'editorType':
             $this->editorType = explode('|', trim((string) $value));
             break;
         default:
             if (JUDownloadHelper::isJoomla3x()) {
                 parent::__set($name, $value);
             } else {
                 $this->{$name} = $value;
             }
     }
 }
예제 #5
0
    protected function getOptions()
    {
        $document = JFactory::getDocument();
        if (JUDownloadHelper::isJoomla3x()) {
            $triggerJqueryChosen = '$("#jform_parent_id").trigger("liszt:updated");';
        } else {
            $triggerJqueryChosen = '';
        }
        $script = '
			jQuery(document).ready(function($){
				$("#jform_template_id").change(function(){
					var objData = {};
					objData.value = $(this).val();
					$.ajax({
						type: "POST",
						url : "index.php?option=com_judownload&task=style.changeTemplateId",
						data: objData
					}).done(function (data) {
						$("option","#jform_parent_id").remove();
						$("#jform_parent_id").append(data);
						' . $triggerJqueryChosen . '
					});
				});
			});
		';
        $document->addScriptDeclaration($script);
        $db = JFactory::getDbo();
        $options = array();
        $styleId = $this->form->getValue('id');
        if ($styleId) {
            $templateId = $this->form->getValue('template_id');
            $query = $db->getQuery(true);
            $query->select('parent_id');
            $query->from('#__judownload_templates');
            $query->where('id = ' . (int) $templateId);
            $db->setQuery($query);
            $templateParentId = $db->loadResult();
        } else {
            $templateParentId = 0;
        }
        $query = $db->getQuery(true);
        $query->select('*');
        $query->select('title AS text');
        $query->select('id AS value');
        $query->from('#__judownload_template_styles');
        $query->where('template_id = ' . (int) $templateParentId);
        $query->order('lft ASC');
        $db->setQuery($query);
        try {
            $options = $db->loadObjectList();
        } catch (RuntimeException $e) {
            JError::raiseWarning(500, $e->getMessage());
        }
        for ($i = 0, $n = count($options); $i < $n; $i++) {
            $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
        }
        $options = array_merge(parent::getOptions(), $options);
        return $options;
    }
예제 #6
0
 protected function loadFormData()
 {
     $data = JFactory::getApplication()->getUserState('com_judownload.edit.criteriagroup.data', array());
     if (empty($data)) {
         $data = $this->getItem();
     }
     if (JUDownloadHelper::isJoomla3x()) {
         $this->preprocessData('com_judownload.criteriagroup', $data);
     }
     return $data;
 }
예제 #7
0
 public function display($tpl = null)
 {
     JHtml::_('behavior.calendar');
     $this->addToolBar();
     $this->model = $this->getModel();
     if ($this->getLayout() == "fields_mapping") {
         $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDOWNLOAD_DEFAULT'));
         $this->fieldsOption[] = JHTML::_('select.option', 'ignore', JText::_("COM_JUDOWNLOAD_IGNORE"));
         $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDOWNLOAD_CORE_FIELDS'));
         $coreFieldsHaveFieldClass = $this->model->getFieldsHaveFieldClass('core');
         foreach ($coreFieldsHaveFieldClass as $field) {
             $this->fieldsOption[] = JHTML::_('select.option', $field->id, $field->caption);
         }
         $coreFieldsHaveNoFieldClass = $this->model->getDocumentTableFieldsName($coreFieldsHaveFieldClass);
         if (!empty($coreFieldsHaveNoFieldClass)) {
             foreach ($coreFieldsHaveNoFieldClass as $field) {
                 $this->fieldsOption[] = JHTML::_('select.option', $field, ucfirst(str_replace('_', ' ', $field)));
             }
         }
         $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDOWNLOAD_EXTRA_FIELDS'));
         $extraFields = $this->model->getFieldsHaveFieldClass('extra');
         foreach ($extraFields as $field) {
             $this->fieldsOption[] = JHTML::_('select.option', $field->id, $field->caption);
         }
         $this->fieldsOption[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('COM_JUDOWNLOAD_OTHER_FIELDS'));
         $this->fieldsOption[] = JHTML::_('select.option', 'main_cat', JText::_('COM_JUDOWNLOAD_FIELD_MAIN_CATEGORY'));
         $this->fieldsOption[] = JHTML::_('select.option', 'secondary_cats', JText::_('COM_JUDOWNLOAD_FIELD_SECONDARY_CATEGORIES'));
         $this->fieldsOption[] = JHTML::_('select.option', 'gallery', JText::_('COM_JUDOWNLOAD_FIELD_GALLERY'));
         $this->fieldsOption[] = JHTML::_('select.option', 'files', JText::_('COM_JUDOWNLOAD_FIELD_FILES'));
         $this->fieldsOption[] = JHTML::_('select.option', 'related_docs', JText::_('COM_JUDOWNLOAD_FIELD_RELATED_DOCUMENTS'));
     }
     if ($this->getLayout() == 'config') {
         $this->form = $this->get('Form');
         $this->save = "<select id='save_options' name='save_options'>";
         $this->save .= "<option value='keep' selected>" . JText::_("COM_JUDOWNLOAD_KEEP_BOTH") . "</option>";
         $this->save .= "<option value='skip'>" . JText::_("COM_JUDOWNLOAD_SKIP_EXISTED_DOCUMENTS") . "</option>";
         $this->save .= "<option value='replace'>" . JText::_("COM_JUDOWNLOAD_REPLACE_EXISTED_DOCUMENTS") . "</option>";
         $this->save .= "</select>";
     }
     if ($this->getLayout() == 'review') {
         if (isset($this->review['config']['default_icon'])) {
             $this->review['config']['default_icon'] = str_replace(array(JPATH_ROOT . '\\', "\\"), array(JUri::root(), '/'), $this->review['config']['default_icon']);
         }
     }
     $this->isJoomla3x = JUDownloadHelper::isJoomla3x();
     if ($this->getLayout() == "export") {
         $this->exportForm = $this->get("ExportForm");
     }
     parent::display($tpl);
     $this->setDocument();
 }
예제 #8
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     JHtml::_('behavior.calendar');
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->script = $this->get('Script');
     $this->canDo = JUDownloadHelper::getActions('com_judownload');
     $this->groupCanDoManage = JUDownloadHelper::checkGroupPermission("globalconfig.save");
     $this->isJoomla3x = JUDownloadHelper::isJoomla3x();
     $this->setDocument();
     $this->addToolBar();
     parent::display($tpl);
 }
예제 #9
0
 public function fetchButton($type = 'JUHelp', $name = '', $text = '', $task = '', $list = true)
 {
     $i18n_text = JText::_($text);
     $class = $this->fetchIconClass($name);
     $doTask = $this->_getCommand($text, $task, $list);
     if (!JUDownloadHelper::isJoomla3x()) {
         $html = "<a href=\"#\" onclick=\"{$doTask}\" class=\"toolbar\">\n";
         $html .= "<span class=\"{$class}\">\n";
         $html .= "</span>\n";
         $html .= "{$i18n_text}\n";
         $html .= "</a>\n";
     } else {
         $html = "<button onclick=\"{$doTask}\" class=\"btn btn-small\">\n";
         $html .= "<span class=\"{$class}\">\n";
         $html .= "</span>\n";
         $html .= "{$i18n_text}\n";
         $html .= "</button>\n";
     }
     return $html;
 }
예제 #10
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->canDo = JUDownloadHelper::getActions('com_judownload');
     $this->groupCanDoManage = JUDownloadHelper::checkGroupPermission("tag.edit");
     $this->groupCanDoDelete = JUDownloadHelper::checkGroupPermission("tags.delete");
     $this->addToolBar();
     if (JUDownloadHelper::isJoomla3x()) {
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
     }
     parent::display($tpl);
     $this->setDocument();
 }
예제 #11
0
    protected function getInput()
    {
        $document = JFactory::getDocument();
        $document->addStyleSheet(JUri::root() . 'administrator/components/com_judownload/assets/css/juselect.css');
        $document->addScript(JUri::root() . 'administrator/components/com_judownload/assets/js/juselect.js');
        $document->addScript(JUri::root() . "components/com_judownload/assets/js/jquery.dragsort.min.js");
        $scriptv3 = '
		setTimeout(function(){
				$(".juselect-container").find(".juselect-select").show();
				$(".juselect-container").next(".chzn-container").hide();
		}, 10);';
        $script = 'jQuery(document).ready(function($){
			$("#' . $this->id . '").juSelect({
				\'selectItems\' : "' . ($this->value ? implode(",", $this->value) : '') . '"
			});

			$(".juselect-list").dragsort({
	            dragSelector: "li",
	            
	            placeHolderTemplate: \'<li class="placeHolder"></li>\',
	            dragSelectorExclude: \'a\'
            });

			' . (JUDownloadHelper::isJoomla3x() ? $scriptv3 : '') . '
		});';
        $document->addScriptDeclaration($script);
        $attr = '';
        $attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
        $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
        $attr .= $this->multiple ? ' multiple' : '';
        $attr .= $this->required ? ' required aria-required="true"' : '';
        $attr .= $this->autofocus ? ' autofocus' : '';
        if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') {
            $attr .= ' disabled="disabled"';
        }
        $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
        $options = (array) $this->getOptions();
        return JHtml::_('select.groupedlist', $options, $this->name, array('id' => $this->id, 'group.id' => 'id', 'list.attr' => $attr, 'list.select' => ''));
    }
예제 #12
0
 public function display($tpl = null)
 {
     if (!JUDownloadHelper::hasMultiRating()) {
         JError::raiseError(500, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
         return false;
     }
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->canDo = JUDownloadHelper::getActions('com_judownload');
     $this->groupCanDoManage = JUDownloadHelper::checkGroupPermission("criteria.edit");
     $this->groupCanDoDelete = JUDownloadHelper::checkGroupPermission("criterias.delete");
     $this->addToolBar();
     if (JUDownloadHelper::isJoomla3x()) {
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
     }
     parent::display($tpl);
     $this->setDocument();
 }
예제 #13
0
">
								<?php 
        echo $item->title;
        ?>
							</a>
						<?php 
    } else {
        ?>
							<?php 
        echo $item->title;
        ?>
						<?php 
    }
    ?>
						<p class="<?php 
    echo JUDownloadHelper::isJoomla3x() ? "small" : "smallsub";
    ?>
"><?php 
    echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));
    ?>
</p>
					</td>

					<td>
						<?php 
    echo JUDownloadHelper::generateCategoryPath($item->parent_id, " > ", true, true);
    ?>
					</td>
					<td>
						<?php 
    echo $item->access;
예제 #14
0
 * @copyright      Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved.
 * @license        GNU General Public License version 2 or later; see LICENSE.txt
 * @author         JoomUltra Co., Ltd
 * @website        http://www.joomultra.com
 * @----------------------------------------------------------------------@
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

$title = "";
$class = "control-label col-sm-2";

if ($this->description)
{
	if (JUDownloadHelper::isJoomla3x())
	{
		$class .= " hasTooltip";
		$separator = "<br/>";
	}
	else
	{
		$separator = "::";
		$class .= " hasTip";
	}
	// If write description as UPPERCASE -> translate it
	if ($this->description == strtoupper($this->description))
	{
		$description = JText::_($this->description);
	}
	else
예제 #15
0
JHtml::_('formbehavior.chosen', 'select');
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'field.ordering';
$priority = $listOrder == 'field.priority';
$backend_list_view_ordering = $listOrder == 'field.backend_list_view_ordering';
if ($saveOrder) {
    $saveOrderingUrl = 'index.php?option=com_judownload&task=fields.saveOrderAjax&tmpl=component';
    JHtml::_('sortablelist.sortable', 'data-list', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
?>
<script type="text/javascript">
	var isJoomla3x = <?php 
echo JUDownloadHelper::isJoomla3x() ? 1 : 0;
?>
;
	Joomla.orderTable = function () {
		table = document.getElementById("sortTable");
		direction = document.getElementById("directionTable");
		order = table.options[table.selectedIndex].value;
		if (order != '<?php 
echo $listOrder;
?>
') {
			dirn = 'asc';
		} else {
			dirn = direction.options[direction.selectedIndex].value;
		}
		Joomla.tableOrdering(order, dirn, '');
예제 #16
0
	public function getInput($fieldValue = null)
	{
		if (!$this->isPublished())
		{
			return "";
		}

		if ((JUDownloadHelper::getDocumentSubmitType($this->doc_id) == 'submit' && $this->canSubmit())
			|| (JUDownloadHelper::getDocumentSubmitType($this->doc_id) == 'edit' && $this->canEdit())
		)
		{
			$disabled = false;
		}
		else
		{
			$disabled = true;
		}

		$document = JFactory::getDocument();
		$rootCat  = JUDownloadFrontHelperCategory::getRootCategory();
		JText::script('COM_JUDOWNLOAD_TOTAL_CATS_OVER_MAXIMUM_N_CATS');
		JText::script('COM_JUDOWNLOAD_CATEGORY_X_ALREADY_EXIST');
		$app = JFactory::getApplication();
		
		if (isset($this->doc) && $this->doc->cat_id)
		{
			$params = JUDownloadHelper::getParams($this->doc->cat_id);
		}
		else
		{
			$params = JUDownloadHelper::getParams(null, $this->doc_id);
		}

		$db              = JFactory::getDbo();
		$docId           = $this->doc_id;
		$documentObject  = JUDownloadHelper::getDocumentById($docId);
		$secondaryCatIds = $secondaryCatIdsStr = "";

		
		if ($fieldValue && !empty($fieldValue['main']))
		{
			$categoryId = (int) $fieldValue['main'];
			if ($fieldValue['secondary'])
			{
				$secondaryCatIdsStr = $fieldValue['secondary'];
				$secondaryCatIds    = explode(",", $secondaryCatIdsStr);
			}
			$query = $db->getQuery(true);
			$query->select("c.id, c.parent_id");
			$query->from("#__judownload_categories AS c");
			$query->select("field_group.id AS fieldgroup_id, field_group.name AS fieldgroup_name");
			$query->join("LEFT", "#__judownload_fields_groups AS field_group ON (field_group.id = c.fieldgroup_id AND field_group.published = 1)");
			$query->where("c.id = " . $categoryId);
			$db->setQuery($query);
			$mainCategory = $db->loadObject();
		}
		
		elseif ($docId)
		{
			$categories = $this->value;
			foreach ($categories AS $category)
			{
				if ($category->main == 1)
				{
					$mainCategory = $category;

					$query = $db->getQuery(true);
					$query->select("field_group.id, field_group.name");
					$query->from("#__judownload_fields_groups AS field_group");
					$query->join("", "#__judownload_categories AS c on c.fieldgroup_id = field_group.id");
					$query->where("c.id = " . $mainCategory->id);
					$query->where("field_group.published = 1");
					$db->setQuery($query);
					$fieldGroup = $db->loadObject();
					if (is_object($fieldGroup))
					{
						$mainCategory->fieldgroup_name = $fieldGroup->name;
						$mainCategory->fieldgroup_id   = $fieldGroup->id;
					}
					else
					{
						$mainCategory->fieldgroup_name = null;
						$mainCategory->fieldgroup_id   = null;
					}
				}
				else
				{
					$secondaryCatIds[] = $category->id;
				}
			}

			if ($secondaryCatIds)
			{
				$secondaryCatIdsStr = implode(",", $secondaryCatIds);
			}
		}
		
		elseif ($app->input->getInt('cat_id'))
		{
			$categoryId   = $app->input->getInt('cat_id');
			$mainCategory = JUDownloadHelper::getCategoryById($categoryId);
			$query        = "SELECT id, name FROM #__judownload_fields_groups WHERE id= " . $mainCategory->fieldgroup_id . " AND published = 1";
			$db->setQuery($query);
			$fieldGroup = $db->loadObject();
			if (is_object($fieldGroup))
			{
				$mainCategory->fieldgroup_name = $fieldGroup->name;
				$mainCategory->fieldgroup_id   = $fieldGroup->id;
			}
			else
			{
				$mainCategory->fieldgroup_name = null;
				$mainCategory->fieldgroup_id   = null;
			}
		}
		
		else
		{
			$mainCategory                  = new stdClass();
			$mainCategory->id              = '';
			$mainCategory->parent_id       = $rootCat->id;
			$mainCategory->fieldgroup_name = null;
			$mainCategory->fieldgroup_id   = null;
		}

		$document->addStyleSheet(JUri::root() . "components/com_judownload/fields/" . $this->folder . "/core_categories.css");

		if (!$disabled)
		{
			$document->addScript(JUri::root() . "components/com_judownload/fields/" . $this->folder . "/core_categories.js");

			if (JUDownloadHelper::isJoomla3x())
			{
				$jsIsJoomla3x = 1;
			}
			else
			{
				$jsIsJoomla3x = 0;
			}

			$script = "jQuery(document).ready(function($){
								$('.category_selection').docChangeCategory({
									doc_id: '" . $docId . "',
									is_joomla_3x: '" . $jsIsJoomla3x . "',
									main_cat_id: '" . $mainCategory->id . "',
									fieldgroup_id: '" . $mainCategory->fieldgroup_id . "',
									fieldgroup_name : '" . $mainCategory->fieldgroup_name . "',
									max_cats : " . (int) 1 . "
								});
						});";

			$document->addScriptDeclaration($script);
		}

		$this->addAttribute("class", "categories", "input");
		$this->addAttribute("class", $this->getInputClass(), "input");

		$this->setVariable('mainCategory', $mainCategory);
		$this->setVariable('secondaryCatIds', $secondaryCatIds);
		$this->setVariable('documentObject', $documentObject);
		$this->setVariable('disabled', $disabled);
		$this->setVariable('secondaryCatIdsStr', $secondaryCatIdsStr);
		$this->setVariable('rootCat', $rootCat);
		$this->setVariable('params', $params);

		return $this->fetch('input.php', __CLASS__);
	}
예제 #17
0
 protected function loadFormData()
 {
     $data = JFactory::getApplication()->getUserState('com_judownload.edit.category.data', array());
     if (empty($data)) {
         $data = $this->getItem();
     }
     $params = JUDownloadHelper::getParams($data->id);
     if (isset($data->config_params) && $data->config_params) {
         $params->loadArray($data->config_params);
         $data->config_params = $params->toArray();
     }
     if (JUDownloadHelper::isJoomla3x()) {
         $this->preprocessData('com_judownload.category', $data);
     }
     return $data;
 }
예제 #18
0
JLoader::register('JUDLViewAdmin', JPATH_ADMINISTRATOR . '/components/com_judownload/helpers/judlviewadmin.php');
JLoader::register('JUDownloadSearchHelper', JPATH_SITE . '/components/com_judownload/helpers/search.php');
spl_autoload_register(array('JUDownloadHelper', 'autoLoadFieldClass'));
jimport('joomla.application.component.controller');
$app = JFactory::getApplication();
$task = $app->input->get('task');
$view = $app->input->get('view');
$permission = JUDownloadHelper::checkGroupPermission($task, $view);
if (!$permission) {
    return JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
}
if (!JFactory::getUser()->authorise('core.manage', 'com_judownload')) {
    return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$document = JFactory::getDocument();
$isJoomla3x = JUDownloadHelper::isJoomla3x();
if ($isJoomla3x) {
    $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judownload/assets/css/styles.css');
} else {
    $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judownload/assets/css/styles.j25.css');
    $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judownload/assets/css/jicomoon.css');
}
JUDownloadFrontHelper::loadjQuery();
JUDownloadFrontHelper::loadBootstrap();
$document->addScript(JUri::root() . "components/com_judownload/assets/js/jquery.dragsort.min.js");
if ($isJoomla3x && $view == 'subscriptions') {
    $document->addScript(JUri::base() . "components/com_judownload/models/forms/subscriptions.js");
}
if ($isJoomla3x && $view == 'collections') {
    $document->addScript(JUri::base() . "components/com_judownload/models/forms/collections.js");
}
예제 #19
0
    protected function getInput()
    {
        $token = JSession::getFormToken();
        $isJoomla3x = JUDownloadHelper::isJoomla3x();
        $script = '
		jQuery(document).ready(function($){';
        if ($isJoomla3x && $this->checkEditor('codemirror')) {
            $script .= '
			Joomla.editors.instances["jform_php_predefined_values"].on("change", function(){
				$("#jform_php_predefined_values").removeData("validPhp");
			});';
        } else {
            $script .= '
			$("#jform_php_predefined_values").on("change", function(){
				$(this).removeData("validPhp");
			});';
        }
        $script .= '
			$("button.testcode").click(function(){
				testPhpCode(false, "");

				return false;
			});

			testPhpCode = function(submitOnSuccess, task){
				var testCodeBtn = $("button.testcode");
					if(testCodeBtn.hasClass("disabled"))
					{
						return false;
					}

					testCodeBtn.addClass("disabled");
				var plugin_id = $("#jform_plugin_id").val();';
        if ($isJoomla3x && $this->checkEditor('codemirror')) {
            $script .= '
				var	php_code = Joomla.editors.instances["jform_php_predefined_values"].getValue();';
        } else {
            $script .= '
				var	php_code = $("#jform_php_predefined_values").val();';
        }
        $script .= '
				$.ajax({
						type: "POST",
						url: "index.php?option=com_judownload&task=field.testPhpCode",
						data: { field_id: ' . (int) $this->form->getValue('id') . ', plugin_id: plugin_id, php_predefined_values: php_code, "' . $token . '": 1 }
					})
					.done(function( data ) {
						$("code.result").html(data).parent().show();

						if(data.indexOf("<b>Fatal error</b>") !== -1)
						{
							$("#jform_php_predefined_values").data("validPhp", 0);

							if(submitOnSuccess)
							{
								alert("Predefined PHP values is invalid");
							}

							return false;
						}
						else
						{
							$("#jform_php_predefined_values").data("validPhp", 1);

							if(submitOnSuccess)
							{
								Joomla.submitbutton(task);
							}

							return true;
						}
					})
					.fail(function(jqXHR, textStatus) {
						$("#jform_php_predefined_values").data("validPhp", 0);
						alert("Error " + jqXHR.status + ": " + jqXHR.statusText);
					})
					.always(function() {
						testCodeBtn.removeClass("disabled");
					});
                }
            });';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($script);
        $editor = JFactory::getEditor('codemirror');
        $html = '<button class="btn testcode"><i class="icon-ok"></i> Test code</button>';
        $html .= '<div class="hide" style="clear: both; max-width: 100%; max-height: 300px; overflow: auto; margin: 10px 0;"><code class="result pull-left"></code></div>';
        $html .= '<div style="clear: both; color: #999; font-family: Monaco,Menlo,Consolas,\'Courier New\',monospace; margin-top: 10px;">';
        $html .= '<div>// Remember to not include the <b>&lt;?php</b> and <b>?&gt;</b> tags.</div>';
        $html .= '<div>// To highlight code, put the first line as: <b>//&lt;?php</b></div>';
        $html .= '</div>';
        if ($isJoomla3x && $this->checkEditor('codemirror')) {
            $html .= $editor->display($this->name, htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), $this->element['width'], $this->element['height'], $this->element['cols'], $this->element['rows'], false, $this->id);
        } else {
            $html .= '<textarea style="';
            if ($this->element['width']) {
                $html .= 'width: ' . $this->element['width'] . 'px;';
            }
            if ($this->element['height']) {
                $html .= 'height: ' . $this->element['height'] . 'px;';
            }
            $html .= '"';
            if ($this->element['cols']) {
                $html .= ' cols="' . $this->element['cols'] . '"';
            }
            if ($this->element['rows']) {
                $html .= ' rows="' . $this->element['rows'] . '"';
            }
            $html .= ' name="' . $this->name . '"';
            $html .= ' id="' . $this->id . '"';
            $html .= '>' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '</textarea>';
        }
        $html .= '<div style="clear: both; font-family: Monaco,Menlo,Consolas,\'Courier New\',monospace;">';
        $html .= '<span style="color: #999;">// End function - return appropriate value</span>';
        $html .= '</div>';
        return $html;
    }
예제 #20
0
 public static function thumb($template, $type = null)
 {
     $template = strtolower($template);
     $basePath = JPATH_SITE . '/components/com_judownload/templates/' . $template;
     $baseUrl = JUri::root(true) . '/components/com_judownload/';
     if ($type == 'thumbnail') {
         $fileList = JFolder::files($basePath . '/');
         if (!empty($fileList)) {
             foreach ($fileList as $fileName) {
                 $explodeArray = explode('.', $fileName);
                 if ($explodeArray[0] == 'template_thumbnail') {
                     $extThumbnail = end($explodeArray);
                     break;
                 }
             }
         }
         if (isset($extThumbnail)) {
             $thumb = $basePath . '/template_thumbnail.' . $extThumbnail;
         }
         if (isset($extThumbnail)) {
             $preview = $basePath . '/template_thumbnail.' . $extThumbnail;
         }
     } elseif ($type == 'preview') {
         $fileList = JFolder::files($basePath . '/');
         if (!empty($fileList)) {
             foreach ($fileList as $fileName) {
                 $explodeArray = explode('.', $fileName);
                 if ($explodeArray[0] == 'template_preview') {
                     $extPreview = end($explodeArray);
                     break;
                 }
             }
         }
         if (isset($extPreview)) {
             $thumb = $basePath . '/template_preview.' . $extPreview;
         }
         if (isset($extPreview)) {
             $preview = $basePath . '/template_preview.' . $extPreview;
         }
     } else {
         $fileList = JFolder::files($basePath . '/');
         if (!empty($fileList)) {
             foreach ($fileList as $fileName) {
                 $explodeArray = explode('.', $fileName);
                 if ($explodeArray[0] == 'template_thumbnail') {
                     $extThumbnail = end($explodeArray);
                 } elseif ($explodeArray[0] == 'template_preview') {
                     $extPreview = end($explodeArray);
                 }
             }
         }
         if (isset($extThumbnail)) {
             $thumb = $basePath . '/template_thumbnail.' . $extThumbnail;
         }
         if (isset($extPreview)) {
             $preview = $basePath . '/template_preview.' . $extPreview;
         }
     }
     $thumbIsImage = false;
     if (isset($thumb)) {
         if (@is_array(getimagesize($thumb))) {
             $thumbIsImage = true;
         }
     }
     $previewIsImage = false;
     if (isset($preview)) {
         if (@is_array(getimagesize($preview))) {
             $previewIsImage = true;
         }
     }
     $html = '';
     if (isset($thumb) && $thumbIsImage && file_exists($thumb)) {
         if (JUDownloadHelper::isJoomla3x()) {
             JHtml::_('bootstrap.tooltip');
         }
         JHtml::_('behavior.modal');
         if ($type == 'thumbnail') {
             $thumb = 'components/com_judownload/templates/' . $template . '/template_thumbnail.' . $extThumbnail;
             $html = JHtml::_('image', $thumb, JText::_('COM_JUDOWNLOAD_PREVIEW'), array('width' => '200px', 'height' => '200px'));
         } elseif ($type == 'preview') {
             $thumb = 'components/com_judownload/templates/' . $template . '/template_preview.' . $extPreview;
             $html = JHtml::_('image', $thumb, JText::_('COM_JUDOWNLOAD_PREVIEW'), array('width' => '200px', 'height' => '200px'));
         } else {
             $thumb = 'components/com_judownload/templates/' . $template . '/template_thumbnail.' . $extThumbnail;
             $html = JHtml::_('image', $thumb, JText::_('COM_JUDOWNLOAD_PREVIEW'));
         }
         if (isset($preview) && $previewIsImage && file_exists($preview)) {
             if ($type == 'thumbnail') {
                 $preview = $baseUrl . '/templates/' . $template . '/template_thumbnail.' . $extThumbnail;
             } elseif ($type == 'preview') {
                 $preview = $baseUrl . '/templates/' . $template . '/template_preview.' . $extPreview;
             } else {
                 $preview = $baseUrl . '/templates/' . $template . '/template_preview.' . $extPreview;
             }
             if (JUDownloadHelper::isJoomla3x()) {
                 $html = '<a href="' . $preview . '" class="thumbnail pull-left modal hasTooltip" title="' . JHtml::tooltipText('COM_JUDOWNLOAD_CLICK_TO_ENLARGE') . '">' . $html . '</a>';
             } else {
                 $html = '<a href="' . $preview . '" class="thumbnail pull-left modal hasTip" title="' . JText::_('COM_JUDOWNLOAD_CLICK_TO_ENLARGE') . '" style="width:200px;">' . $html . '</a>';
             }
         }
     }
     return $html;
 }
예제 #21
0
	public static function loadBootstrap($version = 2, $type = 2)
	{
		$document = JFactory::getDocument();

		
		if ($document->getType() != 'html')
		{
			return true;
		}

		$isJoomla3x = JUDownloadHelper::isJoomla3x();
		$app        = JFactory::getApplication();

		
		if ($type == 0 && ($isJoomla3x || $app->isSite()))
		{
			return false;
		}

		
		$loadBootstrap = true;
		if ($type == 2 || $app->isAdmin())
		{
			$header  = $document->getHeadData();
			$scripts = $header['scripts'];
			if (count($scripts))
			{
				$pattern = '/([\/\\a-zA-Z0-9_:\.-]*)bootstrap.([0-9\.-]|core|custom|min|pack)*?.js(.*?)/i';
				foreach ($scripts AS $script => $opts)
				{
					if (preg_match($pattern, $script))
					{
						$loadBootstrap = false;
						break;
					}
				}
			}
		}

		
		if ($loadBootstrap)
		{
			JUDownloadFrontHelper::loadjQuery();

			if ($version == 2)
			{
				if (!$isJoomla3x)
				{
					$document->addScript(JUri::root(true) . '/components/com_judownload/assets/bootstrap2/js/bootstrap.min.js');
					$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/bootstrap2/css/bootstrap.min.css');
					$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/bootstrap2/css/bootstrap-responsive.min.css');

					$document->addScriptDeclaration('
					jQuery(document).ready(function($){
						$(\'.hasTooltip\').tooltip({\'html\': true, trigger: \'hover\'}).bind(\'hidden\', function () {
					        $(this).show();
					    });
					});
				');
				}
				else
				{
					JHtml::_('bootstrap.framework');
					if ($app->isSite())
					{
						
					}
				}
			}
			elseif ($version == 3)
			{
				$document->addScript(JUri::root(true) . '/components/com_judownload/assets/bootstrap3/js/bootstrap.min.js');
				$document->addStyleSheet(JUri::root(true) . '/components/com_judownload/assets/bootstrap3/css/bootstrap.min.css');
				

				
			}
		}

		
		if ($app->isAdmin())
		{
			$document->addScript(JUri::root(true) . '/administrator/components/com_judownload/assets/js/bootstrap-hover-dropdown.js');
		}
	}
 static function setGlobal($value = 0, $i, $canChange = true, $controller = 'collections', $id = 'cb')
 {
     $states = array(0 => array('publish_x.png', 'icon-unpublish', '', $controller . '.setGlobal', JText::_('COM_JUDOWNLOAD_NOT_GLOBAL'), JText::_('COM_JUDOWNLOAD_TOGGLE_TO_SET_GLOBAL')), 1 => array('tick.png', 'icon-publish', 'active', $controller . '.unsetGlobal', JText::_('COM_JUDOWNLOAD_GLOBAL'), JText::_('COM_JUDOWNLOAD_TOGGLE_TO_UNSET_GLOBAL')));
     $state = JArrayHelper::getValue($states, (int) $value, $states[1]);
     if (JUDownloadHelper::isJoomla3x()) {
         $html = '<i class="' . $state[1] . '"></i>';
         if ($canChange) {
             $html = '<a class="btn btn-micro ' . $state[2] . ' hasTooltip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '<br/>' . $state[5] . '">' . $html . '</a>';
         } else {
             $html = '<a class="btn btn-micro disabled hasTooltip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '<br/>' . $state[5] . '">' . $html . '</a>';
         }
     } else {
         $html = JHtml::_('image', 'admin/' . $state[0], $state[4], null, true);
         if ($canChange) {
             $html = '<a class="hasTip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '::' . $state[5] . '">' . $html . '</a>';
         }
     }
     return $html;
 }