public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } // Prepare $app = JFactory::getApplication(); $form = ''; $options2 = JCckDev::fromJSON($field->options2); $variables = explode('||', $field->options); if (count($variables)) { foreach ($variables as $k => $name) { if ($name) { $request = 'get' . ucfirst($options2['options'][$k]->type ? $options2['options'][$k]->type : ''); $value = $app->input->{$request}($name, ''); $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); $form .= '<input class="inputbox hidden" type="hidden" id="' . $name . '" name="' . $name . '" value="' . $value . '" />'; } } } $field->form = $form; $field->state = 1; $field->value = ''; // Return if ($return === true) { return $field; } }
public function g_onCCK_WebserviceConstruct(&$data) { // JSON if (isset($data['json']) && is_array($data['json'])) { foreach ($data['json'] as $k => $v) { if (is_array($v)) { $data[$k] = JCckDev::toJSON($v); } } } // STRING if (isset($data['string']) && is_array($data['string'])) { foreach ($data['string'] as $k => $v) { if (is_array($v)) { $string = ''; foreach ($v as $s) { if ($s) { $string .= $s . '||'; } } if ($string) { $string = substr($string, 0, -2); } $data[$k] = $string; } } } }
protected static function _getCategories($value, $glue, $data) { $values = JCckDev::fromSTRING($value, $glue); $value = array(); foreach ($values as $v) { if (isset($data['categories'][$v])) { $value[] = $data['categories'][$v]; } } return implode($glue, $value); }
public static function g_getLive($params, $format = '') { if ($format != '') { return JCckDev::fromJSON($params, $format); } else { $reg = new JRegistry(); if ($params) { $reg->loadString($params); } return $reg; } }
protected function postSaveHook(CCKModelSite &$model, $validData = array()) { $recordId = $model->getState($this->context . '.id'); if ($recordId == 10 || $recordId == 500) { $db = JFactory::getDbo(); $params = JCckDatabase::loadResult('SELECT params FROM #__extensions WHERE element = "com_cck"'); $config = JCckDev::fromJSON($params, 'object'); $config->multisite = 1; $params = $db->escape(JCckDev::toJSON($config)); JCckDatabase::execute('UPDATE #__extensions SET params = "' . $params . '" WHERE element = "com_cck"'); } }
public function prepareLanguages($lang) { $config = JFactory::getConfig(); $tmp_path = $config->get('tmp_path'); $tmp_dir = uniqid('cck_'); $path = $tmp_path . '/' . $tmp_dir; $name = 'seblod2'; $filename = $lang . '_' . $name; $path_zip = $tmp_path . '/' . $filename . '.zip'; if (!$filename) { return; } // Core jimport('cck.base.install.export'); $manifest = JCckDev::fromXML(JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml'); $extensions = array(); if (count(@$manifest->files->file)) { foreach ($manifest->files->file as $file) { $id = (string) $file; $id = str_replace('.zip', '', $id); if (strpos($id, 'var_cck_') !== false) { $id = 'files_' . $id; } $extensions[$id] = ''; } } $extensions['com_cck_core'] = ''; $extensions['com_cck_default'] = ''; // Admin $dest = $path . '/admin'; CCK_Export::exportLanguages(JPATH_ADMINISTRATOR . '/language/' . $lang, $dest, $lang, 'admin', 'cck', $extensions); CCK_Export::zip($dest, $path . '/cck_' . $lang . '_admin.zip'); // Site $dest = $path . '/site'; CCK_Export::exportLanguages(JPATH_SITE . '/language/' . $lang, $dest, $lang, 'site', 'cck|tpl_seb', $extensions); CCK_Export::zip($dest, $path . '/cck_' . $lang . '_site.zip'); // Manifest $package = (object) array('title' => 'SEBLOD ' . $lang, 'name' => 'cck_' . $lang, 'description' => 'SEBLOD 3.x ' . $lang . ' Language Pack - www.seblod.com'); $xml = CCK_Export::preparePackage($package); $files = $xml->addChild('files'); $file1 = $files->addChild('file', 'cck_' . $lang . '_admin.zip'); $file1->addAttribute('type', 'file'); $file1->addAttribute('src', 'administrator/language/' . $lang); $file1->addAttribute('id', 'cck_' . $lang . '_admin'); $file2 = $files->addChild('file', 'cck_' . $lang . '_site.zip'); $file2->addAttribute('type', 'file'); $file2->addAttribute('src', 'language/' . $lang); $file2->addAttribute('id', 'cck_' . $lang . '_site'); CCK_Export::clean($path); CCK_Export::createFile($path . '/pkg_cck_' . $lang . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML()); return CCK_Export::zip($path, $path_zip); }
public static function applyTypeOptions(&$config) { $options = JCckDatabase::loadResult('SELECT options_' . $config['client'] . ' FROM #__cck_core_types WHERE name ="' . (string) $config['type'] . '"'); $options = JCckDev::fromJSON($options); if (isset($options['message']) && $options['message'] != '') { $config['message'] = $options['message']; } if (isset($options['data_integrity_excluded'])) { $options['data_integrity_excluded'] = explode(',', str_replace(' ', ',', trim($options['data_integrity_excluded']))); } else { $options['data_integrity_excluded'] = array(); } $config['message_style'] = isset($options['message_style']) ? $options['message_style'] : 'message'; $config['options'] = $options; }
public function check() { $this->title = trim($this->title); if (empty($this->title)) { return false; } if (empty($this->name)) { $this->name = $this->title; $this->name = JCckDev::toSafeSTRING($this->name); if (trim(str_replace('_', '', $this->name)) == '') { $datenow = JFactory::getDate(); $this->name = $datenow->format('Y_m_d_H_i_s'); } } return true; }
protected static function _typo($typo, $field, $value, &$config = array()) { $format = $typo->get('format', 'Y-m-d'); $value = trim($field->value); if ($format == -2) { $typo = self::_getTimeAgo($value, $typo->get('unit', ''), $typo->get('alt_format', ''), $typo->get('format2', 'Y-m-d')); } else { $options2 = JCckDev::fromJSON($field->options2); if ($format == -1) { $format = trim($typo->get('format_custom', @$options2['format'])); } $value = self::_getValueWithFormatStorage($value, @$options2['storage_format']); $date_eng = $format ? date($format, $value) : $value; $typo = self::_getDateByLang($format, $value, $date_eng); } return $typo; }
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name; } else { $id = $field->name; $name = $field->name; } $value = $value != '' ? $value : $field->defaultvalue; // Validate $validate = ''; if ($config['doValidation'] > 1) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config); $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : ''; } // Prepare $options2 = JCckDev::fromJSON($field->options2); $opts = self::_getOptionsList($options2, $field, $config); $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : ''); if ($value != '') { $class .= ' has-value'; } $attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : ''); $form = count($opts) ? JHtml::_('select.genericlist', $opts, $name, $attr, 'value', 'text', $value, $id) : ''; // Set if (!$field->variation) { $field->form = $form; if ($field->script) { parent::g_addScriptDeclaration($field->script); } } else { parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<select', '', '', $config); } $field->value = $value; // Return if ($return === true) { return $field; } }
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)); }
public function revert($pk, $type) { $db = $this->getDbo(); $table = $this->getTable(); if (!$pk || !$type) { return false; } $table->load($pk); if (JCck::getConfig_Param('version_revert', 1) == 1) { Helper_Version::createVersion($type, $table->e_id, JText::sprintf('COM_CCK_VERSION_AUTO_BEFORE_REVERT', $table->e_version)); } $row = JTable::getInstance($type, 'CCK_Table'); $row->load($table->e_id); $core = JCckDev::fromJSON($table->e_core); if (isset($row->asset_id) && $row->asset_id && isset($core['rules'])) { JCckDatabase::execute('UPDATE #__assets SET rules = "' . $db->escape($core['rules']) . '" WHERE id = ' . (int) $row->asset_id); } // More if ($type == 'search') { $clients = array(1 => 'search', 2 => 'filter', 3 => 'list', 4 => 'item', 5 => 'order'); } else { $clients = array(1 => 'admin', 2 => 'site', 3 => 'intro', 4 => 'content'); } foreach ($clients as $i => $client) { $name = 'e_more' . $i; $this->_revert_more($type, $client, $table->e_id, $table->{$name}); } // Override if ($row->version && $row->version != $table->e_version) { $core['version'] = ++$row->version; } $core['checked_out'] = 0; $core['checked_out_time'] = '0000-00-00 00:00:00'; $row->bind($core); $row->check(); $row->store(); return true; }
* @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; $doc = JFactory::getDocument(); $user = JFactory::getUser(); $userId = $user->id; $listOrder = $this->state->get('list.ordering'); $listDir = $this->state->get('list.direction'); $title2 = JText::_('COM_CCK_DOWNLOAD_THIS_VARIATION'); $top = !JCck::on() ? 'border-top' : 'content'; $config = JCckDev::init(array('42', 'button_submit', 'select_simple', 'text'), true, array('vName' => $this->vName)); $cck = JCckDev::preload(array('core_filter_input', 'core_filter_go', 'core_filter_search', 'core_filter_clear', 'core_location_filter')); JText::script('COM_CCK_CONFIRM_DELETE'); Helper_Include::addDependencies($this->getName(), $this->getLayout()); ?> <form action="<?php echo JRoute::_('index.php?option=' . $this->option . '&view=' . $this->getName()); ?> " method="post" id="adminForm" name="adminForm"> <?php if (!empty($this->sidebar)) { ?> <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?>
**/ defined('_JEXEC') or die; ?> <div class="seblod cck-padding-top-0 cck-padding-bottom-0"> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_DEFAULT_VALUES')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_joomla_user_groups', '', $config, array('label' => 'User Groups', 'storage_field' => 'values[groups]')); ?> </ul><div class="clr"></div> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_SETTINGS')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_bool', 0, $config, array('label' => 'Force Password', 'storage_field' => 'options[force_password]')); ?> </ul><div class="clr"></div> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_UPDATE')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Update By Key', 'defaultvalue' => 'email', 'selectlabel' => '', 'options' => 'ID=id||Email=email||Username=username||', 'storage_field' => 'options[key]')); echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Update By Diff', 'selectlabel' => 'None', 'options' => 'Update By Diff Desc=optgroup||Block=block', 'storage_field' => 'options[diff]')); ?> </ul> </div>
public function prepareExport($id = 0, $elements = array(), $dependencies = array(), $options = array()) { $config = JFactory::getConfig(); $tmp_path = $config->get('tmp_path'); $tmp_dir = uniqid('cck_'); $path = $tmp_path . '/' . $tmp_dir; $folders = isset($elements['subfolders']) ? Helper_Folder::getBranch($id, ',') : $id; $folders = JCckDatabase::loadObjectList('SELECT * FROM #__cck_core_folders WHERE id IN (' . (string) $folders . ') ORDER BY lft'); if (!@$folders[0]) { return; } $isApp = false; $isCck = false; $name = $folders[0]->name; if (!$name) { return; } // Core jimport('joomla.filesystem.file'); jimport('cck.base.install.export'); $data = array('root' => $path, 'root_content' => $path . '/content', 'root_elements' => $path . '/elements', 'root_extensions' => $path . '/extensions', 'root_sql' => $path . '/sql', 'root_category' => '', 'elements' => array(), 'db_prefix' => $config->get('dbprefix')); $extensions = array(0 => (object) array('type' => 'plugin', 'id' => 'plg_system_blank', 'group' => 'system', '_file' => 'plg_system_blank.zip')); $data['folders'] = JCckDatabase::loadObjectList('SELECT id, name, path FROM #__cck_core_folders WHERE lft', 'id'); $data['folders2'] = JCckDatabase::loadObjectList('SELECT id, name, path FROM #__cck_core_folders WHERE lft', 'name'); $data['plugins'] = CCK_Export::getCorePlugins(); $data['plugins']['cck_field_live']['stage'] = true; $data['processings'] = JCckDatabase::loadObjectList('SELECT * FROM #__cck_more_processings', 'id'); $data['processings2'] = JCckDatabase::loadObjectList('SELECT folder FROM #__cck_more_processings', 'folder'); $data['styles'] = JCckDatabase::loadObjectList('SELECT * FROM #__template_styles', 'id'); $data['tables'] = array_flip(JCckDatabase::loadColumn('SHOW TABLES')); $data['tables_excluded'] = CCK_Export::getCoreTables(); $data['variations'] = array('empty' => true, 'joomla' => true, 'seb_css3' => true, 'seb_css3b' => true); // Copyright if (JCckDatabase::loadResult('SELECT extension_id FROM #__extensions WHERE type = "component" AND element = "com_cck_packager"') > 0) { $params = JComponentHelper::getParams('com_cck_packager'); $copyright = $params->get('copyright'); } else { $copyright = ''; } CCK_Export::createDir($data['root_content']); CCK_Export::createDir($data['root_elements']); CCK_Export::createDir($data['root_extensions']); CCK_Export::createDir($data['root_sql']); if (isset($dependencies['categories'])) { $data['root_category'] = CCK_Export::exportRootCategory($folders['0'], $data, $extensions); } if (isset($dependencies['menu'])) { $data['root_menu'] = CCK_Export::exportMenus($dependencies['menu'], $data, $extensions); } foreach ($folders as $i => $folder) { if ($i == 0) { if ($folder->path && $folder->path != $folder->name) { $branch = explode('/', $folder->path); array_pop($branch); if (count($branch)) { $parent_id = 2; foreach ($branch as $k => $v) { $elem = JCckDatabase::loadObject('SELECT * FROM #__cck_core_folders WHERE name = "' . (string) $v . '" AND parent_id = ' . (int) $parent_id); $parent_id = $elem->id; CCK_Export::createDir($data['root_elements'] . '/folder' . 's'); CCK_Export::exportElement('folder', $elem, $data, $extensions, 0); } } } } CCK_Export::exportElements('folder', $folders, $data, $extensions, 0, $copyright); if (isset($elements['fields'])) { $fields = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_fields AS a WHERE a.folder = ' . (int) $folder->id); CCK_Export::exportElements('field', $fields, $data, $extensions, 500, $copyright); } if (isset($elements['templates'])) { $templates = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_templates AS a WHERE a.folder = ' . (int) $folder->id); CCK_Export::exportElements('template', $templates, $data, $extensions, 0, $copyright); } if (isset($elements['types'])) { $types = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_types AS a WHERE a.folder = ' . (int) $folder->id); if (count($types)) { $isApp = true; } CCK_Export::exportElements('type', $types, $data, $extensions, 0, $copyright); } if (isset($elements['searchs'])) { $searchs = JCckDatabase::loadObjectList('SELECT a.* FROM #__cck_core_searchs AS a WHERE a.folder = ' . (int) $folder->id); if (count($searchs)) { $isApp = true; } CCK_Export::exportElements('search', $searchs, $data, $extensions, 0, $copyright); } } if (count($data['elements']['tables'])) { CCK_Export::exportTables($data); } if (count($data['elements']['processings'])) { $isCck = true; CCK_Export::exportProcessings($data, $extensions); } // Name & Root if ($isApp) { $filename = 'app_cck_' . $name; } else { if ($isCck) { $filename = 'cck_' . $name; } else { $filename = $name; } if (isset($dependencies['categories']) && file_exists($data['root_content'] . '/joomla_category')) { $items = JFolder::files($data['root_content'] . '/joomla_category', '\\.xml$'); if (count($items) == 1 && isset($items[0]) && $data['root_category'] != '' && JFile::stripExt($items[0]) == $data['root_category']) { JFolder::delete($data['root_content'] . '/joomla_category'); } } } // Elements if ($copyright) { CCK_Export::update($data['root_elements'], $copyright); } // Xml $folders[0]->description = 'SEBLOD 3.x ' . $folders[0]->title . ' App - www.seblod.com'; $folders[0]->name = $filename; $folders[0]->title = 'pkg_' . $folders['0']->name; $manifest = NULL; $xml = CCK_Export::preparePackage($folders[0]); if (is_object($xml)) { $manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_' . $filename . '.xml'; if (is_file($manifest)) { if ($copyright) { CCK_Export::update($manifest, $copyright); } $manifest = JCckDev::fromXML($manifest); $tags = array('copyright', 'creationDate', 'description', 'packager', 'packageurl', 'version'); if (is_object($manifest)) { foreach ($tags as $tag) { if (isset($manifest->{$tag}) && isset($xml->{$tag}) && $manifest->{$tag} != $xml->{$tag}) { $xml->{$tag} = (string) $manifest->{$tag}; } } } } } // Filename $path_zip = $tmp_path . '/' . $filename; if (isset($options['filename_version']) && $options['filename_version']) { $path_zip .= '_' . (isset($manifest->version) ? $manifest->version : '1.0.0'); } if (isset($options['filename_date']) && $options['filename_date']) { $path_zip .= '_' . JFactory::getDate()->format('Y_m_d'); } $path_zip .= '.zip'; // Script if (is_file(JPATH_ADMINISTRATOR . '/manifests/packages/' . $name . '/pkg_script.php')) { if ($copyright) { CCK_Export::update(JPATH_ADMINISTRATOR . '/manifests/packages/' . $name . '/pkg_script.php', $copyright); } } // todo: else $script = $xml->addChild('scriptfile', 'pkg_script.php'); JFile::copy(JPATH_SITE . '/libraries/cck/development/apps/script.php', $path . '/pkg_script.php'); $buffer = JFile::read($path . '/pkg_script.php'); $buffer = str_replace('%class%', $filename, $buffer); JFile::write($path . '/pkg_script.php', $buffer); if ($copyright) { CCK_Export::update($path . '/pkg_script.php', $copyright); } // Extensions $files = $xml->addChild('files'); $files->addAttribute('folder', 'extensions'); $names = array(); foreach ($extensions as $ext) { $file = $files->addChild('file', $ext->_file); $names[$ext->_file] = ''; foreach ($ext as $k => $v) { if ($k != '_file') { $file->addAttribute($k, $v); } } } if (isset($manifest->files->file) && count($manifest->files->file)) { foreach ($manifest->files->file as $f) { $f_name = (string) $f; if (!isset($names[$f_name])) { $f_file = array('_' => $f_name); $f_client = (string) $f->attributes()->client; $f_id = (string) $f->attributes()->id; $f_type = (string) $f->attributes()->type; if ($f_type == 'template') { $f_file['lang_root'] = JPATH_SITE; $f_file['src'] = JPATH_SITE . '/templates/' . (strpos($f_id, 'tpl_') !== false && strpos($f_id, 'tpl_') == 0 ? substr($f_id, 4) : $f_id); $f_file['lang_src'] = $f_file['src'] . '/templateDetails.xml'; } else { // todo } if (is_array($f_file) && $f_file['src'] != '') { CCK_Export::exportFile($f_type, $data, $f_file, array(), $copyright); $file = $files->addChild('file', $f_name); $file->addAttribute('type', $f_type); $file->addAttribute('id', $f_id); $file->addAttribute('client', $f_client); } } } } // Languages $dest = CCK_Export::createDir($path . '/languages'); $languages = JCckDatabase::loadColumn('SELECT element FROM #__extensions WHERE type = "language" AND client_id = 0'); if (count($languages)) { $lang = $xml->addChild('languages'); $lang->addAttribute('folder', 'languages'); foreach ($languages as $language) { if (is_file(JPATH_SITE . '/language/' . $language . '/' . $language . '.pkg_' . $filename . '.ini')) { $l = $lang->addChild('language', $language . '/' . $language . '.pkg_' . $filename . '.ini'); $l->addAttribute('tag', $language); CCK_Export::createDir($path . '/languages/' . $language); if ($copyright) { CCK_Export::update(JPATH_SITE . '/language/' . $language . '/' . $language . '.pkg_' . $filename . '.ini', $copyright); } JFile::copy(JPATH_SITE . '/language/' . $language . '/' . $language . '.pkg_' . $filename . '.ini', $dest . '/' . $language . '/' . $language . '.pkg_' . $filename . '.ini'); } if (is_file(JPATH_SITE . '/language/' . $language . '/' . $language . '.pkg_' . $filename . '.sys.ini')) { $l = $lang->addChild('language', $language . '/' . $language . '.pkg_' . $filename . '.sys.ini'); $l->addAttribute('tag', $language); CCK_Export::createDir($path . '/languages/' . $language); if ($copyright) { CCK_Export::update(JPATH_SITE . '/language/' . $language . '/' . $language . '.pkg_' . $filename . '.sys.ini', $copyright); } JFile::copy(JPATH_SITE . '/language/' . $language . '/' . $language . '.pkg_' . $filename . '.sys.ini', $dest . '/' . $language . '/' . $language . '.pkg_' . $filename . '.sys.ini'); } } } // Media if (file_exists(JPATH_SITE . '/media/cck/apps/' . $name)) { JFolder::copy(JPATH_SITE . '/media/cck/apps/' . $name, $path . '/media'); } // Manifest JFile::copy(JPATH_LIBRARIES . '/cck/base/install/_plg_system_blank.zip', $path . '/extensions/plg_system_blank.zip'); if (is_object($manifest) && isset($manifest->updateservers)) { $servers = $xml->addChild('updateservers'); if (count($manifest->updateservers->server)) { foreach ($manifest->updateservers->server as $server) { $s = $servers->addChild('server', (string) $server); $s->addAttribute('type', (string) $server->attributes()->type); $s->addAttribute('priority', (string) $server->attributes()->priority); $s->addAttribute('name', (string) $server->attributes()->name); } } } CCK_Export::clean($path); CCK_Export::createFile($path . '/pkg_' . $filename . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML()); if ($copyright) { CCK_Export::update($path . '/pkg_' . $filename . '.xml', $copyright); } return CCK_Export::zip($path, $path_zip); }
<div class="legend top left"><?php echo JText::_('COM_CCK_RENDERING') . '<span class="mini">(' . JText::_('COM_CCK_FOR_VIEW_' . $this->item->client) . ')</span>'; ?> </div> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm($cck['core_template'], $this->style->template, $config); echo '<input type="hidden" name="template2" value="' . $this->style->template . '" />'; $style_title = strlen($this->style->title) > 32 ? substr($this->style->title, 0, 32) . '...' : $this->style->title; echo '<li><label>' . JText::_('COM_CCK_STYLE') . '</label><span class="variation_value adminformlist-maxwidth" title="' . $this->style->title . '">' . $style_title . '</span>' . '<input class="inputbox" type="hidden" id="template_' . $this->item->client . '" name="template_' . $this->item->client . '" value="' . $this->style->id . '" /></li>'; ?> </ul> </div> <div class="seblod"> <div class="legend top left"><?php echo '⇒ ' . JText::_('COM_CCK_CSS'); ?> </div> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_dev_text', @$this->style->params['rendering_css_class'], $config, array('label' => 'Root Class', 'size' => '16', 'storage_field' => 'params[rendering_css_class]')); ?> </ul> </div> <?php if (is_object($this->style)) { Helper_Workshop::getTemplateParams($this->style->xml, '//config', 'params', $this->style->params); } ?> </div> <div class="clr"></div>
<?php /** * @version SEBLOD 3.x Core * @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; echo JCckDev::getForm($cck['core_storage_table'], $table, $config, array('selectlabel' => 'None'));
</button> </li> </ul> </div> <?php } if ($user->authorise('core.add', 'com_cck')) { ?> <div class="<?php echo $this->css['batch']; ?> "> <div class="legend top left"><?php echo JText::_('COM_CCK_DUPLICATE_PROCESS'); ?> </div> <ul class="adminformlist"> <li> <?php echo JCckDev::renderForm($cck['core_dev_text'], '', $config, array('label' => 'Title', 'storage_field' => 'duplicate_title')); ?> <button class="inputbutton" type="submit" onclick="Joomla.submitbutton('searchs.duplicate');"><?php echo JText::_('JTOOLBAR_DUPLICATE'); ?> </button> </li> </ul> </div> <?php } }
$required = 'required'; } ?> <div class="seblod"> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_CONSTRUCTION'), JText::_('PLG_CCK_FIELD_LINK_' . $this->item->name . '_DESC')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_list', '', $config, array(), array(), $hide); echo JCckDev::renderForm('core_menuitem', '', $config, array('required' => $required)); echo JCckDev::renderForm('core_dev_select', '', $config, array('defaultvalue' => 0, 'label' => 'Field', 'options' => 'None=-1||Field=optgroup||Inherited=0||Custom=1', 'selectlabel' => '', 'storage_field' => 'search_field'), array(), $hide); echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Field name', 'required' => 'required', 'storage_field' => 'search_fieldname'), array(), $hide); echo JCckDev::renderSpacer(JText::_('COM_CCK_CONSTRUCTION') . '<span class="mini">(' . JText::_('COM_CCK_GENERIC') . ')</span>'); echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Class', 'size' => 24, 'storage_field' => 'class')); echo JCckDev::renderForm('core_options_target', '', $config, array('defaultvalue' => '', 'selectlabel' => 'Inherited', 'storage_field' => 'target')); echo JCckDev::renderForm('core_dev_text', '', $config, array('label' => 'Rel', 'size' => 32, 'storage_field' => 'rel')); echo JCckDev::renderForm('core_tmpl', '', $config); echo JCckDev::renderForm('core_dev_textarea', '', $config, array('label' => 'Custom variables', 'cols' => 92, 'rows' => 1, 'storage_field' => 'custom'), array(), 'w100'); echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Status', 'selectlabel' => '', 'defaultvalue' => '1', 'options' => 'Apply=1||Prepare=0', 'storage_field' => 'state')); echo JCckDev::renderBlank(); ?> </ul> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $('#search_fieldname').isVisibleWhen('search_field','1'); }); </script>
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); if (is_file(JPATH_LIBRARIES . '/joomla/html/html/category.php')) { require_once JPATH_LIBRARIES . '/joomla/html/html/category.php'; } // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name; } else { $id = $field->name; $name = $field->name; } $app = JFactory::getApplication(); $value = $value != '' ? $value : $field->defaultvalue; $value = $value != ' ' ? $value : ''; // Validate $validate = ''; if ($config['doValidation'] > 1) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config); $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : ''; } // Prepare if (parent::g_isStaticVariation($field, $field->variation, true)) { $form = ''; $field->text = ''; parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config); } elseif ($field->variation == 'value') { $form = ''; $field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value); parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config); } else { $opt = ''; $options2 = JCckDev::fromJSON($field->options2); if (trim($field->selectlabel)) { if ($config['doTranslation']) { $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel))); } $opt = '<option value="' . ($field->storage_field == 'parent_id' ? 1 : '') . '">' . '- ' . $field->selectlabel . ' -' . '</option>'; } if ($config['client'] == 'search') { $opt .= '<option value="">' . '- ' . JText::_('COM_CCK_ALL_CATEGORIES') . ' -' . '</option>'; } $multiple = $field->bool3 == 1 ? 'multiple="multiple"' : ''; $size = $field->rows ? $field->rows : 1; $extension = $app->input->getString('extension', @$options2['extension']); $extension = $extension ? $extension : 'com_content'; $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : ''); $xml = ' <form> <field type="' . self::$type2 . '" name="' . $name . '" id="' . $id . '" label="' . htmlspecialchars($field->label) . '" extension="' . $extension . '" ' . $multiple . ' class="' . $class . '" size="' . $size . '" >' . $opt . '</field> </form> '; $form = JForm::getInstance($id, $xml); if ($config['client'] == 'admin' || $config['client'] == 'site' || $config['client'] == 'search') { if ($config['pk']) { $form->setFieldAttribute($name, 'action', 'core.edit'); $form->setFieldAttribute($name, 'action', 'core.edit.own'); } else { $form->setFieldAttribute($name, 'action', 'core.create'); } } $form = $form->getInput($name, '', $value); if ($field->attributes) { $form = str_replace('<select', '<select ' . $field->attributes, $form); } // Set if (!$field->variation) { $field->form = $form; if ($field->script) { parent::g_addScriptDeclaration($field->script); } } else { $field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value); parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config); } } $field->value = $value; // Return if ($return === true) { return $field; } }
public static function importTables($data) { $db = JFactory::getDbo(); $path = $data['root'] . '/tables'; if (file_exists($path)) { $items = JFolder::files($path, '\\.xml$'); if (count($items)) { $prefix = JFactory::getConfig()->get('dbprefix'); $tables = array_flip(JCckDatabase::loadColumn('SHOW TABLES')); foreach ($items as $item) { $xml = JCckDev::fromXML($path . '/' . $item); if (!$xml || (string) $xml->attributes()->type != 'tables') { return; } $name = (string) $xml->table->name; $table_key = (string) $xml->table->primary_key; $short = str_replace('#__', $prefix, $name); if (isset($tables[$short])) { $table = JCckTable::getInstance($name); $table_fields = $table->getFields(); $previous = ''; // Fields $fields = $xml->fields->children(); if (count($fields)) { foreach ($fields as $field) { $column = (string) $field; $type = (string) $field->attributes()->type; $default = (string) $field->attributes()->default; if (!isset($table_fields[$column])) { $query = 'ALTER TABLE ' . $name . ' ADD ' . JCckDatabase::quoteName($column) . ' ' . $type . ' NOT NULL'; $query .= $default != '' ? ' DEFAULT "' . $default . '"' : ''; $query .= $previous != '' ? ' AFTER ' . JCckDatabase::quoteName($previous) : ' FIRST'; JCckDatabase::execute($query); } else { if ($type != $table_fields[$column]->Type) { $query = 'ALTER TABLE ' . $name . ' CHANGE ' . JCckDatabase::quoteName($column) . ' ' . JCckDatabase::quoteName($column) . ' ' . $type . ' NOT NULL'; $query .= $default != '' ? ' DEFAULT "' . $default . '"' : ''; JCckDatabase::execute($query); } } $previous = $column; } } // Indexes $indexes = $xml->indexes->children(); $indexes2 = array(); if (count($indexes)) { foreach ($indexes as $index) { $idx = (string) $index; $indexes2[$idx][(string) $index->attributes()->seq_in_type] = (string) $index->attributes()->column_name; } } if (count($indexes2)) { foreach ($indexes2 as $k => $v) { if ($k == 'PRIMARY') { JCckDatabase::execute('ALTER TABLE ' . $name . ' DROP PRIMARY KEY, ADD PRIMARY KEY ( ' . implode(',', $v) . ' )'); } else { // todo } } } } else { $sql_query = ''; // Fields $fields = $xml->fields->children(); if (count($fields)) { foreach ($fields as $field) { $type = (string) $field->attributes()->type; $default = (string) $field->attributes()->default; $sql_query .= ' ' . JCckDatabase::quoteName((string) $field) . ' ' . $type . ' NOT NULL'; if ($default != '') { $sql_query .= ' DEFAULT "' . $default . '"'; } $sql_query .= ','; } } // Indexes $indexes = $xml->indexes->children(); $indexes2 = array(); if (count($indexes)) { foreach ($indexes as $index) { $idx = (string) $index; $indexes2[$idx][(string) $index->attributes()->seq_in_type] = (string) $index->attributes()->column_name; } } if (count($indexes2)) { foreach ($indexes2 as $k => $v) { $sql_query .= $k == 'PRIMARY' ? ' PRIMARY KEY ( ' . implode(',', $v) . ' ),' : ' KEY ' . $k . ' ( ' . implode(',', $v) . ' ),'; } } $sql_query = $sql_query ? substr($sql_query, 0, -1) : ''; JCckDatabase::execute('CREATE TABLE IF NOT EXISTS ' . $name . ' (' . $sql_query . ') ENGINE=InnoDB DEFAULT CHARSET=utf8;'); } } } } }
<?php /** * @version SEBLOD 3.x Core ~ $Id: edit2.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; $config = JCckDev::init(array(), true, array('item' => $this->item, 'tmpl' => 'ajax')); Helper_Include::addDependencies($this->getName(), $this->getLayout(), 'ajax'); $type = $this->item->type ? $this->item->type : 'text'; $layer = JPATH_PLUGINS . '/cck_field/' . $type . '/tmpl/edit.php'; $lang = JFactory::getLanguage(); $lang->load('plg_cck_field_' . $type, JPATH_ADMINISTRATOR, null, false, true); if (is_file($layer)) { include_once $layer; }
<?php /** * @version SEBLOD 3.x Core * @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; JCckDev::forceStorage(); ?> <div class="seblod"> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_CONSTRUCTION'), JText::_('PLG_CCK_FIELD_' . $this->item->type . '_DESC')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_pane_behavior', $this->item->bool, $config, array('options' => 'Markup Start=0||Markup In Between=1||Markup End=2', 'required' => 'required')); echo JCckDev::renderBlank(); echo JCckDev::renderSpacer(JText::_('COM_CCK_STORAGE'), JText::_('COM_CCK_STORAGE_DESC')); echo JCckDev::getForm('core_storage', $this->item->storage, $config); ?> </ul> </div>
<?php /** * @version SEBLOD 3.x Core * @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; ?> <div class="seblod cck-padding-top-0 cck-padding-bottom-0"> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_DEFAULT_VALUES')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_joomla_category_created_by', '', $config); echo JCckDev::renderForm('core_joomla_category_parent_id', '', $config); echo JCckDev::renderForm('core_joomla_category_state', '', $config); ?> </ul> </div>
protected function prepareData() { $data = JRequest::get('post'); $data['description'] = JRequest::getVar('description', '', '', 'string', JREQUEST_ALLOWRAW); $client = $data['client']; $P = 'template_' . $client; $data[$P] = Helper_Workshop::getTemplateStyleInstance($data[$P], $data['template'], $data['template2'], $data['params'], $data['name'] . ' (' . $client . ')'); $data['options'] = JCckDev::toJSON(@$data['options']); if (!$data['id']) { $clients = array('search', 'filter', 'item'); foreach ($clients as $c) { $P = 'template_' . $c; if (!$data[$P]) { $default = Helper_Workshop::getDefaultStyle('seb_one'); $data[$P] = $default->id; } } if (isset($data['tpl_list']) && $data['tpl_list']) { $default = Helper_Workshop::getDefaultStyle($data['tpl_list']); $data['template_list'] = $default->id; $data['content'] = 1; unset($data['tpl_list']); } } else { $doVersion = JCck::getConfig_Param('version_auto', 2); if ($doVersion == 1 || $doVersion == 2 && Helper_Version::checkLatest('search', $data['id']) === true) { Helper_Version::createVersion('search', $data['id']); } } if ($client == 'list') { $data['content'] = $data[$P] > 0 ? 1 : 0; } return $data; }
public function g_onCCK_FieldConstruct(&$data) { $db = JFactory::getDbo(); $data['display'] = 3; $data['script'] = JRequest::getVar('script', '', '', 'string', JREQUEST_ALLOWRAW); if (isset($data['selectlabel']) && $data['selectlabel'] == '') { $data['selectlabel'] = ' '; } // JSON if (isset($data['json']) && is_array($data['json'])) { foreach ($data['json'] as $k => $v) { if (is_array($v)) { if (isset($v['options'])) { $options = array(); if (count($v['options'])) { foreach ($v['options'] as $option) { $options[] = $option; } } $v['options'] = $options; } $data[$k] = JCckDev::toJSON($v); } } } // STRING if (isset($data['string']) && is_array($data['string'])) { foreach ($data['string'] as $k => $v) { if (is_array($v)) { $string = ''; foreach ($v as $s) { if ($s != '') { $string .= $s . '||'; } } if ($string) { $string = substr($string, 0, -2); } $data[$k] = $string; } } } if (empty($data['storage'])) { $data['storage'] = 'none'; } if ($data['storage'] == 'dev') { $data['published'] = 0; $data['storage_location'] = ''; $data['storage_table'] = ''; } else { // No Table for None! if ($data['storage'] == 'none') { $data['storage_location'] = ''; $data['storage_table'] = ''; } // Storage Field is required! if (!@$data['storage_field']) { if ($data['storage'] == 'none' && $data['storage_field_prev']) { $data['storage_field'] = $data['storage_field_prev']; } else { $data['storage_field'] = $data['name']; $dev_prefix = JCck::getConfig_Param('development_prefix', ''); if ($dev_prefix) { $data['storage_field'] = str_replace($dev_prefix . '_', '', $data['storage_field']); } } } // Storage Field2 is better for flexibility! if ($data['storage'] != 'standard' && $data['storage_field']) { if (($cut = strpos($data['storage_field'], '[')) !== false) { $data['storage_field2'] = substr($data['storage_field'], $cut + 1, -1); $data['storage_field'] = substr($data['storage_field'], 0, $cut); } else { $data['storage_field2'] = ''; } } // Un-existing Fields must be mapped! if (!isset($data['alterTable'])) { $data['alterTable'] = true; } if ($data['storage_location'] == '' && $data['storage_table'] == '') { $data['storage'] = 'none'; } if ($data['alterTable']) { $data['storage_alter_type'] = isset($data['storage_alter_type']) && $data['storage_alter_type'] ? $data['storage_alter_type'] : 'VARCHAR(255)'; $alter = isset($data['storage_alter']) && $data['storage_alter'] && in_array(1, $data['storage_alter']); if (isset($data['storage_alter_table']) && $data['storage_alter_table'] && $alter) { if ($data['storage_table'] && $data['storage_field']) { $columns = $db->getTableColumns($data['storage_table']); if (!isset($columns[$data['storage_field']])) { if ($data['storage_alter_table'] == 2 && $data['storage_field_prev'] != '') { JCckDatabase::execute('ALTER TABLE ' . JCckDatabase::quoteName($data['storage_table']) . ' CHANGE ' . JCckDatabase::quoteName($data['storage_field_prev']) . ' ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . $data['storage_alter_type'] . ' NOT NULL'); } else { JCckDatabase::execute('ALTER TABLE ' . JCckDatabase::quoteName($data['storage_table']) . ' ADD ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . $data['storage_alter_type'] . ' NOT NULL'); } } else { JCckDatabase::execute('ALTER TABLE ' . JCckDatabase::quoteName($data['storage_table']) . ' CHANGE ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . $data['storage_alter_type'] . ' NOT NULL'); } } } else { if ($data['storage_table'] && $data['storage_field']) { if ($data['type'] == 'jform_rules' && $data['storage_field'] == 'rules' || $data['storage_table'] == @$data['core_table'] && in_array($data['storage_field'], $data['core_columns'])) { unset($data['core_table']); unset($data['core_columns']); return; } $columns = $db->getTableColumns($data['storage_table']); if (!isset($columns[$data['storage_field']])) { $prefix = JFactory::getConfig()->get('dbprefix'); if ($data['storage_cck'] != '') { // #__cck_store_form_ $table = '#__cck_store_form_' . $data['storage_cck']; JCckDatabase::execute('CREATE TABLE IF NOT EXISTS ' . $table . ' ( id int(11) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); } else { // #__cck_store_item_ $table = strpos($data['storage_table'], 'cck_store_item') !== false ? $data['storage_table'] : '#__cck_store_item_' . str_replace('#__', '', $data['storage_table']); JCckDatabase::execute('CREATE TABLE IF NOT EXISTS ' . $table . ' ( id int(11) NOT NULL, cck VARCHAR(50) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); } $columns2 = $db->getTableColumns($table); if (!isset($columns2[$data['storage_field']])) { JCckDatabase::execute('ALTER TABLE ' . JCckDatabase::quoteName($table) . ' ADD ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . $data['storage_alter_type'] . ' NOT NULL'); } $data['storage_table'] = $table; } else { if ($alter) { JCckDatabase::execute('ALTER TABLE ' . JCckDatabase::quoteName($data['storage_table']) . ' CHANGE ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . JCckDatabase::quoteName($data['storage_field']) . ' ' . $data['storage_alter_type'] . ' NOT NULL'); } } } } } } unset($data['core_table']); unset($data['core_columns']); }
<?php echo JCckDev::getForm('core_rules_folder', $this->item->asset_id, $config); ?> </div> </div> <div class="clr"></div> <div> <input type="hidden" name="task" value="" /> <input type="hidden" name="parent_db" value="<?php echo @$this->item->parent_db; ?> " /> <?php echo $this->form->getInput('id'); JCckDev::validate($config); echo JHtml::_('form.token'); ?> </div> </form> <?php Helper_Display::quickCopyright(); ?> <script type="text/javascript"> (function ($){ JCck.Dev = { submit: function(task) { Joomla.submitbutton(task); }
* @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; JCckDev::forceStorage('custom'); ?> <div class="seblod"> <?php echo JCckDev::renderLegend(JText::_('COM_CCK_CONSTRUCTION'), JText::_('PLG_CCK_FIELD_' . $this->item->type . '_DESC')); ?> <ul class="adminformlist adminformlist-2cols"> <?php echo JCckDev::renderForm('core_label', $this->item->label, $config); echo JCckDev::renderForm('core_extended', $this->item->extended, $config); echo JCckDev::renderForm('core_rows', $this->item->rows, $config, array('label' => 'DEFAULT', 'defaultvalue' => '1')); echo JCckDev::renderForm('core_bool2', $this->item->bool2, $config, array('label' => 'ADD', 'defaultvalue' => '1')); echo JCckDev::renderForm('core_maxlength', $this->item->maxlength, $config, array('label' => 'MAXIMUM', 'defaultvalue' => '10')); echo JCckDev::renderForm('core_bool3', $this->item->bool3, $config, array('label' => 'DEL', 'defaultvalue' => '1')); echo JCckDev::renderForm('core_minlength', $this->item->minlength, $config, array('label' => 'MINIMUM', 'defaultvalue' => '1')); echo JCckDev::renderForm('core_bool4', $this->item->bool4, $config, array('label' => 'DRAG', 'defaultvalue' => '1')); echo JCckDev::renderHelp('field', 'seblod-2-x-field-x'); echo JCckDev::renderSpacer(JText::_('COM_CCK_STORAGE'), JText::_('COM_CCK_STORAGE_DESC')); echo JCckDev::getForm('core_storage', $this->item->storage, $config, array(), array('alter_type_value' => 'TEXT')); ?> </ul> </div>
?> ><?php echo JText::_('JGLOBAL_ORDER_ASCENDING'); ?> </option> <option value="desc"<?php echo $selected_desc; ?> ><?php echo JText::_('JGLOBAL_ORDER_DESCENDING'); ?> </option> </select> <?php echo $this->pagination->getLimitBox(); ?> </div> <?php } ?> <div class="<?php echo $this->css['filter_select']; ?> "> <?php echo $this->html['filter_select_header']; echo JCckDev::getForm($cck['core_state_filter'], $this->state->get('filter.state'), $config, array('css' => 'small span12')); echo $this->html['filter_select_separator']; ?> </div> </div>
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name; $inherited = true; } else { $id = $field->name; $name = $field->name; $inherited = false; } $value = $value != '' ? htmlspecialchars($value, ENT_COMPAT, 'UTF-8') : @$field->defaultvalue; $value = $value != ' ' ? $value : ''; // Validate $validate = ''; if ($config['doValidation'] > 1) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config); $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : ''; } // Prepare $app = JFactory::getApplication(); $options2 = JCckDev::fromJSON($field->options2); $user = JFactory::getUser(); if ($config['pk'] && @$options2['import'] && $field->storage_location) { if (!JCckDatabase::loadResult('SELECT pk FROM #__cck_core WHERE pk=' . (int) $config['pk'] . ' AND storage_location="' . (string) $field->storage_location . '"')) { $properties = array('custom', 'table'); $properties = JCck::callFunc('plgCCK_Storage_Location' . $field->storage_location, 'getStaticProperties', $properties); $custom = $options2['import'] == 2 ? 'fulltext' : $properties['custom']; $value = $config['storages'][$properties['table']]->{$custom}; } } if (!$user->id && $this->params->get('guest_access', 0) == 0) { $form = ''; } else { $width = @$options2['width'] ? str_replace('px', '', $options2['width']) : '100%'; $height = @$options2['height'] ? str_replace('px', '', $options2['height']) : '280'; $asset = $config['asset_id'] > 0 ? $config['asset_id'] : $config['asset']; if ($app->input->get('option') == 'com_cck' && $app->input->get('view') == 'form' && $config['client'] == '') { $field->bool = 1; } if ($field->bool) { // Default $buttons = array('pagebreak', 'readmore'); $editor = JFactory::getEditor(@$options2['editor'] ? $options2['editor'] : null); $form = '<div>' . $editor->display($name, $value, $width, $height, '60', '20', $buttons, $id, $asset) . '</div>'; } else { // Modal Box if (trim($field->selectlabel)) { if ($config['doTranslation']) { $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel))); } $buttonlabel = $field->selectlabel; } else { $buttonlabel = JText::_('COM_CCK_EDITOR'); } $e_type = @$options2['editor'] != '' ? '&type=' . $options2['editor'] : ''; $link = 'index.php?option=com_cck&task=box.add&tmpl=component&file=plugins/cck_field/' . self::$type . '/tmpl/form.php' . '&id=' . $id . '&name=' . $name . $e_type . '¶ms=' . urlencode(urlencode($width)) . '||' . $height . '||' . $asset; $app = JFactory::getApplication(); $class = 'wysiwyg_editor_box variation_href'; $component = $app->input->get('option'); if ($component == 'com_cck' && $app->input->get('view') != 'form' || $component == 'com_cck_ecommerce' || $component == 'com_cck_toolbox' || $component == 'com_cck_webservices') { // todo: remove later $class .= ' btn'; } $class = 'class="' . $class . '" '; $attr = $class; $form = '<textarea style="display: none;" id="' . $id . '" name="' . $name . '">' . $value . '</textarea>'; $form .= '<a href="' . $link . '" ' . $attr . '>' . $buttonlabel . '</a>'; $field->markup_class .= ' cck_form_wysiwyg_editor_box'; } } // Set if (!$field->variation) { $field->form = $form; self::_addScripts($field->bool, array('height' => @$height, 'inherited' => $inherited), $config); } else { $hidden = '<textarea class="inputbox" style="display: none;" id="' . $id . '" name="' . $name . '" />' . $value . '</textarea>'; parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<textarea', $hidden, '', $config); } $field->value = $value; // Return if ($return === true) { return $field; } }