includes/clientside/static/editor.js
author Dan
Mon, 16 Feb 2009 16:17:25 -0500
changeset 832 7152ca0a0ce9
parent 823 4596c40aaa94
child 880 218b6d4de908
permissions -rw-r--r--
Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message) - Pages are now stored with an extra metadata field called page_format which is "wikitext" or "xhtml" - New $flags parameter + RENDER_* constants added that control RenderMan::render() behavior - Several other changes: * Added a sprite API for Javascript and made editor use sprites when possible * Removed a number of config options from the default install schema, replaced with second parameter to getConfig() calls * MessageBox in editor mostly replaced with miniPrompt * A few bugfixes related to password changes (registration didn't even work) * Rewrote the bitfield compression algorithm used to serialize allowed MIME types * Fixed some typos in language files and strings * Fixed a Text_Wiki bug in Heading parser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
// Javascript routines for the page editor
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
     3
// Idle time required for autosave, in seconds
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
     4
var AUTOSAVE_TIMEOUT = 15;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
     5
var AutosaveTimeoutObj = null;
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
     6
var editor_img_path = cdnPath + '/images/editor';
701
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
     7
var editor_save_lock = false;
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
     8
var editor_wikitext_transform_enable = true;
544
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
     9
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
    10
window.ajaxEditor = function(revid)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    11
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    12
  if ( KILL_SWITCH )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    13
    return true;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    14
  if ( editor_open )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    15
    return true;
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
    16
  load_component(['l10n', 'template-compiler', 'messagebox', 'fadefilter', 'flyin']);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    17
  selectButtonMinor('edit');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    18
  selectButtonMajor('article');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    19
  setAjaxLoading();
588
20484deb89cd Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents: 582
diff changeset
    20
  
20484deb89cd Upgraded TinyMCE to 3.1.0.1. Ported a couple special pages to the componentized JS system.
Dan
parents: 582
diff changeset
    21
  var rev_id_uri = ( revid ) ? '&revid=' + revid : '';
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
    22
  ajaxGet(stdAjaxPrefix + '&_mode=getsource' + rev_id_uri, function(ajax)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    23
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 405
diff changeset
    24
      if ( ajax.readyState == 4 && ajax.status == 200 )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    25
      {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    26
        unsetAjaxLoading();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    27
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    28
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
    29
        if ( !check_json_response(response) )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    30
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    31
          handle_invalid_json(response);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    32
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    33
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    34
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    35
        response = parseJSON(response);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    36
        if ( response.mode == 'error' )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    37
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    38
          unselectAllButtonsMinor();
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
    39
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    40
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    41
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    42
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    43
        if ( !response.auth_view_source )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    44
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    45
          unselectAllButtonsMinor();
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
    46
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_access_denied_title'), $lang.get('editor_err_access_denied_body'));
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    47
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    48
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    49
        
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
    50
        // do we need to enter a captcha before saving the page?
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
    51
        var captcha_hash = ( response.require_captcha ) ? response.captcha_id : false;
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
    52
        
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
    53
        ajaxBuildEditor((!response.auth_edit), response.time, response.allow_wysiwyg, captcha_hash, response.revid, response.undo_info, response);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    54
      }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    55
    });
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    56
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    57
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
    58
window.ajaxBuildEditor = function(readonly, timestamp, allow_wysiwyg, captcha_hash, revid, undo_info, response)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    59
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    60
  // Set flags
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    61
  // We don't want the fancy confirmation framework to trigger if the user is only viewing the page source
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    62
  if ( !readonly )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    63
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    64
    editor_open = true;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    65
    disableUnload();
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
    66
  }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    67
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    68
  // Destroy existing contents of page container
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    69
  if ( editor_use_modal_window )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    70
  {
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
    71
    darken(true, 70, 'enano_editor_darkener');
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    72
    // Build a div with 80% width, centered, and 10px from the top of the window
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    73
    var edcon = document.createElement('div');
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    74
    edcon.style.position = 'absolute';
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    75
    edcon.style.backgroundColor = '#FFFFFF';
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    76
    edcon.style.padding = '10px';
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    77
    edcon.style.width = '80%';
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
    78
    edcon.style.zIndex = getHighestZ() + 1;
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    79
    edcon.id = 'ajaxEditContainerModal';
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    80
    
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    81
    // Positioning
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    82
    var top = getScrollOffset() + 10;
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    83
    var left = ( getWidth() / 10 ) - 10; // 10% of window width on either side - 10px for padding = perfect centering effect
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    84
    edcon.style.top = String(top) + 'px';
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    85
    edcon.style.left = String(left) + 'px';
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    86
    var body = document.getElementsByTagName('body')[0];
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    87
    
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    88
    // Set opacity to 0
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    89
    domObjChangeOpac(0, edcon);
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    90
    body.appendChild(edcon);
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    91
  }
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    92
  else
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    93
  {
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    94
    var edcon = document.getElementById('ajaxEditContainer');
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    95
    for ( var i = edcon.childNodes.length - 1; i >= 0; i-- )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    96
    {
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    97
      edcon.removeChild(edcon.childNodes[i]);
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
    98
    }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
    99
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   100
  
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   101
  var content = response.src;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   102
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   103
  //
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   104
  // BUILD EDITOR
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   105
  //
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   106
  
397
06415d243d09 Added a heading "editing page" in page editor for visual appeal; removed use of alternate <?= ?> syntax in installer as it was causing problems on Win2k3 + PHP/FastCGI. (Experimentally using TortoiseHG's hgtk to commit)
Dan
parents: 387
diff changeset
   107
  var heading = document.createElement('h3');
399
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 397
diff changeset
   108
  heading.style.cssFloat = 'left';
a3a9e463c62f Cosmetic improvements to page editor; added demo mode checks in Admin:LangManager
Dan
parents: 397
diff changeset
   109
  heading.style.styleFloat = 'left';
404
fb4f9e6f378f Made the form validation icons (check/X/?) more visually appealing. IE-friendliness is still on the TODO list.
Dan
parents: 399
diff changeset
   110
  heading.style.marginTop = '0px';
fb4f9e6f378f Made the form validation icons (check/X/?) more visually appealing. IE-friendliness is still on the TODO list.
Dan
parents: 399
diff changeset
   111
  heading.style.marginBottom = '0px';
397
06415d243d09 Added a heading "editing page" in page editor for visual appeal; removed use of alternate <?= ?> syntax in installer as it was causing problems on Win2k3 + PHP/FastCGI. (Experimentally using TortoiseHG's hgtk to commit)
Dan
parents: 387
diff changeset
   112
  heading.appendChild(document.createTextNode($lang.get('editor_msg_editor_heading')));
06415d243d09 Added a heading "editing page" in page editor for visual appeal; removed use of alternate <?= ?> syntax in installer as it was causing problems on Win2k3 + PHP/FastCGI. (Experimentally using TortoiseHG's hgtk to commit)
Dan
parents: 387
diff changeset
   113
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   114
  // Plaintext/wikitext toggler
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   115
  // Only build the editor if using TinyMCE is allowed. THIS IS WEAK
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   116
  // AND CANNOT BE MADE ANY STRONGER.
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   117
  
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   118
  if ( allow_wysiwyg )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   119
  {
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   120
    var toggler = document.createElement('p');
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   121
    toggler.style.marginLeft = '0';
404
fb4f9e6f378f Made the form validation icons (check/X/?) more visually appealing. IE-friendliness is still on the TODO list.
Dan
parents: 399
diff changeset
   122
    toggler.style.textAlign = 'right';
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   123
    
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   124
    var span_wiki = document.createElement('span');
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   125
    var span_mce  = document.createElement('span');
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   126
    span_wiki.id  = 'enano_edit_btn_pt';
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   127
    span_mce.id   = 'enano_edit_btn_mce';
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   128
    
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   129
    // to-wikitext button
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   130
    var a = document.createElement('a');
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   131
    a.href = '#';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   132
    a.className = 'abutton image abutton_green';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   133
    a.appendChild(gen_sprite(scriptPath + '/images/editor/sprite.png', 16, 16, 0, 96));
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   134
    a.appendChild(document.createTextNode(' ' + $lang.get('editor_btn_wikitext')));
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   135
    span_wiki.appendChild(a);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   136
    toggler.appendChild(span_wiki);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   137
    
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   138
    // to-HTML button
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   139
    var a = document.createElement('a');
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   140
    a.href = '#';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   141
    a.className = 'abutton image abutton_blue';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   142
    a.appendChild(gen_sprite(scriptPath + '/images/editor/sprite.png', 16, 16, 0, 112));
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   143
    a.appendChild(document.createTextNode(' ' + $lang.get('editor_btn_graphical')));
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   144
    span_mce.appendChild(a);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   145
    toggler.appendChild(span_mce);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   146
    
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   147
    if ( response.page_format == 'xhtml' )
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   148
    {
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   149
      // Current selection is TinyMCE - make span_wiki have the link and span_mce be plaintext
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   150
      span_mce.style.display = 'none';
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   151
    }
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   152
    else
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   153
    {
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   154
      // Current selection is wikitext - set span_wiki to plaintext and span_mce to link
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   155
      span_wiki.style.display = 'none';
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   156
    }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   157
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   158
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   159
  // Form (to allow submits from MCE to trigger a real save)
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   160
  var form = document.createElement('form');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   161
  form.action = 'javascript:void(0);';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   162
  form.onsubmit = function()
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   163
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   164
    ajaxEditorSave();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   165
    return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   166
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   167
  
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   168
  // Draft notice
705
85943d71c214 Fixed draft controls being shown in view source mode
Dan
parents: 701
diff changeset
   169
  if ( response.have_draft && !readonly )
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   170
  {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   171
    var dn = document.createElement('div');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   172
    dn.className = 'warning-box';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   173
    dn.id = 'ajax_edit_draft_notice';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   174
    dn.innerHTML = '<b>' + $lang.get('editor_msg_have_draft_title') + '</b><br />';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   175
    dn.innerHTML += $lang.get('editor_msg_have_draft_body', { author: response.draft_author, time: response.draft_time });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   176
  }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   177
  
408
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   178
  // Old-revision notice
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   179
  if ( revid > 0 )
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   180
  {
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   181
    var oldrev_box = document.createElement('div');
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   182
    oldrev_box.className = 'usermessage';
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   183
    oldrev_box.appendChild(document.createTextNode($lang.get('editor_msg_editing_old_revision')));
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   184
  }
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   185
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   186
  // Preview holder
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   187
  var preview_anchor = document.createElement('a');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   188
  preview_anchor.name = 'ajax_preview';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   189
  preview_anchor.id = 'ajax_preview';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   190
  var preview_container = document.createElement('div');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   191
  preview_container.id = 'enano_editor_preview';
404
fb4f9e6f378f Made the form validation icons (check/X/?) more visually appealing. IE-friendliness is still on the TODO list.
Dan
parents: 399
diff changeset
   192
  preview_container.style.clear = 'left';
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   193
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   194
  // Textarea containing the content
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   195
  var ta_wrapper = document.createElement('div');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   196
  ta_wrapper.style.margin = '10px 0';
404
fb4f9e6f378f Made the form validation icons (check/X/?) more visually appealing. IE-friendliness is still on the TODO list.
Dan
parents: 399
diff changeset
   197
  // ta_wrapper.style.clear = 'both';
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   198
  var textarea = document.createElement('textarea');
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   199
  ta_wrapper.appendChild(textarea);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   200
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   201
  textarea.id = 'ajaxEditArea';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   202
  textarea.rows = '20';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   203
  textarea.cols = '60';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   204
  textarea.style.width = '98.7%';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   205
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   206
  // Revision metadata controls
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   207
  var tblholder = document.createElement('div');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   208
  tblholder.className = 'tblholder';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   209
  var metatable = document.createElement('table');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   210
  metatable.setAttribute('border', '0');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   211
  metatable.setAttribute('cellspacing', '1');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   212
  metatable.setAttribute('cellpadding', '4');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   213
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   214
  if ( readonly )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   215
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   216
    // Close Viewer button
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   217
    var toolbar = '';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   218
    var head = new templateParser(response.toolbar_templates.toolbar_start);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   219
    var button = new templateParser(response.toolbar_templates.toolbar_button);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   220
    var tail = new templateParser(response.toolbar_templates.toolbar_end);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   221
    
504
bc8e0e9ee01d Added support for embedding language data into plugins; updated all version numbers on plugin files
Dan
parents: 476
diff changeset
   222
    toolbar += head.run();
bc8e0e9ee01d Added support for embedding language data into plugins; updated all version numbers on plugin files
Dan
parents: 476
diff changeset
   223
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   224
    button.assign_bool({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   225
        show_title: true
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   226
      });
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   227
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   228
    // Button: close
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   229
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   230
        TITLE: $lang.get('editor_btn_closeviewer'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   231
        IMAGE: editor_img_path + '/discard.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   232
        SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 16),
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   233
        FLAGS: 'href="#" onclick="ajaxReset(true); return false;"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   234
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   235
    toolbar += button.run();
504
bc8e0e9ee01d Added support for embedding language data into plugins; updated all version numbers on plugin files
Dan
parents: 476
diff changeset
   236
    toolbar += tail.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   237
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   238
  else
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   239
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   240
    // First row: edit summary
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   241
    var tr1 = document.createElement('tr');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   242
    var td1_1 = document.createElement('td');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   243
    var td1_2 = document.createElement('td');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   244
    td1_1.className = 'row2';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   245
    td1_2.className = 'row1';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   246
    td1_2.style.width = '70%';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   247
    td1_1.appendChild(document.createTextNode($lang.get('editor_lbl_edit_summary')));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   248
    td1_1.appendChild(document.createElement('br'));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   249
    var small = document.createElement('small');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   250
    small.appendChild(document.createTextNode($lang.get('editor_lbl_edit_summary_explain')));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   251
    td1_1.appendChild(small);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   252
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   253
    var field_es = document.createElement('input');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   254
    field_es.id = 'enano_editor_field_summary';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   255
    field_es.type = 'text';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   256
    field_es.size = '40';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   257
    field_es.style.width = '96%';
408
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   258
    
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   259
    if ( revid > 0 )
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   260
    {
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   261
      undo_info.last_rev_id = revid;
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   262
      field_es.value = $lang.get('editor_reversion_edit_summary', undo_info);
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   263
    }
7ecbe721217c Modified editor and rename functions to go through the API when rolling back. This causes rollbacks to be logged.
Dan
parents: 407
diff changeset
   264
    
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   265
    td1_2.appendChild(field_es);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   266
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   267
    tr1.appendChild(td1_1);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   268
    tr1.appendChild(td1_2);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   269
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   270
    // Second row: minor edit
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   271
    var tr2 = document.createElement('tr');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   272
    var td2_1 = document.createElement('td');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   273
    var td2_2 = document.createElement('td');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   274
    td2_1.className = 'row2';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   275
    td2_2.className = 'row1';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   276
    td2_1.appendChild(document.createTextNode($lang.get('editor_lbl_minor_edit')));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   277
    td2_1.appendChild(document.createElement('br'));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   278
    var small = document.createElement('small');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   279
    small.appendChild(document.createTextNode($lang.get('editor_lbl_minor_edit_explain')));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   280
    td2_1.appendChild(small);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   281
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   282
    var label = document.createElement('label');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   283
    var field_mi = document.createElement('input');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   284
    field_mi.id = 'enano_editor_field_minor';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   285
    field_mi.type = 'checkbox';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   286
    label.appendChild(field_mi);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   287
    label.appendChild(document.createTextNode(' '));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   288
    label.appendChild(document.createTextNode($lang.get('editor_lbl_minor_edit_field')));
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   289
    td2_2.appendChild(label);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   290
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   291
    tr2.appendChild(td2_1);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   292
    tr2.appendChild(td2_2);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   293
    
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   294
    if ( captcha_hash )
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   295
    {
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   296
      // generate captcha field (effectively third row)
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   297
      var tr4 = document.createElement('tr');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   298
      var td4_1 = document.createElement('td');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   299
      var td4_2 = document.createElement('td');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   300
      td4_1.className = 'row2';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   301
      td4_2.className = 'row1';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   302
      
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   303
      td4_1.appendChild(document.createTextNode($lang.get('editor_lbl_field_captcha')));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   304
      td4_1.appendChild(document.createElement('br'));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   305
      var small2 = document.createElement('small');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   306
      small2.appendChild(document.createTextNode($lang.get('editor_msg_captcha_pleaseenter')));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   307
      small2.appendChild(document.createElement('br'));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   308
      small2.appendChild(document.createElement('br'));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   309
      small2.appendChild(document.createTextNode($lang.get('editor_msg_captcha_blind')));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   310
      td4_1.appendChild(small2);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   311
      
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   312
      var img = document.createElement('img');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   313
      img.src = makeUrlNS('Special', 'Captcha/' + captcha_hash);
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 504
diff changeset
   314
      img.setAttribute('enano:captcha_hash', captcha_hash);
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   315
      img.id = 'enano_editor_captcha_img';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   316
      img.onclick = function()
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   317
      {
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 504
diff changeset
   318
        this.src = makeUrlNS('Special', 'Captcha/' + this.getAttribute('enano:captcha_hash') + '/' + Math.floor(Math.random() * 100000));
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   319
      }
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   320
      img.style.cursor = 'pointer';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   321
      td4_2.appendChild(img);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   322
      td4_2.appendChild(document.createElement('br'));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   323
      td4_2.appendChild(document.createTextNode($lang.get('editor_lbl_field_captcha_code') + ' '));
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   324
      var input = document.createElement('input');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   325
      input.type = 'text';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   326
      input.id = 'enano_editor_field_captcha';
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 504
diff changeset
   327
      input.setAttribute('enano:captcha_hash', captcha_hash);
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   328
      input.size = '9';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   329
      td4_2.appendChild(input);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   330
      
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   331
      tr4.appendChild(td4_1);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   332
      tr4.appendChild(td4_2);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   333
    }
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   334
    
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   335
    // Third row: controls
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   336
    
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   337
    var toolbar = '';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   338
    var head = new templateParser(response.toolbar_templates.toolbar_start);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   339
    var button = new templateParser(response.toolbar_templates.toolbar_button);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   340
    var label = new templateParser(response.toolbar_templates.toolbar_label);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   341
    var tail = new templateParser(response.toolbar_templates.toolbar_end);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   342
    
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   343
    button.assign_bool({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   344
        show_title: true
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   345
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   346
    
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   347
    toolbar += head.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   348
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   349
    // Button: Save
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   350
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   351
        TITLE: $lang.get('editor_btn_save'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   352
        IMAGE: editor_img_path + '/save.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   353
        SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 64),
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   354
        FLAGS: 'href="#" onclick="ajaxEditorSave(); return false;"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   355
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   356
    toolbar += button.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   357
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   358
    // Button: preview
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   359
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   360
        TITLE: $lang.get('editor_btn_preview'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   361
        IMAGE: editor_img_path + '/preview.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   362
        SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 32),
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   363
        FLAGS: 'href="#" onclick="ajaxEditorGenPreview(); return false;"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   364
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   365
    toolbar += button.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   366
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   367
    // Button: revert
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   368
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   369
        TITLE: $lang.get('editor_btn_revert'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   370
          IMAGE: editor_img_path + '/revert.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   371
          SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 48),
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   372
        FLAGS: 'href="#" onclick="ajaxEditorRevertToLatest(); return false;"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   373
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   374
    toolbar += button.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   375
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   376
    // Button: diff
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   377
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   378
        TITLE: $lang.get('editor_btn_diff'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   379
        IMAGE: editor_img_path + '/diff.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   380
        SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 0),
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   381
        FLAGS: 'href="#" onclick="ajaxEditorShowDiffs(); return false;"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   382
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   383
    toolbar += button.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   384
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   385
    // Button: cancel
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   386
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   387
        TITLE: $lang.get('editor_btn_cancel'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   388
        IMAGE: editor_img_path + '/discard.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   389
        SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 16),
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   390
        FLAGS: 'href="#" onclick="ajaxEditorCancel(); return false;"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   391
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   392
    toolbar += button.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   393
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   394
    // Separator
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   395
    label.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   396
        TITLE: ' '
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   397
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   398
    toolbar += label.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   399
    
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   400
    // Button: Save draft
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   401
    button.assign_vars({
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   402
        TITLE: $lang.get('editor_btn_savedraft'),
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   403
        IMAGE: editor_img_path + '/savedraft.gif',
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   404
        SPRITE: false,
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   405
        FLAGS: 'href="#" onclick="ajaxPerformAutosave(); return false;" id="ajax_edit_savedraft_btn"'
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   406
      });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   407
    toolbar += button.run();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   408
    
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   409
    toolbar += tail.run();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   410
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   411
    metatable.appendChild(tr1);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   412
    metatable.appendChild(tr2);
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   413
    if ( captcha_hash )
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   414
    {
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   415
      metatable.appendChild(tr4);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   416
    }
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   417
    // metatable.appendChild(tr3);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   418
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   419
  tblholder.appendChild(metatable);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   420
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   421
  // Edit disclaimer/notice
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   422
  if ( editNotice ) // This is set globally in {JS_DYNAMIC_VARS}.
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   423
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   424
    var en_div = document.createElement('div');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   425
    en_div.innerHTML = editNotice;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   426
    en_div.className = 'usermessage';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   427
    en_div.style.margin = '10px 0 0 0';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   428
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   429
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   430
  // Put it all together...
397
06415d243d09 Added a heading "editing page" in page editor for visual appeal; removed use of alternate <?= ?> syntax in installer as it was causing problems on Win2k3 + PHP/FastCGI. (Experimentally using TortoiseHG's hgtk to commit)
Dan
parents: 387
diff changeset
   431
  form.appendChild(heading);
387
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   432
  if ( allow_wysiwyg )
92664d2efab8 Rebranded source code as 1.1.1; added TinyMCE ACL rule as per Vadi's request: http://forum.enanocms.org/viewtopic.php?f=7&t=54
Dan
parents: 348
diff changeset
   433
    form.appendChild(toggler);
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   434
  
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   435
  if ( dn )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   436
    form.appendChild(dn);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   437
  
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   438
  if ( oldrev_box )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   439
    form.appendChild(oldrev_box);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   440
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   441
  form.appendChild(preview_anchor);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   442
  form.appendChild(preview_container);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   443
  form.appendChild(ta_wrapper);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   444
  form.appendChild(tblholder);
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   445
  form.innerHTML += '<div style="margin: 10px 0 0 0;">' + toolbar + '</div>';
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   446
  edcon.appendChild(form);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   447
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   448
  if ( editNotice && !readonly )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   449
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   450
    edcon.appendChild(en_div);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   451
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   452
  
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   453
  // more textarea attribs/init
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   454
  var textarea = document.getElementById('ajaxEditArea');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   455
  textarea.as_last_save = 0;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   456
  textarea.content_orig = content;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   457
  textarea.used_draft = false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   458
  textarea.onkeyup = function()
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   459
  {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   460
    if ( this.needReset )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   461
    {
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   462
      var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   463
      var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   464
      img.src = editor_img_path + '/savedraft.gif';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   465
      lbl.innerHTML = $lang.get('editor_btn_savedraft');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   466
    }
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   467
    if ( window.AutosaveTimeoutObj )
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   468
      clearTimeout(window.AutosaveTimeoutObj);
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   469
    window.AutosaveTimeoutObj = setTimeout('ajaxAutosaveDraft();', ( AUTOSAVE_TIMEOUT * 1000 ));
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   470
  }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   471
  
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   472
  if ( readonly )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   473
  {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   474
    textarea.className = 'mce_readonly';
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   475
    textarea.setAttribute('readonly', 'readonly');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   476
  }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   477
  
474
3d751a6f2b05 Changed TinyMCE init to run only on demand. Highly experimental.
Dan
parents: 473
diff changeset
   478
  $dynano('ajaxEditArea').object.focus();
3d751a6f2b05 Changed TinyMCE init to run only on demand. Highly experimental.
Dan
parents: 473
diff changeset
   479
  $dynano('ajaxEditArea').object._edTimestamp = timestamp;
3d751a6f2b05 Changed TinyMCE init to run only on demand. Highly experimental.
Dan
parents: 473
diff changeset
   480
  $dynano('ajaxEditArea').setContent(content);
3d751a6f2b05 Changed TinyMCE init to run only on demand. Highly experimental.
Dan
parents: 473
diff changeset
   481
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   482
  // If the editor preference is tinymce, switch the editor to TinyMCE now
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   483
  if ( response.page_format == 'xhtml' && allow_wysiwyg )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   484
  {
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   485
    $dynano('ajaxEditArea').switchToMCE(false);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   486
  }
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   487
  
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 417
diff changeset
   488
  if ( allow_wysiwyg )
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 417
diff changeset
   489
  {
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   490
    var a = document.getElementById('enano_edit_btn_pt').getElementsByTagName('a')[0];
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   491
    a.onclick = function() {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   492
      ajaxSetEditorPlain();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   493
      return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   494
    };
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   495
    var a = document.getElementById('enano_edit_btn_mce').getElementsByTagName('a')[0];
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   496
    a.onclick = function() {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   497
      ajaxSetEditorMCE();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   498
      return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   499
    };
419
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 417
diff changeset
   500
  }
b8b4e38825db Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.
Dan
parents: 417
diff changeset
   501
  
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   502
  // if we're using the modal window, fade it in
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   503
  if ( editor_use_modal_window )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   504
  {
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   505
    domOpacity(edcon, 0, 100, 500);
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   506
  }
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   507
  
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   508
  // Autosave every 5 minutes           (m  *  s  *  ms)
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   509
  setInterval('ajaxPerformAutosave();', ( 5 * 60 * 1000 ));
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   510
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   511
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   512
window.ajaxEditorDestroyModalWindow = function()
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   513
{
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   514
  if ( editor_use_modal_window )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   515
  {
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   516
    var edcon = document.getElementById('ajaxEditContainerModal');
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   517
    var body = document.getElementsByTagName('body')[0];
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   518
    if ( edcon )
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   519
    {
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   520
      body.removeChild(edcon);
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   521
      enlighten(true, 'enano_editor_darkener');
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   522
    }
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   523
  }
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   524
}
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   525
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   526
window.ajaxEditorSave = function(is_draft, text_override)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   527
{
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   528
  if ( !is_draft )
762
e346a3106a4e Fixed: editor state was not unlocked after draft save
Dan
parents: 705
diff changeset
   529
  {
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   530
    ajaxSetEditorLoading();
762
e346a3106a4e Fixed: editor state was not unlocked after draft save
Dan
parents: 705
diff changeset
   531
  }
701
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
   532
  if ( is_draft && editor_save_lock )
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
   533
    return false;
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
   534
  else
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
   535
    editor_save_lock = true;
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
   536
  
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   537
  var ta_content = ( text_override ) ? text_override : $dynano('ajaxEditArea').getContent();
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   538
  
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   539
  if ( !is_draft && ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p>&nbsp;</p>' ) )
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   540
  {
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   541
    new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_no_text_title'), $lang.get('editor_err_no_text_body'));
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   542
    ajaxUnSetEditorLoading();
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   543
    return false;
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   544
  }
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   545
  
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   546
  if ( is_draft )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   547
  {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   548
    // ajaxSetEditorLoading();
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   549
    var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   550
    var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
650
e45183014778 Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
parents: 622
diff changeset
   551
    img.src = cdnPath + '/images/loading.gif';
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   552
    var d = new Date();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   553
    var m = String(d.getMinutes());
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   554
    if ( m.length < 2 )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   555
      m = '0' + m;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   556
    var time = d.getHours() + ':' + m;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   557
    lbl.innerHTML = $lang.get('editor_msg_draft_saving');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   558
  }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   559
  
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   560
  var edit_summ = $dynano('enano_editor_field_summary').object.value;
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   561
  if ( !edit_summ )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   562
    edit_summ = '';
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   563
  var is_minor = ( $dynano('enano_editor_field_minor').object.checked ) ? 1 : 0;
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   564
  var timestamp = $dynano('ajaxEditArea').object._edTimestamp;
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   565
  var used_draft = $dynano('ajaxEditArea').object.used_draft;
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   566
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   567
  var json_packet = {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   568
    src: ta_content,
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   569
    summary: edit_summ,
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   570
    minor_edit: is_minor,
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   571
    time: timestamp,
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   572
    draft: ( is_draft == true ),
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   573
    format: ( $dynano('ajaxEditArea').isMCE() ) ? 'xhtml' : 'wikitext',
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   574
    used_draft: used_draft
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   575
  };
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   576
  
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   577
  // Do we need to add captcha info?
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 504
diff changeset
   578
  if ( document.getElementById('enano_editor_field_captcha') && !is_draft )
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   579
  {
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   580
    var captcha_field = document.getElementById('enano_editor_field_captcha');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   581
    if ( captcha_field.value == '' )
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   582
    {
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   583
      new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_need_captcha_title'), $lang.get('editor_err_need_captcha_body'));
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   584
      ajaxUnSetEditorLoading();
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   585
      return false;
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   586
    }
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   587
    json_packet.captcha_code = captcha_field.value;
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 504
diff changeset
   588
    json_packet.captcha_id = captcha_field.getAttribute('enano:captcha_hash');
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   589
  }
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   590
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   591
  json_packet = ajaxEscape(toJSONString(json_packet));
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
   592
  ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function(ajax)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   593
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 405
diff changeset
   594
      if ( ajax.readyState == 4 && ajax.status == 200 )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   595
      {
555
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents: 550
diff changeset
   596
        ajaxUnSetEditorLoading();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   597
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
   598
        if ( !check_json_response(response) )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   599
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   600
          handle_invalid_json(response);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   601
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   602
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   603
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   604
        response = parseJSON(response);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   605
        // This will only be used if there was a lower-level error.
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   606
        if ( response.mode == 'error' )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   607
        {
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   608
          editor_save_lock = false;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   609
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   610
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   611
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   612
        // This will be used if the PageProcessor generated errors (usually security/permissions related)
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   613
        if ( response.mode == 'errors' )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   614
        {
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   615
          editor_save_lock = false;
336
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   616
          // This will be true if the user entered a captcha code incorrectly, thus
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   617
          // invalidating the code and requiring a new image to be generated.
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   618
          if ( response.new_captcha )
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   619
          {
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   620
            // Generate the new captcha field
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   621
            var img = document.getElementById('enano_editor_captcha_img');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   622
            var input = document.getElementById('enano_editor_field_captcha');
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   623
            if ( img && input )
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   624
            {
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   625
              img._captchaHash = response.new_captcha;
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   626
              input._captchaHash = response.new_captcha;
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   627
              img.src = makeUrlNS('Special', 'Captcha/' + response.new_captcha);
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   628
              input.value = '';
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   629
            }
bfa2e9c23f03 Added ability to require CAPTCHA for guests when editing pages (AJAX INTERFACE ONLY)
Dan
parents: 335
diff changeset
   630
          }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   631
          var errors = '<ul><li>' + implode('</li><li>', response.errors) + '</li></ul>';
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   632
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_save_title'), $lang.get('editor_err_save_body') + errors);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   633
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   634
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   635
        // If someone else got to the page first, warn the user
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   636
        if ( response.mode == 'obsolete' )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   637
        {
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   638
          editor_save_lock = false;
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   639
          // Update the local timestamp to allow override
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   640
          $dynano('ajaxEditArea').object._edTimestamp = response.time;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   641
          new MessageBox(MB_OK | MB_ICONEXCLAMATION, $lang.get('editor_err_obsolete_title'), $lang.get('editor_err_obsolete_body', { author: response.author, timestamp: response.date_string, page_url: makeUrl(title, false, true) }));
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   642
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   643
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   644
        if ( response.mode == 'success' )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   645
        {
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   646
          if ( response.is_draft )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   647
          {
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   648
            document.getElementById('ajaxEditArea').used_draft = true;
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   649
            document.getElementById('ajaxEditArea').needReset = true;
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   650
            var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   651
            var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   652
            if ( response.is_draft == 'delete' )
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   653
            {
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   654
              img.src = scriptPath + '/images/editor/savedraft.gif';
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   655
              lbl.innerHTML = $lang.get('editor_btn_savedraft');
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   656
              
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   657
              var dn = $dynano('ajax_edit_draft_notice').object;
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   658
              if ( dn )
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   659
              {
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   660
                dn.parentNode.removeChild(dn);
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   661
              }
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   662
            }
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   663
            else
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   664
            {
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   665
              img.src = scriptPath + '/images/mini-info.png';
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   666
              var d = new Date();
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   667
              var m = String(d.getMinutes());
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   668
              if ( m.length < 2 )
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   669
                m = '0' + m;
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   670
              var time = d.getHours() + ':' + m;
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
   671
              lbl.innerHTML = $lang.get('editor_msg_draft_saved', { time: time });
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   672
            }
762
e346a3106a4e Fixed: editor state was not unlocked after draft save
Dan
parents: 705
diff changeset
   673
            editor_save_lock = false;
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   674
          }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   675
          else
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   676
          {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   677
            // The save was successful; reset flags and make another request for the new page content
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   678
            setAjaxLoading();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   679
            editor_open = false;
701
dd80cde96a6c Autocomplete further stabilized. Made Special:PasswordReset and Special:Register prevent use if logged in.
Dan
parents: 693
diff changeset
   680
            editor_save_lock = false;
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   681
            enableUnload();
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   682
            $dynano('ajaxEditArea').destroyMCE(false);
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   683
            changeOpac(0, 'ajaxEditContainer');
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
   684
            ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function(ajax)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   685
              {
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   686
                if ( ajax.readyState == 4 && ajax.status == 200 )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   687
                {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   688
                  unsetAjaxLoading();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   689
                  selectButtonMajor('article');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   690
                  unselectAllButtonsMinor();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   691
                  
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   692
                  ajaxEditorDestroyModalWindow();
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   693
                  document.getElementById('ajaxEditContainer').innerHTML = '<div class="usermessage">' + $lang.get('editor_msg_saved') + '</div>' + ajax.responseText;
672
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
   694
                  // if we're on a userpage, call the onload function to rebuild the tabs
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
   695
                  if ( typeof(userpage_onload) == 'function' )
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
   696
                  {
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
   697
                    window.userpage_blocks = [];
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
   698
                    userpage_onload();
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
   699
                  }
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   700
                  opacity('ajaxEditContainer', 0, 100, 1000);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   701
                }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   702
              });
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
   703
          }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   704
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   705
      }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   706
    }, true);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   707
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   708
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   709
// Delete the draft (this is a massive server-side hack)
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   710
window.ajaxEditorDeleteDraft = function()
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   711
{
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   712
  miniPromptMessage({
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   713
      title: $lang.get('editor_msg_confirm_delete_draft_title'),
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   714
      message: $lang.get('editor_msg_confirm_delete_draft_body'),
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   715
      buttons: [
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   716
          {
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   717
            text: $lang.get('editor_btn_delete_draft'),
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   718
            color: 'red',
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   719
            style: {
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   720
              fontWeight: 'bold'
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   721
            },
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   722
            onclick: function() {
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   723
              ajaxEditorDeleteDraftReal();
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   724
              miniPromptDestroy(this);
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   725
            }
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   726
          },
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   727
          {
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   728
            text: $lang.get('etc_cancel'),
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   729
            onclick: function() {
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   730
              miniPromptDestroy(this);
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   731
            }
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   732
          }
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   733
        ]
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   734
    });
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   735
}
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   736
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   737
window.ajaxEditorDeleteDraftReal = function()
550
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   738
{
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   739
  return ajaxEditorSave(true, -1);
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   740
}
685e839d934e Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents: 544
diff changeset
   741
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   742
window.ajaxEditorGenPreview = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   743
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   744
  ajaxSetEditorLoading();
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   745
  var ta_content = $dynano('ajaxEditArea').getContent();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   746
  ta_content = ajaxEscape(ta_content);
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   747
  if ( $dynano('enano_editor_preview').object.innerHTML != '' )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   748
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   749
    opacity('enano_editor_preview', 100, 0, 500);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   750
  }
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
   751
  ajaxPost(stdAjaxPrefix + '&_mode=preview', 'text=' + ta_content, function(ajax)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   752
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 405
diff changeset
   753
      if ( ajax.readyState == 4 && ajax.status == 200 )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   754
      {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   755
        ajaxUnSetEditorLoading();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   756
        changeOpac(0, 'enano_editor_preview');
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   757
        $dynano('enano_editor_preview').object.innerHTML = ajax.responseText;
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   758
        window.location.hash = '#ajax_preview';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   759
        opacity('enano_editor_preview', 0, 100, 500);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   760
      }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   761
    }, true);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   762
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   763
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   764
window.ajaxEditorRevertToLatest = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   765
{
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   766
  miniPromptMessage({
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   767
      title: $lang.get('editor_msg_revert_confirm_title'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   768
      message: $lang.get('editor_msg_revert_confirm_body'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   769
      buttons: [
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   770
        {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   771
          text: $lang.get('editor_btn_revert_confirm'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   772
          color: 'red',
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   773
          sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 48 ],
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   774
          style: {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   775
            fontWeight: 'bold'
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   776
          },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   777
          onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   778
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   779
            ajaxEditorRevertToLatestReal();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   780
            miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   781
            return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   782
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   783
        },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   784
        {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   785
          text: $lang.get('etc_cancel'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   786
          onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   787
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   788
            miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   789
            return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   790
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   791
        }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   792
      ]
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   793
    });
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   794
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   795
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   796
window.ajaxEditorRevertToLatestReal = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   797
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   798
  ajaxSetEditorLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
   799
  ajaxGet(stdAjaxPrefix + '&_mode=getsource', function(ajax)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   800
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 405
diff changeset
   801
      if ( ajax.readyState == 4 && ajax.status == 200 )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   802
      {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   803
        ajaxUnSetEditorLoading();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   804
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   805
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
   806
        if ( !check_json_response(response) )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   807
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   808
          handle_invalid_json(response);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   809
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   810
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   811
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   812
        response = parseJSON(response);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   813
        if ( response.mode == 'error' )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   814
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   815
          unselectAllButtonsMinor();
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   816
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   817
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   818
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   819
        
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   820
        if ( !response.auth_view_source )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   821
        {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   822
          unselectAllButtonsMinor();
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   823
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_access_denied_title'), $lang.get('editor_err_access_denied_body'));
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   824
          return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   825
        }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   826
        
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   827
        setTimeout(function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   828
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   829
            editor_convert_if_needed(response.page_format);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   830
            $dynano('ajaxEditArea').setContent(response.src);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   831
          }, aclDisableTransitionFX ? 10 : 750);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   832
      }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   833
    }, true);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   834
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   835
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   836
window.ajaxEditorShowDiffs = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   837
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   838
  ajaxSetEditorLoading();
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   839
  var ta_content = $dynano('ajaxEditArea').getContent();
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   840
  ta_content = ajaxEscape(ta_content);
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   841
  if ( $dynano('enano_editor_preview').object.innerHTML != '' )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   842
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   843
    opacity('enano_editor_preview', 100, 0, 500);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   844
  }
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
   845
  ajaxPost(stdAjaxPrefix + '&_mode=diff_cur', 'text=' + ta_content, function(ajax)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   846
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 405
diff changeset
   847
      if ( ajax.readyState == 4 && ajax.status == 200 )
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   848
      {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   849
        ajaxUnSetEditorLoading();
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   850
        changeOpac(0, 'enano_editor_preview');
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
   851
        $dynano('enano_editor_preview').object.innerHTML = ajax.responseText;
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   852
        window.location.hash = '#ajax_preview';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   853
        opacity('enano_editor_preview', 0, 100, 500);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   854
      }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   855
    }, true);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   856
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   857
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   858
window.ajaxEditorCancel = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   859
{
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   860
  miniPromptMessage({
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   861
      title: $lang.get('editor_msg_cancel_confirm_title'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   862
      message: $lang.get('editor_msg_cancel_confirm_body'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   863
      buttons: [
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   864
        {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   865
          text: $lang.get('editor_btn_cancel_confirm'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   866
          color: 'red',
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   867
          sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 16 ],
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   868
          style: {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   869
            fontWeight: 'bold'
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   870
          },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   871
          onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   872
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   873
            setAjaxLoading();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   874
            ajaxEditorDestroyModalWindow();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   875
            editor_open = false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   876
            enableUnload();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   877
            $dynano('ajaxEditArea').destroyMCE(false);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   878
            ajaxReset();
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   879
            miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   880
            return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   881
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   882
        },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   883
        {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   884
          text: $lang.get('editor_btn_cancel_cancel'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   885
          onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   886
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   887
            miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   888
            return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   889
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   890
        }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   891
      ]
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   892
    });
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   893
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   894
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   895
window.ajaxSetEditorMCE = function(confirmed)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   896
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   897
  if ( editor_loading )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   898
    return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   899
  
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   900
  if ( !confirmed )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   901
  {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   902
    miniPromptMessage({
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   903
        title: $lang.get('editor_msg_convert_confirm_title'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   904
        message: $lang.get('editor_msg_convert_confirm_body'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   905
        buttons: [
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   906
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   907
            color: 'blue',
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   908
            text: $lang.get('editor_btn_graphical'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   909
            style: {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   910
              fontWeight: 'bold'
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   911
            },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   912
            sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 112 ],
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   913
            onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   914
            {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   915
              ajaxSetEditorMCE(true);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   916
              miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   917
              return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   918
            }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   919
          },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   920
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   921
            text: $lang.get('etc_cancel'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   922
            onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   923
            {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   924
              miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   925
              return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   926
            }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   927
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   928
        ]
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   929
      });
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   930
    return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   931
  }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   932
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   933
  // Clear out existing buttons
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   934
  var span_wiki = $dynano('enano_edit_btn_pt').object;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   935
  var span_mce  = $dynano('enano_edit_btn_mce').object;
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   936
  span_wiki.style.display = 'inline';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   937
  span_mce.style.display = 'none';
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   938
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   939
  // Swap editor
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   940
  $dynano('ajaxEditArea').switchToMCE(true);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   941
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   942
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   943
window.ajaxSetEditorPlain = function(confirmed)
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   944
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   945
  if ( editor_loading )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   946
    return false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   947
  
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   948
  if ( !confirmed )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   949
  {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   950
    miniPromptMessage({
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   951
        title: $lang.get('editor_msg_convert_confirm_title'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   952
        message: $lang.get('editor_msg_convert_confirm_body'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   953
        buttons: [
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   954
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   955
            color: 'green',
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   956
            text: $lang.get('editor_btn_wikitext'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   957
            style: {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   958
              fontWeight: 'bold'
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   959
            },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   960
            sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 96 ],
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   961
            onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   962
            {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   963
              ajaxSetEditorPlain(true);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   964
              miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   965
              return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   966
            }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   967
          },
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   968
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   969
            text: $lang.get('etc_cancel'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   970
            onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   971
            {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   972
              miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   973
              return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   974
            }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   975
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   976
        ]
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   977
      });
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   978
    return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   979
  }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   980
  
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   981
  // Clear out existing buttons
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   982
  var span_wiki = $dynano('enano_edit_btn_pt').object;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   983
  var span_mce  = $dynano('enano_edit_btn_mce').object;
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   984
  span_wiki.style.display = 'none';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   985
  span_mce.style.display = 'inline';
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   986
  
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   987
  // Swap editor
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
   988
  $dynano('ajaxEditArea').destroyMCE(true);
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   989
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   990
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   991
var editor_loading = false;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   992
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   993
window.ajaxSetEditorLoading = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   994
{
622
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
   995
  var ed = false;
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
   996
  if ( window.tinyMCE )
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
   997
  {
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
   998
    ed = tinyMCE.get('ajaxEditArea');
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
   999
  }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1000
  editor_loading = true;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1001
  if ( ed )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1002
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1003
    ed.setProgressState(1);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1004
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1005
  else
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1006
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1007
    ed = document.getElementById('ajaxEditArea');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1008
    var blackout = document.createElement('div');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1009
    blackout.style.position = 'absolute';
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1010
    blackout.style.top = $dynano('ajaxEditArea').Top() + 'px';
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1011
    blackout.style.left = $dynano('ajaxEditArea').Left() + 'px';
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1012
    blackout.style.width = $dynano('ajaxEditArea').Width() + 'px';
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1013
    blackout.style.height = $dynano('ajaxEditArea').Height() + 'px';
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1014
    blackout.style.backgroundColor = '#FFFFFF';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1015
    domObjChangeOpac(60, blackout);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1016
    blackout.style.backgroundImage = 'url(' + scriptPath + '/includes/clientside/tinymce/themes/advanced/skins/default/img/progress.gif)';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1017
    blackout.style.backgroundPosition = 'center center';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1018
    blackout.style.backgroundRepeat = 'no-repeat';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1019
    blackout.id = 'enano_editor_blackout';
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1020
    blackout.style.zIndex = getHighestZ() + 2;
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1021
    
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1022
    var body = document.getElementsByTagName('body')[0];
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1023
    body.appendChild(blackout);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1024
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1025
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1026
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1027
window.ajaxUnSetEditorLoading = function()
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1028
{
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1029
  editor_loading = false;
622
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
  1030
  var ed = false;
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
  1031
  if ( window.tinyMCE )
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
  1032
  {
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
  1033
    ed = tinyMCE.get('ajaxEditArea');
734af34cd7ad Fixed another bad tinyMCE reference in editor.js
Dan
parents: 588
diff changeset
  1034
  }
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1035
  if ( ed )
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1036
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1037
    ed.setProgressState(0);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1038
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1039
  else
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1040
  {
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1041
    var blackout = document.getElementById('enano_editor_blackout');
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1042
    var body = document.getElementsByTagName('body')[0];
693
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
  1043
    if ( !blackout )
f21aa64d050a Fixed that exception that was thrown on draft save in fx3
Dan
parents: 673
diff changeset
  1044
      return false;
335
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1045
    body.removeChild(blackout);
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1046
  }
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1047
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1048
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1049
window.ajaxAutosaveDraft = function()
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1050
{
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1051
  var aed = document.getElementById('ajaxEditArea');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1052
  if ( !aed )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1053
    return false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1054
  var last_save = aed.as_last_save;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1055
  var now = unix_time();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1056
  if ( ( last_save + 120 ) < now && aed.value != aed.content_orig )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1057
  {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1058
    ajaxPerformAutosave();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1059
  }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1060
}
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1061
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1062
window.ajaxPerformAutosave = function()
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1063
{
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1064
  var aed = document.getElementById('ajaxEditArea');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1065
  if ( !aed )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1066
    return false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1067
  var now = unix_time();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1068
  aed.as_last_save = now;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1069
  
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1070
  var ta_content = $dynano('ajaxEditArea').getContent();
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1071
  
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1072
  if ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p>&nbsp;</p>' )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1073
  {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1074
    return false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1075
  }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1076
  
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1077
  ajaxEditorSave(true);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1078
}
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1079
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1080
window.ajaxEditorUseDraft = function()
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1081
{
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1082
  var aed = document.getElementById('ajaxEditArea');
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1083
  if ( !aed )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1084
    return false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1085
  ajaxSetEditorLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 779
diff changeset
  1086
  ajaxGet(stdAjaxPrefix + '&_mode=getsource&get_draft=1', function(ajax)
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1087
    {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1088
      if ( ajax.readyState == 4 && ajax.status == 200 )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1089
      {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1090
        ajaxUnSetEditorLoading();
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1091
        
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1092
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
  1093
        if ( !check_json_response(response) )
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1094
        {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1095
          handle_invalid_json(response);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1096
          return false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1097
        }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1098
        
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1099
        response = parseJSON(response);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1100
        if ( response.mode == 'error' )
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1101
        {
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1102
          unselectAllButtonsMinor();
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1103
          new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1104
          return false;
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1105
        }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1106
        
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1107
        editor_convert_if_needed(response.page_format);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1108
        
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1109
        $dynano('ajaxEditArea').setContent(response.src);
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1110
        $dynano('ajaxEditArea').object.used_draft = true;
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1111
        
417
b76ebe229548 Edit summary should now be carried over when a draft is restored
Dan
parents: 413
diff changeset
  1112
        var es = document.getElementById('enano_editor_field_summary');
b76ebe229548 Edit summary should now be carried over when a draft is restored
Dan
parents: 413
diff changeset
  1113
        if ( es.value == '' )
b76ebe229548 Edit summary should now be carried over when a draft is restored
Dan
parents: 413
diff changeset
  1114
        {
b76ebe229548 Edit summary should now be carried over when a draft is restored
Dan
parents: 413
diff changeset
  1115
          es.value = response.edit_summary;
b76ebe229548 Edit summary should now be carried over when a draft is restored
Dan
parents: 413
diff changeset
  1116
        }
b76ebe229548 Edit summary should now be carried over when a draft is restored
Dan
parents: 413
diff changeset
  1117
        
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 419
diff changeset
  1118
        var dn = $dynano('ajax_edit_draft_notice').object;
413
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1119
        dn.parentNode.removeChild(dn);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1120
      }
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1121
    }, true);
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1122
}
6607cd646d6d Added autosave functionality and resurrected the old toolbar code that was added about a year ago but never uesd.
Dan
parents: 408
diff changeset
  1123
832
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1124
window.editor_convert_if_needed = function(targetformat, noticetitle, noticebody)
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1125
{
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1126
  // Do we need to change the format?
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1127
  var need_to_mce = ( targetformat == 'xhtml' && !$dynano('ajaxEditArea').isMCE() );
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1128
  var need_to_wkt = ( targetformat == 'wikitext' && $dynano('ajaxEditArea').isMCE() );
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1129
  if ( need_to_mce )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1130
  {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1131
    $dynano('ajaxEditArea').setContent('');
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1132
    $dynano('ajaxEditArea').switchToMCE(false);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1133
    
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1134
    // Clear out existing buttons
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1135
    var span_wiki = $dynano('enano_edit_btn_pt').object;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1136
    var span_mce  = $dynano('enano_edit_btn_mce').object;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1137
    span_wiki.style.display = 'inline';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1138
    span_mce.style.display = 'none';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1139
  }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1140
  else if ( need_to_wkt )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1141
  {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1142
    $dynano('ajaxEditArea').setContent('');
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1143
    $dynano('ajaxEditArea').destroyMCE(false);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1144
    
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1145
    // Clear out existing buttons
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1146
    var span_wiki = $dynano('enano_edit_btn_pt').object;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1147
    var span_mce  = $dynano('enano_edit_btn_mce').object;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1148
    span_wiki.style.display = 'none';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1149
    span_mce.style.display = 'inline';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1150
  }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1151
  if ( need_to_mce || need_to_wkt )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1152
  {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1153
    // explain the conversion
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1154
    if ( !noticetitle )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1155
      noticetitle = 'editor_msg_convert_draft_load_title';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1156
    if ( !noticebody )
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1157
      noticebody = 'editor_msg_convert_draft_load_body';
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1158
    
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1159
    miniPromptMessage({
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1160
        title: $lang.get(noticetitle),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1161
        message: $lang.get(noticebody),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1162
        buttons: [
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1163
          {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1164
            text: $lang.get('etc_ok'),
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1165
            onclick: function()
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1166
            {
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1167
              miniPromptDestroy(this);
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1168
              return false;
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1169
            }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1170
          }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1171
        ]
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1172
      });
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1173
  }
7152ca0a0ce9 Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
parents: 823
diff changeset
  1174
}