/** * Adds the dTree resources and builds up the neccessary javascript html output to * show the category tree * * @param array $jgcat_rows * @return string $script */ public function buildTreeview($jgcat_rows) { // Include dTree script, dTree and jgtreeview styles $document = Jfactory::getDocument(); $document->addStyleSheet(JURI::root() . 'media/mod_jgtreeview/css/dtree.css'); $document->addStyleSheet(JURI::root() . 'media/mod_jgtreeview/css/jgtreeview.css'); $document->addScript(JURI::root() . 'media/mod_jgtreeview/js/dtree.js'); // Get current user object $user = JFactory::getUser(); // Get module id $modid = $this->getConfig('modid'); // Array to hold the valid parent categories $validParentCats = array(); // Array with categories to filter $blacklistCats = explode(',', $this->getConfig('blacklist_cats')); // Get root category ID $root_catid = $this->getConfig('root_catid'); // Create and configure dTree object $script = " var jgTreeView" . $modid . "= new dTree('jgTreeView" . $modid . "', " . "'" . $this->getConfig('icon_theme_path') . "');" . "\n"; $script .= " jgTreeView" . $modid . ".config.useCookies = true;" . "\n"; $script .= " jgTreeView" . $modid . ".config.inOrder = true;" . "\n"; $script .= " jgTreeView" . $modid . ".config.useSelection = true;" . "\n"; $script .= " jgTreeView" . $modid . ".config.useLines = " . $this->getConfig('grid') . ";" . "\n"; $root_node_ok = false; if ($root_catid == 1 && !$this->getConfig('usrmode')) { // Prepare root node $root_link = JRoute::_('index.php?option=com_joomgallery&view=gallery' . $this->getJoomId()); $root_name = $this->getConfig('name'); $root_locked = 'false'; $root_node_ok = true; } else { $rootRow = new stdClass(); if (!$this->getConfig('usrmode')) { // Standard mode, find root node category specified in modul configuration foreach ($jgcat_rows as $row) { if ($row->cid == $root_catid) { $rootRow = $row; break; } } } else { // User mode, find the lowest level category node owned by the current user $root_catid = 1; $minLevel = PHP_INT_MAX; foreach ($jgcat_rows as $row) { if ($row->level < $minLevel && $user->get('id') && $row->owner == $user->get('id')) { $rootRow = $row; $root_catid = $row->cid; $minLevel = $row->level; } } } // Prepare root node if (isset($rootRow->cid) && $root_catid > 1) { // Check if user is allowed to access the root category $access = in_array($rootRow->access, $user->getAuthorisedViewLevels()) && isset($this->categories[$rootRow->cid]); if (($this->getConfig('filter_cats') == false || $access || $this->allcategories[$rootRow->cid]->protected && ($rootRow->parent_id == 1 ? true : isset($this->categories[$rootRow->parent_id]))) && !in_array($root_catid, $blacklistCats) && !$this->hideCategory($rootRow->cid)) { $protected = $this->allcategories[$rootRow->cid]->protected ? true : false; $this->getTreeNodeNameAndLink($rootRow, $access, $protected, $root_name, $root_link); $root_locked = $access ? 'false' : 'true'; $root_node_ok = true; } } } // Add root node if ($root_node_ok == true) { $script .= " jgTreeView" . $modid . ".add(" . $root_catid . ", -1, "; $script .= "'" . $root_name . "', "; $script .= "'" . $root_link . "', "; $script .= "'" . $root_locked . "');" . "\n"; $validParentCats[$root_catid] = true; } foreach ($jgcat_rows as $row) { // Check if user is allowed to access the category $access = in_array($row->access, $user->getAuthorisedViewLevels()) && isset($this->categories[$row->cid]); // Get treview node name and node link $protected = $this->allcategories[$row->cid]->protected ? true : false; $this->getTreeNodeNameAndLink($row, $access, $protected, $cat_name, $cat_link); // Add nodes if ($row->parent_id == $root_catid) { if (($this->getConfig('filter_cats') == false || $access || $this->allcategories[$row->cid]->protected && ($row->parent_id == 1 ? true : isset($this->categories[$row->parent_id]))) && !in_array($row->cid, $blacklistCats) && $root_node_ok == true && !$this->hideCategory($row->cid)) { // It is a parent node with node id = $root_catid $script .= " jgTreeView" . $modid . ".add(" . $row->cid . ", " . $root_catid . ", "; $script .= "'" . $cat_name . "', "; $script .= "'" . $cat_link . "', "; $script .= ($access ? 'false' : 'true') . ");" . "\n"; $validParentCats[$row->cid] = true; } } else { if (($this->getConfig('filter_cats') == false || $access || $this->allcategories[$row->cid]->protected && ($row->parent_id == 1 ? true : isset($this->categories[$row->parent_id]))) && isset($validParentCats[$row->parent_id]) && !in_array($row->cid, $blacklistCats) && !$this->hideCategory($row->cid)) { // It is a child node $script .= " jgTreeView" . $modid . ".add(" . $row->cid . ", " . $row->parent_id . ", "; $script .= "'" . $cat_name . "', "; $script .= "'" . $cat_link . "', "; $script .= ($access ? 'false' : 'true') . ");" . "\n"; $validParentCats[$row->cid] = true; } } } $script .= " document.write(jgTreeView" . $modid . ");" . "\n"; if ($root_node_ok == true) { $openToNode = $this->getTreeOpenToNode(); $script .= " switch(" . $openToNode . ")" . "\n"; $script .= " {" . "\n"; $script .= " case -2:" . "\n"; // Not a JoomGallery view $script .= " jgTreeView" . $modid . ".closeAll();" . "\n"; // Unselect highlighted node $script .= " jgTreeView" . $modid . ".us();" . "\n"; $script .= " break;" . "\n"; $script .= " case -1:" . "\n"; // Unselect highlighted node $script .= " jgTreeView" . $modid . ".us();" . "\n"; $script .= " break;" . "\n"; $script .= " case 0:" . "\n"; // Select gallery's home, if root_catid equals one if ($root_catid == 1) { $script .= " jgTreeView" . $modid . ".s(0);" . "\n"; } else { $script .= " jgTreeView" . $modid . ".us();" . "\n"; } $script .= " break;" . "\n"; $script .= " default:" . "\n"; // Select category $script .= " jgTreeView" . $modid . ".openTo(" . $openToNode . ", true);" . "\n"; if ($root_catid > 1 && $openToNode == $root_catid) { $script .= " jgTreeView" . $modid . ".s(0);" . "\n"; } $script .= " break;" . "\n"; $script .= " }" . "\n"; // Show tree always completely expanded if ($this->getConfig('show_always_expanded')) { $script .= " jgTreeView" . $modid . ".openAll()" . "\n"; } } return $script; }
protected function _opengraph() { $app =& JFactory::getApplication(); $document =& Jfactory::getDocument(); $uri =& JFactory::getUri(); $params = $app->getParams('com_redevent'); $row = $this->row; if ($params->get('fbadmin')) { $document->addCustomTag('<meta property="fb:admins" content="' . $params->get('fbadmin') . '"/>'); } $document->addScript('http://connect.facebook.net/en_US/all.js#xfbml=1'); }
* briaskISS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * briaskISS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with briaskISS. If not, see <http://www.gnu.org/licenses/>. * Created on 4 Mar 2008 */ defined('_JEXEC') or die('Restricted access'); $doc =& Jfactory::getDocument(); $doc->addStyleSheet(JURI::root(true) . '/modules/mod_briaskISS/mod_briaskISS.css'); $doc->addScript(JURI::root(true) . '/modules/mod_briaskISS/mod_briaskISS.js'); ?> <noscript> <div>ImageSlideShow requires Javascript</div> </noscript> <?php include_once 'mod_briaskUtility.php'; briask_collectPics($params, $module); ?> <script type="text/javascript"> var briaskPics<?php echo $module->id;
function save() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $task = JRequest::getVar('task'); // Sanitize $post = JRequest::get('post', JREQUEST_ALLOWHTML); $model = $this->getModel('value'); if ($row = $model->store($post)) { switch ($task) { case 'apply': $link = 'index.php?option=com_redform&view=value&hidemainmenu=1&cid[]=' . $row->id; break; default: $link = 'index.php?option=com_redform&view=values'; break; } $msg = JText::_('COM_REDFORM_VALUE_SAVED'); $cache =& JFactory::getCache('com_redform'); $cache->clean(); } else { $msg = ''; $link = 'index.php?option=com_redform&view=values'; } $model->checkin(); if (JRequest::getCmd('task') == 'ajaxsave') { $doc =& Jfactory::getDocument(); $doc->addScriptDeclaration(' window.parent.newvalue(); window.parent.SqueezeBox.close(); '); return; } $this->setRedirect($link, $msg); }
function _displayPopulate($tpl) { $app = JFactory::getApplication(); $document = Jfactory::getDocument(); $uri = JFactory::getURI(); $model = $this->getModel(); $projectws =& $this->get('Data', 'projectws'); $document->setTitle(JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TITLE')); $version = urlencode(JoomleagueHelper::getVersion()); $document->addScript('components/com_joomleague/assets/js/populate.js?v=' . $version); $lists = array(); $options = array(JHTML::_('select.option', 0, Jtext::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_SINGLE_ROUND_ROBIN')), JHTML::_('select.option', 1, Jtext::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_DOUBLE_ROUND_ROBIN')), JHTML::_('select.option', 2, Jtext::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_TOURNAMENT_ROUND_ROBIN'))); $lists['scheduling'] = JHTML::_('select.genericlist', $options, 'scheduling', '', 'value', 'text'); //TODO-add error message - what if there are no teams assigned to the project $teams = $this->get('projectteams'); $options = array(); foreach ($teams as $t) { $options[] = JHTML::_('select.option', $t->projectteam_id, $t->text); } $lists['teamsorder'] = JHTML::_('select.genericlist', $options, 'teamsorder[]', 'multiple="multiple" size="20"'); $this->assignRef('projectws', $projectws); $this->assignRef('request_url', $uri->toString()); $this->assignRef('lists', $lists); $this->addToolbar_Populate(); parent::display($tpl); }