/** * Displays the view * * @param string $tpl The name of the template file to parse * @return void */ public function display($tpl = null) { Html::behavior('framework'); \Hubzero\Document\Assets::addComponentStylesheet('com_languages', 'overrider.css'); \Hubzero\Document\Assets::addComponentScript('com_languages', 'overrider.js'); //Document::addStyleSheet(Request::root().'media/overrider/css/overrider.css'); //Document::addScript(Request::root().'media/overrider/js/overrider.js'); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); return; } // Check whether the cache has to be refreshed $cached_time = User::getState('com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0); if (time() - $cached_time > 60 * 5) { $this->state->set('cache_expired', true); } // Add strings for translations in Javascript JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS'); JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'); $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { $user = User::getRoot(); // If this is an auth_link account update, carry on, otherwise raise an error if (!is_object($user) || !array_key_exists('auth_link_id', $user) || !is_numeric($user->get('username')) || !$user->get('username') < 0) { App::abort('405', 'Method not allowed'); return; } // Get and add the js and extra css to the page \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'link.css'); \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'providers.css'); \Hubzero\Document\Assets::addComponentScript('com_users', 'link'); // Import a few things jimport('joomla.user.helper'); // Look up a few things $hzal = \Hubzero\Auth\Link::find_by_id($user->get("auth_link_id")); $hzad = \Hubzero\Auth\Domain::find_by_id($hzal->auth_domain_id); $plugins = Plugin::byType('authentication'); // Get the display name for the current plugin being used Plugin::import('authentication', $hzad->authenticator); $plugin = Plugin::byType('authentication', $hzad->authenticator); $pparams = new \Hubzero\Config\Registry($plugin->params); $refl = new ReflectionClass("plgAuthentication{$plugin->name}"); $display_name = $pparams->get('display_name', $refl->hasMethod('onGetLinkDescription') ? $refl->getMethod('onGetLinkDescription')->invoke(NULL) : ucfirst($plugin->name)); // Look for conflicts - first check in the hub accounts $profile_conflicts = \Hubzero\User\Profile\Helper::find_by_email($hzal->email); // Now check the auth_link table $link_conflicts = \Hubzero\Auth\Link::find_by_email($hzal->email, array($hzad->id)); $conflict = array(); if ($profile_conflicts) { foreach ($profile_conflicts as $p) { $user_id = JUserHelper::getUserId($p); $juser = User::getInstance($user_id); $auth_link = \Hubzero\Auth\Link::find_by_user_id($juser->id); $dname = is_object($auth_link) && $auth_link->auth_domain_name ? $auth_link->auth_domain_name : 'hubzero'; $conflict[] = array("auth_domain_name" => $dname, "name" => $juser->name, "email" => $juser->email); } } if ($link_conflicts) { foreach ($link_conflicts as $l) { $juser = User::getInstance($l['user_id']); $conflict[] = array("auth_domain_name" => $l['auth_domain_name'], "name" => $juser->name, "email" => $l['email']); } } // Make sure we don't somehow have any duplicate conflicts $conflict = array_map("unserialize", array_unique(array_map("serialize", $conflict))); // @TODO: Could also check for high probability of name matches??? // Get the site name $sitename = Config::get('sitename'); // Assign variables to the view $this->assign('hzal', $hzal); $this->assign('hzad', $hzad); $this->assign('plugins', $plugins); $this->assign('display_name', $display_name); $this->assign('conflict', $conflict); $this->assign('sitename', $sitename); $this->assignref('juser', $user); parent::display($tpl); }
function display($tpl = null) { Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'popup-imagemanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagemanager.css'); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = App::get('session'); $this->config = Component::params('com_media'); $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; parent::display($tpl); }
function display($tpl = null) { // Assign variables to the view $authenticator = \Request::getWord('authenticator', false); \Hubzero\Document\Assets::addComponentStylesheet('com_user', 'login.css'); // Get the site name $sitename = \Config::get('sitename'); // Get the display name for the current plugin being used $plugin = Plugin::byType('authentication', $authenticator); $pparams = new \Hubzero\Config\Registry($plugin->params); $display_name = $pparams->get('display_name', ucfirst($plugin->name)); $this->assign('authenticator', $authenticator); $this->assign('sitename', $sitename); $this->assign('display_name', $display_name); parent::display($tpl); }
function display($tpl = null) { // Do not allow cache App::get('response')->headers->set('Cache-Control', 'no-cache', false); App::get('response')->headers->set('Pragma', 'no-cache'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagelist.css'); Document::addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); $images = $this->get('images'); $folders = $this->get('folders'); $state = $this->get('state'); $this->baseURL = COM_MEDIA_BASEURL; $this->assignRef('images', $images); $this->assignRef('folders', $folders); $this->assignRef('state', $state); parent::display($tpl); }
function display($tpl = null) { $config = Component::params('com_media'); $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word'); Document::setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'mediamanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'mediamanager.css'); Html::behavior('modal'); Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\tdocument.preview = \$.fancybox;\n\t\t});"); Html::asset('script', 'system/jquery.treeview.js', true, true, false, false); Html::asset('stylesheet', 'system/jquery.treeview.css', array(), true); if (Lang::isRTL()) { Html::asset('stylesheet', 'media/jquery.treeview_rtl.css', array(), true); } if (DIRECTORY_SEPARATOR == '\\') { $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; Document::addScriptDeclaration($js); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $session = App::get('session'); $state = $this->get('state'); $this->assignRef('session', $session); $this->assignRef('config', $config); $this->assignRef('state', $state); $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $this->get('folderTree'); // Set the toolbar $this->addToolbar(); parent::display($tpl); echo Html::behavior('keepalive'); }
function display($tpl = null) { // Do not allow cache App::get('response')->headers->set('Cache-Control', 'no-cache', false); App::get('response')->headers->set('Pragma', 'no-cache'); $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word'); Html::behavior('framework', true); //Document::addStyleSheet('../media/media/css/medialist-'.$style.'.css'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'medialist-' . $style . '.css'); if (Lang::isRTL()) { //Document::addStyleSheet('../media/media/css/medialist-'.$style.'_rtl.css'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'medialist-' . $style . '_rtl.css'); } Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\twindow.parent.document.updateUploader();\n\t\t\t\$('a.img-preview').on('click', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\twindow.top.document.preview.open(\$(this).attr('href'));\n\t\t\t});\n\t\t});"); $images = $this->get('images'); $documents = $this->get('documents'); $folders = $this->get('folders'); $state = $this->get('state'); // Check for invalid folder name if (empty($state->folder)) { $dirname = Request::getVar('folder', '', '', 'string'); if (!empty($dirname)) { $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8'); if (Lang::hasKey('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME')) { throw new Exception(Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname), 100); } else { throw new Exception(sprintf('Unable to browse: %s. Directory name must only contain alphanumeric characters and no spaces.', $dirname), 100); } } } $this->baseURL = Request::root(); $this->assignRef('images', $images); $this->assignRef('documents', $documents); $this->assignRef('folders', $folders); $this->assignRef('state', $state); parent::display($tpl); }
/** * Push styles and scripts to the document * * @return void */ public static function documents() { \Hubzero\Document\Assets::addComponentStylesheet('com_resources'); \Hubzero\Document\Assets::addComponentScript('com_resources'); include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'helper.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'usage.php'; }
<?php // no direct access defined('_HZEXEC_') or die; $this->css()->css('jquery.fancybox.css', 'system')->js(); // Add projects stylesheet \Hubzero\Document\Assets::addComponentStylesheet('com_projects'); \Hubzero\Document\Assets::addComponentScript('com_projects'); \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'uploader'); \Hubzero\Document\Assets::addPluginScript('projects', 'files', 'jquery.fileuploader.js'); \Hubzero\Document\Assets::addPluginScript('projects', 'files', 'jquery.queueuploader.js'); ?> <header id="content-header"> <h2><?php echo $this->title; ?> </h2> </header><!-- / #content-header --> <?php if ($this->pid && !empty($this->project) && $this->project->get('created_by_user') == User::get('id')) { ?> <p class="contrib-options"> <?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_NEED_A_PROJECT'); ?> <a href="<?php echo Route::url('index.php?option=com_projects&alias=' . $this->project->get('alias') . '&action=activate'); ?> "> <?php
/** * Include needed libraries and push scripts and CSS to the document * * @return void */ public static function documents() { \Hubzero\Document\Assets::addComponentStylesheet('com_events'); }
/** * Retrieve records for items tagged with specific tags * * @param array $tags Tags to match records against * @param mixed $limit SQL record limit * @param integer $limitstart SQL record limit start * @param string $sort The field to sort records by * @param mixed $areas An array or string of areas that should retrieve records * @return mixed Returns integer when counting records, array when retrieving records */ public function onTagView($tags, $limit = 0, $limitstart = 0, $sort = '', $areas = null) { $response = array('name' => $this->_name, 'title' => Lang::txt('PLG_TAGS_RESOURCES'), 'total' => 0, 'results' => null, 'sql' => '', 'children' => array()); $database = App::get('db'); $rt = new \Components\Resources\Tables\Type($database); foreach ($rt->getMajorTypes() as $category) { $response['children'][$category->alias] = array('name' => $category->alias, 'title' => $category->type, 'total' => 0, 'results' => null, 'sql' => '', 'id' => $category->id); } if (empty($tags)) { return $response; } $ids = array(); foreach ($tags as $tag) { $ids[] = $tag->get('id'); } // Instantiate some needed objects $rr = new \Components\Resources\Tables\Resource($database); // Build query $filters = array(); $filters['tags'] = $ids; $filters['now'] = Date::toSql(); $filters['sortby'] = $sort ? $sort : 'ranking'; $filters['authorized'] = false; $filters['usergroups'] = \Hubzero\User\Helper::getGroups(User::get('id'), 'all'); $filters['select'] = 'count'; foreach ($response['children'] as $k => $t) { $filters['type'] = $t['id']; // Execute a count query for each area/category $database->setQuery($this->_buildPluginQuery($filters)); $response['children'][$k]['total'] = $database->loadResult(); $response['total'] += $response['children'][$k]['total']; } if ($areas && ($areas == $response['name'] || isset($response['children'][$areas]))) { // Push some CSS and JS to the tmeplate that may be needed \Hubzero\Document\Assets::addComponentStylesheet('com_resources'); $filters['select'] = 'records'; $filters['limit'] = $limit; $filters['limitstart'] = $limitstart; $filters['sortby'] = $sort ? $sort : 'date'; // Check the area of return. If we are returning results for a specific area/category // we'll need to modify the query a bit if (isset($response['children'][$areas])) { $filters['type'] = $response['children'][$areas]['id']; $database->setQuery($this->_buildPluginQuery($filters)); $response['children'][$areas]['results'] = $database->loadObjectList(); } else { unset($filters['type']); $database->setQuery($this->_buildPluginQuery($filters)); $response['results'] = $database->loadObjectList(); } } else { $filters['select'] = 'records'; $filters['limit'] = 'all'; $filters['limitstart'] = $limitstart; $filters['sortby'] = $sort ? $sort : 'date'; // Check the area of return. If we are returning results for a specific area/category // we'll need to modify the query a bit if (isset($response['children'][$areas])) { $filters['type'] = $response['children'][$areas]['id']; $response['children'][$key]['sql'] = $this->_buildPluginQuery($filters); } else { unset($filters['type']); $response['sql'] = $this->_buildPluginQuery($filters); } } return $response; }
<?php /** * @package Joomla.Administrator * @subpackage com_templates * @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; // Include the component HTML helpers. Html::addIncludePath(JPATH_COMPONENT . '/helpers/html'); Html::behavior('tooltip'); Html::behavior('modal'); $canDo = TemplatesHelper::getActions(); \Hubzero\Document\Assets::addComponentStylesheet('com_templates'); ?> <div id="item-form"> <div class="grid"> <div class="col span6"> <form action="<?php echo Route::url('index.php?option=com_templates&view=templates'); ?> " method="post" name="adminForm" id="adminForm"> <fieldset class="adminform" id="template-manager-description"> <legend><?php echo Lang::txt('COM_TEMPLATES_TEMPLATE_DESCRIPTION'); ?> </legend> <div class="input-wrap">
/** * Include needed libraries and push scripts and CSS to the document * * @return void */ public static function documents() { // Push some CSS and JS to the tmeplate that may be needed \Hubzero\Document\Assets::addComponentStylesheet('com_resources'); include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'helper.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'usage.php'; }
/** * Return data on a resource view (this will be some form of HTML) * * @param object $publication Current publication * @param string $option Name of the component * @param array $areas Active area(s) * @param string $rtrn Data to be returned * @param string $version Version name * @param boolean $extended Whether or not to show panel * @return array */ public function onPublication($publication, $option, $areas, $rtrn = 'all', $version = 'default', $extended = true) { $arr = array('html' => '', 'metadata' => ''); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (!array_intersect($areas, $this->onPublicationAreas($publication)) && !array_intersect($areas, array_keys($this->onPublicationAreas($publication)))) { $rtrn = 'metadata'; } } if (!$publication->_category->_params->get('plg_usage') || !$extended) { return $arr; } // Temporarily display only metadata $rtrn = 'metadata'; // Check if we have a needed database table $database = App::get('db'); $tables = $database->getTableList(); $table = $database->getPrefix() . 'publication_stats'; if ($publication->alias) { $url = Route::url('index.php?option=' . $option . '&alias=' . $publication->alias . '&active=usage'); } else { $url = Route::url('index.php?option=' . $option . '&id=' . $publication->id . '&active=usage'); } if (!in_array($table, $tables)) { $arr['html'] = '<p class="error">' . Lang::txt('PLG_PUBLICATION_USAGE_MISSING_TABLE') . '</p>'; $arr['metadata'] = '<p class="usage"><a href="' . $url . '">' . Lang::txt('PLG_PUBLICATION_USAGE_DETAILED') . '</a></p>'; return $arr; } // Get/set some variables $dthis = Request::getVar('dthis', date('Y') . '-' . date('m')); $period = Request::getInt('period', $this->params->get('period', 14)); include_once PATH_CORE . DS . 'components' . DS . $option . DS . 'tables' . DS . 'stats.php'; require_once PATH_CORE . DS . 'components' . DS . $option . DS . 'helpers' . DS . 'usage.php'; $stats = new \Components\Publications\Tables\Stats($database); $stats->loadStats($publication->id, $period, $dthis); // Are we returning HTML? if ($rtrn == 'all' || $rtrn == 'html') { \Hubzero\Document\Assets::addComponentStylesheet('com_usage'); // Instantiate a view $view = new \Hubzero\Plugin\View(array('folder' => 'publications', 'element' => 'usage', 'name' => 'browse')); // Get usage helper $view->helper = new \Components\Publications\Helpers\Usage($database, $publication->id, $publication->base); // Pass the view some info $view->option = $option; $view->publication = $publication; $view->stats = $stats; $view->chart_path = $this->params->get('chart_path', ''); $view->map_path = $this->params->get('map_path', ''); $view->dthis = $dthis; $view->period = $period; if ($this->getError()) { $view->setError($this->getError()); } // Return the output $arr['html'] = $view->loadTemplate(); } if ($rtrn == 'metadata') { $stats->loadStats($publication->id, $period); if ($stats->users) { $action = $publication->base == 'files' ? '%s download(s)' : '%s view(s)'; $arr['metadata'] = '<p class="usage">' . Lang::txt('%s user(s)', $stats->users); $arr['metadata'] .= $stats->downloads ? ' | ' . Lang::txt($action, $stats->downloads) : ''; $arr['metadata'] .= '</p>'; } } if ($stats->users) { $arr['name'] = 'usage'; $arr['count'] = $stats->users; } return $arr; }
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access. defined('_HZEXEC_') or die; \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'userconsent.css'); ?> <header id="content-header"> <h2><?php echo Lang::txt('COM_USERS_USERCONSENT'); ?> </h2> </header> <section class="section consent"> <div><?php echo Lang::txt('COM_USERS_USERCONSENT_MESSAGE'); ?> </div>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'factors.css'); ?> <header id="content-header"> <h2><?php echo Lang::txt('COM_USERS_FACTOR_VERIFICATION'); ?> </h2> </header> <section class="main section factors"> <?php foreach ($this->factors as $factor) { ?> <div class="factor-wrap"> <div class="factor">
/** * Build panel content * * @return string HTML */ public function buildContent($pub = NULL, $viewname = 'edit') { $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft'; // Output HTML $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'review')); \Hubzero\Document\Assets::addComponentStylesheet('com_projects', 'css/calendar'); $view->pub = $pub; $view->manifest = $this->_manifest; $view->step = $this->_blockId; if ($this->getError()) { $view->setError($this->getError()); } return $view->loadTemplate(); }
/** * Push styles and scripts to the document * * @return void */ public static function documents() { \Hubzero\Document\Assets::addComponentStylesheet('com_publications'); require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'helpers' . DS . 'html.php'; }
<?php defined('_HZEXEC_') or die; $doc = App::get('document'); if (!defined('HG_INLINE')) { $doc->setTitle('Search'); } \Hubzero\Document\Assets::addComponentStylesheet('com_hubgraph'); $doc->addScript($basePath . '/assets/hubgraph-update.js'); $doc->addScript($basePath . '/assets/jquery.inview.js'); if (isset($results['js'])) { ?> <script type="text/javascript"> <?php echo $results['js']; ?> </script> <?php } if (isset($results['css'])) { ?> <style type="text/css"> <?php echo $results['css']; ?> </style> <?php } ?> <form id="search-form" class="search" action="" method="get"> <div class="bar">