/** * Add the toolbar and toolbar title. * * @access protected * @return void * * @since 2.0 */ protected function addToolbar() { // Get the results for each action $canDo = JoomHelper::getActions(); JToolBarHelper::title(JText::_('COM_JOOMGALLERY_CATMAN_CATEGORY_MANAGER'), 'folder'); if ($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.create') || count(JoomHelper::getAuthorisedCategories('core.create'))) { JToolbarHelper::addNew('new'); } if (($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.edit') || count(JoomHelper::getAuthorisedCategories('core.edit'))) && $this->pagination->total) { JToolbarHelper::editList('edit'); JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">\n <i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\n {$title}</button>"; JToolBar::getInstance('toolbar')->appendButton('Custom', $dhtml, 'batch'); JToolbarHelper::divider(); } if (($this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('core.edit.state'))) && $this->pagination->total) { JToolbarHelper::publishList('publish', JText::_('COM_JOOMGALLERY_COMMON_PUBLISH')); JToolbarHelper::unpublishList('unpublish', JText::_('COM_JOOMGALLERY_COMMON_UNPUBLISH')); JToolbarHelper::divider(); } if (($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.delete') || count(JoomHelper::getAuthorisedCategories('core.delete'))) && $this->pagination->total) { JToolbarHelper::deleteList('', 'remove'); JToolbarHelper::divider(); } $options = array(JHtml::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY')), JHtml::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.published'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); $options = array(JHtml::_('select.option', 1, JText::_('COM_JOOMGALLERY_CATMAN_OPTION_USERCATEGORIES_ONLY')), JHtml::_('select.option', 2, JText::_('COM_JOOMGALLERY_CATMAN_OPTION_BACKENDCATEGORIES_ONLY'))); JHtmlSidebar::addFilter(JText::_('COM_JOOMGALLERY_COMMON_OPTION_SELECT_TYPE'), 'filter_type', JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.type'), true)); }
/** * Add the toolbar and toolbar title. * * @access protected * @return void * * @since 2.0 */ protected function addToolbar() { // Get the results for each action $canDo = JoomHelper::getActions(); JToolBarHelper::title(JText::_('COM_JOOMGALLERY_CATMAN_CATEGORY_MANAGER'), 'folder'); if ($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.create') || count(JoomHelper::getAuthorisedCategories('core.create'))) { JToolbarHelper::addNew('new'); } if (($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.edit') || count(JoomHelper::getAuthorisedCategories('core.edit'))) && $this->pagination->total) { JToolbarHelper::editList('edit'); JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">\n <i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\n {$title}</button>"; JToolBar::getInstance('toolbar')->appendButton('Custom', $dhtml, 'batch'); JToolbarHelper::divider(); } if (($this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('core.edit.state'))) && $this->pagination->total) { JToolbarHelper::publishList('publish', JText::_('COM_JOOMGALLERY_COMMON_PUBLISH')); JToolbarHelper::unpublishList('unpublish', JText::_('COM_JOOMGALLERY_COMMON_UNPUBLISH')); JToolbarHelper::divider(); } if (($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.delete') || count(JoomHelper::getAuthorisedCategories('core.delete'))) && $this->pagination->total) { JToolbarHelper::deleteList('', 'remove'); JToolbarHelper::divider(); } }
/** * Add the toolbar and toolbar title. * * @access protected * @return void * * @since 2.0 */ protected function addToolbar() { // Get the results for each action $canDo = JoomHelper::getActions(); JToolBarHelper::title(JText::_('COM_JOOMGALLERY_IMGMAN_IMAGE_MANAGER'), 'images'); if (($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('joom.upload') || count(JoomHelper::getAuthorisedCategories('joom.upload'))) && $this->pagination->total) { JToolbarHelper::addNew('new'); } if (($canDo->get('core.edit') || $canDo->get('core.edit.own')) && $this->pagination->total) { JToolbarHelper::editList(); JToolbarHelper::custom('edit', 'checkbox-partial', 'checkbox-partial', 'JTOOLBAR_BATCH'); JToolbarHelper::custom('showmove', 'move.png', 'move.png', 'COM_JOOMGALLERY_COMMON_TOOLBAR_MOVE'); JToolbarHelper::custom('recreate', 'refresh.png', 'refresh.png', 'COM_JOOMGALLERY_COMMON_TOOLBAR_RECREATE'); JToolbarHelper::divider(); } if ($canDo->get('core.edit.state') && $this->pagination->total) { JToolbarHelper::publishList('publish', JText::_('COM_JOOMGALLERY_COMMON_PUBLISH')); JToolbarHelper::unpublishList('unpublish', JText::_('COM_JOOMGALLERY_COMMON_UNPUBLISH')); JToolbarHelper::custom('approve', 'upload.png', 'upload_f2.png', 'COM_JOOMGALLERY_IMGMAN_TOOLBAR_APPROVE'); JToolbarHelper::divider(); } //if($canDo->get('core.delete')) //{ JToolbarHelper::deleteList('', 'remove'); //} }
/** * Displays the default upload form * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * @return void * @since 2.0 */ public function display($cachable = false, $urlparams = false) { // Access check if (!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload'))) { $this->setRedirect(JRoute::_($this->_ambit->getRedirectUrl('categories'), false), JText::_('No categories found into which you are allowed to upload'), 'notice'); return; } parent::display($cachable, $urlparams); }
protected function addToolbar() { // Get the results for each action $canDo = JoomHelper::getActions(); JToolBarHelper::title(JText::_('COM_JOOMGALLERY_IMGMAN_IMAGE_MANAGER'), 'images'); if (($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('joom.upload') || count(JoomHelper::getAuthorisedCategories('joom.upload'))) && $this->pagination->total) { JToolbarHelper::addNew('new'); } if (($canDo->get('core.edit') || $canDo->get('core.edit.own')) && $this->pagination->total) { JToolbarHelper::editList(); JToolbarHelper::custom('edit', 'checkbox-partial', 'checkbox-partial', 'JTOOLBAR_BATCH'); JToolbarHelper::custom('showmove', 'move.png', 'move.png', 'COM_JOOMGALLERY_COMMON_TOOLBAR_MOVE'); JToolbarHelper::custom('recreate', 'refresh.png', 'refresh.png', 'COM_JOOMGALLERY_COMMON_TOOLBAR_RECREATE'); JToolbarHelper::divider(); } if ($canDo->get('core.edit.state') && $this->pagination->total) { JToolbarHelper::publishList('publish', JText::_('COM_JOOMGALLERY_COMMON_PUBLISH')); JToolbarHelper::unpublishList('unpublish', JText::_('COM_JOOMGALLERY_COMMON_UNPUBLISH')); JToolbarHelper::custom('approve', 'upload.png', 'upload_f2.png', 'COM_JOOMGALLERY_IMGMAN_TOOLBAR_APPROVE'); JToolbarHelper::divider(); } //if($canDo->get('core.delete')) //{ JToolbarHelper::deleteList('', 'remove'); //} // Add filter by state $options = array(JHtml::_('select.option', 0, JText::_('JOPTION_SELECT_PUBLISHED')), JHtml::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY')), JHtml::_('select.option', 2, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY')), JHtml::_('select.option', 3, JText::_('COM_JOOMGALLERY_COMMON_OPTION_APPROVED_ONLY')), JHtml::_('select.option', 4, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_APPROVED_ONLY')), JHtml::_('select.option', 5, JText::_('COM_JOOMGALLERY_COMMON_OPTION_REJECTED_ONLY'))); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.state'), false), true); // Add filter by category if (!$this->_config->get('jg_ajaxcategoryselection')) { // TODO must find a better way instead of removing the tags, what about switching to AJAX boxes -> doesn't work $options = preg_replace('~^<select[^>]*+>\\s*~', '', trim(JHtml::_('joomselect.categorylist', $this->state->get('filter.category'), 'filter_category', 'class="inputbox" onchange="document.id(\'adminForm\').submit()"', null, '- ', 'filter'))); $options = preg_replace('~\\s*</select>$~', '', $options); JHtmlSidebar::addFilter(JText::_('COM_JOOMGALLERY_COMMON_ALL'), 'filter_category', $options, true); } // Add filter by access JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); // Add filter by owner $html = JHtml::_('joomselect.userspopup', 'filter_owner', $this->state->get('filter.owner'), 'document.id(\'adminForm\').submit();'); if (strpos($html, '<select') !== false) { // TODO must find a better way instead of removing the tags $options = preg_replace('~^<select[^>]*+>\\s*~', '', trim($html)); $options = preg_replace('~\\s*</select>$~', '', $options); JHtmlSidebar::addFilter(JText::_('COM_JOOMGALLERY_COMMON_OPTION_SELECT_OWNER'), 'filter_owner', $options, true); } // Add filter by type $options = array(JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_OPTION_SELECT_TYPE')), JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_USER_UPLOADED_ONLY')), JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_COMMON_OPTION_ADMIN_UPLOADED_ONLY'))); JHtmlSidebar::addFilter(JText::_('COM_JOOMGALLERY_COMMON_OPTION_SELECT_TYPE'), 'filter_type', JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.type'), false), true); }
/** * Add managers to the sub-menu * * @return void * @since 2.0 */ public static function addSubmenu() { $current_controller = JRequest::getCmd('controller', 'control'); $controllers = array('control' => JText::_('COM_JOOMGALLERY_CONTROL_PANEL'), 'categories' => JText::_('COM_JOOMGALLERY_CATEGORY_MANAGER'), 'images' => JText::_('COM_JOOMGALLERY_IMAGE_MANAGER'), 'comments' => JText::_('COM_JOOMGALLERY_COMMENTS_MANAGER'), 'upload' => JText::_('COM_JOOMGALLERY_IMAGE_UPLOAD'), 'ajaxupload' => JText::_('COM_JOOMGALLERY_AJAX_UPLOAD'), 'batchupload' => JText::_('COM_JOOMGALLERY_BATCH_UPLOAD'), 'ftpupload' => JText::_('COM_JOOMGALLERY_FTP_UPLOAD'), 'jupload' => JText::_('COM_JOOMGALLERY_JAVA_UPLOAD'), 'config' => JText::_('COM_JOOMGALLERY_CONFIGURATION_MANAGER'), 'cssedit' => JText::_('COM_JOOMGALLERY_CUSTOMIZE_CSS'), 'migration' => JText::_('COM_JOOMGALLERY_MIGRATION_MANAGER'), 'maintenance' => JText::_('COM_JOOMGALLERY_MAINTENANCE_MANAGER'), 'help' => JText::_('COM_JOOMGALLERY_HELP')); $canDo = self::getActions(); if (!JoomConfig::getInstance()->get('jg_disableunrequiredchecks') && !$canDo->get('joom.upload') && !count(JoomHelper::getAuthorisedCategories('joom.upload'))) { unset($controllers['upload']); unset($controllers['batchupload']); unset($controllers['ftpupload']); unset($controllers['jupload']); unset($controllers['ajaxupload']); } if (!$canDo->get('core.admin')) { unset($controllers['config']); unset($controllers['cssedit']); unset($controllers['maintenance']); } foreach ($controllers as $controller => $title) { JHtmlSidebar::addEntry($title, 'index.php?option=' . _JOOM_OPTION . '&controller=' . $controller, $controller == $current_controller); } }
/** * Returns the query for loading the menu entries * * @return object The query to be used to retrieve the menu entries from the database * @since 1.5.5 */ protected function _buildQuery() { $query = $this->_db->getQuery(true)->select('*')->from('#__menu')->where('parent_id != 1')->where("menutype = 'main'"); $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=images%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=categories%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=comments%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=migration%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=help%'"; $canDo = JoomHelper::getActions(); if ($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('joom.upload') || count(JoomHelper::getAuthorisedCategories('joom.upload'))) { $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=upload%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=ajaxupload%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=batchupload%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=ftpupload%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=jupload%'"; } if ($canDo->get('core.admin')) { $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=config%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=cssedit%'"; $where[] = "link LIKE 'index.php?option=com_joomgallery&controller=maintenance%'"; } $query->where('(' . implode(' OR ', $where) . ')')->order('id'); return $query; }
/** * Retrieves the data for creating the orderings drop down list * * @param int $parent Parent category which has to be included into the list independent of it's access state * @return array An array of JHTML select options with the ordering numbers * and the category names * @since 1.5.7 */ public function getOrderings($parent = null) { if (empty($this->_orderings)) { $categories = JoomHelper::getAuthorisedCategories('core.create'); $allowed_categories = ''; // If the user is allowed to create main categories add '0' as an allowed parent category if ($this->_user->authorise('core.create', _JOOM_OPTION)) { $allowed_categories .= '1,'; } foreach ($categories as $category) { $allowed_categories .= $category->cid . ','; } if (!is_null($parent)) { $allowed_categories .= $parent; } else { $allowed_categories = trim($allowed_categories, ','); } if (!$allowed_categories) { return array(); } $query = $this->_db->getQuery(true); $query->select('cid')->select('parent_id')->select('name')->from(_JOOM_TABLE_CATEGORIES)->where('parent_id IN (' . $allowed_categories . ')')->where('lft > 0')->order('lft'); $this->_db->setQuery($query); if (!($this->_orderings = $this->_db->loadObjectList())) { $this->setError($this->_db->getError()); return array(); } } return $this->_orderings; }
/** * Add the page title and toolbar. * * @return void * * @since 2.0 */ public function addToolbar() { // Get the results for each action $canDo = JoomHelper::getActions('category', $this->item->cid); $title = JText::_('COM_JOOMGALLERY_CATMAN_CATEGORY_MANAGER') . ' :: '; if ($this->isNew) { $title .= JText::_('COM_JOOMGALLERY_CATMAN_ADD_CATEGORY'); } else { $title .= JText::_('COM_JOOMGALLERY_CATMAN_EDIT_CATEGORY'); } $title .= ' ' . JText::_('COM_JOOMGALLERY_COMMON_CATEGORY'); JToolBarHelper::title($title, 'folder'); // For new categories check the create permission if ($this->isNew && ($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.create') || count(JoomHelper::getAuthorisedCategories('core.create')))) { JToolBarHelper::apply('apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } else { if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->owner == $this->_user->get('id')) { JToolBarHelper::apply('apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('save', 'JTOOLBAR_SAVE'); if ($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.create') || count(JoomHelper::getAuthorisedCategories('core.create'))) { JToolBarHelper::save2new(); } } } // If it's an already existing category a copy may be saved (only if creating categories is allowed) if (!$this->isNew && ($this->_config->get('jg_disableunrequiredchecks') || $canDo->get('core.create') || count(JoomHelper::getAuthorisedCategories('core.create')))) { JToolBarHelper::save2copy(); } if ($this->isNew) { JToolBarHelper::cancel('cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::spacer(); }
/** * HTML view display method * * @param string $tpl The name of the template file to parse * @return void * @since 1.5.5 */ public function display($tpl = null) { if (!$this->_config->get('jg_userspace')) { $msg = JText::_('JERROR_ALERTNOAUTHOR'); $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice'); } // Additional security check for unregistered users if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) { $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice'); } $params = $this->_mainframe->getParams(); // Breadcrumbs if ($this->_config->get('jg_completebreadcrumbs')) { $breadcrumbs = $this->_mainframe->getPathway(); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel'); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES'), 'index.php?view=usercategories'); if (JRequest::getInt('catid')) { $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_EDITCATEGORY_MODIFY_CATEGORY')); } else { $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_NEW_CATEGORY')); } } // Header and footer JoomHelper::prepareParams($params); $pathway = null; if ($this->_config->get('jg_showpathway')) { $pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>'; $pathway .= ' » <a href="' . JRoute::_('index.php?view=usercategories') . '">' . JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES') . '</a>'; if (JRequest::getInt('catid')) { $pathway .= ' » ' . JText::_('COM_JOOMGALLERY_EDITCATEGORY_MODIFY_CATEGORY'); } else { $pathway .= ' » ' . JText::_('COM_JOOMGALLERY_COMMON_NEW_CATEGORY'); } } $backtarget = JRoute::_('index.php?view=userpanel'); $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_USER_PANEL'); // Get number of images and hits in gallery $numbers = JoomHelper::getNumberOfImgHits(); // Load modules at position 'top' $modules['top'] = JoomHelper::getRenderedModules('top'); if (count($modules['top'])) { $params->set('show_top_modules', 1); } // Load modules at position 'btm' $modules['btm'] = JoomHelper::getRenderedModules('btm'); if (count($modules['btm'])) { $params->set('show_btm_modules', 1); } // Load the category data $category = $this->get('Category'); // Get the form and fill the fields $form = $this->get('Form'); // Set some additional field attributes // Category slect box if ($category->cid) { // Exclude current category id from select box $form->setFieldAttribute('parent_id', 'exclude', $category->cid); } else { // If we are creating a new category pre-select a valid // parent category in select box in order to fix the content // of the parent category box and of the ordering box // (if the user is allowed to create main categories // 0 is already a valid value for the category select box) if (!$this->_config->get('jg_disableunrequiredchecks') && !$this->_user->authorise('core.create', _JOOM_OPTION)) { $parent_cats = JoomHelper::getAuthorisedCategories('core.create'); if (isset($parent_cats[0])) { $category->parent_id = $parent_cats[0]->cid; } else { $msg = JText::_('COM_JOOMGALLERY_EDITCATEGORY_ERROR_NO_AVAILABLE_PARENT_CATEGORIES'); $this->_mainframe->redirect(JRoute::_('index.php?view=usercategories', false), $msg, 'notice'); } } } // Ordering box is not available if option for performance improvement has been enabled if (!$this->_config->get('jg_disableunrequiredchecks')) { // Set some additional attributes for the ordering select box $form->setFieldAttribute('ordering', 'originalOrder', $category->cid); $form->setFieldAttribute('ordering', 'originalParent', $category->parent_id == 1 ? 0 : $category->parent_id); $form->setFieldAttribute('ordering', 'orderings', base64_encode(serialize($this->getModel()->getOrderings($category->cid ? $category->parent_id : null)))); // Perhaps there is a better way to set the field attribute $parent_field = $this->_findFieldByFieldName($form, 'parent_id'); if ($parent_field !== false) { $form->setFieldAttribute('ordering', 'parent_id', $parent_field->id); } } // Thumbnail preview $imagelib_field = $this->_findFieldByFieldName($form, 'imagelib'); // Set additional attribute for the thumbnail select box if ($imagelib_field !== false) { $form->setFieldAttribute('thumbnail', 'imagelib_id', $imagelib_field->id); } // Bind the data to the form $form->bind($category); // Set some form fields manually $form->setValue('imagelib', null, $category->catimage_src); // Get limitstart from request to set the correct limitstart (page) in usercategories when // leaving edit/new mode with save or cancel $limitstart = JRequest::getVar('limitstart', null); $slimitstart = $limitstart != null ? '&limitstart=' . (int) $limitstart : ''; $this->assignRef('params', $params); $this->assignRef('form', $form); $this->assignRef('category', $category); $this->assignRef('pathway', $pathway); $this->assignRef('modules', $modules); $this->assignRef('backtarget', $backtarget); $this->assignRef('backtext', $backtext); $this->assignRef('numberofpics', $numbers[0]); $this->assignRef('numberofhits', $numbers[1]); $this->assignRef('slimitstart', $slimitstart); parent::display($tpl); }
/** * HTML view display method * * @param string $tpl The name of the template file to parse * @return void * @since 1.5.5 */ public function display($tpl = null) { if (!$this->_config->get('jg_userspace')) { $msg = JText::_('JERROR_ALERTNOAUTHOR'); $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice'); } // Additional security check for unregistered users if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) { $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice'); } $params = $this->_mainframe->getParams(); // Breadcrumbs if ($this->_config->get('jg_completebreadcrumbs')) { $breadcrumbs = $this->_mainframe->getPathway(); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL')); } // Header and footer JoomHelper::prepareParams($params); $this->pathway = JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'); $this->backtarget = JRoute::_('index.php?view=gallery'); $this->backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY'); // Get number of images and hits in gallery $numbers = JoomHelper::getNumberOfImgHits(); $this->numberofpics = $numbers[0]; $this->numberofhits = $numbers[1]; // Load modules at position 'top' $this->modules['top'] = JoomHelper::getRenderedModules('top'); if (count($this->modules['top'])) { $params->set('show_top_modules', 1); } // Load modules at position 'btm' $this->modules['btm'] = JoomHelper::getRenderedModules('btm'); if (count($this->modules['btm'])) { $params->set('show_btm_modules', 1); } // Display button 'Upload' only if there is at least // one category into which the user is allowed to upload if ($this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('joom.upload'))) { $params->set('show_upload_button', 1); } else { $params->set('show_upload_button', 0); } // Display button 'Categories' if the current user is allowed // to create categories or if there are categories owned by him if ($this->_user->authorise('core.create', _JOOM_OPTION) || $this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('core.create')) || count($this->get('Categories'))) { $params->set('show_categories_button', 1); } else { $params->set('show_categories_button', 0); } // Get data from the model $this->total = $this->get('Total'); $this->state = $this->get('State'); if ($this->state->get('list.start') >= $this->total) { // This may happen for instance when an image has been deleted on a page with just one entry $limitstart = $this->total > 0 && $this->total > $this->state->get('list.limit') ? floor(($this->total - 1) / $this->state->get('list.limit')) * $this->state->get('list.limit') : 0; $this->state->set('list.start', $limitstart); } $this->slimitstart = $this->state->get('list.start') > 0 ? '&limitstart=' . $this->state->get('list.start') : ''; $this->items = $this->get('Images'); $this->pagination = $this->get('Pagination'); if (!$this->total) { if ($this->state->get('filter.inuse')) { $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_MSG_NO_IMAGES_FOUND_MATCHING_YOUR_QUERY')); } else { // Guests cannot own any images if (!$this->_user->get('id')) { $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_GUESTS_CANNOT_OWN_IMAGES')); } else { $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_YOU_DO_NOT_HAVE_IMAGE')); } } } $this->lists = array(); // Filter by type $options = array(JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_SELECT_STATE')), JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_APPROVED_ONLY')), JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_APPROVED_ONLY')), JHTML::_('select.option', 3, JText::_('COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY')), JHTML::_('select.option', 4, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY'))); $this->lists['filter_state'] = JHTML::_('select.genericlist', $options, 'filter_state', 'class="inputbox" size="1" onchange="form.submit();"', 'value', 'text', $this->state->get('filter.state')); foreach ($this->items as $key => &$item) { // Set the title attribute in a tag with title and/or description of image // if a box is activated if (!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 1) { $item->atagtitle = JHTML::_('joomgallery.getTitleforATag', $item); } else { // Set the imgtitle by default $item->atagtitle = 'title="' . $item->imgtitle . '"'; } // Show editor links for that image $this->items[$key]->show_edit_icon = false; $this->items[$key]->show_delete_icon = false; if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $this->items[$key]->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $this->items[$key]->id) && $this->items[$key]->owner && $this->items[$key]->owner == $this->_user->get('id')) { $this->items[$key]->show_edit_icon = true; } if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $this->items[$key]->id)) { $this->items[$key]->show_delete_icon = true; } } $this->params = $params; parent::display($tpl); }
/** * HTML view display method * * @param string $tpl The name of the template file to parse * @return void * @since 1.5.5 */ public function display($tpl = null) { if (!$this->_config->get('jg_userspace')) { $msg = JText::_('JERROR_ALERTNOAUTHOR'); $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice'); } // Additional security check for unregistered users if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) { $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice'); } $params = $this->_mainframe->getParams(); // Breadcrumbs if ($this->_config->get('jg_completebreadcrumbs')) { $breadcrumbs = $this->_mainframe->getPathway(); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel'); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES')); } // Header and footer JoomHelper::prepareParams($params); $this->pathway = null; if ($this->_config->get('jg_showpathway')) { $this->pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>'; $this->pathway .= ' » ' . JText::_('COM_JOOMGALLERY_COMMON_CATEGORIES'); } $this->backtarget = JRoute::_('index.php?view=userpanel'); $this->backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_USER_PANEL'); // Get number of images and hits in gallery $numbers = JoomHelper::getNumberOfImgHits(); $this->numberofpics = $numbers[0]; $this->numberofhits = $numbers[1]; // Load modules at position 'top' $this->modules['top'] = JoomHelper::getRenderedModules('top'); if (count($this->modules['top'])) { $params->set('show_top_modules', 1); } // Load modules at position 'btm' $this->modules['btm'] = JoomHelper::getRenderedModules('btm'); if (count($this->modules['btm'])) { $params->set('show_btm_modules', 1); } // Show upload quota if ($this->_config->get('jg_newpicnote') && $this->_user->get('id')) { $params->set('show_categories_notice', 1); } // Get data from the model $this->total = $this->get('Total'); $this->state = $this->get('State'); if ($this->state->get('list.start') >= $this->total) { // This may happen for instance when a category has been deleted on a page with just one entry $limitstart = $this->total > 0 && $this->total > $this->state->get('list.limit') ? floor(($this->total - 1) / $this->state->get('list.limit')) * $this->state->get('list.limit') : 0; $this->state->set('list.start', $limitstart); } $this->slimitstart = $this->state->get('list.start') > 0 ? '&limitstart=' . $this->state->get('list.start') : ''; // Get data from the model $this->categoryNumber = $this->get('CategoryNumber'); $this->items = $this->get('Categories'); $this->pagination = $this->get('Pagination'); // Enqueue a message in case no categories were found if (!$this->total) { if ($this->state->get('filter.inuse')) { $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERPANEL_MSG_NO_CATEGORIES_FOUND_MATCHING_YOUR_QUERY')); } else { // Guests cannot own any categories if (!$this->_user->get('id')) { $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERCATEGORIES_GUESTS_CANNOT_OWN_CATEGORIES')); } else { $this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_USERCATEGORIES_YOU_NOT_HAVE_CATEGORY')); } } } // Show the button to create a new category only for users // with create permissions and who have not reached the limits if (($this->_user->authorise('core.create', _JOOM_OPTION) || $this->_config->get('jg_disableunrequiredchecks') || count(JoomHelper::getAuthorisedCategories('core.create'))) && $this->_config->get('jg_maxusercat') - $this->categoryNumber > 0) { $params->set('show_category_button', 1); } // Preprocess the list of items to find ordering divisions. foreach ($this->items as &$item) { $this->ordering[$item->parent_id][] = $item->cid; } $this->lists = array(); // Filter by state $options = array(JHTML::_('select.option', 0, JText::_('COM_JOOMGALLERY_COMMON_SELECT_STATE')), JHTML::_('select.option', 1, JText::_('COM_JOOMGALLERY_COMMON_OPTION_PUBLISHED_ONLY')), JHTML::_('select.option', 2, JText::_('COM_JOOMGALLERY_COMMON_OPTION_NOT_PUBLISHED_ONLY'))); $this->lists['filter_state'] = JHTML::_('select.genericlist', $options, 'filter_state', 'class="inputbox" size="1" onchange="form.submit();"', 'value', 'text', $this->state->get('filter.state')); $this->params = $params; parent::display($tpl); }
/** * HTML view display method * * @param string $tpl The name of the template file to parse * @return void * @since 1.5.5 */ public function display($tpl = null) { if (!$this->_config->get('jg_userspace')) { $msg = JText::_('JERROR_ALERTNOAUTHOR'); $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), $msg, 'notice'); } // Additional security check for unregistered users if (!$this->_user->get('id') && !$this->_config->get('jg_unregistered_permissions')) { $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'), 'notice'); } if (!$this->_config->get('jg_disableunrequiredchecks') && !count(JoomHelper::getAuthorisedCategories('joom.upload'))) { $this->_mainframe->redirect(JRoute::_('index.php?view=userpanel', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_ALLOWED_TO_UPLOAD'), 'notice'); } $params = $this->_mainframe->getParams(); // Breadcrumbs if ($this->_config->get('jg_completebreadcrumbs')) { $breadcrumbs = $this->_mainframe->getPathway(); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL'), 'index.php?view=userpanel'); $breadcrumbs->addItem(JText::_('COM_JOOMGALLERY_COMMON_UPLOAD_NEW_IMAGE')); } // Header and footer JoomHelper::prepareParams($params); $pathway = null; if ($this->_config->get('jg_showpathway')) { $pathway = '<a href="' . JRoute::_('index.php?view=userpanel') . '">' . JText::_('COM_JOOMGALLERY_COMMON_USER_PANEL') . '</a>'; $pathway .= ' » ' . JText::_('COM_JOOMGALLERY_COMMON_UPLOAD_NEW_IMAGE'); } $backtarget = JRoute::_('index.php?view=gallery'); $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY'); // Get number of images and hits in gallery $numbers = JoomHelper::getNumberOfImgHits(); // Load modules at position 'top' $modules['top'] = JoomHelper::getRenderedModules('top'); if (count($modules['top'])) { $params->set('show_top_modules', 1); } // Load modules at position 'btm' $modules['btm'] = JoomHelper::getRenderedModules('btm'); if (count($modules['btm'])) { $params->set('show_btm_modules', 1); } $count = $this->get('ImageNumber'); if ($count >= $this->_config->get('jg_maxuserimage')) { $timespan = $this->_config->get('jg_maxuserimage_timespan'); $msg = JText::sprintf('COM_JOOMGALLERY_UPLOAD_OUTPUT_MAY_ADD_MAX_OF', $this->_config->get('jg_maxuserimage'), $timespan > 0 ? JText::plural('COM_JOOMGALLERY_UPLOAD_NEW_IMAGE_MAXCOUNT_TIMESPAN', $timespan) : ''); $this->_mainframe->redirect(JRoute::_('index.php?view=userpanel', false), $msg, 'notice'); } $inputcounter = $this->_config->get('jg_maxuserimage') - $count; $remainder = $inputcounter; if ($inputcounter > $this->_config->get('jg_maxuploadfields')) { $inputcounter = $this->_config->get('jg_maxuploadfields'); } $this->assignRef('count', $count); $this->assignRef('remainder', $remainder); $this->assignRef('inputcounter', $inputcounter); $this->_doc->addScriptDeclaration(' var jg_inputcounter = ' . $inputcounter . ';'); $this->assignRef('params', $params); $this->assignRef('pathway', $pathway); $this->assignRef('modules', $modules); $this->assignRef('backtarget', $backtarget); $this->assignRef('backtext', $backtext); $this->assignRef('numberofpics', $numbers[0]); $this->assignRef('numberofhits', $numbers[1]); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.tooltip'); $this->uploads = array(); $types = array('single', 'ajax', 'batch', 'java'); $tab = $this->_mainframe->input->get('tab'); $active_found = false; foreach ($types as $type) { if ($this->_config->get('jg_userupload' . $type)) { $this->uploads[$type] = array('title' => 'COM_JOOMGALLERY_UPLOAD_TAB_' . strtoupper($type) . '_UPLOAD', 'active' => false); if ($tab == $type) { $this->uploads[$type]['active'] = true; $active_found = true; } } } // One tab has to be active if (!$active_found && count($this->uploads)) { // Reset the array in order to be able to use the key of the first element reset($this->uploads); $this->uploads[key($this->uploads)]['active'] = true; } JForm::addFormPath(JPATH_COMPONENT . '/models/forms'); $this->single_form = JForm::getInstance(_JOOM_OPTION . '.upload', 'upload'); $this->ajax_form = JForm::getInstance(_JOOM_OPTION . '.ajaxupload', 'ajaxupload'); $this->batch_form = JForm::getInstance(_JOOM_OPTION . '.batchupload', 'batchupload'); $this->applet_form = JForm::getInstance(_JOOM_OPTION . '.jupload', 'jupload'); $this->single_form->setFieldAttribute('arrscreenshot', 'quantity', $inputcounter); $this->_doc->addScriptDeclaration(' var jg_filenamewithjs = ' . ($this->_config->get('jg_filenamewithjs') ? 'true' : 'false') . ';'); $this->_doc->addScript($this->_ambit->getScript('upload.js')); JText::script('COM_JOOMGALLERY_COMMON_ALERT_IMAGE_MUST_HAVE_TITLE'); JText::script('COM_JOOMGALLERY_COMMON_ALERT_YOU_MUST_SELECT_ONE_IMAGE'); JText::script('COM_JOOMGALLERY_COMMON_ALERT_WRONG_EXTENSION'); JText::script('COM_JOOMGALLERY_COMMON_ALERT_WRONG_FILENAME'); JText::script('COM_JOOMGALLERY_UPLOAD_ALERT_FILENAME_DOUBLE_ONE'); JText::script('COM_JOOMGALLERY_UPLOAD_ALERT_FILENAME_DOUBLE_TWO'); // AJAX Drag'n'Drop Upload if ($this->_config->get('jg_useruploadajax')) { $this->_doc->addStyleSheet($this->_ambit->getScript('fineuploader/fineuploader.css')); $this->_doc->addScript($this->_ambit->getScript('fineuploader/js/fineuploader' . (JFactory::getConfig()->get('debug') ? '' : '.min') . '.js')); $this->ajax_form->setFieldAttribute('ajaxupload', 'redirect', $this->getModel()->getRedirectUrlAfterUpload('ajax')); } if ($this->_config->get('jg_useorigfilename')) { $this->single_form->setFieldAttribute('imgtitle', 'required', 'false'); $this->ajax_form->setFieldAttribute('imgtitle', 'required', 'false'); $this->batch_form->setFieldAttribute('imgtitle', 'required', 'false'); $this->applet_form->setFieldAttribute('imgtitle', 'required', 'false'); } if (!$this->_config->get('jg_disableunrequiredchecks')) { // Set default user upload category $defaultUserUploadCategory = $this->get('DefaultUserUploadCategory'); $this->single_form->setValue('catid', null, $defaultUserUploadCategory); $this->ajax_form->setValue('catid', null, $defaultUserUploadCategory); $this->batch_form->setValue('catid', null, $defaultUserUploadCategory); $this->applet_form->setValue('catid', null, $defaultUserUploadCategory); } parent::display($tpl); }