[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/mambots/editors/mostlyce/jscripts/tiny_mce/themes/advanced/ -> editor_template_src.js (source)

   1  /**

   2   * $Id: editor_template_src.js 555 2008-01-19 19:08:37Z spocke $

   3   *

   4   * @author Moxiecode

   5   * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.

   6   */
   7  
   8  (function() {
   9      var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID;
  10  
  11      // Tell it to load theme specific language pack(s)

  12      tinymce.ThemeManager.requireLangPack('advanced');
  13  
  14      tinymce.create('tinymce.themes.AdvancedTheme', {
  15          // Control name lookup, format: title, command

  16          controls : {
  17              bold : ['bold_desc', 'Bold'],
  18              italic : ['italic_desc', 'Italic'],
  19              underline : ['underline_desc', 'Underline'],
  20              strikethrough : ['striketrough_desc', 'Strikethrough'],
  21              justifyleft : ['justifyleft_desc', 'JustifyLeft'],
  22              justifycenter : ['justifycenter_desc', 'JustifyCenter'],
  23              justifyright : ['justifyright_desc', 'JustifyRight'],
  24              justifyfull : ['justifyfull_desc', 'JustifyFull'],
  25              bullist : ['bullist_desc', 'InsertUnorderedList'],
  26              numlist : ['numlist_desc', 'InsertOrderedList'],
  27              outdent : ['outdent_desc', 'Outdent'],
  28              indent : ['indent_desc', 'Indent'],
  29              cut : ['cut_desc', 'Cut'],
  30              copy : ['copy_desc', 'Copy'],
  31              paste : ['paste_desc', 'Paste'],
  32              undo : ['undo_desc', 'Undo'],
  33              redo : ['redo_desc', 'Redo'],
  34              link : ['link_desc', 'mceLink'],
  35              unlink : ['unlink_desc', 'unlink'],
  36              image : ['image_desc', 'mceImage'],
  37              cleanup : ['cleanup_desc', 'mceCleanup'],
  38              help : ['help_desc', 'mceHelp'],
  39              code : ['code_desc', 'mceCodeEditor'],
  40              hr : ['hr_desc', 'InsertHorizontalRule'],
  41              removeformat : ['removeformat_desc', 'RemoveFormat'],
  42              sub : ['sub_desc', 'subscript'],
  43              sup : ['sup_desc', 'superscript'],
  44              forecolor : ['forecolor_desc', 'ForeColor'],
  45              forecolorpicker : ['forecolor_desc', 'mceForeColor'],
  46              backcolor : ['backcolor_desc', 'HiliteColor'],
  47              backcolorpicker : ['backcolor_desc', 'mceBackColor'],
  48              charmap : ['charmap_desc', 'mceCharMap'],
  49              visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
  50              anchor : ['anchor_desc', 'mceInsertAnchor'],
  51              newdocument : ['newdocument_desc', 'mceNewDocument'],
  52              blockquote : ['blockquote_desc', 'mceBlockQuote']
  53          },
  54  
  55          stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
  56  
  57          init : function(ed, url) {
  58              var t = this, s;
  59  
  60              t.editor = ed;
  61              t.url = url;
  62              t.onResolveName = new tinymce.util.Dispatcher(this);
  63  
  64              // Default settings

  65              t.settings = s = extend({
  66                  theme_advanced_path : true,
  67                  theme_advanced_toolbar_location : 'bottom',
  68                  theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
  69                  theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
  70                  theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
  71                  theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
  72                  theme_advanced_toolbar_align : "center",
  73                  theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
  74                  theme_advanced_font_sizes : "1,2,3,4,5,6,7",
  75                  theme_advanced_more_colors : 1,
  76                  theme_advanced_row_height : 23,
  77                  theme_advanced_resize_horizontal : 1,
  78                  theme_advanced_resizing_use_cookie : 1
  79              }, ed.settings);
  80  
  81              if (s.theme_advanced_path_location)
  82                  s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
  83  
  84              if (s.theme_advanced_statusbar_location == 'none')
  85                  s.theme_advanced_statusbar_location = 0;
  86  
  87              // Init editor

  88              ed.onInit.add(function() {
  89                  ed.onNodeChange.add(t._nodeChanged, t);
  90                  ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
  91              });
  92  
  93              ed.onSetProgressState.add(function(ed, b, ti) {
  94                  var co, id = ed.id, tb;
  95  
  96                  if (b) {
  97                      t.progressTimer = setTimeout(function() {
  98                          co = ed.getContainer();
  99                          co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
 100                          tb = DOM.get(ed.id + '_tbl');
 101  
 102                          DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
 103                          DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
 104                      }, ti || 0);
 105                  } else {
 106                      DOM.remove(id + '_blocker');
 107                      DOM.remove(id + '_progress');
 108                      clearTimeout(t.progressTimer);
 109                  }
 110              });
 111  
 112              DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css"));
 113          },
 114  
 115          createControl : function(n, cf) {
 116              var cd, c;
 117  
 118              if (c = cf.createControl(n))
 119                  return c;
 120  
 121              switch (n) {
 122                  case "styleselect":
 123                      return this._createStyleSelect();
 124  
 125                  case "formatselect":
 126                      return this._createBlockFormats();
 127  
 128                  case "fontselect":
 129                      return this._createFontSelect();
 130  
 131                  case "fontsizeselect":
 132                      return this._createFontSizeSelect();
 133  
 134                  case "forecolor":
 135                      return this._createForeColorMenu();
 136  
 137                  case "backcolor":
 138                      return this._createBackColorMenu();
 139              }
 140  
 141              if ((cd = this.controls[n]))
 142                  return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
 143          },
 144  
 145          execCommand : function(cmd, ui, val) {
 146              var f = this['_' + cmd];
 147  
 148              if (f) {
 149                  f.call(this, ui, val);
 150                  return true;
 151              }
 152  
 153              return false;
 154          },
 155  
 156          _importClasses : function() {
 157              var ed = this.editor, c = ed.controlManager.get('styleselect');
 158  
 159              if (c.getLength() == 0) {
 160                  each(ed.dom.getClasses(), function(o) {
 161                      c.add(o['class'], o['class']);
 162                  });
 163              }
 164          },
 165  
 166          _createStyleSelect : function(n) {
 167              var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', {
 168                  title : 'advanced.style_select',
 169                  onselect : function(v) {
 170                      if (c.selectedValue === v) {
 171                          ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'});
 172                          c.select();
 173                          return false;
 174                      } else
 175                          ed.execCommand('mceSetCSSClass', 0, v);
 176                  }
 177              });
 178  
 179              each((t.settings.theme_advanced_styles || '').split(';'), function(v) {
 180                  var p = v.split('=');
 181  
 182                  if (v)
 183                      c.add(t.editor.translate(p[0]), p[1]);
 184              });
 185  
 186              c.onPostRender.add(function(ed, n) {
 187                  Event.add(n, 'focus', t._importClasses, t);
 188                  Event.add(n, 'mousedown', t._importClasses, t);
 189              });
 190  
 191              return c;
 192          },
 193  
 194          _createFontSelect : function() {
 195              var c, t = this;
 196  
 197              c = t.editor.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'});
 198  
 199              each(t.settings.theme_advanced_fonts.split(';'), function(v) {
 200                  var p = v.split('='), st;
 201  
 202                  if (p[1].indexOf('dings') == -1)
 203                      st = 'font-family:' + p[1];
 204  
 205                  c.add(t.editor.translate(p[0]), p[1], {style : st});
 206              });
 207  
 208              return c;
 209          },
 210  
 211          _createFontSizeSelect : function() {
 212              var c, t = this, lo = [
 213                  "1 (8 pt)",
 214                  "2 (10 pt)",
 215                  "3 (12 pt)",
 216                  "4 (14 pt)",
 217                  "5 (18 pt)",
 218                  "6 (24 pt)",
 219                  "7 (36 pt)"
 220              ], fz = [8, 10, 12, 14, 18, 24, 36];
 221  
 222              c = t.editor.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', cmd : 'FontSize'});
 223  
 224              each(t.settings.theme_advanced_font_sizes.split(','), function(v) {
 225                  c.add(lo[parseInt(v) - 1], v, {'style' : 'font-size:' + fz[v - 1] + 'pt', 'class' : 'fontSize' + v});
 226              });
 227  
 228              return c;
 229          },
 230  
 231          _createBlockFormats : function() {
 232              var c, fmts = {
 233                  p : 'advanced.paragraph',
 234                  address : 'advanced.address',
 235                  pre : 'advanced.pre',
 236                  h1 : 'advanced.h1',
 237                  h2 : 'advanced.h2',
 238                  h3 : 'advanced.h3',
 239                  h4 : 'advanced.h4',
 240                  h5 : 'advanced.h5',
 241                  h6 : 'advanced.h6',
 242                  div : 'advanced.div',
 243                  blockquote : 'advanced.blockquote',
 244                  code : 'advanced.code',
 245                  dt : 'advanced.dt',
 246                  dd : 'advanced.dd',
 247                  samp : 'advanced.samp'
 248              }, t = this;
 249  
 250              c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});
 251  
 252              each(t.settings.theme_advanced_blockformats.split(','), function(v) {
 253                  c.add(t.editor.translate(fmts[v]), v, {element : v, 'class' : v.indexOf('h') == 0 ? '' : 'preview'});
 254              });
 255  
 256              return c;
 257          },
 258  
 259          _createForeColorMenu : function() {
 260              var c, t = this, s = t.settings, o = {}, v;
 261  
 262              if (s.theme_advanced_more_colors) {
 263                  o.more_colors_func = function() {
 264                      t._mceColorPicker(0, {
 265                          color : c.value,
 266                          func : function(co) {
 267                              c.setColor(co);
 268                          }
 269                      });
 270                  };
 271              }
 272  
 273              if (v = s.theme_advanced_text_colors)
 274                  o.colors = v;
 275  
 276              o.title = 'advanced.forecolor_desc';
 277              o.cmd = 'ForeColor';
 278              o.scope = this;
 279  
 280              c = t.editor.controlManager.createColorSplitButton('forecolor', o);
 281  
 282              return c;
 283          },
 284  
 285          _createBackColorMenu : function() {
 286              var c, t = this, s = t.settings, o = {}, v;
 287  
 288              if (s.theme_advanced_more_colors) {
 289                  o.more_colors_func = function() {
 290                      t._mceColorPicker(0, {
 291                          color : c.value,
 292                          func : function(co) {
 293                              c.setColor(co);
 294                          }
 295                      });
 296                  };
 297              }
 298  
 299              if (v = s.theme_advanced_background_colors)
 300                  o.colors = v;
 301  
 302              o.title = 'advanced.backcolor_desc';
 303              o.cmd = 'HiliteColor';
 304              o.scope = this;
 305  
 306              c = t.editor.controlManager.createColorSplitButton('backcolor', o);
 307  
 308              return c;
 309          },
 310  
 311          renderUI : function(o) {
 312              var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
 313  
 314              n = p = DOM.create('div', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin'});
 315  
 316              if (!DOM.boxModel)
 317                  n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
 318  
 319              n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
 320              n = tb = DOM.add(n, 'tbody');
 321  
 322              switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
 323                  case "rowlayout":
 324                      ic = t._rowLayout(s, tb, o);
 325                      break;
 326  
 327                  case "customlayout":
 328                      ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
 329                      break;
 330  
 331                  default:
 332                      ic = t._simpleLayout(s, tb, o, p);
 333              }
 334  
 335              n = o.targetNode;
 336  
 337              // Add classes to first and last TRs

 338              nl = sc.rows;
 339              DOM.addClass(nl[0], 'first');
 340              DOM.addClass(nl[nl.length - 1], 'last');
 341  
 342              // Add classes to first and last TDs

 343              each(DOM.select('tr', tb), function(n) {
 344                  DOM.addClass(n.firstChild, 'first');
 345                  DOM.addClass(n.childNodes[n.childNodes.length - 1], 'last');
 346              });
 347  
 348              if (DOM.get(s.theme_advanced_toolbar_container))
 349                  DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
 350              else
 351                  DOM.insertAfter(p, n);
 352  
 353              Event.add(ed.id + '_path_row', 'click', function(e) {
 354                  e = e.target;
 355  
 356                  if (e.nodeName == 'A') {
 357                      t._sel(e.href.replace(/^[^#]*#/, ''));
 358  
 359                      return Event.cancel(e);
 360                  }
 361              });
 362  /*

 363              if (DOM.get(ed.id + '_path_row')) {

 364                  Event.add(ed.id + '_tbl', 'mouseover', function(e) {

 365                      var re;

 366      

 367                      e = e.target;

 368  

 369                      if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {

 370                          re = DOM.get(ed.id + '_path_row');

 371                          t.lastPath = re.innerHTML;

 372                          DOM.setHTML(re, e.parentNode.title);

 373                      }

 374                  });

 375  

 376                  Event.add(ed.id + '_tbl', 'mouseout', function(e) {

 377                      if (t.lastPath) {

 378                          DOM.setHTML(ed.id + '_path_row', t.lastPath);

 379                          t.lastPath = 0;

 380                      }

 381                  });

 382              }

 383  */
 384  
 385              if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus'))
 386                  Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
 387  
 388              if (s.theme_advanced_toolbar_location == 'external')
 389                  o.deltaHeight = 0;
 390  
 391              t.deltaHeight = o.deltaHeight;
 392              o.targetNode = null;
 393  
 394              return {
 395                  iframeContainer : ic,
 396                  editorContainer : ed.id + '_parent',
 397                  sizeContainer : sc,
 398                  deltaHeight : o.deltaHeight
 399              };
 400          },
 401  
 402          getInfo : function() {
 403              return {
 404                  longname : 'Simple theme',
 405                  author : 'Moxiecode Systems AB',
 406                  authorurl : 'http://tinymce.moxiecode.com',
 407                  version : tinymce.majorVersion + "." + tinymce.minorVersion
 408              }
 409          },
 410  
 411          _simpleLayout : function(s, tb, o, p) {
 412              var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
 413  
 414              // Create toolbar container at top

 415              if (lo == 'top')
 416                  t._addToolbars(tb, o);
 417  
 418              // Create external toolbar

 419              if (lo == 'external') {
 420                  n = c = DOM.create('div', {style : 'position:relative'});
 421                  n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
 422                  DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
 423                  n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
 424                  etb = DOM.add(n, 'tbody');
 425  
 426                  if (p.firstChild.className == 'mceOldBoxModel')
 427                      p.firstChild.appendChild(c);
 428                  else
 429                      p.insertBefore(c, p.firstChild);
 430  
 431                  t._addToolbars(etb, o);
 432  
 433                  ed.onMouseUp.add(function() {
 434                      var e = DOM.get(ed.id + '_external');
 435                      DOM.show(e);
 436  
 437                      DOM.hide(lastExtID);
 438  
 439                      var f = Event.add(ed.id + '_external_close', 'click', function() {
 440                          DOM.hide(ed.id + '_external');
 441                          Event.remove(ed.id + '_external_close', 'click', f);
 442                      });
 443  
 444                      DOM.show(e);
 445                      DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
 446  
 447                      // Fixes IE rendering bug

 448                      DOM.hide(e);
 449                      DOM.show(e);
 450                      e.style.filter = '';
 451  
 452                      lastExtID = ed.id + '_external';
 453  
 454                      e = null;
 455                  });
 456              }
 457  
 458              if (sl == 'top')
 459                  t._addStatusBar(tb, o);
 460  
 461              // Create iframe container

 462              if (!s.theme_advanced_toolbar_container) {
 463                  n = DOM.add(tb, 'tr');
 464                  n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
 465              }
 466  
 467              // Create toolbar container at bottom

 468              if (lo == 'bottom')
 469                  t._addToolbars(tb, o);
 470  
 471              if (sl == 'bottom')
 472                  t._addStatusBar(tb, o);
 473  
 474              return ic;
 475          },
 476  
 477          _rowLayout : function(s, tb, o) {
 478              var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to;
 479  
 480              dc = s.theme_advanced_containers_default_class || '';
 481              da = s.theme_advanced_containers_default_align || 'center';
 482  
 483              each((s.theme_advanced_containers || '').split(','), function(c, i) {
 484                  var v = s['theme_advanced_container_' + c] || '';
 485  
 486                  switch (c.toLowerCase()) {
 487                      case 'mceeditor':
 488                          n = DOM.add(tb, 'tr');
 489                          n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
 490                          break;
 491  
 492                      case 'mceelementpath':
 493                          t._addStatusBar(tb, o);
 494                          break;
 495  
 496                      default:
 497                          n = DOM.add(DOM.add(tb, 'tr'), 'td', {
 498                              'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc),
 499                              align : s['theme_advanced_container_' + c + '_align'] || da
 500                          });
 501  
 502                          to = cf.createToolbar("toolbar" + i);
 503                          t._addControls(v, to);
 504                          DOM.setHTML(n, to.renderHTML());
 505                          o.deltaHeight -= s.theme_advanced_row_height;
 506                  }
 507              });
 508  
 509              return ic;
 510          },
 511  
 512          _addControls : function(v, tb) {
 513              var t = this, s = t.settings, di, cf = t.editor.controlManager;
 514  
 515              if (s.theme_advanced_disable && !t._disabled) {
 516                  di = {};
 517  
 518                  each(s.theme_advanced_disable.split(','), function(v) {
 519                      di[v] = 1;
 520                  });
 521  
 522                  t._disabled = di;
 523              } else
 524                  di = t._disabled;
 525  
 526              each(v.split(','), function(n) {
 527                  var c;
 528  
 529                  if (di && di[n])
 530                      return;
 531  
 532                  // Compatiblity with 2.x

 533                  if (n == 'tablecontrols') {
 534                      each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
 535                          n = t.createControl(n, cf);
 536  
 537                          if (n)
 538                              tb.add(n);
 539                      });
 540  
 541                      return;
 542                  }
 543  
 544                  c = t.createControl(n, cf);
 545  
 546                  if (c)
 547                      tb.add(c);
 548              });
 549          },
 550  
 551          _addToolbars : function(c, o) {
 552              var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [];
 553  
 554              n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar', align : s.theme_advanced_toolbar_align});
 555  
 556              if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus'))
 557                  h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
 558  
 559              h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
 560  
 561              // Create toolbar and add the controls

 562              for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
 563                  tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
 564  
 565                  if (s['theme_advanced_buttons' + i + '_add'])
 566                      v += ',' + s['theme_advanced_buttons' + i + '_add'];
 567  
 568                  if (s['theme_advanced_buttons' + i + '_add_before'])
 569                      v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
 570  
 571                  t._addControls(v, tb);
 572  
 573                  //n.appendChild(n = tb.render());

 574                  h.push(tb.renderHTML());
 575  
 576                  o.deltaHeight -= s.theme_advanced_row_height;
 577              }
 578  
 579              h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
 580              DOM.setHTML(n, h.join(''));
 581          },
 582  
 583          _addStatusBar : function(tb, o) {
 584              var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
 585  
 586              n = DOM.add(tb, 'tr');
 587              n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
 588              n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&nbsp;');
 589              DOM.add(n, 'a', {href : '#', accesskey : 'x'});
 590  
 591              if (s.theme_advanced_resizing && !tinymce.isOldWebKit) {
 592                  DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'resize'});
 593  
 594                  if (s.theme_advanced_resizing_use_cookie) {
 595                      ed.onPostRender.add(function() {
 596                          var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
 597  
 598                          if (!o)
 599                              return;
 600  
 601                          if (s.theme_advanced_resize_horizontal)
 602                              c.style.width = o.cw + 'px';
 603  
 604                          c.style.height = o.ch + 'px';
 605                          DOM.get(ed.id + '_ifr').style.height = (parseInt(o.ch) + t.deltaHeight) + 'px';
 606                      });
 607                  }
 608  
 609                  ed.onPostRender.add(function() {
 610                      Event.add(ed.id + '_resize', 'mousedown', function(e) {
 611                          var c, p, w, h, n, pa;
 612  
 613                          // Measure container

 614                          c = DOM.get(ed.id + '_tbl');
 615                          w = c.clientWidth;
 616                          h = c.clientHeight;
 617  
 618                          miw = s.theme_advanced_resizing_min_width || 100;
 619                          mih = s.theme_advanced_resizing_min_height || 100;
 620                          maw = s.theme_advanced_resizing_max_width || 0xFFFF;
 621                          mah = s.theme_advanced_resizing_max_height || 0xFFFF;
 622  
 623                          // Setup placeholder

 624                          p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
 625                          DOM.setStyles(p, {width : w, height : h});
 626  
 627                          // Replace with placeholder

 628                          DOM.hide(c);
 629                          DOM.show(p);
 630  
 631                          // Create internal resize obj

 632                          r = {
 633                              x : e.screenX,
 634                              y : e.screenY,
 635                              w : w,
 636                              h : h,
 637                              dx : null,
 638                              dy : null
 639                          };
 640  
 641                          // Start listening

 642                          mf = Event.add(document, 'mousemove', function(e) {
 643                              var w, h;
 644  
 645                              // Calc delta values

 646                              r.dx = e.screenX - r.x;
 647                              r.dy = e.screenY - r.y;
 648  
 649                              // Boundery fix box

 650                              w = Math.max(miw, r.w + r.dx);
 651                              h = Math.max(mih, r.h + r.dy);
 652                              w = Math.min(maw, w);
 653                              h = Math.min(mah, h);
 654  
 655                              // Resize placeholder

 656                              if (s.theme_advanced_resize_horizontal)
 657                                  p.style.width = w + 'px';
 658  
 659                              p.style.height = h + 'px';
 660  
 661                              return Event.cancel(e);
 662                          });
 663  
 664                          me = Event.add(document, 'mouseup', function(e) {
 665                              var ifr;
 666  
 667                              // Stop listening

 668                              Event.remove(document, 'mousemove', mf);
 669                              Event.remove(document, 'mouseup', me);
 670  
 671                              c.style.display = '';
 672                              DOM.remove(p);
 673  
 674                              if (r.dx === null)
 675                                  return;
 676  
 677                              ifr = DOM.get(ed.id + '_ifr');
 678  
 679                              if (s.theme_advanced_resize_horizontal)
 680                                  c.style.width = (r.w + r.dx) + 'px';
 681  
 682                              c.style.height = (r.h + r.dy) + 'px';
 683                              ifr.style.height = (ifr.clientHeight + r.dy) + 'px';
 684  
 685                              if (s.theme_advanced_resizing_use_cookie) {
 686                                  Cookie.setHash("TinyMCE_" + ed.id + "_size", {
 687                                      cw : r.w + r.dx,
 688                                      ch : r.h + r.dy
 689                                  });
 690                              }
 691                          });
 692  
 693                          return Event.cancel(e);
 694                      });
 695                  });
 696              }
 697  
 698              o.deltaHeight -= 21;
 699              n = tb = null;
 700          },
 701  
 702          _nodeChanged : function(ed, cm, n, co) {
 703              var t = this, p, de = 0, v, c, s = t.settings;
 704  
 705              tinymce.each(t.stateControls, function(c) {
 706                  cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
 707              });
 708  
 709              cm.setActive('visualaid', ed.hasVisual);
 710              cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
 711              cm.setDisabled('redo', !ed.undoManager.hasRedo());
 712              cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
 713  
 714              p = DOM.getParent(n, 'A');
 715              if (c = cm.get('link')) {
 716                  if (!p || !p.name) {
 717                      c.setDisabled(!p && co);
 718                      c.setActive(!!p);
 719                  }
 720              }
 721  
 722              if (c = cm.get('unlink')) {
 723                  c.setDisabled(!p && co);
 724                  c.setActive(!!p && !p.name);
 725              }
 726  
 727              if (c = cm.get('anchor')) {
 728                  c.setActive(!!p && p.name);
 729  
 730                  if (tinymce.isWebKit) {
 731                      p = DOM.getParent(n, 'IMG');
 732                      c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
 733                  }
 734              }
 735  
 736              p = DOM.getParent(n, 'IMG');
 737              if (c = cm.get('image'))
 738                  c.setActive(!!p && n.className.indexOf('mceItem') == -1);
 739  
 740              if (c = cm.get('styleselect')) {
 741                  if (n.className) {
 742                      t._importClasses();
 743                      c.select(n.className);
 744                  } else
 745                      c.select();
 746              }
 747  
 748              if (c = cm.get('formatselect')) {
 749                  p = DOM.getParent(n, DOM.isBlock);
 750  
 751                  if (p)
 752                      c.select(p.nodeName.toLowerCase());
 753              }
 754  
 755              if (c = cm.get('fontselect'))
 756                  c.select(ed.queryCommandValue('FontName'));
 757  
 758              if (c = cm.get('fontsizeselect'))
 759                  c.select(ed.queryCommandValue('FontSize'));
 760  
 761              if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
 762                  p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
 763                  DOM.setHTML(p, '');
 764  
 765                  ed.dom.getParent(n, function(n) {
 766                      var na = n.nodeName.toLowerCase(), u, pi, ti = '';
 767  
 768                      // Ignore non element and hidden elements

 769                      if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
 770                          return;
 771  
 772                      // Fake name

 773                      if (v = DOM.getAttrib(n, 'mce_name'))
 774                          na = v;
 775      
 776                      // Handle prefix

 777                      if (tinymce.isIE && n.scopeName !== 'HTML')
 778                          na = n.scopeName + ':' + na;
 779  
 780                      // Remove internal prefix

 781                      na = na.replace(/mce\:/g, '');
 782  
 783                      // Handle node name

 784                      switch (na) {
 785                          case 'b':
 786                              na = 'strong';
 787                              break;
 788  
 789                          case 'i':
 790                              na = 'em';
 791                              break;
 792  
 793                          case 'img':
 794                              if (v = DOM.getAttrib(n, 'src'))
 795                                  ti += 'src: ' + v + ' ';
 796  
 797                              break;
 798  
 799                          case 'a':
 800                              if (v = DOM.getAttrib(n, 'name')) {
 801                                  ti += 'name: ' + v + ' ';
 802                                  na += '#' + v;
 803                              }
 804  
 805                              if (v = DOM.getAttrib(n, 'href'))
 806                                  ti += 'href: ' + v + ' ';
 807  
 808                              break;
 809  
 810                          case 'font':
 811                              if (s.convert_fonts_to_spans)
 812                                  na = 'span';
 813  
 814                              if (v = DOM.getAttrib(n, 'face'))
 815                                  ti += 'font: ' + v + ' ';
 816  
 817                              if (v = DOM.getAttrib(n, 'size'))
 818                                  ti += 'size: ' + v + ' ';
 819  
 820                              if (v = DOM.getAttrib(n, 'color'))
 821                                  ti += 'color: ' + v + ' ';
 822  
 823                              break;
 824  
 825                          case 'span':
 826                              if (v = DOM.getAttrib(n, 'style'))
 827                                  ti += 'style: ' + v + ' ';
 828  
 829                              break;
 830                      }
 831  
 832                      if (v = DOM.getAttrib(n, 'id'))
 833                          ti += 'id: ' + v + ' ';
 834  
 835                      if (v = n.className) {
 836                          v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
 837  
 838                          if (v && v.indexOf('mceItem') == -1) {
 839                              ti += 'class: ' + v + ' ';
 840  
 841                              if (DOM.isBlock(n) || na == 'img' || na == 'span')
 842                                  na += '.' + v;
 843                          }
 844                      }
 845  
 846                      na = na.replace(/(html:)/g, '');
 847                      na = {name : na, node : n, title : ti};
 848                      t.onResolveName.dispatch(t, na);
 849                      ti = na.title;
 850                      na = na.name;
 851  
 852                      //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";

 853                      pi = DOM.create('a', {'href' : "#" + (de++) + "", onmousedown : "return false;", title : ti}, na);
 854  
 855                      if (p.hasChildNodes()) {
 856                          p.insertBefore(document.createTextNode(' \u00bb '), p.firstChild);
 857                          p.insertBefore(pi, p.firstChild);
 858                      } else
 859                          p.appendChild(pi);
 860                  }, ed.getBody());
 861              }
 862          },
 863  
 864          // Commands gets called by execCommand

 865  
 866          _sel : function(v) {
 867              this.editor.execCommand('mceSelectNodeDepth', false, v);
 868          },
 869  
 870          _mceInsertAnchor : function(ui, v) {
 871              var ed = this.editor;
 872  
 873              ed.windowManager.open({
 874                  url : tinymce.baseURL + '/themes/advanced/anchor.htm',
 875                  width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
 876                  height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
 877                  inline : true
 878              }, {
 879                  theme_url : this.url
 880              });
 881          },
 882  
 883          _mceCharMap : function() {
 884              var ed = this.editor;
 885  
 886              ed.windowManager.open({
 887                  url : tinymce.baseURL + '/themes/advanced/charmap.htm',
 888                  width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
 889                  height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
 890                  inline : true
 891              }, {
 892                  theme_url : this.url
 893              });
 894          },
 895  
 896          _mceHelp : function() {
 897              var ed = this.editor;
 898  
 899              ed.windowManager.open({
 900                  url : tinymce.baseURL + '/themes/advanced/about.htm',
 901                  width : 480,
 902                  height : 380,
 903                  inline : true
 904              }, {
 905                  theme_url : this.url
 906              });
 907          },
 908  
 909          _mceColorPicker : function(u, v) {
 910              var ed = this.editor;
 911  
 912              v = v || {};
 913  
 914              ed.windowManager.open({
 915                  url : tinymce.baseURL + '/themes/advanced/color_picker.htm',
 916                  width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
 917                  height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
 918                  close_previous : false,
 919                  inline : true
 920              }, {
 921                  input_color : v.color,
 922                  func : v.func,
 923                  theme_url : this.url
 924              });
 925          },
 926  
 927          _mceCodeEditor : function(ui, val) {
 928              var ed = this.editor;
 929  
 930              ed.windowManager.open({
 931                  url : tinymce.baseURL + '/themes/advanced/source_editor.htm',
 932                  width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
 933                  height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
 934                  inline : true,
 935                  resizable : true,
 936                  maximizable : true
 937              }, {
 938                  theme_url : this.url
 939              });
 940          },
 941  
 942          _mceImage : function(ui, val) {
 943              var ed = this.editor;
 944  
 945              ed.windowManager.open({
 946                  url : tinymce.baseURL + '/themes/advanced/image.htm',
 947                  width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
 948                  height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
 949                  inline : true
 950              }, {
 951                  theme_url : this.url
 952              });
 953          },
 954  
 955          _mceLink : function(ui, val) {
 956              var ed = this.editor;
 957  
 958              ed.windowManager.open({
 959                  url : tinymce.baseURL + '/themes/advanced/link.htm',
 960                  width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
 961                  height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
 962                  inline : true
 963              }, {
 964                  theme_url : this.url
 965              });
 966          },
 967  
 968          _mceNewDocument : function() {
 969              var ed = this.editor;
 970  
 971              ed.windowManager.confirm('advanced.newdocument', function(s) {
 972                  if (s)
 973                      ed.execCommand('mceSetContent', false, '');
 974              });
 975          },
 976  
 977          _mceForeColor : function() {
 978              var t = this;
 979  
 980              this._mceColorPicker(0, {
 981                  func : function(co) {
 982                      t.editor.execCommand('ForeColor', false, co);
 983                  }
 984              });
 985          },
 986  
 987          _mceBackColor : function() {
 988              var t = this;
 989  
 990              this._mceColorPicker(0, {
 991                  func : function(co) {
 992                      t.editor.execCommand('HiliteColor', false, co);
 993                  }
 994              });
 995          }
 996      });
 997  
 998      tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
 999  }());