/** * Display the view */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $document = JFactory::getDocument(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } //add css and submenu to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanGroups'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_GROUPS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'groups'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { //initialise variables $mainframe = JFactory::getApplication(); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $user = JFactory::getUser(); $db = JFactory::getDBO(); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); //add css and submenu to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } $permission = FlexicontentHelperPerm::getPerm(); if (!$permission->CanTemplates) { $mainframe->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS')); } // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); //Create Submenu FLEXISubmenu('CanTemplates'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TEMPLATES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'templates'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar //JToolBarHelper::Back(); if ($perms->CanConfig) { //JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } $tmpldirectory = JPATH_COMPONENT_SITE . DS . 'templates' . DS; $source = JRequest::getString('source', ''); $dest = $source ? flexicontent_upload::sanitizedir($tmpldirectory, $source) : ''; //Get data from the model $rows = $this->get('Data'); //assign data to template $this->assignRef('rows', $rows); $this->assignRef('user', $user); $this->assignRef('tmpldirectory', $tmpldirectory); $this->assignRef('source', $source); $this->assignRef('dest', $dest); parent::display($tpl); }
function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $app = JFactory::getApplication(); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $option = JRequest::getCmd('option'); $view = JRequest::getVar('view'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Get filters $count_filters = 0; $search = $app->getUserStateFromRequest($option . '.' . $view . '.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); // ************************** // Add css and js to document // ************************** $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css'); } } // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanGroups'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_GROUPS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'groups'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; $this->addToolbar(); //assign data to template $this->lists['search'] = $search; $this->count_filters = $count_filters; $this->option = $option; $this->view = $view; parent::display($tpl); }
/** * Method to configure the toolbar for this view. * * @access public * @return void */ function setToolbar() { $document = JFactory::getDocument(); $js = "jQuery(document).ready(function(){"; $toolbar = JToolBar::getInstance('toolbar'); $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=basic'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'basicindex.png', 'basicindex_f2.png', 'FLEXI_REINDEX_BASIC_CONTENT_LISTS', false); } else { $toolbar->appendButton('Popup', 'basicindex', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', str_replace('&', '&', $popup_load_url), 500, 240); } JToolBarHelper::divider(); JToolBarHelper::spacer(); $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-advindex a.toolbar, #toolbar-advindex button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'advindex.png', 'advindex_f2.png', 'FLEXI_REINDEX_ADVANCED_SEARCH_VIEW', false); } else { $toolbar->appendButton('Popup', 'advindex', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', str_replace('&', '&', $popup_load_url), 500, 240); } $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced&rebuildmode=quick'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button')\n\t\t\t\t\t.attr('onclick', 'var url = jQuery(this).attr(\\'href\\'); fc_showDialog(url, \\'fc_modal_popup_container\\', 0, 550, 350, function(){document.body.innerHTML=\\'<span class=\"fc_loading_msg\">Reloading ... please wait</span>\\'; window.location.reload(true)}); return false;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'advindexdirty.png', 'advindexdirty_f2.png', 'FLEXI_REINDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', false); } else { $toolbar->appendButton('Popup', 'advindexdirty', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', str_replace('&', '&', $popup_load_url), 500, 240); } $toolbar->appendButton('Confirm', 'FLEXI_DELETE_INDEX_CONFIRM', 'trash', 'FLEXI_INDEX_ADVANCED_PURGE', FLEXI_J16GE ? 'search.purge' : 'purge', false); $user = JFactory::getUser(); $perms = FlexicontentHelperPerm::getPerm(); if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } $js .= "});"; $document->addScriptDeclaration($js); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $task = $jinput->get('task', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $session = JFactory::getSession(); // Get model $model = $this->getModel(); // Some flags $has_zlib = function_exists("zlib_encode"); //version_compare(PHP_VERSION, '5.4.0', '>='); // Get session information $conf = $session->get('csvimport_config', "", 'flexicontent'); $conf = unserialize($conf ? $has_zlib ? zlib_decode(base64_decode($conf)) : base64_decode($conf) : ""); $lineno = $session->get('csvimport_lineno', 999999, 'flexicontent'); $session->set('csvimport_parse_log', null, 'flexicontent'); // This is the flag if CSV file has been parsed (import form already submitted), thus to display the imported data // ************************** // Add css and js to document // ************************** $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // Add JS frameworks flexicontent_html::loadFramework('select2'); $prettycheckable_added = flexicontent_html::loadFramework('prettyCheckable'); flexicontent_html::loadFramework('flexi-lib'); // Add js function to overload the joomla submitform validation JHTML::_('behavior.formvalidation'); // load default validation JS to make sure it is overriden $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH); $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH); // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanImport'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_IMPORT'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'import'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $toolbar = JToolBar::getInstance('toolbar'); if (!empty($conf)) { if ($task != 'processcsv') { $ctrl_task = 'import.processcsv'; $import_btn_title = empty($lineno) ? 'FLEXI_IMPORT_START_TASK' : 'FLEXI_IMPORT_CONTINUE_TASK'; JToolBarHelper::custom($ctrl_task, 'save.png', 'save.png', $import_btn_title, $list_check = false); } $ctrl_task = 'import.clearcsv'; JToolBarHelper::custom($ctrl_task, 'cancel.png', 'cancel.png', 'FLEXI_IMPORT_CLEAR_TASK', $list_check = false); } else { $ctrl_task = 'import.initcsv'; JToolBarHelper::custom($ctrl_task, 'import.png', 'import.png', 'FLEXI_IMPORT_PREPARE_TASK', $list_check = false); $ctrl_task = 'import.testcsv'; JToolBarHelper::custom($ctrl_task, 'test.png', 'test.png', 'FLEXI_IMPORT_TEST_FILE_FORMAT', $list_check = false); } //JToolBarHelper::Back(); if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } // Get types $types = flexicontent_html::getTypesList($_type_ids = false, $_check_perms = false, $_published = true); // Get Languages $languages = FLEXIUtilities::getLanguages('code'); // Get categories global $globalcats; $categories = $globalcats; // ************************************ // Decide layout to load: 'import*.php' // ************************************ $this->setLayout('import'); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; // Execute the import task, load the log-like AJAX-based layout (import_process.php), to display results including any warnings if (!empty($conf) && $task == 'processcsv') { $this->assignRef('conf', $conf); parent::display('process'); return; } else { if (!empty($conf)) { $this->assignRef('conf', $conf); $this->assignRef('cparams', $cparams); $this->assignRef('types', $types); $this->assignRef('languages', $languages); $this->assignRef('categories', $globalcats); parent::display('list'); return; } } // Session config is empty, means import form has not been submited, display the form // We will display import form which is not 'default.php', it is 'import.php' // else ... // Check is session table DATA column is not mediumtext (16MBs, it can be 64 KBs ('text') in some sites that were not properly upgraded) $tblname = 'session'; $dbprefix = $app->getCfg('dbprefix'); $dbname = $app->getCfg('db'); $db->setQuery("SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" . $dbname . "' AND TABLE_NAME = '" . $dbprefix . $tblname . "'"); $jession_coltypes = $db->loadAssocList('COLUMN_NAME'); $_dataColType = strtolower($jession_coltypes['data']['DATA_TYPE']); $_dataCol_wrongSize = $_dataColType != 'mediumtext' && $_dataColType != 'longtext'; // If data type is "text" it is safe to assume that it can be converted to "mediumtext", // since "text" means that session table is not memory storage, // plus it is already stored externally aka operation will be quick ? /*if ($_dataCol_wrongSize && $_dataColType == 'text') { $db->setQuery("ALTER TABLE `#__session` MODIFY `data` MEDIUMTEXT"); $db->execute(); $_dataCol_wrongSize = false; }*/ if ($_dataCol_wrongSize) { $app->enqueueMessage("Joomla DB table: <b>'session'</b> has a <b>'data'</b> column with type: <b>'" . $_dataColType . "'</b>, instead of expected type <b>'mediumtext'</b>. Trying to import large data files may fail", "notice"); } $formvals = array(); // Retrieve Basic configuration $formvals['type_id'] = $model->getState('type_id'); $formvals['language'] = $model->getState('language'); $formvals['state'] = $model->getState('state'); $formvals['access'] = $model->getState('access'); // Main and secondary categories, tags $formvals['maincat'] = $model->getState('maincat'); $formvals['maincat_col'] = $model->getState('maincat_col'); $formvals['seccats'] = $model->getState('seccats'); $formvals['seccats_col'] = $model->getState('seccats_col'); $formvals['tags_col'] = $model->getState('tags_col'); // Publication: Author/modifier $formvals['created_by_col'] = $model->getState('created_by_col'); $formvals['modified_by_col'] = $model->getState('modified_by_col'); // Publication: META data $formvals['metadesc_col'] = $model->getState('metadesc_col'); $formvals['metakey_col'] = $model->getState('metakey_col'); // Publication: dates $formvals['modified_col'] = $model->getState('modified_col'); $formvals['created_col'] = $model->getState('modified_col'); $formvals['publish_up_col'] = $model->getState('publish_up_col'); $formvals['publish_down_col'] = $model->getState('publish_down_col'); // Advanced configuration $formvals['ignore_unused_cols'] = $model->getState('ignore_unused_cols'); $formvals['id_col'] = $model->getState('id_col'); $formvals['items_per_step'] = $model->getState('items_per_step'); // CSV file format $formvals['mval_separator'] = $model->getState('mval_separator'); $formvals['mprop_separator'] = $model->getState('mprop_separator'); $formvals['field_separator'] = $model->getState('field_separator'); $formvals['enclosure_char'] = $model->getState('enclosure_char'); $formvals['record_separator'] = $model->getState('record_separator'); $formvals['debug_records'] = $model->getState('debug_records'); // ****************** // Create form fields // ****************** $lists['type_id'] = flexicontent_html::buildtypesselect($types, 'type_id', $formvals['type_id'], true, 'class="required use_select2_lib"', 'type_id'); $actions_allowed = array('core.create'); // Creating categorories tree for item assignment, we use the 'create' privelege // build the main category select list $attribs = 'class="use_select2_lib required"'; $fieldname = 'maincat'; $lists['maincat'] = flexicontent_cats::buildcatselect($categories, $fieldname, $formvals['maincat'], 2, $attribs, false, true, $actions_allowed); // build the secondary categories select list $class = "use_select2_lib"; $attribs = 'multiple="multiple" size="10" class="' . $class . '"'; $fieldname = 'seccats[]'; $lists['seccats'] = flexicontent_cats::buildcatselect($categories, $fieldname, $formvals['seccats'], false, $attribs, false, true, $actions_allowed, $require_all = true); // build languages list // Retrieve author configuration $authorparams = flexicontent_db::getUserConfig($user->id); $allowed_langs = $authorparams->get('langs_allowed', null); $allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs); // We will not use the default getInput() function of J1.6+ since we want to create a radio selection field with flags // we could also create a new class and override getInput() method but maybe this is an overkill, we may do it in the future $lists['languages'] = flexicontent_html::buildlanguageslist('language', ' style="vertical-align:top;" onchange="var m=jQuery(\'#fc_import_about_langcol\'); this.value ? m.hide(600) : m.show(600);"', $formvals['language'], 6, $allowed_langs, $published_only = true, $disable_langs = null, $add_all = true, $conf = array('required' => true)) . ' <span class="fc-mssg-inline fc-note fc-nobgimage" id="fc_import_about_langcol" style="display:none;"> ' . JText::_('FLEXI_USE_LANGUAGE_COLUMN_TIP') . ' </span>'; $lists['states'] = flexicontent_html::buildstateslist('state', ' style="vertical-align:top;" onchange="var m=jQuery(\'#fc_import_about_statecol\'); this.value ? m.hide(600) : m.show(600);"', $formvals['state'], 2) . '<span class="fc-mssg-inline fc-note fc-nobgimage" id="fc_import_about_statecol" style="display:none;"> ' . JText::_('FLEXI_USE_STATE_COLUMN_TIP') . ' </span>'; // build access level filter $access_levels = JHtml::_('access.assetgroups'); array_unshift($access_levels, JHtml::_('select.option', '0', "Use 'access' column")); array_unshift($access_levels, JHtml::_('select.option', '', 'FLEXI_SELECT_ACCESS_LEVEL')); $fieldname = 'access'; // make multivalue $elementid = 'access'; $attribs = 'class="required use_select2_lib"'; $lists['access'] = JHTML::_('select.genericlist', $access_levels, $fieldname, $attribs, 'value', 'text', $formvals['access'], $elementid, $translate = true); // Ignore warnings because component may not be installed $warnHandlers = JERROR::getErrorHandling(E_WARNING); JERROR::setErrorHandling(E_WARNING, 'ignore'); // Reset the warning handler(s) foreach ($warnHandlers as $mode) { JERROR::setErrorHandling(E_WARNING, $mode); } // ******************************************************************************** // Get field names (from the header line (row 0), and remove it form the data array // ******************************************************************************** $file_field_types_list = '"image","file"'; $q = 'SELECT id, name, label, field_type FROM #__flexicontent_fields AS fi' . ' WHERE fi.field_type IN (' . $file_field_types_list . ')'; $db->setQuery($q); $file_fields = $db->loadObjectList('name'); //assign data to template $this->assignRef('model', $model); $this->assignRef('lists', $lists); $this->assignRef('user', $user); $this->assignRef('cparams', $cparams); $this->assignRef('file_fields', $file_fields); $this->assignRef('formvals', $formvals); parent::display($tpl); }
/** * Build a html select form field that displays a Category Tree * * The output is filtered (via FLEXIaccess or via J1.6+ permission) and has disabled specific categories * About Disabled categories: * - currently edited category is disabled * - if the user can view all categories then categories he has no permission are disabled !!! * * @param array $list * @param string $name * @param array $selected * @param bool $top * @param string $check_published * @param string $check_perms * @param string $require_all * @param array $skip_subtrees * @param array $disable_subtrees * @param array $custom_options * * @return a category form field element */ public static function buildcatselect($list, $name, $selected, $top, $attribs = 'class="inputbox"', $check_published = false, $check_perms = true, $actions_allowed = array('core.create', 'core.edit', 'core.edit.own'), $require_all = true, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options = array(), $disable_specific_cats = array(), $empty_errmsg = false) { // *************************** // Initialize needed variables // *************************** global $globalcats; $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $controller = JRequest::getVar('controller'); $task = JRequest::getVar('task'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } // Privilege of (a) viewing all categories (even if disabled) and (b) viewing as a tree require_once JPATH_ROOT . DS . 'components' . DS . 'com_flexicontent' . DS . 'helpers' . DS . 'permission.php'; $viewallcats = FlexicontentHelperPerm::getPerm()->ViewAllCats; $viewtree = FlexicontentHelperPerm::getPerm()->ViewTree; // Global parameter to force always displaying of categories as tree if ($cparams->get('cats_always_astree', 1)) { $viewtree = 1; } // ************************************************************** // Find user allowed categories to be used during Filtering below // ************************************************************** if ($check_perms) { // Get user allowed categories, NOTE: if user (a) (J2.5) has 'core.admin' or (b) (J1.5) user is super admin (gid==25) then all cats are allowed $usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed, $require_all, $check_published); // NOTE: already selected categories will be allowed to the user, add them to the category list $selectedcats = !is_array($selected) ? array($selected) : $selected; $usercats_indexed = array_flip($usercats); foreach ($selectedcats as $selectedcat) { if ($selectedcat) { $usercats_indexed[$selectedcat] = 1; } } } // ********************************************************************************* // Excluded subtrees e.g. featured categories subtree in item form // Disabled subtrees e.g. existing children subtree when selecting category's parent // ********************************************************************************* $skip_cats_arr = array(); if (!empty($skip_subtrees)) { foreach ($skip_subtrees as $subtree_rootid) { if ($subtree_rootid && isset($globalcats[$subtree_rootid]->descendantsarray)) { foreach ($globalcats[$subtree_rootid]->descendantsarray as $_excluded) { $skip_cats_arr[$_excluded] = 1; } } } } $disable_cats_arr = array(); if (!empty($disable_subtrees)) { foreach ($disable_subtrees as $subtree_rootid) { if ($subtree_rootid && isset($globalcats[$subtree_rootid]->descendantsarray)) { foreach ($globalcats[$subtree_rootid]->descendantsarray as $_excluded) { $disable_cats_arr[$_excluded] = 1; } } } } // Disable specific categories if (!empty($disable_specific_cats)) { foreach ($disable_specific_cats as $_excluded) { $disable_cats_arr[$_excluded] = 1; } } // ************************************************************************** // TOP parameter: defines the APPROPRIATE PROMPT option at top of select list // ************************************************************************** $cats_count = 0; $catlist = array(); // A tree to select: e.g. a parent category if (!is_numeric($top) && strlen($top)) { $catlist[] = JHTML::_('select.option', '', $top); } else { if ($top == 1) { $catlist[] = JHTML::_('select.option', FLEXI_J16GE ? 1 : 0, JText::_('FLEXI_TOPLEVEL')); } else { if ($top == 2 || $top == -1) { $catlist[] = JHTML::_('select.option', '', JText::_($top == -1 ? '' : 'FLEXI_SELECT_CAT')); } else { if ($top == 3) { $first_item = reset($list); //$first_key = key($list); $_first_item_treename = $first_item->treename; $_first_item_title = $first_item->title; $_first_item_id = $first_item->id; $first_item->treename = $first_item->title = JText::_('FLEXI_SELECT_CAT'); $first_item->id = ""; } } } } // Extra custom options ... applies to all top parameters foreach ($custom_options as $custom_value => $custom_option) { $catlist[] = JHTML::_('select.option', $custom_value, '-- ' . JText::_($custom_option) . ' --'); } // ******************************************************************************************************** // Loop through categories to create the select option using user allowed categories (if filtering enabled) // ******************************************************************************************************** foreach ($list as $cat) { $cat->treename = str_replace(" ", " ", strip_tags($cat->treename)); $cat_title = $viewtree ? $cat->treename : $cat->title; if (!$check_published && $cat->published != 1) { $cat_title .= ' --U--'; } if (!$check_published || $cat->published) { // CASE 1: SKIPPED categories e.g. featured categories subtree in item form if (isset($skip_cats_arr[$cat->id])) { } else { if ($check_perms) { // a. Category NOT ALLOWED if (!isset($usercats_indexed[$cat->id])) { // Add current category to the select list as disabled if user can view all categories, OTHERWISE DO NOT ADD IT if ($viewallcats) { $catlist[] = JHTML::_('select.option', $cat->id, $cat_title, 'value', 'text', $disabled = true); } } else { // CASE: DISABLED categories e.g. existing children subtree when selecting category's parent if (isset($disable_cats_arr[$cat->id])) { $catlist[] = JHTML::_('select.option', $cat->id, $cat_title, 'value', 'text', $disabled = true); } else { $catlist[] = JHTML::_('select.option', $cat->id, $cat_title); $cats_count++; } } } else { $catlist[] = JHTML::_('select.option', $cat->id, $cat_title); $cats_count++; } } } } // ************************************ // Finally create the HTML form element // ************************************ $replace_char = FLEXI_J16GE ? '_' : ''; $idtag = preg_replace('/(\\]|\\[)+/', $replace_char, $name); $idtag = preg_replace('/_$/', '', $idtag); $html = $empty_errmsg && $cats_count == 0 ? '<div class="alert alert-error">' . $empty_errmsg . '</div>' : JHTML::_('select.genericlist', $catlist, $name, $attribs, 'value', 'text', $selected, $idtag); if ($top == 3) { // Restore first category element $first_item = reset($list); $first_item->treename = $_first_item_treename; $first_item->title = $_first_item_title; $first_item->id = $_first_item_id; } if ($print_logging_info) { @($fc_run_times['render_categories_select'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } return $html; }
/** * Method to get items using files VIA (multi property) field types that store file as as property either file id or filename! * * @access public * @return object */ function getItemsMultiprop($field_props = array('image' => 'originalname'), $value_props = array('image' => 'filename'), $file_ids = array(), $count_items = false, $ignored = false) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $option = JRequest::getVar('option'); $filter_uploader = $app->getUserStateFromRequest($option . '.' . $this->viewid . '.filter_uploader', 'filter_uploader', 0, 'int'); $where = array(); $file_ids_list = ''; if (count($file_ids)) { $file_ids_list = ' AND f.id IN (' . "'" . implode("','", $file_ids) . "')"; } else { $permission = FlexicontentHelperPerm::getPerm(); $CanViewAllFiles = $permission->CanViewAllFiles; if (!$CanViewAllFiles) { $where[] = ' f.uploaded_by = ' . (int) $user->id; } else { if ($filter_uploader) { $where[] = ' f.uploaded_by = ' . $filter_uploader; } } } if (isset($ignored['item_id'])) { $where[] = ' i.id!=' . (int) $ignored['item_id']; } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; $groupby = !$count_items ? ' GROUP BY i.id' : ' GROUP BY f.id'; // file maybe used in more than one fields or ? in more than one values for same field $orderby = !$count_items ? ' ORDER BY i.title ASC' : ''; // Serialized values are like : "__field_propname__";s:33:"__value__" $format_str = 'CONCAT("%%","\\"%s\\";s:%%:%%\\"",%s,"\\"%%")'; $items = array(); $files = array(); foreach ($field_props as $field_type => $field_prop) { // Some fields may not be using DB, create a limitation for them $field_ids = $this->getFieldsUsingDBmode($field_type); $field_ids_list = !$field_ids ? "" : " AND fi.id IN ('" . implode("','", $field_ids) . "')"; // Create a matching condition for the value depending on given configuration (property name of the field, and value property of file: either id or filename or ...) $value_prop = $value_props[$field_type]; $like_str = $this->_db->escape('f.' . $value_prop, false); $like_str = sprintf($format_str, $field_prop, $like_str); // File field relation sub query $query = 'SELECT ' . ($count_items ? 'f.id as file_id, COUNT(i.id) as item_count' : 'i.id as id, i.title') . ' FROM #__content AS i' . ' JOIN #__flexicontent_fields_item_relations AS rel ON rel.item_id = i.id' . ' JOIN #__flexicontent_fields AS fi ON fi.id = rel.field_id AND fi.field_type IN (' . $this->_db->Quote($field_type) . ')' . $field_ids_list . ' JOIN #__flexicontent_files AS f ON rel.value LIKE ' . $like_str . ' AND f.' . $value_prop . '<>""' . $file_ids_list . $where . $groupby . $orderby; //echo nl2br( "\n".$query."\n"); $this->_db->setQuery($query); $_item_data = $this->_db->loadObjectList($count_items ? 'file_id' : 'id'); if ($this->_db->getErrorNum()) { JFactory::getApplication()->enqueueMessage(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($this->_db->getErrorMsg()), 'error'); } if ($_item_data) { foreach ($_item_data as $item) { if ($count_items) { $items[$item->file_id] = (int) @$items[$item->file_id] + $item->item_count; } else { $items[$item->title] = $item; } } } //echo "<pre>"; print_r($_item_data); exit; } //echo "<pre>"; print_r($items); exit; return $items; }
function display($tpl = null) { global $globalcats; $app = JFactory::getApplication(); $user = JFactory::getUser(); $document = JFactory::getDocument(); if (FLEXI_J16GE) { JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR, 'en-GB', true); JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR, null, true); } // *********************************************************** // Get category data, and check if item is already checked out // *********************************************************** // Get data from the model $model = $this->getModel(); if (FLEXI_J16GE) { $row = $this->get('Item'); $form = $this->get('Form'); } else { $row = $this->get('Category'); } $catparams = FLEXI_J16GE ? new JRegistry($row->params) : new JParameter($row->params); $cid = $row->id; $isnew = !$cid; // Check category is checked out by different editor / administrator if (!$isnew && $model->isCheckedOut($user->get('id'))) { JError::raiseWarning('SOME_ERROR_CODE', $row->title . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN')); $app->redirect('index.php?option=com_flexicontent&view=categories'); } // *************************************************************************** // Currently access checking for category add/edit form , it is done here, for // most other views we force going though the controller and checking it there // *************************************************************************** // ********************************************************************************************* // Global Permssions checking (needed because this view can be called without a controller task) // ********************************************************************************************* // Get global permissions $perms = FlexicontentHelperPerm::getPerm(); // handles super admins correctly // Check no access to categories management (Global permission) if (!$perms->CanCats) { $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS')); } // Check no privilege to create new categories (Global permission) if ($isnew && !$perms->CanAddCats) { JError::raiseWarning(403, JText::_('FLEXI_NO_ACCESS_CREATE')); $app->redirect('index.php?option=com_flexicontent'); } // ************************************************************************************ // Record Permssions (needed because this view can be called without a controller task) // ************************************************************************************ // Get edit privilege for current category if (!$isnew) { if (FLEXI_J16GE) { $isOwner = $row->get('created_by') == $user->id; $rights = FlexicontentHelperPerm::checkAllItemAccess($user->id, 'category', $cid); $canedit_cat = in_array('edit', $rights) || in_array('edit.own', $rights) && $isOwner; } else { if (FLEXI_ACCESS) { $rights = FAccess::checkAllItemAccess('com_content', 'users', $user->gmid, 0, $row->id); $canedit_cat = $user->gid < 25 ? in_array('edit', $rights) || in_array('editown', $rights) : 1; } else { $canedit_cat = true; } } } // Get if we can create inside at least one (com_content) category if (!FLEXI_J16GE || $user->authorise('core.create', 'com_flexicontent')) { $cancreate_cat = true; } else { $usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed = array('core.create'), $require_all = true, $check_published = true, $specific_catids = false, $find_first = true); $cancreate_cat = count($usercats) > 0; } // Creating new category: Check if user can create inside any existing category if ($isnew && !$cancreate_cat) { $acc_msg = JText::_('FLEXI_NO_ACCESS_CREATE') . "<br/>" . (FLEXI_J16GE ? JText::_('FLEXI_CANNOT_ADD_CATEGORY_REASON') : ""); JError::raiseWarning(403, $acc_msg); $app->redirect('index.php?option=com_flexicontent&view=categories'); } // Editing existing category: Check if user can edit existing (current) category if (!$isnew && !$canedit_cat) { $acc_msg = JText::_('FLEXI_NO_ACCESS_EDIT') . "<br/>" . JText::_('FLEXI_CANNOT_EDIT_CATEGORY_REASON'); JError::raiseWarning(403, $acc_msg); $app->redirect('index.php?option=com_flexicontent&view=categories'); } // ************************************************** // Include needed files and add needed js / css files // ************************************************** FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); flexicontent_html::loadFramework('jQuery'); flexicontent_html::loadFramework('select2'); // Load pane behavior jimport('joomla.html.pane'); // Load tooltips JHTML::_('behavior.tooltip'); // Add css to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } // Add js function to overload the joomla submitform $document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/admin.js'); $document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/validate.js'); // ******************** // Initialise variables // ******************** $editor_name = $user->getParam('editor', $app->getCfg('editor')); $editor = JFactory::getEditor($editor_name); $cparams = JComponentHelper::getParams('com_flexicontent'); $bar = JToolBar::getInstance('toolbar'); if (!FLEXI_J16GE) { $pane = JPane::getInstance('sliders'); $tpane = JPane::getInstance('tabs', array('startOffset' => 0, 'allowAllClose' => true, 'opacityTransition' => true, 'duration' => 600)); } $categories = $globalcats; // ****************** // Create the toolbar // ****************** // Create Toolbar title and add the preview button if (!$isnew) { JToolBarHelper::title(JText::_('FLEXI_EDIT_CATEGORY'), 'fc_categoryedit'); $autologin = $cparams->get('autoflogin', 1) ? '&fcu=' . $user->username . '&fcp=' . $user->password : ''; $previewlink = JRoute::_(JURI::root() . FlexicontentHelperRoute::getCategoryRoute($categories[$cid]->slug)) . $autologin; // Add a preview button $bar->appendButton('Custom', '<a class="preview btn btn-small" href="' . $previewlink . '" target="_blank"><span title="' . JText::_('Preview') . '" class="icon-32-preview"></span>' . JText::_('Preview') . '</a>', 'preview'); } else { JToolBarHelper::title(JText::_('FLEXI_NEW_CATEGORY'), 'fc_categoryadd'); } // Add apply and save buttons if (FLEXI_J16GE) { JToolBarHelper::apply('category.apply'); JToolBarHelper::save('category.save'); } else { JToolBarHelper::apply(); JToolBarHelper::save(); } // Add a save and new button, if user can create inside at least one (com_content) category if ($cancreate_cat) { if (FLEXI_J16GE) { JToolBarHelper::save2new('category.save2new'); } else { JToolBarHelper::custom('saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false); } } // Add a save as copy button, if editing an existing category (J2.5 only) if (FLEXI_J16GE && !$isnew && $cancreate_cat) { JToolBarHelper::save2copy('category.save2copy'); } // Add a cancel or close button if ($isnew) { if (FLEXI_J16GE) { JToolBarHelper::cancel('category.cancel'); } else { JToolBarHelper::cancel(); } } else { if (FLEXI_J16GE) { JToolBarHelper::cancel('category.cancel', 'JTOOLBAR_CLOSE'); } else { JToolBarHelper::custom('cancel', 'cancel.png', 'cancel.png', 'CLOSE', false); } } // ******************************************* // Prepare data to pass to the form's template // ******************************************* if (!FLEXI_J16GE) { //clean data JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'description'); // Create the form $form = new JParameter($row->params, JPATH_COMPONENT . DS . 'models' . DS . 'category.xml'); //$form->loadINI($row->attribs); //echo "<pre>"; print_r($form->_xml['templates']->_children[0]); echo "<pre>"; print_r($form->_xml['templates']->param[0]); exit; foreach ($form->_xml['templates']->_children as $i => $child) { if (isset($child->_attributes['enableparam']) && !$cparams->get($child->_attributes['enableparam'])) { unset($form->_xml['templates']->_children[$i]); unset($form->_xml['templates']->param[$i]); } } foreach ($form->_xml['special']->_children as $i => $child) { if (isset($child->_attributes['enableparam']) && !$cparams->get($child->_attributes['enableparam'])) { unset($form->_xml['special']->_children[$i]); unset($form->_xml['special']->param[$i]); } } } // ********************************************************************************** // Get Templates and apply Template Parameters values into the form fields structures // ********************************************************************************** $themes = flexicontent_tmpl::getTemplates(); $tmpls = $themes->category; foreach ($tmpls as $tmpl) { if (FLEXI_J16GE) { $jform = new JForm('com_flexicontent.template.category', array('control' => 'jform', 'load_data' => true)); $jform->load($tmpl->params); $tmpl->params = $jform; // ... values applied at the template form file } else { $tmpl->params->loadINI($row->params); } } //build selectlists $Lists = array(); if (!FLEXI_J16GE) { $javascript = "onchange=\"javascript:if (document.forms[0].image.options[selectedIndex].value!='') {document.imagelib.src='../images/stories/' + document.forms[0].image.options[selectedIndex].value} else {document.imagelib.src='../images/blank.png'}\""; $Lists['imagelist'] = JHTML::_('list.images', 'image', $row->image, $javascript, '/images/stories/'); $Lists['access'] = JHTML::_('list.accesslevel', $row); // build granular access list if (FLEXI_ACCESS) { $Lists['access'] = FAccess::TabGmaccess($row, 'category', 1, 1, 1, 1, 1, 1, 1, 1, 1); } } $check_published = false; $check_perms = true; $actions_allowed = array('core.create'); $fieldname = FLEXI_J16GE ? 'jform[parent_id]' : 'parent_id'; $Lists['parent_id'] = flexicontent_cats::buildcatselect($categories, $fieldname, $row->parent_id, $top = 1, 'class="use_select2_lib"', $check_published, $check_perms, $actions_allowed, $require_all = true, $skip_subtrees = array(), $disable_subtrees = array($row->id)); $check_published = false; $check_perms = true; $actions_allowed = array('core.edit', 'core.edit.own'); $fieldname = FLEXI_J16GE ? 'jform[copycid]' : 'copycid'; $Lists['copycid'] = flexicontent_cats::buildcatselect($categories, $fieldname, '', $top = 2, 'class="use_select2_lib"', $check_published, $check_perms, $actions_allowed, $require_all = false); $custom_options[''] = 'FLEXI_USE_GLOBAL'; $custom_options['0'] = 'FLEXI_COMPONENT_ONLY'; $custom_options['-1'] = 'FLEXI_PARENT_CAT_MULTI_LEVEL'; $check_published = false; $check_perms = true; $actions_allowed = array('core.edit', 'core.edit.own'); $fieldname = FLEXI_J16GE ? 'jform[special][inheritcid]' : 'params[inheritcid]'; $Lists['inheritcid'] = flexicontent_cats::buildcatselect($categories, $fieldname, $catparams->get('inheritcid', ''), $top = false, 'class="use_select2_lib"', $check_published, $check_perms, $actions_allowed, $require_all = false, $skip_subtrees = array(), $disable_subtrees = array(), $custom_options); // ************************ // Assign variables to view // ************************ $this->assignRef('document', $document); $this->assignRef('Lists', $Lists); $this->assignRef('row', $row); $this->assignRef('form', $form); $this->assignRef('perms', $perms); $this->assignRef('editor', $editor); $this->assignRef('tmpls', $tmpls); $this->assignRef('cparams', $cparams); if (!FLEXI_J16GE) { $this->assignRef('pane', $pane); $this->assignRef('tpane', $tpane); } parent::display($tpl); }
/** * Method to fetch the tags form, this is currently NOT USED * * @since 1.5 */ function gettags() { $id = JRequest::getInt('id', 0); $model = $this->getModel('item'); $tags = $model->gettags(); $user = JFactory::getUser(); $used = null; if ($id) { $used = $model->getUsedtagsIds($id); } if (!is_array($used)) { $used = array(); } $permission = FlexicontentHelperPerm::getPerm(); $CanCreateTags = $permission->CanCreateTags; $CanUseTags = $permission->CanUseTags; $CanUseTags = $CanUseTags ? '' : ' disabled="disabled"'; $n = count($tags); $rsp = ''; if ($n > 0) { $rsp .= '<div class="qf_tagbox" id="qf_tagbox">'; $rsp .= '<ul id="ultagbox">'; for ($i = 0, $n; $i < $n; $i++) { $tag = $tags[$i]; if (!in_array($tag->id, $used)) { continue; } // tag not assigned to item if ($CanUseTags && in_array($tag->id, $used)) { $rsp .= ' <li class="tagitem"> <span>' . $tag->name . '</span> <input type="hidden" name="jform[tag][]" value="' . $tag->tid . '" /> <a href="javascript:;" class="deletetag" onclick="javascript:deleteTag(this);" title="' . JText::_('FLEXI_DELETE_TAG') . '"></a> </li>'; } else { $rsp .= ' <li class="tagitem plain"> <span>' . $tag->name . '</span> <input type="hidden" name="jform[tag][]" value="' . $tag->tid . '" /> </li>'; } } $rsp .= '</ul>'; $rsp .= '</div>'; $rsp .= '<div class="clear"></div>'; } if ($CanCreateTags) { $rsp .= ' <div class="qf_addtag"> <label for="addtags">' . JText::_('FLEXI_ADD_TAG') . '</label> <input type="text" id="tagname" class="inputbox" size="30" /> <input type="button" class="fc_button" value="' . JText::_('FLEXI_ADD') . '" onclick="addtag()" /> </div>'; } echo $rsp; }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $option = JRequest::getVar('option'); FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); flexicontent_html::loadFramework('jQuery'); flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); //get vars $filter_assigned = $app->getUserStateFromRequest($option . '.fields.filter_assigned', 'filter_assigned', '', 'word'); $filter_fieldtype = $app->getUserStateFromRequest($option . '.fields.filter_fieldtype', 'filter_fieldtype', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.fields.filter_state', 'filter_state', '', 'word'); $filter_type = $app->getUserStateFromRequest($option . '.fields.filter_type', 'filter_type', '', 'int'); $filter_order = $app->getUserStateFromRequest($option . '.fields.filter_order', 'filter_order', 't.ordering', 'cmd'); if ($filter_type && $filter_order == 't.ordering') { $filter_order = $app->setUserState($option . '.fields.filter_order', 'typeordering'); } else { if (!$filter_type && $filter_order == 'typeordering') { $filter_order = $app->setUserState($option . '.fields.filter_order', 't.ordering'); } } $filter_order_Dir = $app->getUserStateFromRequest($option . '.fields.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $search = $app->getUserStateFromRequest($option . '.fields.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); if ($cparams->get('show_usability_messages', 1)) { $notice_content_type_order = $app->getUserStateFromRequest($option . '.fields.notice_content_type_order', 'notice_content_type_order', 0, 'int'); if (!$notice_content_type_order) { $app->setUserState($option . '.fields.notice_content_type_order', 1); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_BY_TYPE'), 'notice'); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_WITHOUT_TYPE'), 'notice'); $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } //add css and submenu to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } $document->addScript(JURI::base() . 'components/com_flexicontent/assets/js/flexi-lib.js'); // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu and check access FLEXISubmenu('CanFields'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FIELDS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fields'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $contrl = FLEXI_J16GE ? "fields." : ""; if ($perms->CanCopyFields) { JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::custom($contrl . 'copy_wvalues', 'copy_wvalues.png', 'copy_f2.png', 'FLEXI_COPY_WITH_VALUES'); JToolBarHelper::divider(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); if ($perms->CanAddField) { JToolBarHelper::addNew($contrl . 'add'); } if ($perms->CanEditField) { JToolBarHelper::editList($contrl . 'edit'); } if ($perms->CanDeleteField) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } JToolBarHelper::divider(); JToolBarHelper::spacer(); $toggle_icon = 'basicindex'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='issearch';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_TEXT_SEARCHABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); $toggle_icon = 'basicfilter'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isfilter';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_FILTERABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); $toggle_icon = 'advindex'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvsearch';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_ADV_TEXT_SEARCHABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); $toggle_icon = 'advfilter'; $btn_task = FLEXI_J16GE ? 'fields.toggleprop' : 'toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvfilter';"; flexicontent_html::addToolBarButton('FLEXI_TOGGLE_ADV_FILTERABLE', $toggle_icon, $full_js = '', $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false); if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } //Get data from the model $model = $this->getModel(); $rows = $this->get(FLEXI_J16GE ? 'Items' : 'Data'); $pagination = $this->get('Pagination'); $types = $this->get('Typeslist'); $fieldtypes = $model->getFieldtypes($fields_in_groups = true); $lists = array(); //build backend visible filter $ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : '; $fftype = array(); $fftype[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FIELDS_TYPE') . ' -'); $fftype[] = JHTML::_('select.option', 'BV', $ALL . JText::_('FLEXI_BACKEND_FIELDS')); $fftype[] = JHTML::_('select.option', 'C', $ALL . JText::_('FLEXI_CORE_FIELDS')); $fftype[] = JHTML::_('select.option', 'NC', $ALL . JText::_('FLEXI_NON_CORE_FIELDS')); foreach ($fieldtypes as $field_group => $ft_types) { $fftype[] = JHTML::_('select.optgroup', $field_group); foreach ($ft_types as $field_type => $ftdata) { $field_friendlyname = str_ireplace("FLEXIcontent - ", "", $ftdata->field_friendlyname); $fftype[] = JHTML::_('select.option', $field_type, '-' . $ftdata->assigned . '- ' . $field_friendlyname); } $fftype[] = JHTML::_('select.optgroup', ''); } $lists['fftype'] = JHTML::_('select.genericlist', $fftype, 'filter_fieldtype', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_fieldtype); if (!FLEXI_J16GE) { $lists['fftype'] = str_replace('<optgroup label="">', '</optgroup>', $lists['fftype']); } //build orphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FIELDS') . ' -'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_assigned); //build type select list $lists['filter_type'] = flexicontent_html::buildtypesselect($types, 'filter_type', $filter_type, true, 'class="use_select2_lib" size="1" onchange="submitform( );"', 'filter_type'); //publish unpublished filter $states = array(); $states[] = JHTML::_('select.option', '', JText::_('FLEXI_SELECT_STATE')); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); //$lists['state'] = JHTML::_('grid.state', $filter_state ); $lists['state'] = JHTML::_('select.genericlist', $states, 'filter_state', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_state); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // filter ordering if ($filter_type == '' || $filter_type == 0) { $ordering = $lists['order'] == 't.ordering'; } else { $ordering = $lists['order'] == 'typeordering'; } //assign data to template $this->assignRef('permission', $perms); $this->assignRef('filter_type', $filter_type); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('ordering', $ordering); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); //add css to document $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // Add JS frameworks flexicontent_html::loadFramework('select2'); // Add js function to overload the joomla submitform validation JHTML::_('behavior.formvalidation'); // load default validation JS to make sure it is overriden $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH); $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH); //Load pane behavior jimport('joomla.html.pane'); //Import File system jimport('joomla.filesystem.file'); //Get data from the model $model = $this->getModel(); $row = $this->get('Field'); $form = $this->get('Form'); $types = $this->get('Typeslist'); $typesselected = $this->get('Typesselected'); //create the toolbar if ($row->id) { JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit'); } else { JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd'); } $ctrl = FLEXI_J16GE ? 'fields.' : ''; JToolBarHelper::apply($ctrl . 'apply'); JToolBarHelper::save($ctrl . 'save'); JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false); JToolBarHelper::cancel($ctrl . 'cancel'); // Import Joomla plugin that implements the type of current flexi field $extfolder = 'flexicontent_fields'; $extname = $row->iscore ? 'core' : $row->field_type; JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type); // Create class name of the plugin and then create a plugin instance $classname = 'plg' . ucfirst($extfolder) . $extname; // Check max allowed version if (property_exists($classname, 'prior_to_version')) { // Set a system message with warning of failed PHP limits $prior_to_version = $app->getUserStateFromRequest($option . '.flexicontent.prior_to_version_' . $row->field_type, 'prior_to_version_' . $row->field_type, 0, 'int'); $app->setUserState($option . '.flexicontent.prior_to_version_' . $row->field_type, $prior_to_version + 1); if ($prior_to_version < 2) { $close_btn = FLEXI_J30GE ? '<a class="close" data-dismiss="alert">×</a>' : '<a class="fc-close" onclick="this.parentNode.parentNode.removeChild(this.parentNode);">×</a>'; $manifest_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_flexicontent' . DS . 'manifest.xml'; $com_xml = JApplicationHelper::parseXMLInstallFile($manifest_path); $ver_exceeded = version_compare(str_replace(' ', '.', $com_xml['version']), str_replace(' ', '.', $classname::$prior_to_version), '>='); if ($ver_exceeded) { echo ' <span class="fc-note fc-mssg-inline"> ' . $close_btn . ' Warning: installed version of Field: \'<b>' . $extname . '</b>\' was given to be free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ' <br/> It may or may not work properly in later versions </span>'; } else { echo ' <span class="fc-info fc-mssg-inline"> ' . $close_btn . ' Note: installed version of Field: \'<b>' . $extname . '</b>\' is given free for FLEXIcontent versions prior to: v' . $classname::$prior_to_version . ', nevertheless it will continue to function after FLEXIcontent is upgraded. </span>'; } } } // load plugin's english language file then override with current language file $extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type); JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true); JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true); //check which properties are supported by current field $ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore); $supportsearch = $ft_support->supportsearch; $supportadvsearch = $ft_support->supportadvsearch; $supportfilter = $ft_support->supportfilter; $supportadvfilter = $ft_support->supportadvfilter; $supportuntranslatable = $ft_support->supportuntranslatable; $supportvalueseditable = $ft_support->supportvalueseditable; $supportformhidden = $ft_support->supportformhidden; $supportedithelp = $ft_support->supportedithelp; //build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes) $lists = array(); //build field_type list if (!$row->field_type) { $row->field_type = 'text'; } $_attribs = ' class="use_select2_lib fc_skip_highlight" '; if ($row->iscore == 1) { $_attribs .= ' disabled="disabled" '; } else { $_field_id = 'jform_field_type'; $_row_id = $form->getValue("id"); $_ctrl_task = 'task=fields.getfieldspecificproperties'; $document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\t" . (FLEXI_J30GE ? "\n\t\t\t\t\t\t\t\t\tjQuery('.hasTooltip').tooltip({'html': true,'container': jQuery('#fieldspecificproperties')});\n\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\tvar tipped_elements = jQuery('#fieldspecificproperties .hasTip');\n\t\t\t\t\t\t\t\ttipped_elements.each(function() {\n\t\t\t\t\t\t\t\t\tvar title = this.get('title');\n\t\t\t\t\t\t\t\t\tif (title) {\n\t\t\t\t\t\t\t\t\t\tvar parts = title.split('::', 2);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:title', parts[0]);\n\t\t\t\t\t\t\t\t\t\tthis.store('tip:text', parts[1]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tvar ajax_JTooltips = new Tips(\$('fieldspecificproperties').getElements('.hasTip'), { maxTitleChars: 50, fixed: false});\n\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\ttabberAutomatic(tabberOptions, 'fieldspecificproperties');\n\t\t\t\t\t\t\t\tfc_bindFormDependencies('#fieldspecificproperties', 0, '');\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('#" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t"); } //build field select list $fieldtypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = true); $fftypes = array(); foreach ($fieldtypes as $field_group => $ft_types) { $fftypes[] = $field_group; foreach ($ft_types as $field_type => $ftdata) { $fftypes[] = array('value' => $ftdata->field_type, 'text' => $ftdata->friendly); } $fftypes[] = ''; } $lists['field_type'] = flexicontent_html::buildfieldtypeslist($fftypes, 'jform[field_type]', $row->field_type, $_grouped ? 1 : 0, $_attribs); //build type select list $attribs = 'class="use_select2_lib" multiple="multiple" size="6"'; $attribs .= $row->iscore ? ' disabled="disabled"' : ''; $types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]'; $lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs); // ************************************************************************** // Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields) // ************************************************************************** if (!FLEXI_J16GE) { //build formhidden selector $formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO')); $formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND')); $formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND')); $formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH')); $formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden'; $lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden); if (FLEXI_ACCESS) { $valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR')); $valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION')); $valueseditable_fieldname = FLEXI_J16GE ? 'jform[valueseditable]' : 'valueseditable'; $lists['valueseditable'] = JHTML::_('select.radiolist', $valueseditable, $valueseditable_fieldname, '', 'value', 'text', $row->valueseditable); } $edithelp[] = JHTML::_('select.option', 0, JText::_('FLEXI_EDIT_HELP_NONE')); $edithelp[] = JHTML::_('select.option', 1, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP')); $edithelp[] = JHTML::_('select.option', 2, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP_WICON')); $edithelp[] = JHTML::_('select.option', 3, JText::_('FLEXI_EDIT_HELP_INLINE')); $edithelp_fieldname = FLEXI_J16GE ? 'jform[edithelp]' : 'edithelp'; $lists['edithelp'] = JHTML::_('select.radiolist', $edithelp, $edithelp_fieldname, '', 'value', 'text', $row->edithelp); // build the html select list for ordering $query = 'SELECT ordering AS value, label AS text' . ' FROM #__flexicontent_fields' . ' WHERE published >= 0' . ' ORDER BY ordering'; $row->ordering = @$row->ordering; $lists['ordering'] = $row->id ? JHTML::_('list.specificordering', $row, $row->id, $query) : JHTML::_('list.specificordering', $row, '', $query); //build access level list if (FLEXI_ACCESS) { $lang = JFactory::getLanguage(); $lang->_strings['FLEXIACCESS_PADD'] = 'Edit-Value'; $lists['access'] = FAccess::TabGmaccess($row, 'field', 1, 1, 0, 1, 0, 1, 0, 1, 1); } else { $lists['access'] = JHTML::_('list.accesslevel', $row); } } if (!FLEXI_J16GE) { // Create the parameter 's form object parsing the file XML $pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $row->field_type . '.xml'; if (JFile::exists($pluginpath)) { $form = new JParameter('', $pluginpath); } else { $form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml'); } // Special and Core Groups $form->loadINI($row->attribs); } // fail if checked out not by 'me' if ($row->id) { if ($model->isCheckedOut($user->get('id'))) { JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN')); $app->redirect('index.php?option=com_flexicontent&view=fields'); } } //clean data JFilterOutput::objectHTMLSafe($row, ENT_QUOTES); // assign permissions for J2.5 $permission = FlexicontentHelperPerm::getPerm(); $this->assignRef('permission', $permission); //assign data to template $this->assignRef('document', $document); $this->assignRef('row', $row); $this->assignRef('lists', $lists); $this->assignRef('form', $form); $this->assignRef('typesselected', $typesselected); $this->assignRef('supportsearch', $supportsearch); $this->assignRef('supportadvsearch', $supportadvsearch); $this->assignRef('supportfilter', $supportfilter); $this->assignRef('supportadvfilter', $supportadvfilter); $this->assignRef('supportuntranslatable', $supportuntranslatable); $this->assignRef('supportvalueseditable', $supportvalueseditable); $this->assignRef('supportformhidden', $supportformhidden); $this->assignRef('supportedithelp', $supportedithelp); parent::display($tpl); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $document = JFactory::getDocument(); $user = JFactory::getUser(); // Get data from the model $genstats = $this->get('Generalstats'); $popular = $this->get('Popular'); $rating = $this->get('Rating'); $worstrating = $this->get('WorstRating'); $favoured = $this->get('Favoured'); $statestats = $this->get('Statestats'); $votesstats = $this->get('Votesstats'); $creators = $this->get('Creators'); $editors = $this->get('Editors'); // ************************************************** New data*********************************************************************************************************************// $itemsgraph = $this->get('Itemsgraph'); $unpopular = $this->get('Unpopular'); $totalitemspublish = $this->get('Itemspublish'); $totalitemsunpublish = $this->get('Itemsunpublish'); $totalitemswaiting = $this->get('Itemswaiting'); $totalitemsprogress = $this->get('Itemsprogress'); $metadescription = $this->get('Itemsmetadescription'); $metakeywords = $this->get('Itemsmetakeywords'); // ************************************************** New data*********************************************************************************************************************// // ************************** // Add css and js to document // ************************** $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css'); } } //*****************************************************************Adicionar as biblitecas*******************************************************************************************// $document->addStyleSheet('//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css'); $document->addScript(JURI::root(true) . '/components/com_flexicontent/librairies/esl/esl.js'); //*****************************************************************Adicionar as biblitecas*******************************************************************************************// // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanStats'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_STATISTICS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'stats'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar //JToolBarHelper::Back(); if ($perms->CanConfig) { //JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } //Load pane behavior if (!FLEXI_J16GE) { jimport('joomla.html.pane'); $pane = JPane::getInstance('Tabs'); $this->assignRef('pane', $pane); } $this->assignRef('genstats', $genstats); $this->assignRef('popular', $popular); $this->assignRef('rating', $rating); $this->assignRef('worstrating', $worstrating); $this->assignRef('favoured', $favoured); $this->assignRef('statestats', $statestats); $this->assignRef('votesstats', $votesstats); $this->assignRef('creators', $creators); $this->assignRef('editors', $editors); // ************************************************** New data*********************************************************************************************************************// $this->assignRef('itemsgraph', $itemsgraph); $this->assignRef('unpopular', $unpopular); $this->assignRef('totalitemspublish', $totalitemspublish); $this->assignRef('totalitemsunpublish', $totalitemsunpublish); $this->assignRef('totalitemswaiting', $totalitemswaiting); $this->assignRef('totalitemsprogress', $totalitemsprogress); $this->assignRef('metadescription', $metadescription); $this->assignRef('metakeywords', $metakeywords); // ************************************************** New data*********************************************************************************************************************// $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }
/** * Logic to mass ordering fields * * @access public * @return void * @since 1.0 */ function saveorder() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // Get variables: model, user, field id, new ordering $model = $this->getModel('fields'); $user = JFactory::getUser(); $cid = JRequest::getVar('cid', array(0), 'default', 'array'); $order = JRequest::getVar('order', array(0), 'post', 'array'); // calculate access if (FLEXI_J16GE) { $is_authorised = $user->authorise('flexicontent.orderfields', 'com_flexicontent'); } else { if (FLEXI_ACCESS && $user->gid < 25) { $perms = FlexicontentHelperPerm::getPerm(); $is_authorised = $perms->CanFields; // For FLEXIAccess consider MANAGE privilege as REORDER Field privilege } else { // Only admin or super admin can reorder fields $is_authorised = $user->gid >= 24; } } // check access if (!$is_authorised) { JError::raiseWarning(403, JText::_('FLEXI_ALERTNOTAUTH')); } else { if (!$model->saveorder($cid, $order)) { $msg = JText::_('FLEXI_OPERATION_FAILED'); JError::raiseWarning(500, $model->getError()); } else { $msg = JText::_('FLEXI_NEW_ORDERING_SAVED'); } } $this->setRedirect('index.php?option=com_flexicontent&view=fields', $msg); }
function checkDirtyFields() { if (JRequest::getVar('task') != '' || JRequest::getVar('format') != '' || JRequest::getVar('tmpl') != '') { return; } $perms = FlexicontentHelperPerm::getPerm(); if (!$perms->CanFields) { return; } $db = JFactory::getDBO(); // GET fields having dirty field properties, NOTE: a dirty field property means that search index must be updated, // even if the field was unpublished, because the field values may still exists in the search index for some items $query = 'SELECT COUNT(*) ' . ' FROM #__flexicontent_fields' . ' WHERE (issearch=-1 || issearch=2)'; $db->setQuery($query); $dirty_basic = $db->loadResult(); $query = 'SELECT COUNT(*) ' . ' FROM #__flexicontent_fields' . ' WHERE (isadvsearch=-1 OR isadvsearch=2 OR isadvfilter=-1 OR isadvfilter=2)'; $db->setQuery($query); $dirty_advanced = $db->loadResult(); if ($dirty_basic) { JError::raiseNotice(403, JText::sprintf('FLEXI_ALERT_UPDATE_BASIC_INDEX', $dirty_basic)); } if ($dirty_advanced) { JError::raiseNotice(403, JText::sprintf('FLEXI_ALERT_UPDATE_ADVANCED_INDEX', $dirty_advanced)); } }
/** * Method to fetch the tags form * * @since 1.5 */ function gettags() { $id = JRequest::getInt('id', 0); $model = $this->getModel('item'); $tags = $model->gettags(); $user = JFactory::getUser(); $used = null; if ($id) { $used = $model->getUsedtagsIds($id); } if (!is_array($used)) { $used = array(); } if (FLEXI_J16GE) { $permission = FlexicontentHelperPerm::getPerm(); $CanNewTags = $permission->CanNewTags; $CanUseTags = $permission->CanUseTags; } if (FLEXI_ACCESS) { $CanNewTags = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'newtags', 'users', $user->gmid) : 1; $CanUseTags = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'usetags', 'users', $user->gmid) : 1; } else { // no FLEXIAccess everybody can create / use tags $CanNewTags = 1; $CanUseTags = 1; } $CanUseTags = $CanUseTags ? '' : ' disabled="disabled"'; $n = count($tags); $rsp = ''; if ($n > 0) { $rsp .= '<div class="qf_tagbox">'; $rsp .= '<ul>'; for ($i = 0, $n; $i < $n; $i++) { $tag = $tags[$i]; $rsp .= '<li><div><span class="qf_tagidbox"><input type="checkbox" name="tag[]" value="' . $tag->id . '"' . (in_array($tag->id, $used) ? 'checked="checked"' : '') . $CanUseTags . ' /></span>' . $tag->name . '</div></li>'; if ($CanUseTags && in_array($tag->id, $used)) { $rsp .= '<input type="hidden" name="tag[]" value="' . $tag->id . '" />'; } } $rsp .= '</ul>'; $rsp .= '</div>'; $rsp .= '<div class="clear"></div>'; } if ($CanNewTags) { $rsp .= '<div class="qf_addtag">'; $rsp .= '<label for="addtags">' . JText::_('FLEXI_ADD_TAG') . '</label>'; $rsp .= '<input type="text" id="tagname" class="inputbox" size="30" />'; $rsp .= '<input type="button" class="fc_button" value="' . JText::_('FLEXI_ADD') . '" onclick="addtag()" />'; $rsp .= '</div>'; } echo $rsp; }
/** * Creates the state selector button * * @param int $id * @param array $params * @since 1.0 */ static function statebutton($item, &$params = null, $addToggler = true) { // Check for empty params too if ($params && !$params->get('show_state_icon', 1) || JRequest::getCmd('print')) { return; } $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $nullDate = $db->getNullDate(); $app = JFactory::getApplication(); // Determine general archive privilege static $has_archive = null; if ($has_archive === null) { $permission = FlexicontentHelperPerm::getPerm(); $has_archive = $permission->CanArchives; } // Determine edit state, delete privileges of the current user on the given item $asset = 'com_content.article.' . $item->id; $has_edit_state = $user->authorise('core.edit.state', $asset) || $user->authorise('core.edit.state.own', $asset) && $item->created_by == $user->get('id'); $has_delete = $user->authorise('core.delete', $asset) || $user->authorise('core.delete.own', $asset) && $item->created_by == $user->get('id'); // Display state toggler if it can do any of state change $canChangeState = $has_edit_state || $has_delete || $has_archive; static $js_and_css_added = false; if (!$js_and_css_added && $canChangeState && $addToggler) { // File exists both in frontend & backend (and is different), so we will use 'base' method and not 'root' $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/stateselector.js', FLEXI_VERSION); $js = ' function fc_setitemstate(state, id) { var handler = new fc_statehandler({task: "' . ($app->isAdmin() ? 'items.setitemstate' : 'setitemstate') . '"}); handler.setstate( state, id ); }'; $document->addScriptDeclaration($js); $js_and_css_added = true; } static $state_names = null; static $state_descrs = null; static $state_imgs = null; static $tooltip_class = null; static $state_tips = null; static $button_classes = null; static $icon_sep = null; if (!$state_names) { $state_names = array(1 => JText::_('FLEXI_PUBLISHED'), -5 => JText::_('FLEXI_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISHED'), -3 => JText::_('FLEXI_PENDING'), -4 => JText::_('FLEXI_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVED'), -2 => JText::_('FLEXI_TRASHED'), '' => JText::_('FLEXI_UNKNOWN')); $state_descrs = array(1 => JText::_('FLEXI_PUBLISH_THIS_ITEM'), -5 => JText::_('FLEXI_SET_STATE_AS_IN_PROGRESS'), 0 => JText::_('FLEXI_UNPUBLISH_THIS_ITEM'), -3 => JText::_('FLEXI_SET_STATE_AS_PENDING'), -4 => JText::_('FLEXI_SET_STATE_AS_TO_WRITE'), 2 => JText::_('FLEXI_ARCHIVE_THIS_ITEM'), -2 => JText::_('FLEXI_TRASH_THIS_ITEM'), '' => 'FLEXI_UNKNOWN'); $state_imgs = array(1 => 'tick.png', -5 => 'publish_g.png', 0 => 'publish_x.png', -3 => 'publish_r.png', -4 => 'publish_y.png', 2 => 'archive.png', -2 => 'trash.png', '' => 'unknown.png'); $tooltip_class = FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $state_tips = array(); $title_header = ''; //JText::_( 'FLEXI_ACTION' ); foreach ($state_names as $state_id => $i) { $state_tips[$state_id] = flexicontent_html::getToolTip($title_header, $state_names[$state_id], 0); } $button_classes = 'fc_statebutton'; $button_classes .= FLEXI_J30GE ? ' btn btn-small' : ' fc_button fcsimple fcsmall'; $button_classes .= FLEXI_J30GE ? ' hasTooltip' : ' hasTip'; $icon_sep = JText::_('FLEXI_ICON_SEP'); } // Create state icon $state = $item->state; $state_text = ''; $tmpparams = new JRegistry(); $tmpparams->set('stateicon_popup', 'none'); $stateicon = flexicontent_html::stateicon($state, $tmpparams, $state_text); $tz_string = JFactory::getApplication()->getCfg('offset'); $tz = new DateTimeZone($tz_string); $tz_offset = $tz->getOffset(new JDate()) / 3600; // Calculate common variables used to produce output $publish_up = JFactory::getDate($item->publish_up); $publish_down = JFactory::getDate($item->publish_down); $publish_up->setTimezone($tz); $publish_down->setTimezone($tz); $img_path = JURI::root(true) . "/components/com_flexicontent/assets/images/"; // Create publish information $publish_info = ''; if (isset($item->publish_up)) { if ($item->publish_up == $nullDate) { $publish_info .= JText::_('FLEXI_START_ALWAYS'); } else { $publish_info .= JText::_('FLEXI_START') . ": " . JHTML::_('date', $publish_up->toSql(), 'Y-m-d H:i:s'); } } if (isset($item->publish_down)) { if ($item->publish_down == $nullDate) { $publish_info .= ($publish_info ? '<br/>' : '') . JText::_('FLEXI_FINISH_NO_EXPIRY'); } else { $publish_info .= ($publish_info ? '<br/>' : '') . JText::_('FLEXI_FINISH') . ": " . JHTML::_('date', $publish_down->toSql(), 'Y-m-d H:i:s'); } } $publish_info = $state_text . '<br/>' . $publish_info; // Create the state selector button and return it if ($canChangeState && $addToggler) { // Only add user's permitted states on the current item if ($has_edit_state) { $state_ids = array(1, -5, 0, -3, -4); } if ($has_archive) { $state_ids[] = 2; } if ($has_delete) { $state_ids[] = -2; } $box_css = ''; //$app->isSite() ? 'width:182px; left:-100px;' : ''; $publish_info .= '<br/><br/>' . JText::_('FLEXI_CLICK_TO_CHANGE_STATE'); $allowed_states = array(); foreach ($state_ids as $i => $state_id) { $allowed_states[] = ' <li> <a href="javascript:void(0);" onclick="fc_setitemstate(\'' . $state_id . '\', \'' . $item->id . '\')" class="btn setstate_btn ' . $tooltip_class . '" title="' . $state_tips[$state_id] . '"> <img src="' . $img_path . $state_imgs[$state_id] . '" width="16" height="16" style="border-width:0;" alt="' . $state_names[$state_id] . '" /> </a> </li>'; } $tooltip_title = flexicontent_html::getToolTip(JText::_('FLEXI_PUBLISH_INFORMATION'), $publish_info, 0); $output = ' <ul class="statetoggler"> <li class="topLevel"> <a href="javascript:void(0);" onclick="fc_toggleStateSelector(this)" id="row' . $item->id . '" class="stateopener ' . $button_classes . '" title="' . $tooltip_title . '"> ' . $stateicon . ' </a> <div class="options" style="' . $box_css . '" onclick="fc_toggleStateSelector(this)"> <ul> ' . implode('', $allowed_states) . ' </ul> </div> </li> </ul>'; } else { if ($app->isAdmin()) { if ($canChangeState) { $publish_info .= '<br/><br/>' . JText::_('FLEXI_STATE_CHANGER_DISABLED'); } $tooltip_title = flexicontent_html::getToolTip(JText::_('FLEXI_PUBLISH_INFORMATION'), $publish_info, 0); $output = ' <div id="row' . $item->id . '"> <span class="' . $tooltip_class . '" title="' . $tooltip_title . '"> ' . $stateicon . ' </span> </div>'; $output = $icon_sep . $output . $icon_sep; } else { $output = ''; // frontend with no permissions to edit / delete / archive } } return $output; }
/** * Logic to set the access level of the Fields * * @access public * @return void * @since 1.5 */ function access() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $user = JFactory::getUser(); $model = $this->getModel('filemanager'); $task = JRequest::getVar('task'); $cid = JRequest::getVar('cid', array(0), 'default', 'array'); $file_id = (int) $cid[0]; $row = JTable::getInstance('flexicontent_files', ''); $row->load($file_id); // calculate access if (FLEXI_J16GE || FLEXI_ACCESS) { $perms = FlexicontentHelperPerm::getPerm(); $is_authorised = $perms->CanFiles && ($perms->CanViewAllFiles || $user->id == $row->uploaded_by); } else { // Only manager/admin/super admin or uploader can change view level of file $is_authorised = $user->gid >= 23 || $user->id == $row->uploaded_by; } // check access if (!$is_authorised) { JError::raiseNotice(403, JText::_('FLEXI_ALERTNOTAUTH')); $this->setRedirect('index.php?option=com_flexicontent&view=filemanager', ''); return; } if (FLEXI_J16GE) { $accesses = JRequest::getVar('access', array(0), 'post', 'array'); $access = $accesses[$file_id]; } else { if ($task == 'accesspublic') { $access = 0; } elseif ($task == 'accessregistered') { $access = 1; } else { if (FLEXI_ACCESS) { $access = 3; } else { $access = 2; } } } if (!$model->saveaccess($file_id, $access)) { $msg = JText::_('FLEXI_OPERATION_FAILED'); JError::raiseWarning(500, $model->getError()); } else { $msg = ''; $cache = JFactory::getCache('com_flexicontent'); $cache->clean(); } $view = JRequest::getVar('view', 'filemanager'); if ($view != 'filemanager') { $url = $_SERVER['HTTP_REFERER']; } else { $url = 'index.php?option=com_flexicontent&view=filemanager'; } $this->setRedirect($url, $msg); }
function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); //add css to document $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); // Add JS frameworks flexicontent_html::loadFramework('select2'); // Add js function to overload the joomla submitform validation JHTML::_('behavior.formvalidation'); // load default validation JS to make sure it is overriden $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/admin.js', FLEXI_VHASH); $document->addScriptVersion(JURI::root(true) . '/components/com_flexicontent/assets/js/validate.js', FLEXI_VHASH); //Load pane behavior jimport('joomla.html.pane'); //Get data from the model $model = $this->getModel(); $row = $this->get(FLEXI_J16GE ? 'Item' : 'Type'); $form = $this->get('Form'); $themes = flexicontent_tmpl::getTemplates(); $tmpls = $themes->items; //create the toolbar if ($row->id) { JToolBarHelper::title(JText::_('FLEXI_EDIT_TYPE'), 'typeedit'); } else { JToolBarHelper::title(JText::_('FLEXI_ADD_TYPE'), 'typeadd'); } $ctrl = FLEXI_J16GE ? 'types.' : ''; JToolBarHelper::apply($ctrl . 'apply'); JToolBarHelper::save($ctrl . 'save'); JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false); JToolBarHelper::cancel($ctrl . 'cancel'); // fail if checked out not by 'me' if ($row->id) { if ($model->isCheckedOut($user->get('id'))) { JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN')); $app->redirect('index.php?option=com_flexicontent&view=types'); } } if (FLEXI_ACCESS) { $itemscreatable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_AUTHOR')); $itemscreatable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_TO_HIDE')); $itemscreatable[] = JHTML::_('select.option', 2, JText::_('FLEXI_USE_ACL_TO_DISABLE')); $itemscreatable_fieldname = FLEXI_J16GE ? 'jform[itemscreatable]' : 'itemscreatable'; $lists['itemscreatable'] = JHTML::_('select.genericlist', $itemscreatable, $itemscreatable_fieldname, '', 'value', 'text', $row->itemscreatable); } //build access level list if (!FLEXI_J16GE) { if (FLEXI_ACCESS) { $lang = JFactory::getLanguage(); $lang->_strings['FLEXIACCESS_PADD'] = 'Create Items'; $lists['access'] = FAccess::TabGmaccess($row, 'type', 1, 1, 0, 0, 0, 0, 0, 0, 0); } else { $lists['access'] = JHTML::_('list.accesslevel', $row); } } if (!FLEXI_J16GE) { //clean data JFilterOutput::objectHTMLSafe($row, ENT_QUOTES); //create the parameter form $form = new JParameter($row->attribs, JPATH_COMPONENT . DS . 'models' . DS . 'type.xml'); //$form->loadINI($row->attribs); //echo "<pre>"; print_r($form->_xml['themes']->_children[0]); echo "<pre>"; print_r($form->_xml['themes']->param[0]); exit; foreach ($form->_xml['themes']->_children as $i => $child) { if (isset($child->_attributes['enableparam']) && !$cparams->get($child->_attributes['enableparam'])) { unset($form->_xml['themes']->_children[$i]); unset($form->_xml['themes']->param[$i]); } } } // Apply Template Parameters values into the form fields structures foreach ($tmpls as $tmpl) { if (FLEXI_J16GE) { $jform = new JForm('com_flexicontent.template.item', array('control' => 'jform', 'load_data' => true)); $jform->load($tmpl->params); $tmpl->params = $jform; // ... values applied at the template form file } else { $tmpl->params->loadINI($row->attribs); } } //assign data to template // assign permissions for J2.5 if (FLEXI_J16GE) { $permission = FlexicontentHelperPerm::getPerm(); $this->assignRef('permission', $permission); } $this->assignRef('document', $document); $this->assignRef('row', $row); $this->assignRef('form', $form); $this->assignRef('tmpls', $tmpls); if (!FLEXI_J16GE) { $pane = JPane::getInstance('sliders'); $this->assignRef('pane', $pane); $this->assignRef('lists', $lists); } parent::display($tpl); }
function display($tpl = null) { // Initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $use_jquery_sortable = true; $type = JRequest::getVar('type', 'items', '', 'word'); $folder = JRequest::getVar('folder', 'default', '', 'cmd'); $ismodal = JRequest::getVar('ismodal', 'default', '', 'int'); FLEXIUtilities::loadTemplateLanguageFile($folder); //Get data from the model $layout = $this->get('Data'); $conf = $this->get('LayoutConf'); $fields = $this->get('Fields'); $fbypos = $this->get('FieldsByPositions'); $used = $this->get('UsedFields'); $contentTypes = $this->get('TypesList'); //$fieldTypes = $this->get( 'FieldTypesList' ); $fieldTypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = false, $_published = false); // Field types with content type ASSIGNMENT COUNTING // Create CONTENT TYPE SELECTOR foreach ($fields as $field) { $field->type_ids = !empty($field->reltypes) ? explode(",", $field->reltypes) : array(); } $options = array(); $options[] = JHTML::_('select.option', '', JText::_('FLEXI_ALL')); foreach ($contentTypes as $contentType) { $options[] = JHTML::_('select.option', $contentType->id, JText::_($contentType->name)); } $fieldname = $elementid = 'content_type__au__'; $attribs = ' onchange="filterFieldList(\'%s\', \'%s\', \'%s\');" class="use_select2_lib" '; $content_type_select = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', '', $elementid); // Create FIELD TYPE SELECTOR $ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : '; $fftypes = array(); $fftypes[] = array('value' => '', 'text' => JText::_('FLEXI_ALL')); //$fftypes[] = array('value'=>'BV', 'text'=>$ALL . JText::_( 'FLEXI_BACKEND_FIELDS' ) ); //$fftypes[] = array('value'=>'C', 'text'=>$ALL . JText::_( 'FLEXI_CORE_FIELDS' ) ); //$fftypes[] = array('value'=>'NC', 'text'=>$ALL . JText::_( 'FLEXI_NON_CORE_FIELDS' )); foreach ($fieldTypes as $field_group => $ft_types) { $fftypes[] = $field_group; foreach ($ft_types as $field_type => $ftdata) { $fftypes[] = array('value' => $ftdata->field_type, 'text' => $ftdata->friendly); } $fftypes[] = ''; } $fieldname = $elementid = 'field_type__au__'; $attribs = ' class="use_select2_lib" onchange="filterFieldList(\'%s\', \'%s\', \'%s\');"'; $field_type_select = flexicontent_html::buildfieldtypeslist($fftypes, $fieldname, '', $_grouped ? 1 : 0, $attribs, $elementid); if (isset($layout->positions)) { $sort = array(); $jssort = array(); $idsort = array(); $sort[0] = 'sortablecorefields'; $sort[1] = 'sortableuserfields'; $i = 2; $count = -1; foreach ($layout->positions as $pos) { $count++; if (isset($layout->attributes[$count]) && isset($layout->attributes[$count]['readonly'])) { continue; } $sort[$i] = 'sortable-' . $pos; $idsort[$i] = $pos; $i++; } foreach ($idsort as $k => $v) { if ($k > 1) { $jssort[] = 'storeordering(jQuery("#sortable-' . $v . '"))'; } } $positions = implode(',', $idsort); $jssort = implode("; ", $jssort); $sortable_ids = "#" . implode(",#", $sort); $js = "\n\t\t\tjQuery(function() {\n\t\t\t\tmy = jQuery( \"{$sortable_ids}\" ).sortable({\n\t\t\t\t\tconnectWith: \"" . $sortable_ids . "\",\n\t\t\t\t\tupdate: function(event, ui) {\n\t\t\t\t\t\tif(ui.sender) {\n\t\t\t\t\t\t\tstoreordering(jQuery(ui.sender));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tstoreordering(jQuery(ui.item).parent());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tinitordering();\n\t\t\t});\n\t\t\tfunction storeordering(parent_element) {\n\t\t\t\thidden_id = '#'+jQuery.trim(parent_element.attr('id').replace('sortable-',''));\n\t\t\t\tfields = new Array();\n\t\t\t\ti = 0;\n\t\t\t\tparent_element.children('li').each(function(){\n\t\t\t\t\tfields[i++] = jQuery(this).attr('id').replace('field_', '');\n\t\t\t\t});\n\t\t\t\tjQuery(hidden_id).val(fields.join(','))\n\t\t\t}\n\t\t\t"; $js .= ' var fieldListFilters = new Array( "content_type", "field_type" ); function filterFieldList (containerID, method, group) { var needed_classes = ""; for (i=0; i<fieldListFilters.length; i++) { filter_name = fieldListFilters[i]; var filter_val = jQuery("#" + filter_name + "_" + group).val(); if (filter_val) { needed_classes += "."+filter_name+"_"+filter_val; } } if (needed_classes) { (method=="hide") ? jQuery("#"+containerID).find("li").show().filter(":not("+needed_classes+")").hide() : jQuery("#"+containerID).find("li").css({"color":"red"}).filter(":not("+needed_classes+")").css({"color":"black"}); } else { (method=="hide") ? jQuery("#"+containerID).find("li").show() : jQuery("#"+containerID).find("li").css({"color":"black"}); } } '; $document->addScriptDeclaration($js); } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal'); $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base(true) . '/components/com_flexicontent/assets/css/j25.css'); } } // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); if (!$perms->CanTemplates) { $app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS')); } // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanTemplates'); //create the toolbar $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::title(JText::_('FLEXI_EDIT_TEMPLATE'), 'templates'); if (!$ismodal) { JToolBarHelper::apply('templates.apply'); JToolBarHelper::save('templates.save'); JToolBarHelper::cancel('templates.cancel'); } else { JToolBarHelper::apply('templates.apply_modal'); echo $bar->render(); } // ********************************************************************************** // Get Templates and apply Template Parameters values into the form fields structures // ********************************************************************************** if (FLEXI_J16GE) { $jform = new JForm('com_flexicontent.template.category', array('control' => 'jform', 'load_data' => true)); $jform->load($layout->params); $layout->params = $jform; // ... values applied at the template form file } else { $layout->params->loadINI($row->params); } //print_r($layout); //assign data to template //print_r($conf); $this->assignRef('conf', $conf); $this->assignRef('layout', $layout); $this->assignRef('fields', $fields); $this->assignRef('user', $user); $this->assignRef('type', $type); $this->assignRef('folder', $folder); $this->assignRef('jssort', $jssort); $this->assignRef('positions', $positions); $this->assignRef('used', $used); $this->assignRef('fbypos', $fbypos); $this->assignRef('use_jquery_sortable', $use_jquery_sortable); $this->assignRef('content_type_select', $content_type_select); $this->assignRef('field_type_select', $field_type_select); parent::display($tpl); }
/** * Calculates the user permission on the given item * * @since 1.0 */ function _getItemPerms(&$item) { $user = JFactory::getUser(); // get current user $permission = FlexicontentHelperPerm::getPerm(); // get global perms $model = $this->getModel(); $perms = array(); $perms['isSuperAdmin'] = $permission->SuperAdmin; $perms['multicat'] = $permission->MultiCat; $perms['cantags'] = $permission->CanUseTags; $perms['canparams'] = $permission->CanParams; $perms['cantemplates'] = $permission->CanTemplates; $perms['canarchive'] = $permission->CanArchives; $perms['canright'] = $permission->CanRights; $perms['canacclvl'] = $permission->CanAccLvl; $perms['canversion'] = $permission->CanVersion; $perms['editcreationdate'] = $permission->EditCreationDate; // Get general edit/publish/delete permissions (we will override these for existing items) $perms['canedit'] = $permission->CanEdit || $permission->CanEditOwn; $perms['canpublish'] = $permission->CanPublish || $permission->CanPublishOwn; $perms['candelete'] = $permission->CanDelete || $permission->CanDeleteOwn; $perms['canchange_cat'] = $permission->CanChangeCat; $perms['canchange_seccat'] = $permission->CanChangeSecCat; $perms['canchange_featcat'] = $permission->CanChangeFeatCat; // OVERRIDE global with existing item's atomic settings if ($model->get('id')) { // the following include the "owned" checks too $itemAccess = $model->getItemAccess(); $perms['canedit'] = $itemAccess->get('access-edit'); // includes temporary editable via session's 'rendered_uneditable' $perms['canpublish'] = $itemAccess->get('access-edit-state'); // includes (frontend) check (and allows) if user is editing via a coupon and has 'edit.state.own' $perms['candelete'] = $itemAccess->get('access-delete'); } // Get can change categories ACL access $type = $this->get('Typesselected'); if ($type->id) { $perms['canchange_cat'] = $user->authorise('flexicontent.change.cat', 'com_flexicontent.type.' . $type->id); $perms['canchange_seccat'] = $user->authorise('flexicontent.change.cat.sec', 'com_flexicontent.type.' . $type->id); $perms['canchange_featcat'] = $user->authorise('flexicontent.change.cat.feat', 'com_flexicontent.type.' . $type->id); } return $perms; }
function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); //add css to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } //add js function to overload the joomla submitform FLEXI_J30GE ? JHtml::_('behavior.framework', true) : JHTML::_('behavior.mootools'); JHTML::_('behavior.tooltip'); flexicontent_html::loadFramework('jQuery'); flexicontent_html::loadFramework('select2'); $document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/admin.js'); $document->addScript(JURI::root() . 'components/com_flexicontent/assets/js/validate.js'); //Load pane behavior jimport('joomla.html.pane'); //Import File system jimport('joomla.filesystem.file'); //Get data from the model $model = $this->getModel(); $row = $this->get('Field'); if (FLEXI_J16GE) { $form = $this->get('Form'); } $types = $this->get('Typeslist'); $typesselected = $this->get('Typesselected'); //create the toolbar if ($row->id) { JToolBarHelper::title(JText::_('FLEXI_EDIT_FIELD'), 'fieldedit'); } else { JToolBarHelper::title(JText::_('FLEXI_ADD_FIELD'), 'fieldadd'); } $ctrl = FLEXI_J16GE ? 'fields.' : ''; JToolBarHelper::apply($ctrl . 'apply'); JToolBarHelper::save($ctrl . 'save'); JToolBarHelper::custom($ctrl . 'saveandnew', 'savenew.png', 'savenew.png', 'FLEXI_SAVE_AND_NEW', false); JToolBarHelper::cancel($ctrl . 'cancel'); // Import Joomla plugin that implements the type of current flexi field JPluginHelper::importPlugin('flexicontent_fields', $row->iscore ? 'core' : $row->field_type); // load plugin's english language file then override with current language file $extension_name = 'plg_flexicontent_fields_' . ($row->iscore ? 'core' : $row->field_type); JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, 'en-GB', true); JFactory::getLanguage()->load($extension_name, JPATH_ADMINISTRATOR, null, true); //check which properties are supported by current field $ft_support = FlexicontentFields::getPropertySupport($row->field_type, $row->iscore); $supportsearch = $ft_support->supportsearch; $supportadvsearch = $ft_support->supportadvsearch; $supportfilter = $ft_support->supportfilter; $supportadvfilter = $ft_support->supportadvfilter; $supportuntranslatable = $ft_support->supportuntranslatable; $supportvalueseditable = $ft_support->supportvalueseditable; $supportformhidden = $ft_support->supportformhidden; $supportedithelp = $ft_support->supportedithelp; //build selectlists, (for J1.6+ most of these are defined via XML file and custom form field classes) $lists = array(); //build field_type list if (!$row->field_type) { $row->field_type = 'text'; } if ($row->iscore == 1) { $class = 'disabled="disabled"'; } else { $class = ''; $_field_id = '#' . (FLEXI_J16GE ? 'jform_' : '') . 'field_type'; $_row_id = FLEXI_J16GE ? $form->getValue("id") : $row->id; $_ctrl_task = FLEXI_J16GE ? 'task=fields.getfieldspecificproperties' : 'controller=fields&task=getfieldspecificproperties'; $document->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('" . $_field_id . "').on('change', function() {\n\t\t\t\t\t\tjQuery('#fieldspecificproperties').html('<p class=\"centerimg\"><img src=\"components/com_flexicontent/assets/images/ajax-loader.gif\" align=\"center\"></p>');\n\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\turl: 'index.php?option=com_flexicontent&" . $_ctrl_task . "&cid=" . $_row_id . "&field_type='+this.value+'&format=raw',\n\t\t\t\t\t\t\tsuccess: function(str) {\n\t\t\t\t\t\t\t\tjQuery('#fieldspecificproperties').html(str);\n\t\t\t\t\t\t\t\tvar JTooltips = new Tips(jQuery('#fieldspecificproperties .hasTip'), { maxTitleChars: 50, fixed: false});\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tjQuery('#field_typename').html(jQuery('" . $_field_id . "').val());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t"); } //build field select list $lists['field_type'] = flexicontent_html::buildfieldtypeslist('field_type', $class, $row->field_type, $group = true); //build type select list $attribs = 'class="use_select2_lib" multiple="multiple" size="6"'; $attribs .= $row->iscore ? ' disabled="disabled"' : ''; $types_fieldname = FLEXI_J16GE ? 'jform[tid][]' : 'tid[]'; $lists['tid'] = flexicontent_html::buildtypesselect($types, $types_fieldname, $typesselected, false, $attribs); // ************************************************************************** // Create fields for J1.5 (J2.5+ uses JForm XML file for most of form fields) // ************************************************************************** if (!FLEXI_J16GE) { //build formhidden selector $formhidden[] = JHTML::_('select.option', 0, JText::_('FLEXI_NO')); $formhidden[] = JHTML::_('select.option', 1, JText::_('FLEXI_FRONTEND')); $formhidden[] = JHTML::_('select.option', 2, JText::_('FLEXI_BACKEND')); $formhidden[] = JHTML::_('select.option', 3, JText::_('FLEXI_BOTH')); $formhidden_fieldname = FLEXI_J16GE ? 'jform[formhidden]' : 'formhidden'; $lists['formhidden'] = JHTML::_('select.radiolist', $formhidden, $formhidden_fieldname, '', 'value', 'text', $row->formhidden); if (FLEXI_ACCESS) { $valueseditable[] = JHTML::_('select.option', 0, JText::_('FLEXI_ANY_EDITOR')); $valueseditable[] = JHTML::_('select.option', 1, JText::_('FLEXI_USE_ACL_PERMISSION')); $valueseditable_fieldname = FLEXI_J16GE ? 'jform[valueseditable]' : 'valueseditable'; $lists['valueseditable'] = JHTML::_('select.radiolist', $valueseditable, $valueseditable_fieldname, '', 'value', 'text', $row->valueseditable); } $edithelp[] = JHTML::_('select.option', 0, JText::_('FLEXI_EDIT_HELP_NONE')); $edithelp[] = JHTML::_('select.option', 1, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP')); $edithelp[] = JHTML::_('select.option', 2, JText::_('FLEXI_EDIT_HELP_LABEL_TOOLTIP_WICON')); $edithelp[] = JHTML::_('select.option', 3, JText::_('FLEXI_EDIT_HELP_INLINE')); $edithelp_fieldname = FLEXI_J16GE ? 'jform[edithelp]' : 'edithelp'; $lists['edithelp'] = JHTML::_('select.radiolist', $edithelp, $edithelp_fieldname, '', 'value', 'text', $row->edithelp); // build the html select list for ordering $query = 'SELECT ordering AS value, label AS text' . ' FROM #__flexicontent_fields' . ' WHERE published >= 0' . ' ORDER BY ordering'; $row->ordering = @$row->ordering; $lists['ordering'] = $row->id ? JHTML::_('list.specificordering', $row, $row->id, $query) : JHTML::_('list.specificordering', $row, '', $query); //build access level list if (FLEXI_ACCESS) { $lang = JFactory::getLanguage(); $lang->_strings['FLEXIACCESS_PADD'] = 'Edit-Value'; $lists['access'] = FAccess::TabGmaccess($row, 'field', 1, 1, 0, 1, 0, 1, 0, 1, 1); } else { $lists['access'] = JHTML::_('list.accesslevel', $row); } } if (!FLEXI_J16GE) { // Create the parameter 's form object parsing the file XML $pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $row->field_type . '.xml'; if (JFile::exists($pluginpath)) { $form = new JParameter('', $pluginpath); } else { $form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml'); } // Special and Core Groups $form->loadINI($row->attribs); } // fail if checked out not by 'me' if ($row->id) { if ($model->isCheckedOut($user->get('id'))) { JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN')); $app->redirect('index.php?option=com_flexicontent&view=fields'); } } //clean data JFilterOutput::objectHTMLSafe($row, ENT_QUOTES); // assign permissions for J2.5 if (FLEXI_J16GE) { $permission = FlexicontentHelperPerm::getPerm(); $this->assignRef('permission', $permission); } //assign data to template $this->assignRef('document', $document); $this->assignRef('row', $row); $this->assignRef('lists', $lists); $this->assignRef('form', $form); $this->assignRef('typesselected', $typesselected); $this->assignRef('supportsearch', $supportsearch); $this->assignRef('supportadvsearch', $supportadvsearch); $this->assignRef('supportfilter', $supportfilter); $this->assignRef('supportadvfilter', $supportadvfilter); $this->assignRef('supportuntranslatable', $supportuntranslatable); $this->assignRef('supportvalueseditable', $supportvalueseditable); $this->assignRef('supportformhidden', $supportformhidden); $this->assignRef('supportedithelp', $supportedithelp); parent::display($tpl); }
/** * Method to configure the toolbar for this view. * * @access public * @return void */ function setToolbar() { $document = JFactory::getDocument(); $js = "jQuery(document).ready(function(){"; $toolbar = JToolBar::getInstance('toolbar'); $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=basic'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'basicindex.png', 'basicindex_f2.png', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', false); JHtml::_('behavior.modal', '#toolbar-basicindex a.toolbar, #toolbar-basicindex button'); } else { $toolbar->appendButton('Popup', 'basicindex', 'FLEXI_INDEX_BASIC_CONTENT_LISTS', str_replace('&', '&', $popup_load_url), 500, 240); } JToolBarHelper::divider(); JToolBarHelper::spacer(); $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-advindex a.toolbar, #toolbar-advindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'advindex.png', 'advindex_f2.png', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', false); JHtml::_('behavior.modal', '#toolbar-advindex a.toolbar, #toolbar-advindex button'); } else { $toolbar->appendButton('Popup', 'advindex', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW', str_replace('&', '&', $popup_load_url), 500, 240); } $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=search&layout=indexer&tmpl=component&indexer=advanced&rebuildmode=quick'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 500, y: 240}, onClose: function() {}}');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'advindexdirty.png', 'advindexdirty_f2.png', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', false); JHtml::_('behavior.modal', '#toolbar-advindexdirty a.toolbar, #toolbar-advindexdirty button'); } else { $toolbar->appendButton('Popup', 'advindexdirty', 'FLEXI_INDEX_ADVANCED_SEARCH_VIEW_DIRTY_ONLY', str_replace('&', '&', $popup_load_url), 500, 240); } $toolbar->appendButton('Confirm', 'FLEXI_DELETE_INDEX_CONFIRM', 'trash', 'FLEXI_INDEX_ADVANCED_PURGE', FLEXI_J16GE ? 'search.purge' : 'purge', false); $user = JFactory::getUser(); $perms = FlexicontentHelperPerm::getPerm(); if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } $js .= "});"; $document->addScriptDeclaration($js); }
/** * Creates the Entrypage * * @since 1.0 */ function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $filter_order = $app->getUserStateFromRequest($option . '.types.filter_order', 'filter_order', 't.name', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.types.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.types.filter_state', 'filter_state', '*', 'word'); $search = $app->getUserStateFromRequest($option . '.types.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //add css and submenu to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanTypes'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TYPES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'types'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $contrl = FLEXI_J16GE ? "types." : ""; JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::divider(); JToolBarHelper::spacer(); JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::addNew($contrl . 'add'); JToolBarHelper::editList($contrl . 'edit'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } if (FLEXI_J16GE) { $rows = $this->get('Items'); } else { $rows = $this->get('Data'); } if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Create type's parameters foreach ($rows as $type) { $type->config = FLEXI_J16GE ? new JRegistry($type->config) : new JParameter($type->config); } // Create pagination object $pagination = $this->get('Pagination'); $lists = array(); //publish unpublished filter $lists['state'] = JHTML::_('grid.state', $filter_state); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { $mainframe = JFactory::getApplication(); $option = JRequest::getVar('option'); //initialise variables $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); JHTML::_('behavior.tooltip'); //get vars $filter_order = $mainframe->getUserStateFromRequest($option . '.archive.filter_order', 'filter_order', 'i.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.archive.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . '.archive.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //add css and submenu to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanArchives'); //create the toolbar JToolBarHelper::title(JText::_('FLEXI_ITEM_ARCHIVE'), 'archive'); if (FLEXI_J16GE) { JToolBarHelper::unarchiveList('archive.unarchive'); JToolBarHelper::deleteList('Are you sure?', 'archive.remove'); } else { JToolBarHelper::unarchiveList(); JToolBarHelper::deleteList(); } if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } //Get data from the model $rows =& $this->get('Data'); $pageNav =& $this->get('Pagination'); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $ordering = $lists['order'] == 'i.ordering'; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pageNav', $pageNav); $this->assignRef('ordering', $ordering); $this->assignRef('user', $user); parent::display($tpl); }
/** * Method to get items in progress state, (published but) waiting to be completed * * @access public * @return array */ function getInprogress() { $user = JFactory::getUser(); $permission = FlexicontentHelperPerm::getPerm(); $allitems = $permission->DisplayAllItems; $use_tmp = true; $query_select_ids = 'SELECT c.id'; //SQL_CALC_FOUND_ROWS $query_select_data = 'SELECT c.id, c.title, c.catid, c.created, cr.name as creator, c.created_by, c.modified, c.modified_by, mr.name as modifier'; $query_from_join = '' . ' FROM ' . ($use_tmp ? '#__flexicontent_items_tmp' : '#__content') . ' as c' . ' LEFT JOIN #__users AS cr ON cr.id = c.created_by' . ' LEFT JOIN #__users AS mr ON mr.id = c.modified_by'; $query_where_orderby_having = '' . ' WHERE c.state = -5' . (!FLEXI_J16GE ? ' AND c.sectionid = ' . (int) FLEXI_SECTION : '') . ($allitems ? '' : ' AND c.created_by = ' . $user->id) . ' ORDER BY c.created DESC'; $query = $query_select_ids . $query_from_join . $query_where_orderby_having; $this->_db->SetQuery($query, 0, 5); $ids = FLEXI_J16GE ? $this->_db->loadColumn() : $this->_db->loadResultArray(); $genstats = array(); if (!empty($ids)) { $query = $query_select_data . $query_from_join . ' WHERE c.id IN (' . implode(',', $ids) . ')'; $this->_db->SetQuery($query, 0, 5); $genstats = $this->_db->loadObjectList(); } return $genstats; }
/** * Logic to delete categories * * @access public * @return void * @since 1.0 */ function remove() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $user = JFactory::getUser(); if (FLEXI_J16GE) { $perms = FlexicontentHelperPerm::getPerm(); $CanCats = $perms->CanCats; } else { if (FLEXI_ACCESS) { $CanCats = $user->gid < 25 ? FAccess::checkComponentAccess('com_flexicontent', 'categories', 'users', $user->gmid) : 1; } else { $CanCats = 1; } } $cid = JRequest::getVar('cid', array(0), 'post', 'array'); $msg = ''; if (!is_array($cid) || count($cid) < 1) { // no category selected JError::raiseWarning(500, JText::_('FLEXI_SELECT_ITEM_DELETE')); } else { if (!$CanCats) { // no access rights JError::raiseWarning(500, JText::_('FLEXI_ALERTNOTAUTH_TASK')); } else { // try to delete the category and clean cache $model = $this->getModel('categories'); $msg = $model->delete($cid); if (!$msg) { JError::raiseWarning(500, $model->getError()); $this->setRedirect('index.php?option=com_flexicontent&view=categories', $msg); return; } // clean cache $cache = JFactory::getCache('com_flexicontent'); $cache->clean(); $catscache = JFactory::getCache('com_flexicontent_cats'); $catscache->clean(); } } // redirect to categories management tab $this->setRedirect('index.php?option=com_flexicontent&view=categories', $msg); }
function display($tpl = null) { //initialise variables global $globalcats; $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $view = JRequest::getVar('view'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $order_property = !FLEXI_J16GE ? 'c.ordering' : 'c.lft'; $filter_order = $app->getUserStateFromRequest($option . '.' . $view . '.filter_order', 'filter_order', $order_property, 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.' . $view . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.' . $view . '.filter_state', 'filter_state', '', 'string'); $filter_cats = $app->getUserStateFromRequest($option . '.' . $view . '.filter_cats', 'filter_cats', '', 'int'); $filter_level = $app->getUserStateFromRequest($option . '.' . $view . '.filter_level', 'filter_level', '', 'string'); $filter_access = $app->getUserStateFromRequest($option . '.' . $view . '.filter_access', 'filter_access', '', 'string'); if (FLEXI_J16GE) { $filter_language = $app->getUserStateFromRequest($option . '.' . $view . '.filter_language', 'filter_language', '', 'string'); } $search = $app->getUserStateFromRequest($option . '.' . $view . '.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); // Prepare the document: add css files, etc $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanCats'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_CATEGORIES'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fc_categories'); $document->setTitle($doc_title . ' - ' . $site_title); // ****************** // Create the toolbar // ****************** $js = "window.addEvent('domready', function(){"; $contrl = FLEXI_J16GE ? "categories." : ""; $contrl_singular = FLEXI_J16GE ? "category." : ""; $toolbar = JToolBar::getInstance('toolbar'); // Copy Parameters $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=categories&layout=params&tmpl=component'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\tjQuery('#toolbar-params a.toolbar, #toolbar-params button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 600, y: 440}, onClose: function() {}}');\n\t\t\t"; JToolBarHelper::custom($btn_task, 'params.png', 'params_f2.png', 'FLEXI_COPY_PARAMS', false); JHtml::_('behavior.modal', '#toolbar-params a.toolbar, #toolbar-params button'); } else { $toolbar->appendButton('Popup', 'params', JText::_('FLEXI_COPY_PARAMS'), str_replace('&', '&', $popup_load_url), 600, 440); } //if (FLEXI_J16GE) // $toolbar->appendButton('Popup', 'move', JText::_('FLEXI_COPY_MOVE'), JURI::base().'index.php?option=com_flexicontent&view=categories&layout=batch&tmpl=component', 800, 440); JToolBarHelper::divider(); $add_divider = false; if (!FLEXI_J16GE || $user->authorise('core.create', 'com_flexicontent')) { $cancreate_cat = true; } else { $usercats = FlexicontentHelperPerm::getAllowedCats($user, $actions_allowed = array('core.create'), $require_all = true, $check_published = true, $specific_catids = false, $find_first = true); $cancreate_cat = count($usercats) > 0; } if ($cancreate_cat) { JToolBarHelper::addNew($contrl_singular . 'add'); $add_divider = true; } if (!FLEXI_J16GE || ($user->authorise('core.edit', 'com_flexicontent') || $user->authorise('core.edit.own', 'com_flexicontent'))) { JToolBarHelper::editList($contrl_singular . 'edit'); $add_divider = true; } if (FLEXI_J16GE && $user->authorise('core.admin', 'checkin')) { JToolBarHelper::checkin($contrl . 'checkin'); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } $add_divider = false; if (!FLEXI_J16GE || ($user->authorise('core.edit.state', 'com_flexicontent') || $user->authorise('core.edit.state.own', 'com_flexicontent'))) { JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::divider(); if (FLEXI_J16GE) { JToolBarHelper::archiveList($contrl . 'archive'); } } $add_divider = false; if (!FLEXI_J16GE || $filter_state == -2 && $user->authorise('core.delete', 'com_flexicontent')) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); $add_divider = true; } elseif ($user->authorise('core.edit.state', 'com_flexicontent')) { JToolBarHelper::trash($contrl . 'trash'); $add_divider = true; } if ($add_divider) { JToolBarHelper::divider(); } if ($perms->CanConfig) { //JToolBarHelper::custom($contrl.'rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } $js .= "});"; $document->addScriptDeclaration($js); //Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } if (FLEXI_J16GE) { $rows = $this->get('Items'); } else { $rows = $this->get('Data'); } if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Get assigned items $model = $this->getModel(); $rowids = array(); foreach ($rows as $row) { $rowids[] = $row->id; } if ($print_logging_info) { $start_microtime = microtime(true); } $rowtotals = $model->getAssignedItems($rowids); if ($print_logging_info) { @($fc_run_times['execute_sec_queries'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } foreach ($rows as $row) { $row->nrassigned = isset($rowtotals[$row->id]) ? $rowtotals[$row->id]->nrassigned : 0; } // Parse configuration for every category foreach ($rows as $cat) { $cat->config = FLEXI_J16GE ? new JRegistry($cat->config) : new JParameter($cat->config); } if (FLEXI_J16GE) { $this->state = $this->get('State'); // Preprocess the list of items to find ordering divisions. foreach ($rows as &$item) { $this->ordering[$item->parent_id][] = $item->id; } } $pagination = $this->get('Pagination'); $categories =& $globalcats; $lists['copyid'] = flexicontent_cats::buildcatselect($categories, 'copycid', '', 2, 'class="inputbox"', false, true, $actions_allowed = array('core.edit')); $lists['destid'] = flexicontent_cats::buildcatselect($categories, 'destcid[]', '', false, 'class="inputbox" size="15" multiple="true"', false, true, $actions_allowed = array('core.edit')); // ******************* // Create Form Filters // ******************* // filter by a category (it's subtree will be displayed) $categories = $globalcats; $lists['cats'] = flexicontent_cats::buildcatselect($categories, 'filter_cats', $filter_cats, 2, 'class="inputbox" size="1" onchange="this.form.submit();"', $check_published = true, $check_perms = false); // filter depth level $options = array(); $options[] = JHtml::_('select.option', '', JText::_('FLEXI_SELECT_MAX_DEPTH')); for ($i = 1; $i <= 10; $i++) { $options[] = JHtml::_('select.option', $i, $i); } $fieldname = $elementid = 'filter_level'; $attribs = ' size="1" class="inputbox" onchange="this.form.submit();" '; $lists['level'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_level, $elementid, $translate = true); // filter publication state if (FLEXI_J16GE) { $options = JHtml::_('jgrid.publishedOptions'); array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_SELECT_PUBLISHED'))); $fieldname = $elementid = 'filter_state'; $attribs = ' size="1" class="inputbox" onchange="Joomla.submitform()" '; $lists['state'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_state, $elementid, $translate = true); } else { $lists['state'] = JHTML::_('grid.state', $filter_state); } if (FLEXI_J16GE) { // filter access level $options = JHtml::_('access.assetgroups'); array_unshift($options, JHtml::_('select.option', '', JText::_('JOPTION_SELECT_ACCESS'))); $fieldname = $elementid = 'filter_access'; $attribs = ' size="1" class="inputbox" onchange="Joomla.submitform()" '; $lists['access'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // filter language $lists['language'] = flexicontent_html::buildlanguageslist('filter_language', 'size="1" class="inputbox" onchange="submitform();"', $filter_language, 2); } else { // filter access level $options = array(); $options[] = JHtml::_('select.option', '', JText::_('FLEXI_SELECT_ACCESS_LEVEL')); $options[] = JHtml::_('select.option', '0', JText::_('Public')); $options[] = JHtml::_('select.option', '1', JText::_('Registered')); $options[] = JHtml::_('select.option', '2', JText::_('SPECIAL')); $fieldname = $elementid = 'filter_access'; $attribs = ' size="1" class="inputbox" onchange="this.form.submit()" '; $lists['access'] = JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); } // filter search word $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $ordering = $lists['order'] == $order_property ? $order_property : ''; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('perms', $perms); if (FLEXI_J16GE) { $this->assignRef('orderingx', $ordering); } else { $this->assignRef('ordering', $ordering); } $this->assignRef('pagination', $pagination); $this->assignRef('user', $user); parent::display($tpl); }
/** * Creates the Filemanagerview * * @since 1.0 */ function display($tpl = null) { // Check for request forgeries JRequest::checkToken('request') or jexit('Invalid Token'); flexicontent_html::loadJQuery(); flexicontent_html::loadFramework('select2'); JHTML::_('behavior.tooltip'); // Load the form validation behavior JHTML::_('behavior.formvalidation'); //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $document = JFactory::getDocument(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $params = JComponentHelper::getParams('com_flexicontent'); //$authorparams = flexicontent_db::getUserConfig($user->id); $langs = FLEXIUtilities::getLanguages('code'); $fieldid = JRequest::getVar('field', null, 'request', 'int'); $client = $app->isAdmin() ? '../' : ''; //get vars $filter_order = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_order', 'filter_order', 'f.filename', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter', 'filter', 1, 'int'); $filter_lang = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_lang', 'filter_lang', '', 'string'); $filter_uploader = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_uploader', 'filter_uploader', 0, 'int'); $filter_url = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_url', 'filter_url', '', 'word'); $filter_secure = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_secure', 'filter_secure', '', 'word'); $filter_ext = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.filter_ext', 'filter_ext', '', 'alnum'); $search = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.search', 'search', '', 'string'); $filter_item = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.item_id', 'item_id', '', 'int'); $u_item_id = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.u_item_id', 'u_item_id', 0, 'string'); $autoselect = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.autoselect', 'autoselect', 0, 'int'); $autoassign = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.autoassign', 'autoassign', 0, 'int'); $folder_mode = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.folder_mode', 'folder_mode', 0, 'int'); $folder_param = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.folder_param', 'folder_param', 'dir', 'string'); $append_item = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.append_item', 'append_item', 1, 'int'); $append_field = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.append_field', 'append_field', 1, 'int'); $targetid = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.targetid', 'targetid', '', 'string'); $thumb_w = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.thumb_w', 'thumb_w', 120, 'int'); $thumb_h = $app->getUserStateFromRequest($option . '.fileselement' . $fieldid . '.thumb_h', 'thumb_h', 90, 'int'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); $newfileid = JRequest::getInt('newfileid'); $newfilename = base64_decode(JRequest::getVar('newfilename', '')); $delfilename = base64_decode(JRequest::getVar('delfilename', '')); //add css and submenu to document if ($app->isSite()) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontent.css'); $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexi_shared.css'); // NOTE: this is imported by main Frontend CSS file } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); } if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } $document->addStyleSheet(JURI::root() . 'administrator/templates/system/css/system.css'); // include backend CSS template CSS file , access to backend folder may not be allowed but ... if ($app->isSite()) { $template = !FLEXI_J16GE ? 'khepri' : (FLEXI_J30GE ? 'hathor' : 'bluestork'); $document->addStyleSheet(JURI::root() . 'administrator/templates/' . $template . (FLEXI_J16GE ? '/css/template.css' : '/css/general.css')); } //a trick to avoid loosing general style in modal window $css = 'body, td, th { font-size: 11px; } a.striketext { text-decoration: line-through; color:red; font-style:italic; } '; $document->addStyleDeclaration($css); // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // *********************** // Get data from the model // *********************** $model = $this->getModel(); if (!$folder_mode) { $rows = $this->get('Data'); $img_folder = ''; } else { $rows = $model->getFilesFromPath($u_item_id, $fieldid, $append_item, $append_field, $folder_param); $img_folder = $model->getFieldFolderPath($u_item_id, $fieldid, $append_item, $append_field, $folder_param); $img_path = str_replace('\\', '/', $img_folder . DS . $newfilename); $thumb = JURI::root() . 'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $img_path . '&w=' . $thumb_w . '&h=' . $thumb_h; } $upload_path_var = 'fc_upload_path_' . $fieldid . '_' . $u_item_id; $app->setUserState($upload_path_var, $img_folder); //echo $upload_path_var . "<br>"; //echo $app->getUserState( $upload_path_var, 'noset' ); $pagination = $this->get('Pagination'); //$users = $this->get('Users'); // Get item using at least one file (-of- the currently listed files) /*$items_single = $model->getItemsSingleprop( array('file','minigallery') ); $items_multi = $model->getItemsMultiprop ( $field_props=array('image'=>'originalname'), $value_props=array('image'=>'filename') ); $items = array(); foreach ($items_single as $item_id => $_item) $items[$item_id] = $_item; foreach ($items_multi as $item_id => $_item) $items[$item_id] = $_item; ksort($items);*/ $fname = $model->getFieldName($fieldid); $files_selected = $model->getItemFiles($u_item_id); $formfieldname = FLEXI_J16GE ? 'custom[' . $fname . '][]' : $fname . '[]'; //add js to document if ($folder_mode) { $js = "\n\t\t\t\n\t\t\twindow.addEvent('domready', function() {\n\n\t\t function closest (obj, el) {\n\t\t var find = obj.getElement(el);\n\t\t var self = obj;\n\t\t \n\t\t while (self && !find) {\n\t\t self = self.getParent();\n\t\t find = self ? self.getElement(el) : null;\n\t\t }\n\t\t return find;\n\t\t }\n\n\t\t\t\tvar delfilename = '" . $delfilename . "';\n\t\t\t\tvar remove_existing_files_from_list = 0;\n\t\t\t\tvar remove_new_files_from_list = 0;\n\t\t\t\toriginal_objs = \$(window.parent.document.body).getElement('#container_fcfield_" . $fieldid . "').getElements('.originalname');\n\t\t\t\texisting_objs = \$(window.parent.document.body).getElement('#container_fcfield_" . $fieldid . "').getElements('.existingname');\n\t\t\t\t\n\t\t\t\tvar imgobjs = Array();\n\t\t\t\tfor(i=0,n=original_objs.length; i<n; i++) {\n\t\t\t\t\tif (original_objs[i].value) imgobjs.push(original_objs[i].value);\n\t\t\t\t\tif ( delfilename!='' && original_objs[i].value == delfilename)\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.parent.deleteField" . $fieldid . "( original_objs[i].getParent() );\n\t\t\t\t\t\tremove_existing_files_from_list = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i=0,n=existing_objs.length; i<n; i++) {\n\t\t\t\t\tif ( existing_objs[i].value) imgobjs.push(existing_objs[i].value);\n\t\t\t\t\tif ( delfilename!='' && existing_objs[i].value == delfilename)\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.parent.deleteField" . $fieldid . "(\n\t\t\t\t\t\t\t(MooTools.version>='1.2.4') ? existing_objs[i].getParent('.img_value_props') : closest (existing_objs[i] , '.img_value_props')\n\t\t\t\t\t\t);\n\t\t\t\t\t\tremove_new_files_from_list = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( remove_existing_files_from_list || remove_new_files_from_list ) {\n\t\t\t\t\tmssg = '" . JText::_('FLEXI_DELETE_FILE_IN_LIST_WINDOW_MUST_CLOSE') . "';\n\t\t\t\t\tmssg = mssg + '\\n' + (remove_existing_files_from_list ? '" . JText::_('FLEXI_EXISTING_FILE_REMOVED_SAVE_RECOMMENEDED', true) . "' : '');\n\t\t\t\t\talert( mssg );\n\t\t\t\t\t(MooTools.version>='1.2.4') ? window.parent.SqueezeBox.close() : window.parent.document.getElementById('sbox-window').close();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor(i=0,n=imgobjs.length; i<n; i++) {\n\t\t\t\t\tvar rows = \$(document.body).getElements('a[rel='+ imgobjs[i] +']');\n\t\t\t\t\trows.addClass('striketext');\n\t\t\t\t\t\n\t\t\t\t\t//if( (typeof rows) != 'undefined' && rows != null) {\n\t\t\t\t\t\t//alert(rows[0]);\n\t\t\t\t\t\t//row.className = 'striketext';\n\t\t\t\t\t//}\n\t\t\t\t}\n\t\t\t\t" . ($autoassign && $newfilename ? "window.parent.qmAssignFile" . $fieldid . "('" . $targetid . "', '" . $newfilename . "', '" . $thumb . "');" : "") . "\n\t\t\t});\n\t\t\t"; } else { $js = "\n\t\t\tfunction qffileselementadd(obj, id, file) {\n\t\t\t\tvar result = window.parent.qfSelectFile" . $fieldid . "(id, file);\n\t\t\t\tif ((typeof result) != 'undefined' && result == 'cancel') return;\n\t\t\t\tobj.className = 'striketext';\n\t\t\t\tdocument.adminForm.file.value=id;\n\t\t\t}\n\t\t\twindow.addEvent('domready', function() {\n\t\t\t\tfileobjs = window.parent.document.getElementsByName('{$formfieldname}');\n\t\t\t\tfor(i=0,n=fileobjs.length; i<n; i++) {\n\t\t\t\t\trow = document.getElementById('file'+fileobjs[i].value);\n\t\t\t\t\tif( (typeof row) != 'undefined' && row != null) {\n\t\t\t\t\t\trow.className = 'striketext';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t" . ($autoselect && $newfileid ? "qffileselementadd( document.getElementById('file" . $newfileid . "'), '" . $newfileid . "', '" . $newfilename . "');" : "") . "\n\t\t\t});\n\t\t\t"; } $document->addScriptDeclaration($js); if ($autoselect && $newfileid) { $app->enqueueMessage(JText::_('FLEXI_UPLOADED_FILE_WAS_SELECTED'), 'message'); } /***************** ** BUILD LISTS ** *****************/ $lists = array(); // ** FILE UPLOAD FORM ** // Build languages list //$allowed_langs = !$authorparams ? null : $authorparams->get('langs_allowed',null); //$allowed_langs = !$allowed_langs ? null : FLEXIUtilities::paramToArray($allowed_langs); $display_file_lang_as = $params->get('display_file_lang_as', 3); $allowed_langs = null; if (FLEXI_FISH || FLEXI_J16GE) { $lists['file-lang'] = flexicontent_html::buildlanguageslist('file-lang', '', '*', $display_file_lang_as, $allowed_langs, $published_only = false); } else { $lists['file-lang'] = flexicontent_html::getSiteDefaultLang() . '<input type="hidden" name="file-lang" value="' . flexicontent_html::getSiteDefaultLang() . '" />'; } /************* ** FILTERS ** *************/ // language filter $lists['language'] = flexicontent_html::buildlanguageslist('filter_lang', 'class="use_select2_lib" onchange="submitform();" size="1" ', $filter_lang, 2); // search $lists['search'] = $search; //search filter $filters = array(); $filters[] = JHTML::_('select.option', '1', JText::_('FLEXI_FILENAME')); $filters[] = JHTML::_('select.option', '2', JText::_('FLEXI_FILE_TITLE')); $lists['filter'] = JHTML::_('select.genericlist', $filters, 'filter', 'size="1" class="use_select2_lib"', 'value', 'text', $filter); //build url/file filterlist $url = array(); $url[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_FILES') . ' -'); $url[] = JHTML::_('select.option', 'F', JText::_('FLEXI_FILE')); $url[] = JHTML::_('select.option', 'U', JText::_('FLEXI_URL')); $lists['url'] = JHTML::_('select.genericlist', $url, 'filter_url', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_url); //item lists /*$items_list = array(); $items_list[] = JHTML::_('select.option', '', '- '. JText::_( 'FLEXI_FILTER_BY_ITEM' ) .' -' ); foreach($items as $item) { $items_list[] = JHTML::_('select.option', $item->id, JText::_( $item->title ) . ' (#' . $item->id . ')' ); } $lists['item_id'] = JHTML::_('select.genericlist', $items_list, 'item_id', 'size="1" class="use_select2_lib" onchange="submitform( );"', 'value', 'text', $filter_item );*/ $lists['item_id'] = '<input type="text" name="item_id" size="1" class="inputbox" onchange="submitform( );" value="' . $filter_item . '" />'; //build secure/media filterlist $secure = array(); $secure[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_DIRECTORIES') . ' -'); $secure[] = JHTML::_('select.option', 'S', JText::_('FLEXI_SECURE_DIR')); $secure[] = JHTML::_('select.option', 'M', JText::_('FLEXI_MEDIA_DIR')); $lists['secure'] = JHTML::_('select.genericlist', $secure, 'filter_secure', 'class="use_select2_lib" size="1" onchange="submitform( );"', 'value', 'text', $filter_secure); //build ext filterlist $lists['ext'] = flexicontent_html::buildfilesextlist('filter_ext', 'class="use_select2_lib" size="1" onchange="submitform( );"', $filter_ext); //build uploader filterlist $lists['uploader'] = flexicontent_html::builduploaderlist('filter_uploader', 'class="use_select2_lib" size="1" onchange="submitform( );"', $filter_uploader); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // removed files $filelist = JRequest::getString('files'); $file = JRequest::getInt('file'); $filelist = explode(',', $filelist); $files = array(); foreach ($filelist as $fileid) { if ($fileid && $fileid != $file) { $files[] = (int) $fileid; } } $files = implode(',', $files); if (strlen($files) > 0) { $files .= ','; } $files .= $file; //assign data to template $this->assignRef('params', $params); $this->assignRef('client', $client); //Load pane behavior if (!FLEXI_J16GE) { jimport('joomla.html.pane'); $pane = JPane::getInstance('Tabs'); $this->assignRef('pane', $pane); } $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('folder_mode', $folder_mode); $this->assignRef('img_folder', $img_folder); $this->assignRef('thumb_w', $thumb_w); $this->assignRef('thumb_h', $thumb_h); $this->assignRef('pagination', $pagination); $this->assignRef('files', $files); $this->assignRef('fieldid', $fieldid); $this->assignRef('u_item_id', $u_item_id); $this->assignRef('targetid', $targetid); $this->assignRef('CanFiles', $perms->CanFiles); $this->assignRef('CanUpload', $perms->CanUpload); $this->assignRef('CanViewAllFiles', $perms->CanViewAllFiles); $this->assignRef('files_selected', $files_selected); $this->assignRef('langs', $langs); parent::display($tpl); }
function display($tpl = null) { //initialise variables $app = JFactory::getApplication(); $option = JRequest::getVar('option'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } JHTML::_('behavior.tooltip'); //get vars $filter_order = $app->getUserStateFromRequest($option . '.tags.filter_order', 'filter_order', 't.name', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '.tags.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $app->getUserStateFromRequest($option . '.tags.filter_state', 'filter_state', '*', 'word'); $filter_assigned = $app->getUserStateFromRequest($option . '.tags.filter_assigned', 'filter_assigned', '*', 'word'); $search = $app->getUserStateFromRequest($option . '.tags.search', 'search', '', 'string'); $search = FLEXI_J16GE ? $db->escape(trim(JString::strtolower($search))) : $db->getEscaped(trim(JString::strtolower($search))); //add css and submenu to document $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/flexicontentbackend.css'); if (FLEXI_J30GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j3x.css'); } else { if (FLEXI_J16GE) { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j25.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_flexicontent/assets/css/j15.css'); } } // Get User's Global Permissions $perms = FlexicontentHelperPerm::getPerm(); // Create Submenu (and also check access to current view) FLEXISubmenu('CanTags'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_TAGS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'tags'); $document->setTitle($doc_title . ' - ' . $site_title); // Create the toolbar $js = "window.addEvent('domready', function(){"; $contrl = FLEXI_J16GE ? "tags." : ""; $toolbar = JToolBar::getInstance('toolbar'); if ($perms->CanConfig) { $btn_task = ''; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent&view=tags&layout=import&tmpl=component'; if (FLEXI_J30GE || !FLEXI_J16GE) { // Layout of Popup button broken in J3.1, add in J1.5 it generates duplicate HTML tag id (... just for validation), so add manually $js .= "\n\t\t\t\t\tjQuery('#toolbar-import a.toolbar, #toolbar-import button')\n\t\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 430, y: 500}, onClose: function() {}}');\n\t\t\t\t"; JToolBarHelper::custom($btn_task, 'import.png', 'import_f2.png', 'FLEXI_IMPORT', false); JHtml::_('behavior.modal', '#toolbar-import a.toolbar, #toolbar-import button'); } else { $toolbar->appendButton('Popup', 'import', JText::_('FLEXI_IMPORT'), str_replace('&', '&', $popup_load_url), 430, 500); } JToolBarHelper::divider(); JToolBarHelper::spacer(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); JToolBarHelper::addNew($contrl . 'add'); JToolBarHelper::editList($contrl . 'edit'); //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } $js .= "});"; $document->addScriptDeclaration($js); //Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $this->get('Data'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } // Get assigned items $model = $this->getModel(); $rowids = array(); foreach ($rows as $row) { $rowids[] = $row->id; } if ($print_logging_info) { $start_microtime = microtime(true); } $rowtotals = $model->getAssignedItems($rowids); if ($print_logging_info) { @($fc_run_times['execute_sec_queries'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } foreach ($rows as $row) { $row->nrassigned = isset($rowtotals[$row->id]) ? $rowtotals[$row->id]->nrassigned : 0; } $pagination = $this->get('Pagination'); $lists = array(); //build arphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '- ' . JText::_('FLEXI_ALL_TAGS') . ' -'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_assigned); //publish unpublished filter $lists['state'] = JHTML::_('grid.state', $filter_state); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //assign data to template $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function display($tpl = null) { // ******************** // Initialise variables // ******************** $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $cparams = JComponentHelper::getParams('com_flexicontent'); $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); // Get model $model = $this->getModel(); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; } // *********** // Get filters // *********** $count_filters = 0; // various filters $filter_fieldtype = $model->getState('filter_fieldtype'); $filter_assigned = $model->getState('filter_assigned'); $filter_type = $model->getState('filter_type'); $filter_state = $model->getState('filter_state'); $filter_access = $model->getState('filter_access'); if ($filter_assigned) { $count_filters++; } if ($filter_fieldtype) { $count_filters++; } if ($filter_state) { $count_filters++; } if ($filter_access) { $count_filters++; } if ($filter_type) { $count_filters++; } // ordering filters $filter_order = $model->getState('filter_order'); $filter_order_Dir = $model->getState('filter_order_Dir'); // text search $search = $model->getState('search'); $search = $db->escape(trim(JString::strtolower($search))); // **************************** // Important usability messages // **************************** if ($cparams->get('show_usability_messages', 1)) { $notice_content_type_order = $app->getUserStateFromRequest($option . '.' . $view . '.notice_content_type_order', 'notice_content_type_order', 0, 'int'); if (!$notice_content_type_order) { $app->setUserState($option . '.' . $view . '.notice_content_type_order', 1); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_BY_TYPE'), 'message'); $app->enqueueMessage(JText::_('FLEXI_DEFINE_FIELD_ORDER_FILTER_WITHOUT_TYPE'), 'message'); $app->enqueueMessage(JText::_('FLEXI_USABILITY_MESSAGES_TURN_OFF'), 'message'); } } // ************************** // Add css and js to document // ************************** flexicontent_html::loadFramework('select2'); //JHTML::_('behavior.tooltip'); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontentbackend.css', FLEXI_VHASH); $document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/j3x.css', FLEXI_VHASH); $js = "jQuery(document).ready(function(){"; // ***************************** // Get user's global permissions // ***************************** $perms = FlexicontentHelperPerm::getPerm(); // ************************ // Create Submenu & Toolbar // ************************ // Create Submenu (and also check access to current view) FLEXISubmenu('CanFields'); // Create document/toolbar titles $doc_title = JText::_('FLEXI_FIELDS'); $site_title = $document->getTitle(); JToolBarHelper::title($doc_title, 'fields'); $document->setTitle($doc_title . ' - ' . $site_title); if ($perms->CanEditField) { $ctrl_task = '&task=fields.selectsearchflag'; $popup_load_url = JURI::base() . 'index.php?option=com_flexicontent' . $ctrl_task . '&tmpl=component'; $btn_name = 'basicindex'; $btn_task = ''; $full_js = ';'; $extra_js = ''; flexicontent_html::addToolBarButton(JText::_('FLEXI_TOGGLE_SEARCH_FLAG'), $btn_name, $full_js, $msg_alert = JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm = '', $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = false, $btn_class = ""); $js .= "\n\t\t\t\tjQuery('#toolbar-basicindex a.toolbar, #toolbar-basicindex button')\n\t\t\t\t\t.attr('onclick', 'javascript:;')\n\t\t\t\t\t.attr('href', '" . $popup_load_url . "')\n\t\t\t\t\t.attr('rel', '{handler: \\'iframe\\', size: {x: 800, y: 340}, onClose: function() {}}');\n\t\t\t"; } $contrl = "fields."; if ($perms->CanCopyFields) { JToolBarHelper::custom($contrl . 'copy', 'copy.png', 'copy_f2.png', 'FLEXI_COPY'); JToolBarHelper::custom($contrl . 'copy_wvalues', 'copy_wvalues.png', 'copy_f2.png', 'FLEXI_COPY_WITH_VALUES'); JToolBarHelper::divider(); } JToolBarHelper::publishList($contrl . 'publish'); JToolBarHelper::unpublishList($contrl . 'unpublish'); if ($perms->CanAddField) { JToolBarHelper::addNew($contrl . 'add'); } if ($perms->CanEditField) { JToolBarHelper::editList($contrl . 'edit'); } if ($perms->CanDeleteField) { //JToolBarHelper::deleteList(JText::_('FLEXI_ARE_YOU_SURE'), $contrl.'remove'); // This will work in J2.5+ too and is offers more options (above a little bogus in J1.5, e.g. bad HTML id tag) $msg_alert = JText::sprintf('FLEXI_SELECT_LIST_ITEMS_TO', JText::_('FLEXI_DELETE')); $msg_confirm = JText::_('FLEXI_ITEMS_DELETE_CONFIRM'); $btn_task = $contrl . 'remove'; $extra_js = ""; flexicontent_html::addToolBarButton('FLEXI_DELETE', 'delete', '', $msg_alert, $msg_confirm, $btn_task, $extra_js, $btn_list = true, $btn_menu = true, $btn_confirm = true); } JToolbarHelper::checkin($contrl . 'checkin'); /* JToolBarHelper::divider(); JToolBarHelper::spacer(); $btn_name = 'basicindex'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='issearch';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_TEXT_SEARCHABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); $btn_name = 'basicfilter'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isfilter';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_FILTERABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); $btn_name = 'advindex'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvsearch';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_ADV_TEXT_SEARCHABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); $btn_name = 'advfilter'; $btn_task = 'fields.toggleprop'; $extra_js = "document.getElementById('adminForm').elements['propname'].value='isadvfilter';"; flexicontent_html::addToolBarButton( 'FLEXI_TOGGLE_ADV_FILTERABLE', $btn_name, $full_js='', $msg_alert=JText::_('FLEXI_SELECT_FIELDS_TO_TOGGLE_PROPERTY'), $msg_confirm='', $btn_task, $extra_js, $btn_list=true, $btn_menu=true, $btn_confirm=false, $btn_class="btn-info"); */ $appsman_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'views' . DS . 'appsman'; if (file_exists($appsman_path)) { $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'appsman.exportxml'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_fields'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Export now', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Export now as XML', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); $btn_icon = 'icon-box-add'; $btn_name = 'box-add'; $btn_task = 'appsman.addtoexport'; $extra_js = " var f=document.getElementById('adminForm'); f.elements['view'].value='appsman'; jQuery('<input>').attr({type: 'hidden', name: 'table', value: 'flexicontent_fields'}).appendTo(jQuery(f));"; flexicontent_html::addToolBarButton('Add to export', $btn_name, $full_js = '', $msg_alert = '', $msg_confirm = 'Add to export list', $btn_task, $extra_js, $btn_list = false, $btn_menu = true, $btn_confirm = true, $btn_class = "btn-warning", $btn_icon); } /*$btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'fields.exportsql'; $extra_js = ""; flexicontent_html::addToolBarButton( 'Export SQL', $btn_name, $full_js='', $msg_alert='', $msg_confirm='Field\'s configuration will be exported as SQL', $btn_task, $extra_js, $btn_list=false, $btn_menu=true, $btn_confirm=true, $btn_class="btn-warning", $btn_icon); $btn_icon = 'icon-download'; $btn_name = 'download'; $btn_task = 'fields.exportcsv'; $extra_js = ""; flexicontent_html::addToolBarButton( 'Export CSV', $btn_name, $full_js='', $msg_alert='', $msg_confirm='Field\'s configuration will be exported as CSV', $btn_task, $extra_js, $btn_list=false, $btn_menu=true, $btn_confirm=true, $btn_class="btn-warning", $btn_icon);*/ if ($perms->CanConfig) { JToolBarHelper::divider(); JToolBarHelper::spacer(); $session = JFactory::getSession(); $fc_screen_width = (int) $session->get('fc_screen_width', 0, 'flexicontent'); $_width = $fc_screen_width && $fc_screen_width - 84 > 940 ? $fc_screen_width - 84 > 1400 ? 1400 : $fc_screen_width - 84 : 940; $fc_screen_height = (int) $session->get('fc_screen_height', 0, 'flexicontent'); $_height = $fc_screen_height && $fc_screen_height - 128 > 550 ? $fc_screen_height - 128 > 1000 ? 1000 : $fc_screen_height - 128 : 550; JToolBarHelper::preferences('com_flexicontent', $_height, $_width, 'Configuration'); } $js .= "});"; $document->addScriptDeclaration($js); // Get data from the model if ($print_logging_info) { $start_microtime = microtime(true); } $rows = $this->get('Items'); $allrows = $this->get('AllItems'); if ($print_logging_info) { @($fc_run_times['execute_main_query'] += round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10); } $pagination = $this->get('Pagination'); // Pagination $types = $this->get('Typeslist'); // Content types $fieldTypes = flexicontent_db::getFieldTypes($_grouped = true, $_usage = true, $_published = false); // Field types with content type ASSIGNMENT COUNTING $lists = array(); // build item-type filter $lists['filter_type'] = ($filter_type || 1 ? '<label class="label">' . JText::_('FLEXI_TYPE') . '</label>' : '') . flexicontent_html::buildtypesselect($types, 'filter_type', $filter_type, '-', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'filter_type'); // build orphaned/assigned filter $assigned = array(); $assigned[] = JHTML::_('select.option', '', '-'); $assigned[] = JHTML::_('select.option', 'O', JText::_('FLEXI_ORPHANED')); $assigned[] = JHTML::_('select.option', 'A', JText::_('FLEXI_ASSIGNED')); $lists['assigned'] = ($filter_assigned || 1 ? '<label class="label">' . JText::_('FLEXI_ASSIGNED') . '</label>' : '') . JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_assigned); // build field-type filter $ALL = mb_strtoupper(JText::_('FLEXI_ALL'), 'UTF-8') . ' : '; $fftypes = array(); $fftypes[] = array('value' => '', 'text' => '-'); $fftypes[] = array('value' => 'BV', 'text' => $ALL . JText::_('FLEXI_BACKEND_FIELDS')); $fftypes[] = array('value' => 'C', 'text' => $ALL . JText::_('FLEXI_CORE_FIELDS')); $fftypes[] = array('value' => 'NC', 'text' => $ALL . JText::_('FLEXI_NON_CORE_FIELDS')); foreach ($fieldTypes as $field_group => $ft_types) { $fftypes[] = $field_group; foreach ($ft_types as $field_type => $ftdata) { $fftypes[] = array('value' => $ftdata->field_type, 'text' => '-' . $ftdata->assigned . '- ' . $ftdata->friendly); } $fftypes[] = ''; } $lists['fftype'] = ($filter_fieldtype || 1 ? '<label class="label">' . JText::_('FLEXI_FIELD_TYPE') . '</label>' : '') . flexicontent_html::buildfieldtypeslist($fftypes, 'filter_fieldtype', $filter_fieldtype, $_grouped ? 1 : 0, 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'); // build publication state filter $states = array(); $states[] = JHTML::_('select.option', '', '-'); $states[] = JHTML::_('select.option', 'P', JText::_('FLEXI_PUBLISHED')); $states[] = JHTML::_('select.option', 'U', JText::_('FLEXI_UNPUBLISHED')); //$states[] = JHTML::_('select.option', '-2', JText::_( 'FLEXI_TRASHED' ) ); $lists['state'] = ($filter_state || 1 ? '<label class="label">' . JText::_('FLEXI_STATE') . '</label>' : '') . JHTML::_('select.genericlist', $states, 'filter_state', 'class="use_select2_lib" size="1" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"', 'value', 'text', $filter_state); //JHTML::_('grid.state', $filter_state ); // build access level filter $options = JHtml::_('access.assetgroups'); array_unshift($options, JHtml::_('select.option', '', '-')); $fieldname = $elementid = 'filter_access'; $attribs = 'class="use_select2_lib" onchange="document.adminForm.limitstart.value=0; Joomla.submitform()"'; $lists['access'] = ($filter_access || 1 ? '<label class="label">' . JText::_('FLEXI_ACCESS') . '</label>' : '') . JHTML::_('select.genericlist', $options, $fieldname, $attribs, 'value', 'text', $filter_access, $elementid, $translate = true); // text search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; if ($filter_type == '' || $filter_type == 0) { $ordering = $lists['order'] == 't.ordering'; } else { $ordering = $lists['order'] == 'typeordering'; } //assign data to template $this->assignRef('count_filters', $count_filters); $this->assignRef('permission', $perms); $this->assignRef('filter_type', $filter_type); $this->assignRef('lists', $lists); $this->assignRef('rows', $rows); $this->assignRef('allrows', $allrows); $this->assignRef('types', $types); $this->assignRef('ordering', $ordering); $this->assignRef('pagination', $pagination); $this->assignRef('option', $option); $this->assignRef('view', $view); $this->sidebar = FLEXI_J30GE ? JHtmlSidebar::render() : null; parent::display($tpl); }