Beispiel #1
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = NewsfeedsHelper::getActions($state->get('filter.category_id'));
     Toolbar::title(Lang::txt('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'newsfeeds.png');
     if (count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         Toolbar::addNew('newsfeed.add');
     }
     if ($canDo->get('core.edit')) {
         Toolbar::editList('newsfeed.edit');
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('newsfeeds.publish', 'JTOOLBAR_PUBLISH', true);
         Toolbar::unpublish('newsfeeds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         Toolbar::divider();
         Toolbar::archiveList('newsfeeds.archive');
     }
     if ($canDo->get('core.admin')) {
         Toolbar::checkin('newsfeeds.checkin');
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         Toolbar::deleteList('', 'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
         Toolbar::divider();
     } elseif ($canDo->get('core.edit.state')) {
         Toolbar::trash('newsfeeds.trash');
         Toolbar::divider();
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_newsfeeds');
         Toolbar::divider();
     }
     Toolbar::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
 }
Beispiel #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $userId = User::get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     // Since we don't track these assets at the item level, use the category id.
     $canDo = NewsfeedsHelper::getActions($this->item->catid, 0);
     Toolbar::title(Lang::txt('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'newsfeeds.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
         Toolbar::apply('newsfeed.apply');
         Toolbar::save('newsfeed.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         Toolbar::save2new('newsfeed.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('newsfeed.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('newsfeed.cancel');
     } else {
         Toolbar::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
 }
Beispiel #3
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
     Toolbar::title(Lang::txt('COM_CONTENT_ARTICLES_TITLE'), 'article.png');
     if ($canDo->get('core.create') || count(User::getAuthorisedCategories('com_content', 'core.create')) > 0) {
         Toolbar::addNew('article.add');
     }
     if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
         Toolbar::editList('article.edit');
     }
     if ($canDo->get('core.edit.state')) {
         Toolbar::divider();
         Toolbar::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
         Toolbar::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         //Toolbar::custom('articles.featured', 'featured.png', 'featured_f2.png', 'JFEATURED', true);
         Toolbar::divider();
         Toolbar::archiveList('articles.archive');
         Toolbar::checkin('articles.checkin');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         Toolbar::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
         Toolbar::divider();
     } elseif ($canDo->get('core.edit.state')) {
         Toolbar::trash('articles.trash');
         Toolbar::divider();
     }
     if ($canDo->get('core.admin')) {
         Toolbar::preferences('com_content');
         Toolbar::divider();
     }
     Toolbar::help('articles');
 }
Beispiel #4
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Get model data.
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $this->return_page = $this->get('ReturnPage');
     if (empty($this->item->id)) {
         $authorised = User::authorise('core.create', 'com_content') || count(User::getAuthorisedCategories('com_content', 'core.create'));
     } else {
         $authorised = $this->item->params->get('access-edit');
     }
     if ($authorised !== true) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     if (!empty($this->item) && isset($this->item->id)) {
         $this->item->images = json_decode($this->item->images);
         $this->item->urls = json_decode($this->item->urls);
         $tmp = new stdClass();
         $tmp->images = $this->item->images;
         $tmp->urls = $this->item->urls;
         $this->form->bind($tmp);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors), 500);
         return false;
     }
     // Create a shortcut to the parameters.
     $params =& $this->state->params;
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->params = $params;
     $this->user = User::getRoot();
     if ($params->get('enable_category') == 1) {
         $this->form->setFieldAttribute('catid', 'default', $params->get('catid', 1));
         $this->form->setFieldAttribute('catid', 'readonly', 'true');
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
Beispiel #5
0
 /**
  * Display the button
  *
  * @param   string   $name
  * @param   string   $asset
  * @param   integer  $author
  * @return  array    A two element array of (imageName, textToInsert)
  */
 public function onDisplay($name, $asset, $author)
 {
     $params = Component::params('com_media');
     $extension = Request::getCmd('option');
     if ($asset == '') {
         $asset = $extension;
     }
     if (User::authorise('core.edit', $asset) || User::authorise('core.create', $asset) || count(User::getAuthorisedCategories($asset, 'core.create')) > 0 || User::authorise('core.edit.own', $asset) && $author == User::get('id') || count(User::getAuthorisedCategories($extension, 'core.edit')) > 0 || count(User::getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == User::get('id')) {
         $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name . '&asset=' . $asset . '&author=' . $author;
         Html::behavior('modal');
         $button = new \Hubzero\Base\Object();
         $button->set('modal', true);
         $button->set('link', $link);
         $button->set('text', Lang::txt('PLG_IMAGE_BUTTON_IMAGE'));
         $button->set('name', 'image');
         $button->set('options', "{handler: 'iframe', size: {x: 800, y: 500}}");
         return $button;
     }
     return false;
 }
Beispiel #6
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $userId = User::get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = ContentHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     Toolbar::title(Lang::txt('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))), 'article-add.png');
     // Built the actions for new and existing records.
     // For new records, check the create permission.
     if ($isNew && count(User::getAuthorisedCategories('com_content', 'core.create')) > 0) {
         Toolbar::apply('article.apply');
         Toolbar::save('article.save');
         Toolbar::save2new('article.save2new');
         Toolbar::cancel('article.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checkedOut) {
             // Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
             if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) {
                 Toolbar::apply('article.apply');
                 Toolbar::save('article.save');
                 // We can save this record, but check the create permission to see if we can return to make a new one.
                 if ($canDo->get('core.create')) {
                     Toolbar::save2new('article.save2new');
                 }
             }
         }
         // If checked out, we can still save
         if ($canDo->get('core.create')) {
             Toolbar::save2copy('article.save2copy');
         }
         Toolbar::cancel('article.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('article');
 }
Beispiel #7
0
 /**
  * Method to check if you can add a new record.
  *
  * @param   array  $data  An array of input data.
  * @return  boolean
  */
 protected function allowAdd($data = array())
 {
     return User::authorise('core.create', $this->_option) || count(User::getAuthorisedCategories($this->_option, 'core.create'));
 }
Beispiel #8
0
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
         Toolbar::apply('note.apply');
         Toolbar::save('note.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
         Toolbar::save2new('note.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
         Toolbar::save2copy('note.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('note.cancel');
     } else {
         Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('note');
 }
Beispiel #9
0
// No direct access
defined('_HZEXEC_') or die;
$checkedOut = !($this->row->get('checked_out') == 0 || $this->row->get('checked_out') == User::get('id'));
$canDo = Components\Members\Helpers\Admin::getActions($this->row->get('category_id'), $this->row->get('id'));
$text = $this->task == 'edit' ? Lang::txt('JACTION_EDIT') : Lang::txt('JACTION_CREATE');
Toolbar::title(Lang::txt('COM_MEMBERS') . ': ' . Lang::txt('COM_MEMBERS_NOTES') . ': ' . $text, 'user');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
    Toolbar::apply('note.apply');
    Toolbar::save('note.save');
}
if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
    Toolbar::save2new('note.save2new');
}
// If an existing item, can save to a copy.
if (!$this->row->isNew() && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
    Toolbar::save2copy('note.save2copy');
}
Toolbar::cancel('note.cancel');
Toolbar::divider();
Toolbar::help('note');
Html::behavior('tooltip');
Html::behavior('formvalidation');
?>

<script type="text/javascript">
function submitbutton(pressbutton)
{
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
Beispiel #10
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     // Initialise variables.
     $extension = Request::getCmd('extension');
     $userId = User::get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Avoid nonsense situation.
     if ($extension == 'com_categories') {
         return;
     }
     // The extension can be in the form com_foo.section
     $parts = explode('.', $extension);
     $component = $parts[0];
     $section = count($parts) > 1 ? $parts[1] : null;
     // Need to load the menu language file as mod_menu hasn't been loaded yet.
     $lang = Lang::getRoot();
     $lang->load($component, JPATH_BASE, null, false, false) || $lang->load($component, PATH_CORE . '/components/' . $component . '/admin', null, false, false) || $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false) || $lang->load($component, PATH_CORE . '/components/' . $component . '/admin', $lang->getDefault(), false, false);
     // Load the category helper.
     require_once JPATH_COMPONENT . '/helpers/categories.php';
     // Get the results for each action.
     $canDo = CategoriesHelper::getActions($component, $this->item->id);
     // If a component categories title string is present, let's use it.
     if ($lang->hasKey($component_title_key = $component . ($section ? "_{$section}" : '') . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE')) {
         $title = Lang::txt($component_title_key);
     } elseif ($lang->hasKey($component_section_key = $component . ($section ? "_{$section}" : ''))) {
         $title = Lang::txt('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', $this->escape(Lang::txt($component_section_key)));
     } else {
         $title = Lang::txt('COM_CATEGORIES_CATEGORY_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE');
     }
     // Load specific css component
     Html::asset('stylesheet', $component . '/administrator/categories.css', array(), true);
     // Prepare the toolbar.
     Toolbar::title($title, 'category-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-{$section}" : '') . '-category-' . ($isNew ? 'add' : 'edit'));
     // For new records, check the create permission.
     if ($isNew && count(User::getAuthorisedCategories($component, 'core.create')) > 0) {
         Toolbar::apply('category.apply');
         Toolbar::save('category.save');
         Toolbar::save2new('category.save2new');
     } elseif (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_user_id == $userId)) {
         Toolbar::apply('category.apply');
         Toolbar::save('category.save');
         if ($canDo->get('core.create')) {
             Toolbar::save2new('category.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('category.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('category.cancel');
     } else {
         Toolbar::cancel('category.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     // Compute the ref_key if it does exist in the component
     if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_{$section}" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY')) {
         $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_{$section}" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT');
     }
     // Get help for the category/section view for the component by
     // -remotely searching in a language defined dedicated URL: *component*_HELP_URL
     // -locally  searching in a component help file if helpURL param exists in the component and is set to ''
     // -remotely searching in a component URL if helpURL param exists in the component and is NOT set to ''
     if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) {
         $debug = $lang->setDebug(false);
         $url = Lang::txt($lang_help_url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     Toolbar::help('category');
     //$ref_key, Component::params( $component )->exists('helpURL'), $url, $component);
 }
Beispiel #11
0
<?php

/**
 * @package		Joomla.Site
 * @subpackage	com_media
 * @copyright	Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// no direct access
defined('_HZEXEC_') or die;
$params = Component::params('com_media');
// Make sure the user is authorized to view this page
$asset = Request::getCmd('asset');
$author = Request::getCmd('author');
if (!$asset or !User::authorise('core.edit', $asset) && !User::authorise('core.create', $asset) && count(User::getAuthorisedCategories($asset, 'core.create')) == 0 && !(User::get('id') == $author && User::authorise('core.edit.own', $asset))) {
    return App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
}
// Set the path definitions
define('COM_MEDIA_BASE', PATH_CORE . '/' . $params->get('image_path', 'images'));
define('COM_MEDIA_BASEURL', Request::root() . '/' . $params->get('image_path', 'images'));
Lang::load('com_media', dirname(__DIR__) . '/admin', null, false, true) || Lang::load('com_media', __DIR__, null, false, true);
// Load the admin HTML view
require_once dirname(__DIR__) . '/admin/helpers/media.php';
// Require the base controller
require_once __DIR__ . '/controller.php';
// Make sure the user is authorized to view this page
$cmd = Request::getCmd('task', null);
if (strpos($cmd, '.') != false) {
    // We have a defined controller/task pair -- lets split them out
    list($controllerName, $task) = explode('.', $cmd);
    // Define the controller name and path