1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Tinymce perms fix

This commit is contained in:
CaMer0n
2009-11-10 01:21:05 +00:00
parent 7edd4ba390
commit 31d3d6b1be
2 changed files with 64 additions and 8 deletions

View File

@@ -8,9 +8,9 @@
* e107 Admin Helper
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/admin.js,v $
* $Revision: 1.21 $
* $Date: 2009-08-15 15:44:37 $
* $Author: marj_nl_fr $
* $Revision: 1.22 $
* $Date: 2009-11-09 16:55:41 $
* $Author: secretr $
*
*/
@@ -300,12 +300,66 @@ e107Admin.AdminMenu = {
_track: $H()
}
// TEMPORARY HERE, awaiting the overall JS refactoring
/**
* Auto resizeable textarea, max character counter (optional)
* Inspired by user post on stackoverflow.com
* TODO - make it e107 widget (or even part of BBArea widget?)
* @param string|Element textarea
* @param Object options
*/
e107Admin.Nicearea = Class.create({
initialize: function(textarea, options)
{
this.textarea = $(textarea);
this.options = $H({
'min_height' : 30,
'max_height' : 400,
'max_length' : null
}).update(options);
this.textarea.observe('keyup', this.refresh.bind(this));
this._shadow = new Element('div').setStyle({
lineHeight : this.textarea.getStyle('lineHeight'),
fontSize : this.textarea.getStyle('fontSize'),
fontFamily : this.textarea.getStyle('fontFamily'),
position : 'absolute',
top: '-10000px',
left: '-10000px',
width: this.textarea.getWidth() + 'px'
});
this.textarea.insert({ after: this._shadow });
if(null !== this.options.get('max_length')) {
this._remainingCharacters = new Element('p').addClassName('remainingCharacters');
this.textarea.insert({before: this._remainingCharacters});
}
this.refresh();
},
refresh: function()
{
this._shadow.update($F(this.textarea).replace(/\n/g, '<br/>') + '<br/>');
this.textarea.setStyle({
height: Math.min(Math.max(parseInt(this._shadow.getHeight()) + parseInt(this.textarea.getStyle('lineHeight').replace('px', '')), this.options.get('min_height')), this.options.get('max_height')) + 'px'
});
if (null !== this.options.get('max_length')) {
var remaining = this.options.get('max_length') - $F(this.textarea).length;
if(!this.options.get('max_length')) this._remainingCharacters.update(Math.abs(remaining) + ' characters');
else this._remainingCharacters.update(Math.abs(remaining) + ' characters ' + (remaining > 0 ? 'remaining' : 'over the limit'));
}
}
});
if(e107Admin.initRules.AdminMenu)
document.observe( 'dom:loaded', function() { e107Admin.AdminMenu.init() });
// SecretR - FIXME - need general solution for admin UI tools + user autocomplete uses built-in Scripty Ajax.Autocompleter
//TODO find the right place for this and make generic - wanted it out of download plugin for now
// Current use:
// - filter text field must be in a form

View File

@@ -4,8 +4,8 @@
| e107 website system - Tiny MCE controller file.
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/wysiwyg.php,v $
| $Revision: 1.18 $
| $Date: 2009-10-26 10:55:46 $
| $Revision: 1.19 $
| $Date: 2009-11-10 01:21:05 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -15,6 +15,7 @@ class wysiwyg
{
var $js;
var $config = array();
var $configName;
function wysiwyg($config=FALSE)
@@ -56,7 +57,7 @@ class wysiwyg
$text .= "<script type='text/javascript'>\n";
$text .= "\n /* TinyMce Config: ".$this->configName." */";
$text .= $this->tinyMce_config();
$text .= "\t\t start_tinyMce(); \n
@@ -225,7 +226,7 @@ class wysiwyg
}
else
{
$query = "SELECT * FROM #tinymce WHERE tinymce_userclass REGEXP '".e_CLASS_REGEXP."' AND NOT (tinymce_userclass REGEXP '(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)') ORDER BY tinymce_userclass DESC LIMIT 1";
$query = "SELECT * FROM #tinymce WHERE tinymce_userclass REGEXP '".e_CLASS_REGEXP."' AND NOT (tinymce_userclass REGEXP '(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)') ORDER BY Field(tinymce_userclass,250,254,253) LIMIT 1";
}
$sql -> db_Select_gen($query);
@@ -234,7 +235,7 @@ class wysiwyg
//TODO Cache!
$plug_array = explode(",",$config['tinymce_plugins']);
$this->configName = $config['tinymce_name'];
$this->config = array(
'language' => $this->tinymce_lang(),
@@ -261,6 +262,7 @@ class wysiwyg
'convert_fonts_to_spans' => 'true',
'trim_span_elements' => 'true',
'inline_styles' => 'true',
'auto_resize' => 'true',
'debug' => 'false',
'force_br_newlines' => 'true',
'forced_root_block' => '',