protected function addToolbar($search) { $bar = JToolBar::getInstance('toolbar'); $canDo = Helper_Admin::getActions(); $separator = false; $title = empty($search->title) ? 'List' : $search->title; $user = JFactory::getUser(); require_once JPATH_COMPONENT . '/helpers/toolbar/link.php'; require_once JPATH_COMPONENT . '/helpers/toolbar/separator.php'; JToolBarHelper::title($title, 'stack'); if (!(is_object($search) && $search->id)) { return; } $form = JCckDatabase::loadResult('SELECT live_value FROM #__cck_core_search_field WHERE fieldid = 1 AND searchid = ' . $search->id . ' AND stage = 0'); if ($canDo->get('core.create') || $canDo->get('core.edit')) { $form = JCckDatabase::loadObject('SELECT id, name, location FROM #__cck_core_types WHERE name = "' . $form . '"'); if (is_object($form)) { $canCreate = $user->authorise('core.create', 'com_cck.form.' . $form->id); $creation = !$form->location || $form->location == 'admin' ? true : false; } else { $canCreate = false; $creation = false; } if ($canCreate && $creation) { $link = 'index.php?option=com_cck&view=form&type=' . $form->name . '&return_o=cck&return_v=list&return=' . base64_encode(JFactory::getURI()); $bar->prependButton('CckLink', 'new', JText::_('JTOOLBAR_NEW'), $link, '_self'); } } }
public function prepareToolbar() { Helper_Admin::addToolbar($this->vName, $this->vTitle, $this->state->get('filter.folder')); if (JCck::on()) { JHtmlSidebar::setAction('index.php?option=com_cck&view=templates'); } }
public function display($cachable = false, $urlparams = false) { $app = JFactory::getApplication(); $id = $app->input->getInt('id'); $layout = $app->input->get('layout', 'default'); $view = $app->input->get('view', $this->default_view); // _setUIX $this->_setUIX($view, $layout); if (!($view == 'box' || $view == 'form' || $view == 'list')) { require_once JPATH_COMPONENT . '/helpers/helper_admin.php'; require_once JPATH_COMPONENT . '/helpers/helper_folder.php'; if (!($layout == 'edit' || $layout == 'edit2')) { if (!(JCck::on() && $view == $this->default_view)) { Helper_Admin::addSubmenu($this->default_view, $view); } } if ($view == 'template' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.template', $id) || $view == 'type' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.type', $id) || $view == 'field' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.field', $id) || $view == 'search' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.search', $id) || $view == 'folder' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.folder', $id) || $view == 'site' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.site', $id) || $view == 'version' && $layout == 'edit' && !$this->checkEditId(CCK_COM . '.edit.version', $id)) { // $this->setError( JText::sprintf( 'JLIB_APPLICATION_ERROR_UNHELD_ID', $id ) ); // $this->setMessage( $this->getError(), 'error' ); // $this->setRedirect( JRoute::_( CCK_LINK.'&view='.$view.'s', false ) ); // return false; } } parent::display(); return $this; }
public function prepareToolbar() { $canDo = Helper_Admin::getActions(); $this->e_type = $this->state->get('filter.e_type'); $type = $this->e_type == 'search' ? _C4_TEXT : _C2_TEXT; $type2 = $this->e_type == 'search' ? 'search' : 'form'; JToolBarHelper::title(JText::_(_C6_TEXT . '_MANAGER') . ' - ' . JText::_('COM_CCK_' . $type . 's'), Helper_Admin::getIcon($this->vName)); if ($canDo->get('core.delete')) { JToolBarHelper::custom($this->vName . 's' . '.delete', 'delete', 'delete', 'JTOOLBAR_DELETE', true); } require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/toolbar/link.php'; JToolBar::getInstance('toolbar')->appendButton('CckLink', 'cck-' . $type2, JText::_('COM_CCK_' . $type . 'S'), JRoute::_('index.php?option=com_cck&view=' . $this->e_type . 's'), '_self'); }
protected function prepareToolbar() { $canDo = Helper_Admin::getActions(); if (JCck::on()) { JToolBarHelper::title(CCK_LABEL, 'cck-seblod'); } else { JToolBarHelper::title(' ', 'seblod.png'); } if ($canDo->get('core.admin')) { JToolBarHelper::preferences(CCK_ADDON, 560, 840, 'JTOOLBAR_OPTIONS'); } Helper_Admin::addToolbarSupportButton(); }
function prepareDisplay() { $app = JFactory::getApplication(); $model = $this->getModel(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); Helper_Session::loadExtensionLang($this->item->extension); Helper_Session::loadExtensionLang($this->item->type); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->isNew = @$this->item->id > 0 ? 0 : 1; Helper_Admin::addToolbarEdit($this->vName, _C8_TEXT, array('isNew' => $this->isNew, 'folder' => 0, 'checked_out' => '')); }
public function prepareToolbar() { $canDo = Helper_Admin::getActions(); $this->extension = $this->state->get('filter.extension'); if ($this->extension == 'extension') { JToolBarHelper::title(JText::_('COM_CCK_SESSION_MANAGER'), Helper_Admin::getIcon($this->vName)); return; } Helper_Session::loadExtensionLang($this->extension); JToolBarHelper::title(JText::_('COM_CCK_SESSION_MANAGER') . ' - ' . JText::_($this->extension), Helper_Admin::getIcon($this->vName)); if ($canDo->get('core.delete')) { JToolBarHelper::custom($this->vName . 's' . '.delete', 'delete', 'delete', 'JTOOLBAR_DELETE', true); } require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/toolbar/link.php'; JToolBar::getInstance('toolbar')->appendButton('CckLink', 'cck-extension', JText::_($this->extension), JRoute::_('index.php?option=' . $this->extension), '_self'); $this->sidebar = ''; }
function prepareDisplay() { $app = JFactory::getApplication(); $model = $this->getModel(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); $this->state = $this->get('State'); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->isNew = @$this->item->id > 0 ? 0 : 1; $type = $this->item->e_type ? $this->item->e_type : 'type'; $this->item->title = JCckDatabase::loadResult('SELECT title FROM #__cck_core_' . $type . 's WHERE id = ' . (int) $this->item->e_id); Helper_Admin::addToolbarEdit($this->vName, _C6_TEXT, array('isNew' => $this->isNew, 'folder' => 0, 'checked_out' => $this->item->checked_out)); }
function prepareDisplay() { $app = JFactory::getApplication(); $model = $this->getModel(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); $this->state = $this->get('State'); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->isNew = @$this->item->id > 0 ? 0 : 1; $this->item->folder = Helper_Admin::getSelected($this->vName, 'folder', $this->item->folder, 1); $this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->isNew ? $this->state->get('ajax.state') : $this->item->published, 1); $this->item->type = Helper_Admin::getSelected($this->vName, 'type', $app->input->getString('ajax_type', $this->state->get('ajax.type', $this->item->type)), 'text'); Helper_Admin::addToolbarEdit($this->vName, _C3_TEXT, array('isNew' => $this->isNew, 'folder' => $this->state->get('filter.folder'), 'checked_out' => $this->item->checked_out)); }
function prepareDisplay() { $app = JFactory::getApplication(); $model = $this->getModel(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); $this->state = $this->get('State'); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->isNew = @$this->item->id > 0 ? 0 : 1; $this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1); $this->item->type = $this->state->get('type', '2,7'); $this->item->fields = JCck::getConfig_Param('multisite_options', array()); $this->item->options = $this->item->options ? JCckDev::fromJSON($this->item->options) : array(); Helper_Admin::addToolbarEdit($this->vName, _C5_TEXT, array('isNew' => $this->isNew, 'folder' => 0, 'checked_out' => $this->item->checked_out)); }
function prepareDisplay() { $app = JFactory::getApplication(); $model = $this->getModel(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); $this->state = $this->get('State'); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->isNew = @$this->item->id > 0 ? 0 : 1; $this->item->folder = Helper_Admin::getSelected($this->vName, 'folder', $this->item->folder, 1); $this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1); $this->item->mode = Helper_Admin::getSelected($this->vName, 'mode', $this->state->get('mode', $this->item->mode), '0'); if (!$this->isNew) { jimport('joomla.filesystem.folder'); $this->item->tree = $this->_generateTree(); $this->item->files = JFolder::files(JPATH_SITE . '/templates/' . $this->item->name); } Helper_Admin::addToolbarEdit($this->vName, _C1_TEXT, array('isNew' => $this->isNew, 'folder' => $this->state->get('filter.folder'), 'checked_out' => $this->item->checked_out)); }
<?php /** * @version SEBLOD 3.x Core ~ $Id: new.php sebastienheraud $ * @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder) * @url http://www.seblod.com * @editor Octopoos - www.octopoos.com * @copyright Copyright (C) 2013 SEBLOD. All Rights Reserved. * @license GNU General Public License version 2 or later; see _LICENSE.php **/ defined('_JEXEC') or die; $elem = JText::_('COM_CCK_' . _C2_TEXT); Helper_Include::addDependencies($this->getName(), $this->getLayout()); $options = array(); $options[] = JHtml::_('select.option', 0, '- ' . JText::_('COM_CCK_NONE') . ' -', 'value', 'text'); $options2 = Helper_Admin::getFolderOptions(false, false, true, true, '', true); if (count($options2)) { $options = array_merge($options, $options2); } $lists['featured'] = JHtml::_('select.genericlist', $options, 'featured', 'class="inputbox" size="1"', 'value', 'text', 10, 'featured'); $doc = JFactory::getDocument(); $js = ' (function ($){ JCck.Dev = { submit: function() { var skeleton_id = $("#featured").val(); var tpl_a = $("#tpl_admin").val(); var tpl_s = $("#tpl_site").val(); var tpl_c = $("#tpl_content").val(); var tpl_i = $("#tpl_intro").val(); var url = "index.php?option=com_cck&task=type.add&skeleton_id="+skeleton_id+"&tpl_a="+tpl_a+"&tpl_s="+tpl_s+"&tpl_c="+tpl_c+"&tpl_i="+tpl_i;
<?php if ($uix == 'compact') { echo '<div class="fltlft">'; Helper_Admin::addIcon(CCK_COM, _C2_LINK, _C2_NAME, JText::_('COM_CCK_' . _C2_TEXT . '_MANAGER' . '_BR')); Helper_Admin::addIcon(CCK_COM, _C0_LINK, _C0_NAME, JText::_('COM_CCK_' . _C0_TEXT . '_MANAGER' . '_BR')); echo '</div>'; } else { echo '<div class="fltlft">'; Helper_Admin::addIcon(CCK_COM, _C2_LINK, _C2_NAME, JText::_('COM_CCK_' . _C2_TEXT . '_MANAGER' . '_BR')); Helper_Admin::addIcon(CCK_COM, _C3_LINK, _C3_NAME, JText::_(_C3_TEXT . '_MANAGER' . '_BR')); Helper_Admin::addIcon(CCK_COM, _C4_LINK, _C4_NAME, JText::_('COM_CCK_' . _C4_TEXT . '_MANAGER' . '_BR')); Helper_Admin::addIcon(CCK_COM, _C1_LINK, _C1_NAME, JText::_(_C1_TEXT . '_MANAGER' . '_BR')); echo '</div><div class="clr"></div>' . '<div class="fltlft">'; Helper_Admin::addIcon(CCK_COM, 'spacer', 'spacer', 'spacer', 24); Helper_Admin::addIcon(CCK_COM, _C0_LINK, _C0_NAME, JText::_('COM_CCK_' . _C0_TEXT . '_MANAGER' . '_BR'), 24, 'left'); Helper_Admin::addIcon(CCK_COM, _C5_LINK, _C5_NAME, JText::_(_C5_TEXT . '_MANAGER' . '_BR'), 24, 'right'); echo '</div>'; } ?> </div> <?php if ($uix == 'compact') { echo JCckDevAccordion::open('cckOptions', 'collapse1', JText::_('COM_CCK_PANE_NANO')); ?> <div class="<?php echo $this->css['items']; ?> "> <ul class="adminformlist"> <li> <span class="variation_value" style="font-size:12px; font-style:italic; text-align:center;"><?php
public function clearACL($pks) { require_once JPATH_COMPONENT . '/helpers/helper_admin.php'; if (count($pks)) { return Helper_Admin::initACL(array('table' => 'folder', 'name' => 'folder', 'rules' => '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), $pks); } return false; }
public static function getParams($element, $master, $client) { $data = array(); $data['_'] = array('add' => JText::_('COM_CCK_ADD'), 'configure' => JText::_('COM_CCK_CONFIGURE'), 'edit' => JText::_('COM_CCK_EDIT'), 'optional' => JText::_('COM_CCK_OPTIONAL'), 'required' => JText::_('COM_CCK_REQUIRED')); if ($element == 'type') { if ($master == 'content') { $data['link'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_link', 'cck_', false, false, true)); $data['typo'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_typo', 'cck_', false, false, true)); $data['markup'] = array(JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'none', JText::_('COM_CCK_NONE'))); $data['access'] = JCckDatabase::loadObjectList('SELECT a.id AS value, a.title AS text FROM #__viewlevels AS a GROUP BY a.id ORDER BY title ASC'); $data['restriction'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_restriction', 'cck_', false, false, true)); } else { $data['client'] = $client; $data['variation'] = array(JHtml::_('select.option', 'hidden', JText::_('COM_CCK_HIDDEN')), JHtml::_('select.option', 'value', JText::_('COM_CCK_VALUE')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_FORM')), JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'disabled', JText::_('COM_CCK_FORM_DISABLED')), JHtml::_('select.option', '</OPTGROUP>', '')); $data['live'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT'))), Helper_Admin::getPluginOptions('field_live', 'cck_', false, false, true)); $data['stage'] = array(JHtml::_('select.option', 0, JText::_('COM_CCK_STAGE_FINAL')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_STAGE_TEMP')), JHtml::_('select.option', 1, JText::_('COM_CCK_STAGE_1ST')), JHtml::_('select.option', 2, JText::_('COM_CCK_STAGE_2ND')), JHtml::_('select.option', 3, JText::_('COM_CCK_STAGE_3RD')), JHtml::_('select.option', 4, JText::_('COM_CCK_STAGE_4TH')), JHtml::_('select.option', 5, JText::_('COM_CCK_STAGE_5TH')), JHtml::_('select.option', '</OPTGROUP>', '')); $data['markup'] = array(JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'none', JText::_('COM_CCK_NONE'))); $data['access'] = JCckDatabase::loadObjectList('SELECT a.id AS value, a.title AS text FROM #__viewlevels AS a GROUP BY a.id ORDER BY title ASC'); $data['validation'] = true; $data['restriction'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_restriction', 'cck_', false, false, true)); } } else { if ($master == 'order') { $data['match_mode'] = array(JHtml::_('select.option', 'ASC', JText::_('COM_CCK_ASCENDING')), JHtml::_('select.option', 'DESC', JText::_('COM_CCK_DESCENDING')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_CUSTOM')), JHtml::_('select.option', 'FIELD', JText::_('COM_CCK_VALUES')), JHtml::_('select.option', '</OPTGROUP>', '')); } elseif ($master == 'content') { $data['link'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_link', 'cck_', false, false, true)); $data['typo'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_typo', 'cck_', false, false, true)); $data['markup'] = array(JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'none', JText::_('COM_CCK_NONE'))); $data['access'] = JCckDatabase::loadObjectList('SELECT a.id AS value, a.title AS text FROM #__viewlevels AS a GROUP BY a.id ORDER BY title ASC'); $data['restriction'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_restriction', 'cck_', false, false, true)); } else { $data['client'] = $client; $data['variation'] = array(JHtml::_('select.option', 'hidden', JText::_('COM_CCK_HIDDEN')), JHtml::_('select.option', 'value', JText::_('COM_CCK_VALUE')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_FORM')), JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'form_filter', JText::_('COM_CCK_FORM_FILTER')), JHtml::_('select.option', 'disabled', JText::_('COM_CCK_FORM_DISABLED')), JHtml::_('select.option', '</OPTGROUP>', '')); $data['match_mode'] = array(JHtml::_('select.option', 'none', JText::_('COM_CCK_NONE')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_BASIC')), JHtml::_('select.option', 'alpha', JText::_('COM_CCK_MATCH_BEGINNING_WITH')), JHtml::_('select.option', 'empty', JText::_('COM_CCK_MATCH_EMPTY')), JHtml::_('select.option', 'zeta', JText::_('COM_CCK_MATCH_ENDING_WITH')), JHtml::_('select.option', 'exact', JText::_('COM_CCK_MATCH_EXACT_PHRASE')), JHtml::_('select.option', '', JText::_('COM_CCK_MATCH_DEFAULT_PHRASE')), JHtml::_('select.option', '</OPTGROUP>', ''), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_DATE_AND_TIME')), JHtml::_('select.option', 'date_past_only', JText::_('COM_CCK_MATCH_DATE_PAST_ONLY')), JHtml::_('select.option', 'date_past', JText::_('COM_CCK_MATCH_DATE_PAST')), JHtml::_('select.option', 'date_future', JText::_('COM_CCK_MATCH_DATE_FUTURE')), JHtml::_('select.option', 'date_future_only', JText::_('COM_CCK_MATCH_DATE_FUTURE_ONLY')), JHtml::_('select.option', '</OPTGROUP>', ''), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_EXCLUSION')), JHtml::_('select.option', 'not_alpha', JText::_('COM_CCK_MATCH_NOT_BEGINNING_WITH')), JHtml::_('select.option', 'not_empty', JText::_('COM_CCK_MATCH_NOT_EMPTY')), JHtml::_('select.option', 'not_zeta', JText::_('COM_CCK_MATCH_NOT_ENDING_WITH')), JHtml::_('select.option', 'not_equal', JText::_('COM_CCK_MATCH_NOT_EQUAL')), JHtml::_('select.option', 'not_null', JText::_('COM_CCK_MATCH_NOT_NULL')), JHtml::_('select.option', 'not_any_exact', JText::_('COM_CCK_MATCH_NOT_ANY_WORDS_EXACT')), JHtml::_('select.option', 'not_like', JText::_('COM_CCK_MATCH_NOT_LIKE')), JHtml::_('select.option', '</OPTGROUP>', ''), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_GEO_DISTANCE')), JHtml::_('select.option', 'radius_higher', JText::_('COM_CCK_MATCH_RADIUS_HIGHER')), JHtml::_('select.option', 'radius_lower', JText::_('COM_CCK_MATCH_RADIUS_LOWER')), JHtml::_('select.option', '</OPTGROUP>', ''), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_NULL')), JHtml::_('select.option', 'is_null', JText::_('COM_CCK_MATCH_IS_NULL')), JHtml::_('select.option', 'is_not_null', JText::_('COM_CCK_MATCH_IS_NOT_NULL')), JHtml::_('select.option', '</OPTGROUP>', ''), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_NUMERIC')), JHtml::_('select.option', 'num_higher_only', JText::_('COM_CCK_MATCH_NUMERIC_HIGHER_ONLY')), JHtml::_('select.option', 'num_higher', JText::_('COM_CCK_MATCH_NUMERIC_HIGHER')), JHtml::_('select.option', 'num_lower', JText::_('COM_CCK_MATCH_NUMERIC_LOWER')), JHtml::_('select.option', 'num_lower_only', JText::_('COM_CCK_MATCH_NUMERIC_LOWER_ONLY')), JHtml::_('select.option', '</OPTGROUP>', ''), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_MATCH_GROUP_WORDS')), JHtml::_('select.option', 'any', JText::_('COM_CCK_MATCH_ANY_WORDS')), JHtml::_('select.option', 'any_exact', JText::_('COM_CCK_MATCH_ANY_WORDS_EXACT')), JHtml::_('select.option', 'each', JText::_('COM_CCK_MATCH_EACH_WORD')), JHtml::_('select.option', 'each_exact', JText::_('COM_CCK_MATCH_EACH_WORD_EXACT')), JHtml::_('select.option', 'nested_exact', JText::_('COM_CCK_MATCH_NESTED_EXACT')), JHtml::_('select.option', '</OPTGROUP>', '')); $data['live'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'stage', JText::_('COM_CCK_STAGE'))), Helper_Admin::getPluginOptions('field_live', 'cck_', false, false, true)); $data['stage'] = array(JHtml::_('select.option', 0, JText::_('COM_CCK_STAGE_FINAL')), JHtml::_('select.option', '<OPTGROUP>', JText::_('COM_CCK_STAGE_TEMP')), JHtml::_('select.option', 1, JText::_('COM_CCK_STAGE_1ST')), JHtml::_('select.option', 2, JText::_('COM_CCK_STAGE_2ND')), JHtml::_('select.option', 3, JText::_('COM_CCK_STAGE_3RD')), JHtml::_('select.option', 4, JText::_('COM_CCK_STAGE_4TH')), JHtml::_('select.option', 5, JText::_('COM_CCK_STAGE_5TH')), JHtml::_('select.option', '</OPTGROUP>', '')); $data['markup'] = array(JHtml::_('select.option', '', JText::_('COM_CCK_DEFAULT')), JHtml::_('select.option', 'none', JText::_('COM_CCK_NONE'))); $data['access'] = JCckDatabase::loadObjectList('SELECT a.id AS value, a.title AS text FROM #__viewlevels AS a GROUP BY a.id ORDER BY title ASC'); $data['validation'] = true; $data['restriction'] = array_merge(array(JHtml::_('select.option', '', JText::_('COM_CCK_NONE'))), Helper_Admin::getPluginOptions('field_restriction', 'cck_', false, false, true)); } } return $data; }
function prepareDisplay_Ajax() { // Fields if ($this->item->cck_type != '' && !$this->item->skip) { $pos = isset($this->style->positions[0]->value) ? $this->style->positions[0]->value : 'mainbody'; $this->fields = Helper_Workshop::getFields('search', $this->item, 'a.name = "cck"', false, false, $pos); $this->fields[$pos][0]->variation = 'hidden'; $this->fields[$pos][0]->match_mode = 'exact'; $this->fields[$pos][0]->live_value = $this->item->cck_type; $this->fieldsAv = Helper_Workshop::getFieldsAv('search', $this->item, '', 'a.name != "cck"'); } else { $this->fields = Helper_Workshop::getFields('search', $this->item); $this->fieldsAv = Helper_Workshop::getFieldsAv('search', $this->item, ''); } $this->type_fields = JCckDatabase::loadObjectList('SELECT fieldid, GROUP_CONCAT(DISTINCT typeid separator " c-") AS cc FROM #__cck_core_type_field group by fieldid', 'fieldid'); // Positions $positions = Helper_Workshop::getPositions('search', $this->item); if (is_object($this->style) && count($this->style->positions)) { $this->positions = array(); foreach ($this->style->positions as $p) { if ($p->value) { $this->positions[$p->value] = new stdClass(); $this->positions[$p->value]->title = $p->text; $this->positions[$p->value]->name = $p->value; $this->positions[$p->value]->disable = false; $this->positions[$p->value]->legend = @$positions[$p->value]->legend; $this->positions[$p->value]->variation = @$positions[$p->value]->variation; $this->positions[$p->value]->variation_options = @$positions[$p->value]->variation_options; $this->positions[$p->value]->width = @$positions[$p->value]->width; $this->positions[$p->value]->height = @$positions[$p->value]->height; $this->positions[$p->value]->css = @$positions[$p->value]->css; } } } else { $this->positions = array('mainbody' => (object) array('title' => '(mainbody)', 'name' => 'mainbody', 'disable' => false, 'legend' => '', 'variation' => '', 'variation_options' => '', 'width' => '', 'height' => '')); } $this->positions_nb = count($this->positions); $this->variations = Helper_Workshop::getPositionVariations($this->item->template); // Filters $max_width = JCck::on() ? '' : ' style="max-width:180px;"'; $default_f = $this->item->id > 0 ? $this->item->folder : ''; $options = Helper_Admin::getPluginOptions('field', 'cck_', true, false, true); $this->lists['af_t'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter" size="1" prefix="t-"' . $max_width, 'value', 'text', '', 'filter1'); $options = Helper_Admin::getAlphaOptions(true); $this->lists['af_a'] = JHtml::_('select.genericlist', $options, 'filter_alpha', 'class="inputbox filter" size="1" prefix="a-"', 'value', 'text', '', 'filter3'); $options = Helper_Admin::getTypeOptions(true, false); $this->lists['af_c'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter" size="1" prefix="c-"' . $max_width, 'value', 'text', '', 'filter4'); $options = Helper_Admin::getFolderOptions(true, true, false, true, 'field'); $this->lists['af_f'] = JHtml::_('select.genericlist', $options, 'filter_folder', 'class="inputbox filter" size="1" prefix="f-"' . $max_width, 'value', 'text', $default_f, 'filter2'); }
<?php echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Required', 'selectlabel' => '', 'options' => 'No=||Yes=required||Yes GroupRequired=grouprequired', 'storage_field' => 'required')); echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Alert', 'storage_field' => 'required_alert')); echo JCckDev::renderBlank('<input type="hidden" id="blank_li" value="" />'); echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Group', 'required' => 'required', 'storage_field' => 'required2')); ?> </ul> </div> <div class="seblod"> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_VALIDATION')); ?> <div id="loading" class="loading"></div> <ul class="adminformlist adminformlist-2cols"> <?php $options = Helper_Admin::getPluginOptions('field_validation', 'cck_', false, true, true, array('required')); $validation = JHtml::_('select.genericlist', $options, 'validation', 'class="inputbox select" style="max-width:175px;"', 'value', 'text', $name, 'validation'); ?> <li><label><?php echo JText::_('COM_CCK_VALIDATION'); ?> </label><?php echo $validation; ?> </li> <?php echo JCckDev::renderForm('core_validation_alert', '', $config); ?> </ul> <ul id="layer" class="adminformlist adminformlist-2cols"> <?php
<tbody> <?php foreach ($this->items as $i => $item) { $checkedOut = !($item->checked_out == $userId || $item->checked_out == 0); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; $canChange = $user->authorise('core.edit.state', CCK_COM . '.folder.' . $item->id) && $canCheckin; $canEdit = $user->authorise('core.edit', CCK_COM . '.folder.' . $item->id); $canEditOwn = ''; $last = $item->id == 1 ? ' last' : ''; $link = JRoute::_('index.php?option=' . $this->option . '&task=folder.edit&id=' . $item->id); $linkTemplate = JRoute::_('index.php?option=' . $this->option . '&view=' . _C1_NAME . '&folder_id=' . $item->id); $linkType = JRoute::_('index.php?option=' . $this->option . '&view=' . _C2_NAME . '&folder_id=' . $item->id); $linkField = JRoute::_('index.php?option=' . $this->option . '&view=' . _C3_NAME . '&folder_id=' . $item->id); $linkSearch = JRoute::_('index.php?option=' . $this->option . '&view=' . _C4_NAME . '&folder_id=' . $item->id); $linkFilter = JRoute::_('index.php?option=' . $this->option . '&view=' . $this->getName() . '&folder_id=' . $item->id); Helper_Admin::addFolderClass($css, $item->id, $item->color, $item->colorchar, '60'); ?> <tr class="row<?php echo $i % 2; echo $last; ?> " height="64px;"> <td class="center hidden-phone"><?php Helper_Display::quickSlideTo('pagination-bottom', $i + 1); ?> </td> <td class="center hidden-phone"><?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td>
function prepareDisplay_Ajax() { $featured = $this->state->get('skeleton_id', 0); // Fields $objects = ''; $pos = isset($this->style->positions[0]->value) ? $this->style->positions[0]->value : 'mainbody'; $this->fields = Helper_Workshop::getFields('type', $this->item, 'a.folder = ' . (int) $featured, false, false, $pos); $this->fieldsAv = Helper_Workshop::getFieldsAv('type', $this->item, $objects, 'a.folder != ' . (int) $featured); $this->type_fields = JCckDatabase::loadObjectList('SELECT fieldid, GROUP_CONCAT(DISTINCT typeid separator " c-") AS cc FROM #__cck_core_type_field group by fieldid', 'fieldid'); // Positions $positions = Helper_Workshop::getPositions('type', $this->item); if (count($this->style->positions)) { $this->positions = array(); foreach ($this->style->positions as $p) { if ($p->value) { $this->positions[$p->value] = new stdClass(); $this->positions[$p->value]->title = $p->text; $this->positions[$p->value]->name = $p->value; $this->positions[$p->value]->disable = false; $this->positions[$p->value]->legend = @$positions[$p->value]->legend; $this->positions[$p->value]->variation = @$positions[$p->value]->variation; $this->positions[$p->value]->variation_options = @$positions[$p->value]->variation_options; $this->positions[$p->value]->width = @$positions[$p->value]->width; $this->positions[$p->value]->height = @$positions[$p->value]->height; } } } $this->positions_nb = count($this->positions); $this->variations = Helper_Workshop::getPositionVariations($this->style->template); // Filters $max_width = JCck::on() ? '' : ' style="max-width:180px;"'; $default_f = $this->item->id > 0 ? $this->item->folder : ''; $options = Helper_Admin::getPluginOptions('field', 'cck_', true, false, true); $this->lists['af_t'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter input-medium" prefix="t-"' . $max_width, 'value', 'text', '', 'filter1'); $options = Helper_Admin::getAlphaOptions(true); $this->lists['af_a'] = JHtml::_('select.genericlist', $options, 'filter_alpha', 'class="inputbox filter input-medium" prefix="a-"', 'value', 'text', '', 'filter3'); $options = Helper_Admin::getTypeOptions(true, false); $this->lists['af_c'] = JHtml::_('select.genericlist', $options, 'filter_type', 'class="inputbox filter input-medium" prefix="c-"' . $max_width, 'value', 'text', '', 'filter4'); $options = Helper_Admin::getFolderOptions(true, true, false, true, 'field'); $this->lists['af_f'] = JHtml::_('select.genericlist', $options, 'filter_folder', 'class="inputbox filter input-medium" prefix="f-"' . $max_width, 'value', 'text', $default_f, 'filter2'); }
public function prepareToolbar() { require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/toolbar/link.php'; JToolBarHelper::title(JText::_(_C7_TEXT . '_MANAGER'), Helper_Admin::getIcon($this->vName)); JToolBar::getInstance('toolbar')->appendButton('CckLink', 'cck-template', JText::_(_C1_TEXT . 'S'), JRoute::_('index.php?option=com_cck&view=templates'), '_self'); }
public function prepareToolbar() { Helper_Admin::addToolbar($this->vName, 'COM_CCK_' . $this->vTitle, $this->state->get('filter.folder')); }
function prepareDisplay() { $app = JFactory::getApplication(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); $this->state = $this->get('State'); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } if (@$this->item->id > 0) { $this->isNew = 0; $this->panel_class = 'closed'; $this->panel_style = 'display:none; '; $name = $this->item->name; $app->setUserState(CCK_COM . '.edit.type.client', NULL); } else { $this->isNew = 1; $this->panel_class = 'open'; $this->panel_style = ''; $name = ''; $featured = $this->state->get('skeleton_id', 0); if ($featured == 11) { $this->item->storage_location = 'joomla_category'; } elseif ($featured == 13) { $this->item->storage_location = 'joomla_user'; } elseif ($featured == 14) { $this->item->storage_location = 'joomla_user_group'; } } $this->item->folder = Helper_Admin::getSelected($this->vName, 'folder', $this->item->folder, 1); $this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1); $this->item->client = $this->isNew ? 'admin' : $this->state->get('client', $app->input->cookie->getString('cck_type' . $name . '_client', 'admin')); $this->item->master = $this->item->client == 'content' || $this->item->client == 'intro' ? 'content' : 'form'; $this->item->layer = $app->input->getString('layer', 'fields'); $P = 'template_' . $this->item->client; $this->style = Helper_Workshop::getTemplateStyle($this->vName, $this->item->{$P}, $this->state->get('tpl.' . $this->item->client, 'seb_one')); $this->item->template = $this->style->template; $this->insidebox = Helper_Admin::addInsidebox($this->isNew); Helper_Admin::addToolbarEdit($this->vName, 'COM_CCK_' . _C2_TEXT, array('isNew' => $this->isNew, 'folder' => $this->state->get('filter.folder'), 'checked_out' => $this->item->checked_out), array('template' => $this->style->template)); }
function prepareDisplay() { $app = JFactory::getApplication(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->option = $app->input->get('option', ''); $this->state = $this->get('State'); // Check Errors if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->item->cck_type = $this->state->get('content_type', ''); $this->item->skip = $this->state->get('skip'); if (@$this->item->id > 0) { $this->isNew = 0; $this->panel_class = 'closed'; $this->panel_style = 'display:none; '; $name = $this->item->name; $app->setUserState(CCK_COM . '.edit.search.client', NULL); } else { $this->isNew = 1; $this->panel_class = 'open'; $this->panel_style = ''; $name = ''; if ($this->item->cck_type != '') { $this->item->storage_location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $this->item->cck_type . '"'); if ($this->item->storage_location == 'none') { $this->item->storage_location = ''; } } $this->tpl_list = $this->state->get('tpl.list'); } $this->item->folder = Helper_Admin::getSelected($this->vName, 'folder', $this->item->folder, 1); $this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1); if ($this->item->skip != '') { $this->item->client = $this->item->skip; $this->item->master = $this->item->client == 'list' || $this->item->client == 'item' ? 'content' : ($this->item->client == 'order' ? 'order' : 'search'); $this->item->layer = $app->input->getString('layer', 'fields'); $P = 'template_' . $this->item->client; $force_template = $this->item->client == 'list' ? $this->state->get('tpl.list') : Helper_Workshop::getDefaultTemplate(); } else { $this->item->client = $this->isNew ? 'search' : $this->state->get('client', $app->input->cookie->getString('cck_search' . $name . '_client', 'search')); $this->item->master = $this->item->client == 'list' || $this->item->client == 'item' ? 'content' : ($this->item->client == 'order' ? 'order' : 'search'); $this->item->layer = $app->input->getString('layer', 'fields'); $P = 'template_' . $this->item->client; $force_template = $this->item->client == 'list' ? '' : Helper_Workshop::getDefaultTemplate(); } $this->style = $this->item->client != 'order' ? Helper_Workshop::getTemplateStyle($this->vName, $this->item->{$P}, $this->state->get('tpl.' . $this->item->client, $force_template)) : ''; $this->item->template = isset($this->style->template) ? $this->style->template : ''; $this->insidebox = Helper_Admin::addInsidebox($this->isNew); Helper_Admin::addToolbarEdit($this->vName, 'COM_CCK_' . _C4_TEXT, array('isNew' => $this->isNew, 'folder' => $this->state->get('filter.folder'), 'checked_out' => $this->item->checked_out), array('template' => $this->item->template)); }
</tr> </thead> <tbody> <?php foreach ($this->items as $i => $item) { $checkedOut = !($item->checked_out == $userId || $item->checked_out == 0); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; $canChange = $user->authorise('core.edit.state', CCK_COM . '.folder.' . $item->folder) && $canCheckin; $canEdit = $user->authorise('core.edit', CCK_COM . '.folder.' . $item->folder); $canEditFolder = $user->authorise('core.edit', CCK_COM . '.folder.' . $item->folder); $canEditOwn = ''; $link = JRoute::_('index.php?option=' . $this->option . '&task=' . $this->vName . '.edit&id=' . $item->id); $link2 = JRoute::_('index.php?option=' . $this->option . '&view=form&type=' . $item->name . '&return=cck&return_v=types'); $linkFilter = JRoute::_('index.php?option=' . $this->option . '&view=' . $this->getName() . '&folder_id=' . $item->folder); $linkFolder = JRoute::_('index.php?option=' . $this->option . '&task=folder.edit&id=' . $item->folder); Helper_Admin::addFolderClass($css, $item->folder, $item->folder_color, $item->folder_colorchar); ?> <tr class="row<?php echo $i % 2; ?> " height="64px;"> <td class="center hidden-phone"><?php Helper_Display::quickSlideTo('pagination-bottom', $i + 1); ?> </td> <td class="center hidden-phone"><?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td width="30px" class="center hidden-phone"> <?php
function postflight($type, $parent) { $app = JFactory::getApplication(); $db = JFactory::getDbo(); // Force { CCK } Plugins + { CCK } Library to be published $db->setQuery('UPDATE #__extensions SET enabled = 1 WHERE element = "cck"'); $db->execute(); // Rename Menu Item $db->setQuery('UPDATE #__menu SET alias = "SEBLOD 3.x", path="SEBLOD 3.x" WHERE link = "index.php?option=com_cck"'); $db->execute(); // Re-build menu $query = 'SELECT id, level, lft, path FROM #__menu WHERE link = "index.php?option=com_cck"'; $db->setQuery($query); $seblod = $db->loadObject(); if ($seblod->id > 0) { $query = 'SELECT extension_id as id, element FROM #__extensions WHERE type = "component" AND element LIKE "com_cck_%" ORDER BY name'; $db->setQuery($query); $addons = $db->loadObjectList(); if (count($addons)) { JLoader::register('JTableMenu', JPATH_PLATFORM . '/joomla/database/table/menu.php'); $titles = array('com_cck_builder' => 'Builder', 'com_cck_developer' => 'Developer', 'com_cck_ecommerce' => 'eCommerce', 'com_cck_exporter' => 'Exporter', 'com_cck_importer' => 'Importer', 'com_cck_manager' => 'Manager', 'com_cck_multilingual' => 'Multilingual', 'com_cck_packager' => 'Packager', 'com_cck_toolbox' => 'Toolbox', 'com_cck_updater' => 'Updater', 'com_cck_webservices' => 'WebServices'); foreach ($addons as $addon) { $addon->title = $titles[$addon->element]; self::_addAddon($addon, $seblod); } } } // Reorder Plugins $i = 2; $ids = ''; $query = 'SELECT extension_id FROM #__extensions WHERE type = "plugin" AND folder = "content" AND element != "cck" ORDER BY ordering'; $db->setQuery($query); $plgs = $db->loadObjectList(); $sql = 'UPDATE #__extensions SET ordering = CASE extension_id'; foreach ($plgs as $p) { $ids .= $p->extension_id . ','; $sql .= ' WHEN ' . $p->extension_id . ' THEN ' . $i; $i++; } $ids = substr($ids, 0, -1); $sql .= ' END WHERE extension_id IN (' . $ids . ')'; $db->setQuery($sql); $db->execute(); $db->setQuery('UPDATE #__extensions SET ordering = 1 WHERE type = "plugin" AND folder = "content" AND element = "cck"'); $db->execute(); if ($type == 'install') { // Manage Modules $modules = array(0 => array('name' => 'mod_cck_menu', 'update' => 'title = "Admin Menu - SEBLOD", access = 3, published = 1, position = "menu", ordering = 2'), 1 => array('name' => 'mod_cck_quickadd', 'update' => 'title = "Quick Add - SEBLOD", access = 3, published = 1, position = "status", ordering = 0'), 2 => array('name' => 'mod_cck_quickicon', 'update' => 'title = "Quick Icons - SEBLOD", access = 3, published = 1, position = "icon", ordering = 2'), 3 => array('name' => 'mod_cck_breadcrumbs', 'update' => 'title = "Breadcrumbs - SEBLOD"'), 4 => array('name' => 'mod_cck_form', 'update' => 'title = "Form - SEBLOD"'), 5 => array('name' => 'mod_cck_list', 'update' => 'title = "List - SEBLOD"'), 6 => array('name' => 'mod_cck_search', 'update' => 'title = "Search - SEBLOD"')); foreach ($modules as $module) { $query = 'UPDATE #__modules SET ' . $module['update'] . ' WHERE module = "' . $module['name'] . '"'; $db->setQuery($query); $db->execute(); $query = 'SELECT id FROM #__modules WHERE module="' . $module['name'] . '"'; $db->setQuery($query); $mid = $db->loadResult(); $query = 'INSERT INTO #__modules_menu (moduleid, menuid) VALUES (' . $mid . ', 0)'; $db->setQuery($query); $db->execute(); } // Publish Plugins $query = 'UPDATE #__extensions SET enabled = 1 WHERE folder LIKE "cck_%"'; $db->setQuery($query); $db->execute(); // Revert Version for Joomla! 2.5.x if (!JCck::on()) { $query = 'SELECT id FROM #__cck_core_types WHERE version = 2 ORDER BY id'; $db->setQuery($query); $forms = $db->loadObjectList(); if (count($forms)) { require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/helper_version.php'; foreach ($forms as $f) { Helper_Version::revert('type', $f->id, '1'); } } } // Set Template Styles $query = 'SELECT id FROM #__template_styles WHERE template="seb_one" ORDER BY id'; $db->setQuery($query); $style = $db->loadResult(); $query = 'SELECT id FROM #__template_styles WHERE template="seb_blog" ORDER BY id'; $db->setQuery($query); $style2 = $db->loadResult(); // $query = 'UPDATE #__cck_core_types SET template_admin = ' . $style . ', template_site = ' . $style . ', template_content = ' . $style . ', template_intro = ' . $style; $db->setQuery($query); $db->execute(); // $query = 'UPDATE #__cck_core_searchs SET template_search = ' . $style . ', template_filter = ' . $style . ', template_list = ' . $style2 . ', template_item = ' . $style; $db->setQuery($query); $db->execute(); // Add Categories $categories = array(0 => array('title' => 'Users', 'published' => '1', 'access' => '2', 'language' => '*', 'parent_id' => 1, 'plg_name' => 'joomla_user'), 1 => array('title' => 'User Groups', 'published' => '1', 'access' => '2', 'language' => '*', 'parent_id' => 1, 'plg_name' => 'joomla_user_group')); JLoader::register('JTableCategory', JPATH_PLATFORM . '/joomla/database/table/category.php'); foreach ($categories as $category) { $table = JTable::getInstance('category'); $table->access = 2; $table->setLocation(1, 'last-child'); $table->bind($category); $rules = new JAccessRules('{"core.create":{"1":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'); $table->setRules($rules); $table->check(); $table->extension = 'com_content'; $table->path .= $table->alias; $table->language = '*'; $table->store(); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $dispatcher->trigger('onContentBeforeSave', array('', &$table, true)); $table->store(); $dispatcher->trigger('onContentAfterSave', array('', &$table, true)); // $query = 'SELECT extension_id as id, params FROM #__extensions WHERE type="plugin" AND folder="cck_storage_location" AND element="' . $category['plg_name'] . '"'; $db->setQuery($query); $plugin = $db->loadObject(); $params = str_replace('"bridge_default-catid":"2"', '"bridge_default-catid":"' . $table->id . '"', $plugin->params); $query = 'UPDATE #__extensions SET params = "' . $db->escape($params) . '" WHERE extension_id = ' . (int) $plugin->id; $db->setQuery($query); $db->execute(); } // Init Default Author $res = JCckDatabase::loadResult('SELECT id FROM #__users ORDER BY id ASC'); $params = JComponentHelper::getParams('com_cck'); $params->set('integration_user_default_author', (int) $res); $db->setQuery('UPDATE #__extensions SET params = "' . $db->escape($params) . '" WHERE name = "com_cck"'); $db->execute(); // Init ACL require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/helper_admin.php'; $pks = JCckDatabase::loadColumn('SELECT id FROM #__cck_core_folders ORDER BY lft'); if (count($pks)) { $rules = '{"core.create":[],"core.delete":[],"core.delete.own":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'; Helper_Admin::initACL(array('table' => 'folder', 'name' => 'folder', 'rules' => $rules), $pks); } $pks = JCckDatabase::loadColumn('SELECT id FROM #__cck_core_types ORDER BY id'); if (count($pks)) { $rules = '{"core.create":[],"core.create.max.parent":{"8":0},"core.create.max.parent.author":{"8":0},"core.create.max.author":{"8":0},' . '"core.delete":[],"core.delete.own":[],"core.edit":[],"core.edit.own":[]}'; $rules2 = array(8 => '{"core.create":{"1":1,"2":0},"core.create.max.parent":{"8":0},"core.create.max.parent.author":{"8":0},"core.create.max.author":{"8":0},' . '"core.delete":[],"core.delete.own":[],"core.edit":{"4":0},"core.edit.own":{"2":1}}'); Helper_Admin::initACL(array('table' => 'type', 'name' => 'form', 'rules' => $rules), $pks, $rules2); } } else { $new = $app->cck_core_version; $old = $app->cck_core_version_old; $root = JPATH_ADMINISTRATOR . '/components/com_cck'; require_once JPATH_ADMINISTRATOR . '/components/' . CCK_COM . '/helpers/helper_folder.php'; // ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** // $versions = array(0 => '2.0.0', 1 => '2.0.0.RC2', 2 => '2.0.0.RC2-1', 3 => '2.0.0.RC2-2', 4 => '2.0.0.RC2-3', 5 => '2.0.0.RC3', 6 => '2.0.0.RC4', 7 => '2.0.0.GA', 8 => '2.0.5', 9 => '2.0.6', 10 => '2.0.7', 11 => '2.1.0', 12 => '2.1.5', 13 => '2.2.0', 14 => '2.2.5', 15 => '2.3.0', 16 => '2.3.1', 17 => '2.3.5', 18 => '2.3.6', 19 => '2.3.7', 20 => '2.3.8', 21 => '2.3.9', 22 => '2.3.9.2', 23 => '2.4.5', 24 => '2.4.6', 25 => '2.4.7', 26 => '2.4.8', 27 => '2.4.8.5', 28 => '2.4.9', 29 => '2.4.9.1', 30 => '2.4.9.2', 31 => '2.4.9.5', 32 => '2.4.9.6', 33 => '2.4.9.7', 34 => '2.4.9.8', 35 => '2.5.0', 36 => '2.5.1', 37 => '2.5.2', 38 => '2.6.0', 39 => '2.7.0', 40 => '2.8.0', 41 => '2.9.0', 42 => '3.0.0', 43 => '3.0.1', 44 => '3.0.2', 45 => '3.0.3', 46 => '3.0.4', 47 => '3.0.5', 48 => '3.1.0', 49 => '3.1.1', 50 => '3.1.2', 51 => '3.1.3', 52 => '3.1.4', 53 => '3.1.5', 54 => '3.2.0', 55 => '3.2.1', 56 => '3.2.2', 57 => '3.3.0', 58 => '3.3.1', 59 => '3.3.2', 60 => '3.3.3', 61 => '3.3.4', 62 => '3.3.5', 63 => '3.3.6', 64 => '3.3.7', 65 => '3.3.8', 66 => '3.4.0', 67 => '3.4.1', 68 => '3.4.2', 69 => '3.4.3', 70 => '3.5.0', 71 => '3.5.1', 72 => '3.6.0', 73 => '3.6.1', 74 => '3.6.2', 75 => '3.6.3', 76 => '3.6.4', 77 => '3.6.5', 78 => '3.7.0', 79 => '3.7.1', 80 => '3.7.2', 81 => '3.7.3', 82 => '3.7.4', 83 => '3.7.5', 82 => '3.8.0'); // ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** ******** // $i = array_search($old, $versions); $i2 = $i; $n = array_search($new, $versions); if ($i < 7) { // ONLY < 2.0 GA $prefix = JFactory::getConfig()->get('dbprefix'); $tables = JCckDatabase::loadColumn('SHOW TABLES'); if (count($tables)) { foreach ($tables as $table) { if (strpos($table, $prefix . 'cck_item_') !== false) { $replace = str_replace($prefix . 'cck_item_', $prefix . 'cck_store_item_', $table); if ($replace) { JCckDatabase::doQuery('ALTER TABLE ' . $table . ' RENAME ' . $replace); } } elseif (strpos($table, $prefix . 'cck_type_') !== false) { $replace = str_replace($prefix . 'cck_type_', $prefix . 'cck_store_form_', $table); if ($replace) { JCckDatabase::doQuery('ALTER TABLE ' . $table . ' RENAME ' . $replace); } } } } $fields = JCckDatabase::loadObjectList('SELECT id, storage_table FROM #__cck_core_fields WHERE storage_table LIKE "#__cck_item_%"'); if (count($fields)) { foreach ($fields as $field) { $replace = str_replace('#__cck_item_', '#__cck_store_item_', $field->storage_table); JCckDatabase::doQuery('UPDATE #__cck_core_fields SET storage_table = "' . $replace . '" WHERE id = ' . (int) $field->id); } } $fields = JCckDatabase::loadObjectList('SELECT id, storage_table FROM #__cck_core_fields WHERE storage_table LIKE "#__cck_type_%"'); if (count($fields)) { foreach ($fields as $field) { $replace = str_replace('#__cck_type_', '#__cck_store_form_', $field->storage_table); JCckDatabase::doQuery('UPDATE #__cck_core_fields SET storage_table = "' . $replace . '" WHERE id = ' . (int) $field->id); } } $fields = JCckDatabase::loadObjectList('SELECT id, options2 FROM #__cck_core_fields WHERE type = "select_dynamic"'); if (count($fields)) { foreach ($fields as $field) { $options2 = $field->options2; if (strpos($options2, '#__cck_item_') !== false) { $options2 = str_replace('#__cck_item_', '#__cck_store_item_', $options2); } if (strpos($options2, '#__cck_type_') !== false) { $options2 = str_replace('#__cck_type_', '#__cck_store_form_', $options2); } if ($options2 != $field->options2) { JCckDatabase::doQuery('UPDATE #__cck_core_fields SET options2 = "' . $db->escape($options2) . '" WHERE id = ' . (int) $field->id); } } } } if ($i < 23) { // ONLY < 2.4.5 JCckDatabase::doQuery('ALTER TABLE #__cck_core_folders ADD path VARCHAR( 1024 ) NOT NULL AFTER parent_id;'); require_once JPATH_ADMINISTRATOR . '/components/' . CCK_COM . '/helpers/helper_folder.php'; $folders = JCckDatabase::loadColumn('SELECT id FROM #__cck_core_folders WHERE lft ORDER BY lft'); foreach ($folders as $f) { $path = Helper_Folder::getPath($f, '/'); JCckDatabase::doQuery('UPDATE #__cck_core_folders SET path = "' . $path . '" WHERE id = ' . (int) $f); } if (JCckDatabase::doQuery('INSERT IGNORE #__cck_core_folders (id) VALUES (29)')) { require_once JPATH_ADMINISTRATOR . '/components/' . CCK_COM . '/tables/folder.php'; $folder = JTable::getInstance('folder', 'CCK_Table'); $folder->load(29); $folder_data = array('parent_id' => 13, 'path' => 'joomla/user/profile', 'title' => 'Profile', 'name' => 'profile', 'color' => '#0090d1', 'introchar' => 'U.', 'colorchar' => '#ffffff', 'elements' => 'field', 'featured' => 0, 'published' => 1); $rules = new JAccessRules('{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'); $folder->setRules($rules); $folder->bind($folder_data); $folder->store(); } } for ($i = $i + 1; $i <= $n; $i++) { $file = $root . '/install/upgrades/' . strtolower($versions[$i]) . '.sql'; if (JFile::exists($file)) { $buffer = file_get_contents($file); $queries = JInstallerHelper::splitSql($buffer); foreach ($queries as $query) { $query = trim($query); if ($query != '' && $query[0] != '#') { $db->setQuery($query); $db->execute(); } } } } if ($i2 < 23) { // ONLY < 2.4.5 $bool = true; $live = JCckDatabase::loadObjectList('SELECT typeid, fieldid, client, live, live_value FROM #__cck_core_type_field WHERE live IN ("url_var_int","url_var_string","user_profile")'); if (count($live)) { foreach ($live as $l) { if ($l->live == 'user_profile') { $live_type = 'joomla_user'; $live_options = '{"content":"","property":"' . $l->live_value . '"}'; } elseif ($l->live == 'url_var_int') { $live_type = 'url_variable'; $live_options = '{"variable":"' . $l->live_value . '","type":"int"}'; } elseif ($l->live == 'url_var_string') { $live_type = 'url_variable'; $live_options = '{"variable":"' . $l->live_value . '","type":"string"}'; } if (!JCckDatabase::doQuery('UPDATE #__cck_core_type_field SET live = "' . $live_type . '", live_options = "' . $db->escape($live_options) . '" WHERE typeid = ' . $l->typeid . ' AND fieldid = ' . $l->fieldid . ' AND client = "' . $l->client . '"')) { $bool = false; } } } $live = JCckDatabase::loadObjectList('SELECT searchid, fieldid, client, live, live_value FROM #__cck_core_search_field WHERE live IN ("url_var_int","url_var_string","user_profile")'); if (count($live)) { foreach ($live as $l) { if ($l->live == 'user_profile') { $live_type = 'joomla_user'; $live_options = '{"content":"","property":"' . $l->live_value . '"}'; } elseif ($l->live == 'url_var_int') { $live_type = 'url_variable'; $live_options = '{"variable":"' . $l->live_value . '","type":"int"}'; } elseif ($l->live == 'url_var_string') { $live_type = 'url_variable'; $live_options = '{"variable":"' . $l->live_value . '","type":"string"}'; } if (!JCckDatabase::doQuery('UPDATE #__cck_core_search_field SET live = "' . $live_type . '", live_options = "' . $db->escape($live_options) . '" WHERE searchid = ' . $l->searchid . ' AND fieldid = ' . $l->fieldid . ' AND client = "' . $l->client . '"')) { $bool = false; } } } if ($bool) { JCckDatabase::doQuery('UPDATE #__extensions SET enabled = 0 WHERE element IN ("url_var_int","url_var_string","user_profile") AND folder = "cck_field_live"'); } } if ($i2 < 25) { $table = JTable::getInstance('asset'); $table->loadByName('com_cck'); if ($table->rules) { $rules = (array) json_decode($table->rules); $rules['core.delete.own'] = array(6 => "1"); $table->rules = json_encode($rules); $table->store(); } } if ($i2 < 31) { $src = JPATH_ADMINISTRATOR . '/components/com_cck/install/src/tmp/joomla_message'; if (JFolder::exists($src)) { JFolder::copy($src, JPATH_SITE . '/plugins/cck_storage_location/joomla_message', '', true); } } if ($i2 < 33) { $folders = array(10, 11, 12, 13, 14); foreach ($folders as $folder) { Helper_Folder::rebuildBranch($folder); } } if ($i2 < 35) { $objects = array('joomla_article' => 'article', 'joomla_category' => 'category', 'joomla_user' => 'user', 'joomla_user_group' => 'user_group'); foreach ($objects as $k => $v) { $params = JCckDatabase::loadResult('SELECT options FROM #__cck_core_objects WHERE name = "' . $k . '"'); $params = json_decode($params); $params->default_type = JCck::getConfig_Param('integration_' . $v, ''); $params->add_redirect = $params->default_type != '' ? '1' : '0'; $params->edit = JCck::getConfig_Param('integration_' . $v . '_edit', '0'); if ($k == 'joomla_category') { $params->exclude = JCck::getConfig_Param('integration_' . $v . '_exclude', ''); } JCckDatabase::doQuery('UPDATE #__cck_core_objects SET options = "' . $db->escape(json_encode($params)) . '" WHERE name = "' . $k . '"'); } } if ($i2 < 45) { $table = '#__cck_store_item_users'; $columns = $db->getTableColumns($table); if (isset($columns['password2'])) { JCckDatabase::doQuery('ALTER TABLE ' . JCckDatabase::quoteName($table) . ' DROP ' . JCckDatabase::quoteName('password2')); } } if ($i2 < 66) { $path = JPATH_ADMINISTRATOR . '/components/com_cck/download.php'; if (JFile::exists($path)) { JFile::delete($path); } } if ($i2 < 70) { $plg_image = JPluginHelper::getPlugin('cck_field', 'upload_image'); $plg_params = new JRegistry($plg_image->params); $com_cck = JComponentHelper::getComponent('com_cck'); $com_cck->params->set('media_quality_jpeg', $plg_params->get('quality_jpeg', '90')); $com_cck->params->set('media_quality_png', $plg_params->get('quality_png', '3')); JCckDatabase::doQuery('UPDATE #__extensions SET params = "' . $db->escape($com_cck->params->toString()) . '" WHERE type = "component" AND element = "com_cck"'); } // Folder Tree Helper_Folder::rebuildTree(2, 1); } // Overrides $path = JPATH_ADMINISTRATOR . '/components/com_cck/install/src'; if (JFolder::exists($path)) { $folders = JFolder::folders($path, '^joomla'); $folders = array_reverse($folders); $count = count($folders); foreach ($folders as $folder) { $version = str_replace('joomla', '', $folder); if (version_compare(JVERSION, $version, 'lt')) { $path .= '/' . $folder; $len = strlen($path); $items = JFolder::files($path, '.', true, true, array('index.html')); if (count($items)) { foreach ($items as $item) { $dest = JPATH_SITE . substr($item, $len); JFile::copy($item, $dest); } } break; } } } // Tmp $path = JPATH_ADMINISTRATOR . '/components/com_cck/install/src/tmp'; if (JFolder::exists($path)) { JFolder::delete($path); } }
public function prepareToolbar() { Helper_Admin::addToolbar($this->vName, $this->vTitle); }
function prepareDelete() { Helper_Admin::addToolbarDelete($this->vName, 'COM_CCK_' . $this->vTitle); }
* @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder) * @url http://www.seblod.com * @editor Octopoos - www.octopoos.com * @copyright Copyright (C) 2009 - 2016 SEBLOD. All Rights Reserved. * @license GNU General Public License version 2 or later; see _LICENSE.php **/ defined('_JEXEC') or die; $elem = JText::_('COM_CCK_' . _C2_TEXT); Helper_Include::addDependencies($this->getName(), $this->getLayout()); $options = array(); $options[] = JHtml::_('select.option', 0, '- ' . JText::_('COM_CCK_NONE') . ' -', 'value', 'text'); $options2 = Helper_Admin::getFolderOptions(false, false, true, true, '', true); if (count($options2)) { $options = array_merge($options, $options2); } $template = Helper_Admin::getDefaultTemplate(); $lists['featured'] = JHtml::_('select.genericlist', $options, 'featured', 'class="inputbox" size="1"', 'value', 'text', 10, 'featured'); $doc = JFactory::getDocument(); $js = ' (function ($){ JCck.Dev = { submit: function() { var skeleton_id = $("#featured").val(); var tpl_a = $("#tpl_admin").val(); var tpl_s = $("#tpl_site").val(); var tpl_c = $("#tpl_content").val(); var tpl_i = $("#tpl_intro").val(); var url = "index.php?option=com_cck&task=type.add&skeleton_id="+skeleton_id+"&tpl_a="+tpl_a+"&tpl_s="+tpl_s+"&tpl_c="+tpl_c+"&tpl_i="+tpl_i; top.location.href = url; return false; }
public function onExtensionAfterSave($context, $table, $flag) { if ($context != 'com_config.component') { return; } if (!(is_object($table) && $table->type == 'component' && $table->element == 'com_cck_updater')) { return; } $params = new JRegistry(); $params->loadString($table->params); if ($proxy = (int) $params->get('proxy', '0')) { require_once JPATH_ADMINISTRATOR . '/components/com_cck_updater/helpers/helper_admin.php'; $proxy = Helper_Admin::getProxy($params, 'proxy_segment'); JCckDatabase::execute('UPDATE #__update_sites SET location = REPLACE(location, "update.seblod.com", "' . $proxy . '") WHERE location LIKE "%update.seblod.com%" AND location != "http://update.seblod.com/pkg_cck.xml"'); } elseif (!$proxy && $params->get('proxy_domain')) { require_once JPATH_ADMINISTRATOR . '/components/com_cck_updater/helpers/helper_admin.php'; $proxy = Helper_Admin::getProxy($params, 'proxy_segment'); JCckDatabase::execute('UPDATE #__update_sites SET location = REPLACE(location, "' . $proxy . '", "update.seblod.com") WHERE location LIKE "%' . $proxy . '%"'); } }