includes/clientside/static/editor.js
author Dan Fuhry <dan@enanocms.org>
Thu, 02 Jun 2011 05:28:28 -0400
changeset 1343 2a31905a567d
parent 1334 b9ecf7618fbc
child 1344 dc96d6c5cd1e
permissions -rw-r--r--
Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
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;
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
     9
var editor_orig_text = '';
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
    10
var editor_last_draft = '';
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
    11
var page_format = 'wikitext';
544
81b4499a963e Added TinyMCE compression support and made some supporting modifications to common.php
Dan
parents: 541
diff changeset
    12
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
    13
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
    14
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    15
	if ( KILL_SWITCH )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    16
		return true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    17
	if ( editor_open )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    18
		return true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    19
	load_component(['l10n', 'template-compiler', 'messagebox', 'fadefilter', 'flyin', 'toolbar']);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    20
	selectButtonMinor('edit');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    21
	selectButtonMajor('article');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    22
	setAjaxLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    23
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    24
	var rev_id_uri = ( revid ) ? '&revid=' + revid : '';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    25
	ajaxGet(stdAjaxPrefix + '&_mode=getsource' + rev_id_uri, function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    26
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    27
			if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    28
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    29
				unsetAjaxLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    30
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    31
				var response = String(ajax.responseText + '');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    32
				if ( !check_json_response(response) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    33
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    34
					handle_invalid_json(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    35
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    36
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    37
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    38
				response = parseJSON(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    39
				if ( response.mode == 'error' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    40
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    41
					unselectAllButtonsMinor();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    42
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    43
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    44
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    45
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    46
				if ( !response.auth_view_source )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    47
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    48
					unselectAllButtonsMinor();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    49
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_access_denied_title'), $lang.get('editor_err_access_denied_body'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    50
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    51
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    52
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    53
				// do we need to enter a captcha before saving the page?
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    54
				var captcha_hash = ( response.require_captcha ) ? response.captcha_id : false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    55
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    56
				ajaxBuildEditor((!response.auth_edit), response.time, response.allow_wysiwyg, captcha_hash, response.revid, response.undo_info, response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    57
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    58
		});
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
    61
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
    62
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    63
	// Set flags
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    64
	// We don't want the fancy confirmation framework to trigger if the user is only viewing the page source
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    65
	if ( !readonly )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    66
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    67
		editor_open = true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    68
		disableUnload();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    69
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    70
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    71
	// Destroy existing contents of page container
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    72
	if ( editor_use_modal_window )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    73
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    74
		darken(true, 70, 'enano_editor_darkener');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    75
		// Build a div with 80% width, centered, and 10px from the top of the window
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    76
		var edcon = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    77
		edcon.style.position = 'absolute';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    78
		edcon.style.backgroundColor = '#FFFFFF';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    79
		edcon.style.padding = '10px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    80
		edcon.style.width = '80%';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    81
		edcon.style.zIndex = getHighestZ() + 1;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    82
		edcon.id = 'ajaxEditContainerModal';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    83
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    84
		// Positioning
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    85
		var top = getScrollOffset() + 10;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    86
		var left = ( getWidth() / 10 ) - 10; // 10% of window width on either side - 10px for padding = perfect centering effect
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    87
		edcon.style.top = String(top) + 'px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    88
		edcon.style.left = String(left) + 'px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    89
		var body = document.getElementsByTagName('body')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    90
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    91
		// Set opacity to 0
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    92
		domObjChangeOpac(0, edcon);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    93
		body.appendChild(edcon);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    94
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    95
	else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    96
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    97
		var edcon = document.getElementById('ajaxEditContainer');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    98
		for ( var i = edcon.childNodes.length - 1; i >= 0; i-- )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
    99
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   100
			edcon.removeChild(edcon.childNodes[i]);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   101
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   102
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   103
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   104
	var content = response.src;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   105
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   106
	//
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   107
	// BUILD EDITOR
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   108
	//
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   109
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   110
	var heading = document.createElement('h3');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   111
	heading.style.cssFloat = 'left';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   112
	heading.style.styleFloat = 'left';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   113
	heading.style.marginTop = '0px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   114
	heading.style.marginBottom = '0px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   115
	heading.appendChild(document.createTextNode($lang.get('editor_msg_editor_heading')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   116
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   117
	// Plaintext/wikitext toggler
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   118
	// Only build the editor if using TinyMCE is allowed. THIS IS WEAK
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   119
	// AND CANNOT BE MADE ANY STRONGER.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   120
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   121
	if ( allow_wysiwyg )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   122
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   123
		var toggler = document.createElement('p');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   124
		toggler.style.marginLeft = '0';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   125
		toggler.style.textAlign = 'right';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   126
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   127
		var span_wiki = document.createElement('span');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   128
		var span_mce  = document.createElement('span');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   129
		span_wiki.id  = 'enano_edit_btn_pt';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   130
		span_mce.id   = 'enano_edit_btn_mce';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   131
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   132
		// to-wikitext button
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   133
		var a = document.createElement('a');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   134
		a.href = '#';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   135
		a.className = 'abutton image abutton_green';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   136
		a.appendChild(gen_sprite(scriptPath + '/images/editor/sprite.png', 16, 16, 0, 96));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   137
		a.appendChild(document.createTextNode(' ' + $lang.get('editor_btn_wikitext')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   138
		span_wiki.appendChild(a);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   139
		toggler.appendChild(span_wiki);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   140
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   141
		// to-HTML button
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   142
		var a = document.createElement('a');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   143
		a.href = '#';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   144
		a.className = 'abutton image abutton_blue';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   145
		a.appendChild(gen_sprite(scriptPath + '/images/editor/sprite.png', 16, 16, 0, 112));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   146
		a.appendChild(document.createTextNode(' ' + $lang.get('editor_btn_graphical')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   147
		span_mce.appendChild(a);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   148
		toggler.appendChild(span_mce);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   149
		
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   150
		if ( response.page_format == 'wikitext' )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   151
		{
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   152
			// Current selection is a custom editor plugin - make span_wiki have the link and span_mce be plaintext
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   153
			span_wiki.style.display = 'none';
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   154
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   155
		else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   156
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   157
			// Current selection is wikitext - set span_wiki to plaintext and span_mce to link
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   158
			span_mce.style.display = 'none';
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   159
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   160
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   161
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   162
	// Form (to allow submits from MCE to trigger a real save)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   163
	var form = document.createElement('form');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   164
	form.action = 'javascript:void(0);';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   165
	form.onsubmit = function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   166
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   167
		ajaxEditorSave();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   168
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   169
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   170
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   171
	// Draft notice
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   172
	if ( response.have_draft && !readonly )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   173
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   174
		var dn = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   175
		dn.className = 'warning-box';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   176
		dn.id = 'ajax_edit_draft_notice';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   177
		dn.innerHTML = '<b>' + $lang.get('editor_msg_have_draft_title') + '</b><br />';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   178
		dn.innerHTML += $lang.get('editor_msg_have_draft_body', { author: response.draft_author, time: response.draft_time });
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   179
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   180
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   181
	// Old-revision notice
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   182
	if ( revid > 0 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   183
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   184
		var oldrev_box = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   185
		oldrev_box.className = 'usermessage';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   186
		oldrev_box.appendChild(document.createTextNode($lang.get('editor_msg_editing_old_revision')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   187
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   188
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   189
	// Preview holder
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   190
	var preview_anchor = document.createElement('a');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   191
	preview_anchor.name = 'ajax_preview';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   192
	preview_anchor.id = 'ajax_preview';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   193
	var preview_container = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   194
	preview_container.id = 'enano_editor_preview';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   195
	preview_container.style.clear = 'left';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   196
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   197
	// Textarea containing the content
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   198
	var ta_wrapper = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   199
	ta_wrapper.style.margin = '10px 0';
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
   200
	
1316
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   201
	// ta_wrapper.style.clear = 'both';
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   202
	var textarea = document.createElement('textarea');
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   203
	textarea.id = 'ajaxEditArea';
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   204
	
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
   205
	// A hook allowing plugins to create a toolbar on top of the textarea
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
   206
	eval(setHook('editor_gui_toolbar'));
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
   207
	
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   208
	ta_wrapper.appendChild(textarea);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   209
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   210
	textarea.rows = '20';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   211
	textarea.cols = '60';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   212
	textarea.style.width = '98.7%';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   213
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   214
	// Revision metadata controls
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   215
	var tblholder = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   216
	tblholder.className = 'tblholder';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   217
	var metatable = document.createElement('table');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   218
	metatable.setAttribute('border', '0');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   219
	metatable.setAttribute('cellspacing', '1');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   220
	metatable.setAttribute('cellpadding', '4');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   221
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   222
	if ( readonly )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   223
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   224
		// Close Viewer button
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   225
		var toolbar = '';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   226
		var head = new templateParser(response.toolbar_templates.toolbar_start);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   227
		var button = new templateParser(response.toolbar_templates.toolbar_button);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   228
		var tail = new templateParser(response.toolbar_templates.toolbar_end);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   229
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   230
		toolbar += head.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   231
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   232
		button.assign_bool({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   233
				show_title: true
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   234
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   235
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   236
		// Button: close
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   237
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   238
				TITLE: $lang.get('editor_btn_closeviewer'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   239
				IMAGE: editor_img_path + '/discard.gif',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   240
				SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 16),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   241
				FLAGS: 'href="#" onclick="ajaxReset(true); return false;"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   242
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   243
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   244
		toolbar += tail.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   245
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   246
	else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   247
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   248
		// First row: edit summary
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   249
		var tr1 = document.createElement('tr');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   250
		var td1_1 = document.createElement('td');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   251
		var td1_2 = document.createElement('td');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   252
		td1_1.className = 'row2';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   253
		td1_2.className = 'row1';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   254
		td1_2.style.width = '70%';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   255
		td1_1.appendChild(document.createTextNode($lang.get('editor_lbl_edit_summary')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   256
		td1_1.appendChild(document.createElement('br'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   257
		var small = document.createElement('small');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   258
		small.appendChild(document.createTextNode($lang.get('editor_lbl_edit_summary_explain')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   259
		td1_1.appendChild(small);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   260
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   261
		var field_es = document.createElement('input');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   262
		field_es.id = 'enano_editor_field_summary';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   263
		field_es.type = 'text';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   264
		field_es.size = '40';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   265
		field_es.style.width = '96%';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   266
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   267
		if ( revid > 0 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   268
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   269
			undo_info.last_rev_id = revid;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   270
			field_es.value = $lang.get('editor_reversion_edit_summary', undo_info);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   271
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   272
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   273
		td1_2.appendChild(field_es);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   274
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   275
		tr1.appendChild(td1_1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   276
		tr1.appendChild(td1_2);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   277
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   278
		// Second row: minor edit
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   279
		var tr2 = document.createElement('tr');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   280
		var td2_1 = document.createElement('td');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   281
		var td2_2 = document.createElement('td');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   282
		td2_1.className = 'row2';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   283
		td2_2.className = 'row1';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   284
		td2_1.appendChild(document.createTextNode($lang.get('editor_lbl_minor_edit')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   285
		td2_1.appendChild(document.createElement('br'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   286
		var small = document.createElement('small');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   287
		small.appendChild(document.createTextNode($lang.get('editor_lbl_minor_edit_explain')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   288
		td2_1.appendChild(small);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   289
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   290
		var label = document.createElement('label');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   291
		var field_mi = document.createElement('input');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   292
		field_mi.id = 'enano_editor_field_minor';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   293
		field_mi.type = 'checkbox';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   294
		label.appendChild(field_mi);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   295
		label.appendChild(document.createTextNode(' '));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   296
		label.appendChild(document.createTextNode($lang.get('editor_lbl_minor_edit_field')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   297
		td2_2.appendChild(label);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   298
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   299
		tr2.appendChild(td2_1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   300
		tr2.appendChild(td2_2);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   301
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   302
		if ( captcha_hash )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   303
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   304
			// generate captcha field (effectively third row)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   305
			var tr4 = document.createElement('tr');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   306
			var td4_1 = document.createElement('td');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   307
			var td4_2 = document.createElement('td');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   308
			td4_1.className = 'row2';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   309
			td4_2.className = 'row1';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   310
			
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   311
			td4_1.appendChild(document.createTextNode($lang.get('editor_lbl_field_captcha')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   312
			td4_1.appendChild(document.createElement('br'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   313
			var small2 = document.createElement('small');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   314
			small2.appendChild(document.createTextNode($lang.get('editor_msg_captcha_pleaseenter')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   315
			small2.appendChild(document.createElement('br'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   316
			small2.appendChild(document.createElement('br'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   317
			small2.appendChild(document.createTextNode($lang.get('editor_msg_captcha_blind')));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   318
			td4_1.appendChild(small2);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   319
			
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   320
			var img = document.createElement('img');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   321
			img.src = makeUrlNS('Special', 'Captcha/' + captcha_hash);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   322
			img.setAttribute('enano:captcha_hash', captcha_hash);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   323
			img.id = 'enano_editor_captcha_img';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   324
			img.onclick = function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   325
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   326
				this.src = makeUrlNS('Special', 'Captcha/' + this.getAttribute('enano:captcha_hash') + '/' + Math.floor(Math.random() * 100000));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   327
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   328
			img.style.cursor = 'pointer';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   329
			td4_2.appendChild(img);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   330
			td4_2.appendChild(document.createElement('br'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   331
			td4_2.appendChild(document.createTextNode($lang.get('editor_lbl_field_captcha_code') + ' '));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   332
			var input = document.createElement('input');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   333
			input.type = 'text';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   334
			input.id = 'enano_editor_field_captcha';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   335
			input.setAttribute('enano:captcha_hash', captcha_hash);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   336
			input.size = '9';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   337
			td4_2.appendChild(input);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   338
			
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   339
			tr4.appendChild(td4_1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   340
			tr4.appendChild(td4_2);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   341
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   342
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   343
		// Third row: controls
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   344
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   345
		var toolbar = '';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   346
		var head = new templateParser(response.toolbar_templates.toolbar_start);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   347
		var button = new templateParser(response.toolbar_templates.toolbar_button);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   348
		var label = new templateParser(response.toolbar_templates.toolbar_label);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   349
		var tail = new templateParser(response.toolbar_templates.toolbar_end);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   350
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   351
		button.assign_bool({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   352
				show_title: true
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   353
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   354
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   355
		toolbar += head.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   356
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   357
		// Button: Save
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   358
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   359
				TITLE: $lang.get('editor_btn_save'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   360
				IMAGE: editor_img_path + '/save.gif',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   361
				SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 64),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   362
				FLAGS: 'href="#" onclick="ajaxEditorSave(); return false;"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   363
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   364
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   365
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   366
		// Button: preview
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   367
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   368
				TITLE: $lang.get('editor_btn_preview'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   369
				IMAGE: editor_img_path + '/preview.gif',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   370
				SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 32),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   371
				FLAGS: 'href="#" onclick="ajaxEditorGenPreview(); return false;"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   372
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   373
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   374
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   375
		// Button: revert
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   376
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   377
				TITLE: $lang.get('editor_btn_revert'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   378
					IMAGE: editor_img_path + '/revert.gif',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   379
					SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 48),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   380
				FLAGS: 'href="#" onclick="ajaxEditorRevertToLatest(); return false;"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   381
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   382
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   383
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   384
		// Button: diff
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   385
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   386
				TITLE: $lang.get('editor_btn_diff'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   387
				IMAGE: editor_img_path + '/diff.gif',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   388
				SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 0),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   389
				FLAGS: 'href="#" onclick="ajaxEditorShowDiffs(); return false;"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   390
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   391
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   392
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   393
		// Button: cancel
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   394
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   395
				TITLE: $lang.get('editor_btn_cancel'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   396
				IMAGE: editor_img_path + '/discard.gif',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   397
				SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 16),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   398
				FLAGS: 'href="#" onclick="ajaxEditorCancel(); return false;"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   399
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   400
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   401
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   402
		// Separator
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   403
		label.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   404
				TITLE: ' '
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   405
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   406
		toolbar += label.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   407
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   408
		// Button: Save draft
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   409
		button.assign_vars({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   410
				TITLE: $lang.get('editor_btn_savedraft'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   411
				IMAGE: editor_img_path + '/savedraft.gif',
1291
a971f6efcb7b Visual refresh on the textarea in the enanium page editor. Also fixed missing image on the Save Draft button.
Dan Fuhry <dan@enanocms.org>
parents: 1227
diff changeset
   412
				// SPRITE: gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 80),
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   413
				SPRITE: false,
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   414
				FLAGS: 'href="#" onclick="ajaxPerformAutosave(); return false;" id="ajax_edit_savedraft_btn"'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   415
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   416
		toolbar += button.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   417
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   418
		toolbar += tail.run();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   419
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   420
		metatable.appendChild(tr1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   421
		metatable.appendChild(tr2);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   422
		if ( captcha_hash )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   423
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   424
			metatable.appendChild(tr4);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   425
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   426
		// metatable.appendChild(tr3);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   427
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   428
	tblholder.appendChild(metatable);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   429
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   430
	// Edit disclaimer/notice
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   431
	if ( response.edit_notice )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   432
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   433
		var en_div = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   434
		en_div.innerHTML = response.edit_notice;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   435
		en_div.className = 'usermessage';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   436
		en_div.style.margin = '10px 0 0 0';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   437
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   438
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   439
	// Put it all together...
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   440
	form.appendChild(heading);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   441
	if ( allow_wysiwyg )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   442
		form.appendChild(toggler);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   443
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   444
	if ( dn )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   445
		form.appendChild(dn);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   446
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   447
	if ( oldrev_box )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   448
		form.appendChild(oldrev_box);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   449
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   450
	form.appendChild(preview_anchor);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   451
	form.appendChild(preview_container);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   452
	form.appendChild(ta_wrapper);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   453
	if ( !readonly )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   454
		form.appendChild(tblholder);
1316
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   455
	var tbdiv = document.createElement('div');
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   456
	tbdiv.innerHTML = toolbar;
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   457
	tbdiv.style.margin = '10px 0 0 0';
3df4818b99bf editor: removed extraneous debug info; changed around the order by which the textarea is created and appended to the DOM
Dan Fuhry <dan@enanocms.org>
parents: 1311
diff changeset
   458
	form.appendChild(tbdiv);
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   459
	edcon.appendChild(form);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   460
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   461
	if ( response.edit_notice && !readonly )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   462
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   463
		edcon.appendChild(en_div);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   464
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   465
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   466
	// more textarea attribs/init
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   467
	var textarea = document.getElementById('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   468
	textarea.as_last_save = 0;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   469
	textarea.content_orig = content;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   470
	textarea.used_draft = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   471
	textarea.onkeyup = function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   472
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   473
		if ( this.needReset )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   474
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   475
			var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   476
			var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   477
			img.src = editor_img_path + '/savedraft.gif';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   478
			lbl.innerHTML = $lang.get('editor_btn_savedraft');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   479
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   480
		if ( window.AutosaveTimeoutObj )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   481
			clearTimeout(window.AutosaveTimeoutObj);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   482
		window.AutosaveTimeoutObj = setTimeout('ajaxAutosaveDraft();', ( AUTOSAVE_TIMEOUT * 1000 ));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   483
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   484
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   485
	if ( readonly )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   486
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   487
		textarea.className = 'mce_readonly';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   488
		textarea.setAttribute('readonly', 'readonly');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   489
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   490
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   491
	$dynano('ajaxEditArea').object.focus();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   492
	$dynano('ajaxEditArea').object._edTimestamp = timestamp;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   493
	$dynano('ajaxEditArea').setContent(content);
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
   494
	editor_orig_text = content;
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   495
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   496
	// If the editor preference is tinymce, switch the editor to TinyMCE now
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   497
	if ( response.page_format != 'wikitext' && allow_wysiwyg )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   498
	{
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   499
		if ( typeof(editor_formats[response.page_format]) == 'object' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   500
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   501
			// instruct the editor plugin to go ahead and build its UI
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   502
			editor_formats[response.page_format].ui_construct();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   503
			window.page_format = response.page_format;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   504
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   505
		else
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   506
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   507
			// Page was formatted with a plugin that no longer exists
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   508
			miniPromptMessage({
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   509
				title: $lang.get('editor_msg_convert_missing_plugin_title'),
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   510
				message: $lang.get('editor_msg_convert_missing_plugin_body', { plugin: response.page_format }),
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   511
				buttons: [
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   512
					{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   513
						text: $lang.get('etc_ok'),
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   514
						onclick: function()
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   515
						{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   516
							miniPromptDestroy(this);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   517
							return false;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   518
						}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   519
					}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   520
				]
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   521
			});
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   522
		}
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   523
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   524
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   525
	if ( allow_wysiwyg )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   526
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   527
		var a = document.getElementById('enano_edit_btn_pt').getElementsByTagName('a')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   528
		a.onclick = function() {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   529
			ajaxSetEditorPlain();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   530
			return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   531
		};
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   532
		var a = document.getElementById('enano_edit_btn_mce').getElementsByTagName('a')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   533
		a.onclick = function() {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   534
			ajaxSetEditorMCE();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   535
			return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   536
		};
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   537
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   538
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   539
	// if we're using the modal window, fade it in
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   540
	if ( editor_use_modal_window )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   541
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   542
		domOpacity(edcon, 0, 100, 500);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   543
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   544
	
1334
b9ecf7618fbc Added another AJAX editor hook after init is pretty much done
Dan Fuhry <dan@enanocms.org>
parents: 1332
diff changeset
   545
	eval(setHook('editor_post_init'));
b9ecf7618fbc Added another AJAX editor hook after init is pretty much done
Dan Fuhry <dan@enanocms.org>
parents: 1332
diff changeset
   546
	
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   547
	// Autosave every 5 minutes           (m  *  s  *  ms)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   548
	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
   549
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   550
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   551
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
   552
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   553
	if ( editor_use_modal_window )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   554
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   555
		var edcon = document.getElementById('ajaxEditContainerModal');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   556
		var body = document.getElementsByTagName('body')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   557
		if ( edcon )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   558
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   559
			body.removeChild(edcon);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   560
			enlighten(true, 'enano_editor_darkener');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   561
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   562
	}
473
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   563
}
518bc2b214f1 Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
parents: 461
diff changeset
   564
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   565
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
   566
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   567
	if ( !is_draft )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   568
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   569
		ajaxSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   570
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   571
	if ( is_draft && editor_save_lock )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   572
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   573
	else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   574
		editor_save_lock = true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   575
	
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   576
	var ta_content = ( text_override ) ? text_override : ajaxEditorGetContent();
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   577
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   578
	if ( !is_draft && ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p>&nbsp;</p>' ) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   579
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   580
		new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_no_text_title'), $lang.get('editor_err_no_text_body'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   581
		ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   582
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   583
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   584
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   585
	if ( is_draft )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   586
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   587
		// ajaxSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   588
		var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   589
		var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   590
		img.src = cdnPath + '/images/loading.gif';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   591
		var d = new Date();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   592
		var m = String(d.getMinutes());
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   593
		if ( m.length < 2 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   594
			m = '0' + m;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   595
		var time = d.getHours() + ':' + m;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   596
		lbl.innerHTML = $lang.get('editor_msg_draft_saving');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   597
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   598
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   599
	var edit_summ = $dynano('enano_editor_field_summary').object.value;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   600
	if ( !edit_summ )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   601
		edit_summ = '';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   602
	var is_minor = ( $dynano('enano_editor_field_minor').object.checked ) ? 1 : 0;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   603
	var timestamp = $dynano('ajaxEditArea').object._edTimestamp;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   604
	var used_draft = $dynano('ajaxEditArea').object.used_draft;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   605
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   606
	var json_packet = {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   607
		src: ta_content,
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   608
		summary: edit_summ,
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   609
		minor_edit: is_minor,
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   610
		time: timestamp,
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   611
		draft: ( is_draft == true ),
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   612
		format: window.page_format,
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   613
		used_draft: used_draft
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   614
	};
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   615
	
1332
12286b3ee214 Added some more hooks to the page editing pipeline. It should now be possible to add controls to the page editor, send the data from them out to the server, and process them on the server side.
Dan Fuhry <dan@enanocms.org>
parents: 1316
diff changeset
   616
	eval(setHook('editor_save_presend'));
12286b3ee214 Added some more hooks to the page editing pipeline. It should now be possible to add controls to the page editor, send the data from them out to the server, and process them on the server side.
Dan Fuhry <dan@enanocms.org>
parents: 1316
diff changeset
   617
	
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   618
	// Do we need to add captcha info?
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   619
	if ( document.getElementById('enano_editor_field_captcha') && !is_draft )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   620
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   621
		var captcha_field = document.getElementById('enano_editor_field_captcha');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   622
		if ( captcha_field.value == '' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   623
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   624
			new MessageBox(MB_OK|MB_ICONSTOP, $lang.get('editor_err_need_captcha_title'), $lang.get('editor_err_need_captcha_body'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   625
			ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   626
			return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   627
		}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   628
		json_packet.captcha_code = captcha_field.value;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   629
		json_packet.captcha_id = captcha_field.getAttribute('enano:captcha_hash');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   630
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   631
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   632
	json_packet = ajaxEscape(toJSONString(json_packet));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   633
	ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   634
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   635
			if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   636
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   637
				ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   638
				var response = String(ajax.responseText + '');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   639
				if ( !check_json_response(response) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   640
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   641
					handle_invalid_json(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   642
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   643
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   644
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   645
				response = parseJSON(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   646
				// This will only be used if there was a lower-level error.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   647
				if ( response.mode == 'error' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   648
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   649
					editor_save_lock = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   650
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   651
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   652
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   653
				// This will be used if the PageProcessor generated errors (usually security/permissions related)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   654
				if ( response.mode == 'errors' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   655
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   656
					editor_save_lock = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   657
					// This will be true if the user entered a captcha code incorrectly, thus
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   658
					// invalidating the code and requiring a new image to be generated.
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   659
					if ( response.new_captcha )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   660
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   661
						// Generate the new captcha field
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   662
						var img = document.getElementById('enano_editor_captcha_img');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   663
						var input = document.getElementById('enano_editor_field_captcha');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   664
						if ( img && input )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   665
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   666
							img._captchaHash = response.new_captcha;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   667
							input._captchaHash = response.new_captcha;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   668
							img.src = makeUrlNS('Special', 'Captcha/' + response.new_captcha);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   669
							input.value = '';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   670
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   671
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   672
					var errors = '<ul><li>' + implode('</li><li>', response.errors) + '</li></ul>';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   673
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_save_title'), $lang.get('editor_err_save_body') + errors);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   674
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   675
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   676
				// If someone else got to the page first, warn the user
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   677
				if ( response.mode == 'obsolete' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   678
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   679
					editor_save_lock = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   680
					// Update the local timestamp to allow override
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   681
					$dynano('ajaxEditArea').object._edTimestamp = response.time;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   682
					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) }));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   683
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   684
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   685
				if ( response.mode == 'success' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   686
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   687
					if ( response.is_draft )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   688
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   689
						document.getElementById('ajaxEditArea').used_draft = true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   690
						document.getElementById('ajaxEditArea').needReset = true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   691
						var img = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('img')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   692
						var lbl = $dynano('ajax_edit_savedraft_btn').object.getElementsByTagName('span')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   693
						if ( response.is_draft == 'delete' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   694
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   695
							img.src = scriptPath + '/images/editor/savedraft.gif';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   696
							lbl.innerHTML = $lang.get('editor_btn_savedraft');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   697
							
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   698
							var dn = $dynano('ajax_edit_draft_notice').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   699
							if ( dn )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   700
							{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   701
								dn.parentNode.removeChild(dn);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   702
							}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   703
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   704
						else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   705
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   706
							img.src = scriptPath + '/images/mini-info.png';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   707
							var d = new Date();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   708
							var m = String(d.getMinutes());
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   709
							if ( m.length < 2 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   710
								m = '0' + m;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   711
							var time = d.getHours() + ':' + m;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   712
							lbl.innerHTML = $lang.get('editor_msg_draft_saved', { time: time });
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   713
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   714
						editor_save_lock = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   715
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   716
					else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   717
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   718
						// The save was successful; reset flags and make another request for the new page content
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   719
						setAjaxLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   720
						editor_open = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   721
						editor_save_lock = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   722
						enableUnload();
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   723
						if ( window.page_format != 'wikitext' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   724
						{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   725
							if ( typeof(editor_formats[window.page_format].ui_destroy) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   726
							{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   727
								editor_formats[window.page_format].ui_destroy();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   728
							}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   729
						}
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   730
						changeOpac(0, 'ajaxEditContainer');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   731
						ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   732
							{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   733
								if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   734
								{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   735
									unsetAjaxLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   736
									selectButtonMajor('article');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   737
									unselectAllButtonsMinor();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   738
									
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   739
									ajaxEditorDestroyModalWindow();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   740
									document.getElementById('ajaxEditContainer').innerHTML = '<div class="usermessage">' + $lang.get('editor_msg_saved') + '</div>' + ajax.responseText;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   741
									// if we're on a userpage, call the onload function to rebuild the tabs
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   742
									if ( typeof(userpage_onload) == 'function' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   743
									{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   744
										window.userpage_blocks = [];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   745
										userpage_onload();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   746
									}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   747
									opacity('ajaxEditContainer', 0, 100, 1000);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   748
								}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   749
							});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   750
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   751
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   752
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   753
		}, 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
   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
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
   756
// 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
   757
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
   758
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   759
	miniPromptMessage({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   760
			title: $lang.get('editor_msg_confirm_delete_draft_title'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   761
			message: $lang.get('editor_msg_confirm_delete_draft_body'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   762
			buttons: [
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   763
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   764
						text: $lang.get('editor_btn_delete_draft'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   765
						color: 'red',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   766
						style: {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   767
							fontWeight: 'bold'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   768
						},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   769
						onclick: function() {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   770
							ajaxEditorDeleteDraftReal();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   771
							miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   772
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   773
					},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   774
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   775
						text: $lang.get('etc_cancel'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   776
						onclick: function() {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   777
							miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   778
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   779
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   780
				]
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   781
		});
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
   782
}
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
   783
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   784
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
   785
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   786
	return ajaxEditorSave(true, -1);
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
   787
}
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
   788
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   789
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
   790
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   791
	ajaxSetEditorLoading();
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   792
	var ta_content = ajaxEditorGetContent();
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   793
	ta_content = ajaxEscape(ta_content);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   794
	if ( $dynano('enano_editor_preview').object.innerHTML != '' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   795
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   796
		opacity('enano_editor_preview', 100, 0, 500);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   797
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   798
	ajaxPost(stdAjaxPrefix + '&_mode=preview', 'text=' + ta_content, function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   799
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   800
			if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   801
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   802
				ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   803
				changeOpac(0, 'enano_editor_preview');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   804
				$dynano('enano_editor_preview').object.innerHTML = ajax.responseText;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   805
				window.location.hash = '#ajax_preview';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   806
				opacity('enano_editor_preview', 0, 100, 500);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   807
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   808
		}, 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
   809
}
67bd3121a12e Replaced TinyMCE 2.x 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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   811
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
   812
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   813
	miniPromptMessage({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   814
			title: $lang.get('editor_msg_revert_confirm_title'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   815
			message: $lang.get('editor_msg_revert_confirm_body'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   816
			buttons: [
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   817
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   818
					text: $lang.get('editor_btn_revert_confirm'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   819
					color: 'red',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   820
					sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 48 ],
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   821
					style: {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   822
						fontWeight: 'bold'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   823
					},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   824
					onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   825
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   826
						ajaxEditorRevertToLatestReal();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   827
						miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   828
						return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   829
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   830
				},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   831
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   832
					text: $lang.get('etc_cancel'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   833
					onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   834
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   835
						miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   836
						return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   837
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   838
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   839
			]
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   840
		});
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
   841
}
67bd3121a12e Replaced TinyMCE 2.x 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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   843
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
   844
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   845
	ajaxSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   846
	ajaxGet(stdAjaxPrefix + '&_mode=getsource', function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   847
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   848
			if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   849
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   850
				ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   851
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   852
				var response = String(ajax.responseText + '');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   853
				if ( !check_json_response(response) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   854
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   855
					handle_invalid_json(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   856
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   857
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   858
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   859
				response = parseJSON(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   860
				if ( response.mode == 'error' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   861
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   862
					unselectAllButtonsMinor();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   863
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   864
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   865
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   866
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   867
				if ( !response.auth_view_source )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   868
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   869
					unselectAllButtonsMinor();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   870
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_access_denied_title'), $lang.get('editor_err_access_denied_body'));
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   871
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   872
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   873
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   874
				setTimeout(function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   875
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   876
						editor_convert_if_needed(response.page_format);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   877
						$dynano('ajaxEditArea').setContent(response.src);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   878
					}, aclDisableTransitionFX ? 10 : 750);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   879
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   880
		}, 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
   881
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   882
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   883
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
   884
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   885
	ajaxSetEditorLoading();
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   886
	var ta_content = ajaxEditorGetContent();
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   887
	ta_content = ajaxEscape(ta_content);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   888
	if ( $dynano('enano_editor_preview').object.innerHTML != '' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   889
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   890
		opacity('enano_editor_preview', 100, 0, 500);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   891
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   892
	ajaxPost(stdAjaxPrefix + '&_mode=diff_cur', 'text=' + ta_content, function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   893
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   894
			if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   895
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   896
				ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   897
				changeOpac(0, 'enano_editor_preview');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   898
				$dynano('enano_editor_preview').object.innerHTML = ajax.responseText;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   899
				window.location.hash = '#ajax_preview';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   900
				opacity('enano_editor_preview', 0, 100, 500);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   901
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   902
		}, 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
   903
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
   904
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
   905
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
   906
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   907
	miniPromptMessage({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   908
			title: $lang.get('editor_msg_cancel_confirm_title'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   909
			message: $lang.get('editor_msg_cancel_confirm_body'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   910
			buttons: [
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   911
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   912
					text: $lang.get('editor_btn_cancel_confirm'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   913
					color: 'red',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   914
					sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 16 ],
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   915
					style: {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   916
						fontWeight: 'bold'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   917
					},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   918
					onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   919
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   920
						setAjaxLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   921
						editor_open = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   922
						enableUnload();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   923
						$dynano('ajaxEditArea').destroyMCE(false);
1311
a228f7e8fb15 Added a new "hide-with-mce" CSS class in Dynano; all elements which have it will be hidden when TinyMCE is activated, and re-shown when it is destroyed.
Dan Fuhry <dan@enanocms.org>
parents: 1307
diff changeset
   924
						ajaxEditorDestroyModalWindow();
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   925
						ajaxReset();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   926
						miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   927
						return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   928
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   929
				},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   930
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   931
					text: $lang.get('editor_btn_cancel_cancel'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   932
					onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   933
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   934
						miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   935
						return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   936
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   937
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   938
			]
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   939
		});
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
   940
}
67bd3121a12e Replaced TinyMCE 2.x 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
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   942
window.ajaxSetEditorMCE = 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
   943
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   944
	if ( editor_loading )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   945
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   946
	
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   947
	var len = 0;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   948
	for ( var i in editor_formats )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   949
	{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   950
		len++;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   951
	}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   952
	
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   953
	if ( len == 0 )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   954
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   955
		miniPromptMessage({
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   956
				title: $lang.get('editor_msg_convert_no_plugins_title'),
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   957
				message: $lang.get('editor_msg_convert_no_plugins_body'),
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   958
				buttons: [
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   959
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   960
						text: $lang.get('etc_cancel'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   961
						onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   962
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   963
							miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   964
							return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   965
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   966
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   967
				]
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   968
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   969
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   970
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
   971
	
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   972
	var mp = miniPrompt(function(div)
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   973
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   974
			$(div).css('text-align', 'center');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   975
			$(div).append('<h3>' + $lang.get('editor_msg_convert_confirm_title') + '</h3>');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   976
			$(div).append('<p>' + $lang.get('editor_msg_convert_confirm_body') + '</p>');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   977
			var select = '<select class="format">';
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   978
			for ( var i in editor_formats )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   979
			{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   980
				var obj = editor_formats[i];
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   981
				select += '<option value="' + i + '">' + $lang.get(obj.name) + '</option>';
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   982
			}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   983
			select += '</select>';
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   984
			
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   985
			$(div).append('<p class="format_drop">' + $lang.get('editor_msg_convert_lbl_plugin') + select + '</p>');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   986
			$(div).append('<p><a href="#" class="abutton abutton_green go_action" style="font-weight: bold;">' + gen_sprite_html(editor_img_path + '/sprite.png', 16, 16, 0, 112) + $lang.get('editor_btn_graphical_convert') + '</a>'
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   987
					+ '<a href="#" class="abutton cancel_action">' + $lang.get('etc_cancel') + '</a></p>');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   988
			
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   989
			$('a.go_action', div).click(function()
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   990
				{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   991
					// go ahead with converting to this format
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   992
					
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   993
					var parent = miniPromptGetParent(this);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   994
					var whitey = whiteOutMiniPrompt(parent);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   995
					var plugin = $('select.format', parent).val();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   996
					ajaxEditorSetFormat(plugin, function()
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   997
						{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   998
							if ( typeof(whitey) == 'object' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
   999
								whiteOutReportSuccess(whitey);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1000
						});
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1001
					return false;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1002
				});
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1003
			
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1004
			$('a.cancel_action', div).click(function()
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1005
				{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1006
					miniPromptDestroy(this);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1007
					return false;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1008
				});
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1009
		});
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1010
	
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1011
	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
  1012
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1013
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
  1014
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
  1015
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1016
	if ( editor_loading )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1017
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1018
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1019
	if ( !confirmed )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1020
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1021
		miniPromptMessage({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1022
				title: $lang.get('editor_msg_convert_confirm_title'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1023
				message: $lang.get('editor_msg_convert_confirm_body'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1024
				buttons: [
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1025
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1026
						color: 'green',
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1027
						text: $lang.get('editor_btn_wikitext'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1028
						style: {
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1029
							fontWeight: 'bold'
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1030
						},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1031
						sprite: [ editor_img_path + '/sprite.png', 16, 16, 0, 96 ],
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1032
						onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1033
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1034
							ajaxSetEditorPlain(true);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1035
							miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1036
							return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1037
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1038
					},
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1039
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1040
						text: $lang.get('etc_cancel'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1041
						onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1042
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1043
							miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1044
							return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1045
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1046
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1047
				]
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1048
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1049
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1050
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1051
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1052
	// Clear out existing buttons
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1053
	var span_wiki = $dynano('enano_edit_btn_pt').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1054
	var span_mce  = $dynano('enano_edit_btn_mce').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1055
	span_wiki.style.display = 'none';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1056
	span_mce.style.display = 'inline';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1057
	
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1058
	// Swap editor
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1059
	if ( typeof(editor_formats[window.page_format].ui_destroy) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1060
	{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1061
		if ( typeof(editor_formats[window.page_format].convert_from) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1062
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1063
			var text = ajaxEditorGetContent();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1064
			var newtext = editor_formats[window.page_format].convert_from(text);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1065
			if ( typeof(newtext) != 'string' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1066
				newtext = text;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1067
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1068
		editor_formats[window.page_format].ui_destroy();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1069
		$('#ajaxEditArea').val(newtext);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1070
	}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1071
	
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1072
	window.page_format = 'wikitext';
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
  1073
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1074
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1075
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
  1076
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1077
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
  1078
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1079
	var ed = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1080
	if ( window.tinyMCE )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1081
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1082
		ed = tinyMCE.get('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1083
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1084
	editor_loading = true;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1085
	if ( ed )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1086
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1087
		ed.setProgressState(1);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1088
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1089
	else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1090
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1091
		ed = document.getElementById('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1092
		var blackout = document.createElement('div');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1093
		blackout.style.position = 'absolute';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1094
		blackout.style.top = $dynano('ajaxEditArea').Top() + 'px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1095
		blackout.style.left = $dynano('ajaxEditArea').Left() + 'px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1096
		blackout.style.width = $dynano('ajaxEditArea').Width() + 'px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1097
		blackout.style.height = $dynano('ajaxEditArea').Height() + 'px';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1098
		blackout.style.backgroundColor = '#FFFFFF';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1099
		domObjChangeOpac(60, blackout);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1100
		blackout.style.backgroundImage = 'url(' + scriptPath + '/includes/clientside/tinymce/themes/advanced/skins/default/img/progress.gif)';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1101
		blackout.style.backgroundPosition = 'center center';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1102
		blackout.style.backgroundRepeat = 'no-repeat';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1103
		blackout.id = 'enano_editor_blackout';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1104
		blackout.style.zIndex = getHighestZ() + 2;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1105
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1106
		var body = document.getElementsByTagName('body')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1107
		body.appendChild(blackout);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1108
	}
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
  1109
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1110
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1111
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
  1112
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1113
	editor_loading = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1114
	var ed = false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1115
	if ( window.tinyMCE )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1116
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1117
		ed = tinyMCE.get('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1118
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1119
	if ( ed )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1120
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1121
		ed.setProgressState(0);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1122
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1123
	else
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1124
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1125
		var blackout = document.getElementById('enano_editor_blackout');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1126
		var body = document.getElementsByTagName('body')[0];
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1127
		if ( !blackout )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1128
			return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1129
		body.removeChild(blackout);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1130
	}
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
  1131
}
67bd3121a12e Replaced TinyMCE 2.x with 3.0 beta 3. Supports everything but IE. Also rewrote the editor interface completely from the ground up.
Dan
parents: 117
diff changeset
  1132
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1133
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
  1134
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1135
	var aed = document.getElementById('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1136
	if ( !aed )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1137
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1138
	var last_save = aed.as_last_save;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1139
	var now = unix_time();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1140
	if ( ( last_save + 120 ) < now && aed.value != aed.content_orig )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1141
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1142
		ajaxPerformAutosave();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1143
	}
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
  1144
}
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
  1145
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1146
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
  1147
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1148
	var aed = document.getElementById('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1149
	if ( !aed )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1150
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1151
	var now = unix_time();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1152
	aed.as_last_save = now;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1153
	
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1154
	var ta_content = ajaxEditorGetContent();
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1155
	
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
  1156
	if ( ta_content == '' || ta_content == '<p></p>' || ta_content == '<p>&nbsp;</p>' || ta_content == editor_orig_text || ta_content == editor_last_draft )
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1157
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1158
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1159
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1160
	
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
  1161
	editor_last_draft = ta_content;
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
  1162
	
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1163
	ajaxEditorSave(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
  1164
}
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
  1165
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 572
diff changeset
  1166
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
  1167
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1168
	var aed = document.getElementById('ajaxEditArea');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1169
	if ( !aed )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1170
		return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1171
	ajaxSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1172
	ajaxGet(stdAjaxPrefix + '&_mode=getsource&get_draft=1', function(ajax)
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1173
		{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1174
			if ( ajax.readyState == 4 && ajax.status == 200 )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1175
			{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1176
				ajaxUnSetEditorLoading();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1177
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1178
				var response = String(ajax.responseText + '');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1179
				if ( !check_json_response(response) )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1180
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1181
					handle_invalid_json(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1182
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1183
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1184
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1185
				response = parseJSON(response);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1186
				if ( response.mode == 'error' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1187
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1188
					unselectAllButtonsMinor();
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1189
					new MessageBox(MB_OK | MB_ICONSTOP, $lang.get('editor_err_server'), response.error);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1190
					return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1191
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1192
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1193
				editor_convert_if_needed(response.page_format);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1194
				
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1195
				if ( response.page_format != 'wikitext' && typeof(editor_formats[response.page_format]) == 'object' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1196
				{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1197
					if ( typeof(editor_formats[response.page_format].set_text) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1198
					{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1199
						editor_formats[response.page_format].set_text(response.src);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1200
					}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1201
					else
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1202
					{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1203
						$('#ajaxEditArea').val(response.src);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1204
					}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1205
				}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1206
				else
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1207
				{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1208
					$('#ajaxEditArea').val(response.src);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1209
				}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1210
				
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1211
				$dynano('ajaxEditArea').object.used_draft = true;
1307
5d9f6ecf748e Added an editor hook that allows plugins to insert their own content right before the editor box.
Dan Fuhry <dan@enanocms.org>
parents: 1291
diff changeset
  1212
				editor_orig_text = editor_last_draft = response.src;
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1213
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1214
				var es = document.getElementById('enano_editor_field_summary');
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1215
				if ( es.value == '' )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1216
				{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1217
					es.value = response.edit_summary;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1218
				}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1219
				
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1220
				var dn = $dynano('ajax_edit_draft_notice').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1221
				dn.parentNode.removeChild(dn);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1222
			}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1223
		}, 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
  1224
}
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
  1225
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
  1226
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
  1227
{
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1228
	// Do we need to change the format?
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1229
	var need_to_mce = ( targetformat != 'wikitext' && page_format == 'wikitext' );
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1230
	var need_to_wkt = ( targetformat == 'wikitext' && page_format != 'wikitext' );
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1231
	if ( need_to_mce )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1232
	{
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1233
		editor_formats[targetformat].ui_construct();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1234
		window.page_format = targetformat;
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1235
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1236
		// Clear out existing buttons
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1237
		var span_wiki = $dynano('enano_edit_btn_pt').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1238
		var span_mce  = $dynano('enano_edit_btn_mce').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1239
		span_wiki.style.display = 'inline';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1240
		span_mce.style.display = 'none';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1241
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1242
	else if ( need_to_wkt )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1243
	{
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1244
		editor_formats[window.page_format].ui_construct();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1245
		window.page_format = 'wikitext';
1227
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1246
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1247
		// Clear out existing buttons
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1248
		var span_wiki = $dynano('enano_edit_btn_pt').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1249
		var span_mce  = $dynano('enano_edit_btn_mce').object;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1250
		span_wiki.style.display = 'none';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1251
		span_mce.style.display = 'inline';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1252
	}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1253
	if ( need_to_mce || need_to_wkt )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1254
	{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1255
		// explain the conversion
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1256
		if ( !noticetitle )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1257
			noticetitle = 'editor_msg_convert_draft_load_title';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1258
		if ( !noticebody )
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1259
			noticebody = 'editor_msg_convert_draft_load_body';
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1260
		
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1261
		miniPromptMessage({
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1262
				title: $lang.get(noticetitle),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1263
				message: $lang.get(noticebody),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1264
				buttons: [
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1265
					{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1266
						text: $lang.get('etc_ok'),
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1267
						onclick: function()
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1268
						{
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1269
							miniPromptDestroy(this);
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1270
							return false;
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1271
						}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1272
					}
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1273
				]
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1274
			});
bdac73ed481e Going ahead with the switch to tabs. This is a major coding standards change! If any unusual parser bugs show up, check this changeset. Converted all .php, .js, .tpl, .css, and .json files and did basic testing.
Dan
parents: 1102
diff changeset
  1275
	}
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
  1276
}
1343
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1277
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1278
window.ajaxEditorSetFormat = function(plugin, success_func)
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1279
	{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1280
		// perform conversion
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1281
		if ( typeof(editor_formats[plugin].convert_to) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1282
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1283
			var result = editor_formats[plugin].convert_to($('#ajaxEditArea').val());
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1284
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1285
		else
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1286
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1287
			var result = $('#ajaxEditArea').val();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1288
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1289
		if ( typeof(result) != 'string' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1290
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1291
			result = $('#ajaxEditArea').val();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1292
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1293
		$('#ajaxEditArea').val(result);
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1294
		if ( typeof(editor_formats[plugin].ui_construct) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1295
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1296
			editor_formats[plugin].ui_construct();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1297
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1298
		success_func();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1299
		window.page_format = plugin;
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1300
		
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1301
		// change the buttons over
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1302
		$('#enano_edit_btn_pt').css('display', 'inline');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1303
		$('#enano_edit_btn_mce').css('display', 'none');
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1304
	};
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1305
	
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1306
window.ajaxEditorGetContent = function()
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1307
	{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1308
		if ( window.page_format == 'wikitext' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1309
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1310
			return $('#ajaxEditArea').val();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1311
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1312
		else
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1313
		{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1314
			if ( typeof(editor_formats[window.page_format].get_text) == 'function' )
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1315
			{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1316
				return editor_formats[window.page_format].get_text();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1317
			}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1318
			else
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1319
			{
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1320
				return $('#ajaxEditArea').val();
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1321
			}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1322
		}
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1323
	};
2a31905a567d Removed explicit TinyMCE support, replaced with support for arbitrary page_formats. The TinyMCE files will be removed in an upcoming commit.
Dan Fuhry <dan@enanocms.org>
parents: 1334
diff changeset
  1324