Good to know about the differences, particularly when there are multiple extras for the same technology. I've read that in the 2.3.4, the file browser will respect Media Sources (up to this point we've just hidden part of the file browser with CSS so that users could not see all the media sources). Would a non-standard file browser even be aware of media sources?
1. It pulls its RTE settings from RTE specific chunks.
2. So any whoever can go, to say, the TinyMCE chunk and edit ALL of TinyMCE's settings, simple, done, voila!
The existing extras make it almost impossible to find the blasted settings, and these settings are mere JavaScript, and in my opinion should not, never be obfuscated; I mean, TinyMCE is so easy to setup, why should it be complicated? Why should TinyMCE-specific questions be asked in a MODx forum? E.g. TinyMCE is eating my code, how do I stop it? TinyMCE adds line breaks unnecessarily, how do I stop that?
Yet basic questions on TinyMCE are so rampant here, because the simple <script>tinymce.init(...);</script> can't be found. And yes, the settings in the MODx settings page is highly limiting.
$isRichText = $modx->resource->get('richtext'); $isNewResource = $modx->resource->get("pagetitle");
if (isset($scriptProperties['resource']) && $resource->get('richtext')){ //do stuff here }
case 'file': /* code adapted from core/model/modx/processors/element/tv/renders/mgr/input/file.php * and (...)/image.php */ $this->modx->getService('fileHandler', 'modFileHandler', '', array('context' => $this->context)); $params['wctx'] = $this->context; $value = $tv->getValue($this->existing); $openTo = ''; $source = $tv->getSource($this->context); if (!$source) { $this->setError($this->modx->lexicon('np_no_media_source') . $name); return null; } if (!$source->getWorkingContext()) { $this->setError($this->modx->lexicon('np_source_wctx_error') . $name); } $source->initialize(); $params['source'] = $source->get('id'); if (!$source->checkPolicy('view')) { $this->setError($this->modx->lexicon('np_media_source_access_denied') . $name); return null; } if (!empty($value)) { $openTo = $source->getOpenTo($value,$params); } $formTpl .= $this->_displayFileInput($name, $tvType.'Tpl', $params, $openTo);
/** Produces the HTML code for file/image TVs * * @access protected * @param $name string - name of the TV * @param $tplName string - name of the template chunk that should be used * @param $sourceOptions array - Associative array of options. Accepts all file/image TV input options. * Possible options: all (processed) TV input options (Revo versions below 2.20), respectively the media source. * 'wctx' doesn't seem to have an effect (?) * @param $openTo string - Path for the directory to open to * @return string - HTML code */ protected function _displayFileInput($name, $tplName, $sourceOptions = array(), $openTo = '') { /* @var $browserAction modAction */ $browserAction = $this->modx->getObject('modAction', array('namespace' => 'newspublisher', 'controller' => 'filebrowser')); $browserUrl = $browserAction ? $this->modx->getOption('manager_url',null, MODX_MANAGER_URL).'index.php?a='.$browserAction->get('id') : null; if ($browserUrl) { $phpthumbUrl = $this->modx->getOption('connectors_url',null, MODX_CONNECTORS_URL) . 'system/phpthumb.php?'; foreach ($sourceOptions as $key => $value) { $phpthumbUrl .= "&{$key}={$value}"; } $browserUrl .= '&field=' . $name; $sourceOptions['openTo'] = $openTo; $_SESSION['newspublisher']['filebrowser'][$name] = $sourceOptions; $PHs = array( '[[+npx.phpthumbBaseUrl]]' => $phpthumbUrl, '[[+npx.browserUrl]]' => $browserUrl ); return $this->strReplaceAssoc($PHs, $this->getTpl($tplName)); } else { $this->setError($this->modx->lexicon('np_no_action_found')); return null; } }
is there any reason to reinvent the wheel here? I wonder if you'd consider forking and submitting FRs around this idea for the init config, to the TinyMCE RTE instead of creating a new 3rd one? I think this is a brilliant idea (though I am not sure a chunk is the right place or not). I certainly would like to be able to use any and all of the tiny configs and not have to rely on whether the plugin author added each directive etc into system settings.At least for MODx, the wheel for TinyMCE has not been invented...not yet.