includes/clientside/static/ajax.js
author Dan
Tue, 19 Aug 2008 20:57:57 -0400
changeset 698 40f9528b6348
parent 696 bd5069e1f19a
child 699 c7d737202d59
permissions -rw-r--r--
Merge? o_O
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
/*
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
 * AJAX applets
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     3
 */
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     4
 
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
     5
window.ajaxReset = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
     6
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
     7
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
     8
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
     9
    return true;
566
06d241de3151 Made ajaxReset() call the actual requested title instead of effective title; fixed (again) template compiler bug not matching certain tags (probably PCRE bug)
Dan
parents: 560
diff changeset
    10
  var ns_id = strToPageID(physical_title);
221
e5302cb1945c Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents: 215
diff changeset
    11
  if ( ns_id[1] == 'Special' || ns_id[1] == 'Admin' )
e5302cb1945c Localized a good part, if not all, of the registration page and a couple other things.
Dan
parents: 215
diff changeset
    12
    return false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    13
  enableUnload();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    14
  setAjaxLoading();
566
06d241de3151 Made ajaxReset() call the actual requested title instead of effective title; fixed (again) template compiler bug not matching certain tags (probably PCRE bug)
Dan
parents: 560
diff changeset
    15
  var redir = ( disable_redirect ) ? '&redirect=no' : '';
06d241de3151 Made ajaxReset() call the actual requested title instead of effective title; fixed (again) template compiler bug not matching certain tags (probably PCRE bug)
Dan
parents: 560
diff changeset
    16
  ajaxGet(scriptPath + '/ajax.php?title=' + physical_title +'&_mode=getpage&noheaders' + redir, function() {
430
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 420
diff changeset
    17
    // Allow for 404 here, it's generated by the "page not found" error message
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 420
diff changeset
    18
    // (even with noheaders specified, probably should be fixed)
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 420
diff changeset
    19
    if ( ajax.readyState == 4 && ( ajax.status == 200 || ajax.status == 404 ) ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    20
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    21
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    22
      selectButtonMajor('article');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    23
      unselectAllButtonsMinor();
672
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
    24
      // if we're on a userpage, call the onload function to rebuild the tabs
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
    25
      if ( typeof(userpage_onload) == 'function' )
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
    26
      {
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
    27
        window.userpage_blocks = [];
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
    28
        userpage_onload();
08a7875258b4 Added tab-based interface to userpage UI. Yes, it is plugin expansible, and yes, it breaks existing plugins that add code to the userpage (but that can be fixed with a "colspan=4")
Dan
parents: 651
diff changeset
    29
      }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    30
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    31
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    34
// Miscellaneous AJAX applets
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    35
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    36
window.ajaxProtect = function(l) {
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    37
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    38
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    39
    return true;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    40
  load_component('l10n');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    41
  
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    42
  if(shift) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    43
    r = 'NO_REASON';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    44
  } else {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
    45
    r = prompt($lang.get('ajax_protect_prompt_reason'));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    46
    if(!r || r=='') return;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    47
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    48
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    49
  document.getElementById('protbtn_0').style.textDecoration = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    50
  document.getElementById('protbtn_1').style.textDecoration = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    51
  document.getElementById('protbtn_2').style.textDecoration = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    52
  document.getElementById('protbtn_'+l).style.textDecoration = 'underline';
298
39c132e69781 Hopefully now all calls to escape() are replaced with ajaxEscape() in response to Tomasz's forum post; remove deprecated version of show_category_info() from functions.php
Dan
parents: 175
diff changeset
    53
  ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
    54
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    55
      unsetAjaxLoading();
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    56
      if(ajax.responseText == 'good')
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    57
        return true;
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    58
      // check for JSON error response
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    59
      var response = String(ajax.responseText + '');
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    60
      if ( response.substr(0, 1) == '{' )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    61
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    62
        response = parseJSON(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    63
        if ( response.mode == 'error' )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    64
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    65
          alert(response.error);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    66
          return true;
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    67
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    68
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
    69
      alert(ajax.responseText);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    70
    }
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: 329
diff changeset
    71
  }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    72
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    73
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    74
window.ajaxRename = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    75
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    76
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    77
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
    78
    return true;
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    79
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    80
  // updated - 1.1.4 to use miniPrompt
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    81
  load_component('l10n');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
    82
  load_component('messagebox');
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    83
  miniPrompt(ajaxRenameConstructDialog);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    84
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    85
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    86
var ajaxRenameConstructDialog = function(div)
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    87
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    88
  // title
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    89
  var heading = document.createElement('h3');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    90
  heading.appendChild(document.createTextNode($lang.get('ajax_rename_prompt_short')));
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    91
  div.appendChild(heading);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    92
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    93
  // form
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    94
  var form = document.createElement('form');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    95
  form.action = 'javascript:void(0);';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    96
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    97
  // box
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    98
  var box = document.createElement('input');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
    99
  box.size = '43';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   100
  box.style.width = '100%';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   101
  form.appendChild(box);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   102
  div.appendChild(form);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   103
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   104
  // notice
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   105
  var notice = document.createElement('small');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   106
  notice.appendChild(document.createTextNode($lang.get('ajax_rename_notice')));
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   107
  div.appendChild(notice);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   108
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   109
  // button area
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   110
  var btndiv = document.createElement('div');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   111
  btndiv.className = 'mp-buttons';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   112
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   113
  // buttons
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   114
  var btn_submit = document.createElement('a');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   115
  btn_submit.href = '#';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   116
  btn_submit.appendChild(document.createTextNode($lang.get('etc_go')));
537
547b7ba6d535 Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents: 527
diff changeset
   117
  btn_submit.className = 'abutton abutton_green';
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   118
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   119
  var btn_cancel = document.createElement('a');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   120
  btn_cancel.href = '#';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   121
  btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
537
547b7ba6d535 Added a really simple message box system based on miniPrompts, this will be used for confirmation windows like delete_page, clear_logs, delvote, etc.
Dan
parents: 527
diff changeset
   122
  btn_cancel.className = 'abutton';
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   123
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   124
  btndiv.appendChild(btn_submit);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   125
  btndiv.appendChild(document.createTextNode(' | '));
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   126
  btndiv.appendChild(btn_cancel);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   127
  div.appendChild(btndiv);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   128
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   129
  // events
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   130
  btn_submit.onclick = function()
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   131
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   132
    ajaxRenameSubmit(this);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   133
    return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   134
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   135
  btn_cancel.onclick = function()
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   136
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   137
    miniPromptDestroy(this);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   138
    return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   139
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   140
  form.onsubmit = function()
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   141
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   142
    ajaxRenameSubmit(this);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   143
    return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   144
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   145
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   146
  setTimeout(function()
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   147
    {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   148
      box.focus();
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   149
    }, 200);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   150
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   151
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   152
window.ajaxRenameSubmit = function(obj)
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   153
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   154
  var box = miniPromptGetParent(obj);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   155
  if ( !box )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   156
    return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   157
  
592
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   158
  var input = obj.getElementsByTagName('input')[0];
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   159
  console.debug(obj, input);
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   160
  if ( !input )
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   161
    return false;
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   162
  var newname = input.value;
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   163
  newname = trim(newname);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   164
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   165
  if ( newname.length < 1 )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   166
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   167
    alert($lang.get('ajax_rename_too_short'));
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   168
    return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   169
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   170
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   171
  if ( !newname )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   172
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   173
    return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   174
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   175
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   176
  var innerBox = getElementsByClassName(box, 'div', 'mp-body')[0];
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   177
  var whiteout = whiteOutElement(innerBox);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   178
  whiteout.style.width = ( $(whiteout).Width() - 78 ) + 'px';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   179
  whiteout.style.left = ( $(whiteout).Left() + 44 ) + 'px';
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   180
  
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   181
  ajaxPost(stdAjaxPrefix + '&_mode=rename', 'newtitle=' + ajaxEscape(newname), function()
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   182
    {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   183
      if ( ajax.readyState == 4 && ajax.status == 200 )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   184
      {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   185
        whiteout.parentNode.removeChild(whiteout);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   186
        var response = String(ajax.responseText);
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
   187
        if ( !check_json_response(response) )
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   188
        {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   189
          handle_invalid_json(response);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   190
          return false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   191
        }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   192
        response = parseJSON(response);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   193
        if ( response.success )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   194
        {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   195
          miniPromptDestroy(box, true);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   196
          ajaxRenameDoClientTransform(newname);
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: 539
diff changeset
   197
          new MessageBox( MB_OK|MB_ICONINFORMATION, $lang.get('ajax_rename_success_title'), $lang.get('ajax_rename_success_body', { page_name_new: newname }) );
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   198
          mb_previously_had_darkener = false;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   199
        }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   200
        else
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   201
        {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   202
          var errmsg = $lang.get('page_err_' + response.error);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   203
          alert(errmsg);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   204
        }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   205
      }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   206
    }, true);
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   207
}
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   208
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   209
window.ajaxRenameDoClientTransform = function(newname)
522
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   210
{
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   211
  var obj = document.getElementById('h2PageName');
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   212
  if ( obj )
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   213
  {
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   214
    obj.firstChild.nodeValue = newname;
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   215
  }
fd46b1bf708e Dramatically improved the page-rename UX and added a miniPrompt API that allows small pop-down prompts as opposed to prompt() or confirm().
Dan
parents: 481
diff changeset
   216
  document.title = newname;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   217
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   218
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   219
window.ajaxDeletePage = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   220
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   221
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   222
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   223
    return true;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   224
  load_component('l10n');
696
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   225
  load_component('messagebox');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   226
  load_component('SpryEffects');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   227
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   228
  // stage 1: prompt for reason and confirmation
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   229
  miniPrompt(function(parent)
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   230
    {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   231
      // heading/title
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   232
      var h3 = document.createElement('h3');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   233
      h3.appendChild(document.createTextNode($lang.get('ajax_delete_header')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   234
      parent.appendChild(h3);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   235
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   236
      // "please enter your reason"
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   237
      var p1 = document.createElement('p');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   238
      p1.appendChild(document.createTextNode($lang.get('ajax_delete_prompt_reason')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   239
      parent.appendChild(p1);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   240
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   241
      // textbox + label thereof
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   242
      var p2 = document.createElement('p');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   243
      var tb = document.createElement('input');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   244
      var dl = document.createElement('label');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   245
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   246
      tb.type = 'text';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   247
      tb.size = '30';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   248
      tb.onkeyup = function(e)
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   249
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   250
        if ( e )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   251
        if ( e.keyCode )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   252
        if ( e.keyCode == 13 )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   253
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   254
          if ( ajaxDeletePageSubmit(this) )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   255
          {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   256
            miniPromptDestroy(this);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   257
          }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   258
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   259
        else if ( e.keyCode == 27 )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   260
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   261
          miniPromptDestroy(this);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   262
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   263
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   264
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   265
      dl.appendChild(document.createTextNode($lang.get('ajax_delete_lbl_reason') + ' '));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   266
      dl.appendChild(tb);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   267
      p2.appendChild(dl);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   268
      parent.appendChild(p2);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   269
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   270
      // notice underneath
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   271
      var p3 = document.createElement('p');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   272
      p3.style.fontSize = 'smaller';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   273
      p3.appendChild(document.createTextNode($lang.get('ajax_delete_msg_confirm')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   274
      parent.appendChild(p3);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   275
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   276
      // confirmation + submit/cancel (structure)
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   277
      var divleft  = document.createElement('div');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   278
      var divright = document.createElement('div');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   279
      var divclear = document.createElement('div');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   280
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   281
      divleft.style.cssFloat = 'left';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   282
      divleft.style.styleFloat = 'left';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   283
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   284
      divright.style.cssFloat = 'right';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   285
      divright.style.styleFloat = 'right';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   286
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   287
      divclear.style.clear = 'both';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   288
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   289
      parent.appendChild(divleft);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   290
      parent.appendChild(divright);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   291
      parent.appendChild(divclear);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   292
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   293
      // confirmation + submit/cancel (controls)
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   294
      var cb = document.createElement('input');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   295
      var cl = document.createElement('label');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   296
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   297
      cb.type = 'checkbox';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   298
      cb.checked = false;
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   299
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   300
      // a bit of a hack here, doesn't seem to work in fx3
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   301
      cb.onblur = function(e)
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   302
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   303
        var parent = this.parentNode.parentNode.parentNode;
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   304
        var submitter = parent.getElementsByTagName('a')[0];
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   305
        if ( submitter )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   306
          submitter.focus();
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   307
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   308
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   309
      cl.appendChild(cb);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   310
      cl.appendChild(document.createTextNode(' ' + $lang.get('ajax_delete_lbl_confirm')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   311
      divleft.appendChild(cl);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   312
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   313
      var btn_submit = document.createElement('a');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   314
      btn_submit.className = 'abutton abutton_red';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   315
      btn_submit.href = '#';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   316
      btn_submit.appendChild(document.createTextNode($lang.get('ajax_delete_btn_delete')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   317
      btn_submit.onclick = function()
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   318
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   319
        if ( ajaxDeletePageSubmit(this) )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   320
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   321
          miniPromptDestroy(this);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   322
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   323
        return false;
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   324
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   325
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   326
      var btn_cancel = document.createElement('a');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   327
      btn_cancel.className = 'abutton';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   328
      btn_cancel.href = '#';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   329
      btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   330
      btn_cancel.onclick = function()
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   331
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   332
        miniPromptDestroy(this);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   333
        return false;
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   334
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   335
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   336
      divright.appendChild(btn_submit);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   337
      divright.appendChild(document.createTextNode(' '));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   338
      divright.appendChild(btn_cancel);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   339
      
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   340
      var timeout = ( aclDisableTransitionFX ) ? 10 : 1000;
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   341
      setTimeout(function()
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   342
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   343
          tb.focus();
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   344
        }, timeout);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   345
    });
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   346
}
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   347
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   348
window.ajaxDeletePageSubmit = function(prompt_obj)
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   349
{
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   350
  prompt_obj = miniPromptGetParent(prompt_obj).childNodes[1];
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   351
  var inputs = prompt_obj.getElementsByTagName('input');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   352
  var reason = inputs[0];
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   353
  var confirm = inputs[1];
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   354
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   355
  if ( trim(reason.value) == '' )
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   356
  {
696
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   357
    // flash the background of the reason entry
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   358
    if ( !reason.sfx )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   359
      reason.sfx = new Spry.Effect.Highlight(reason.parentNode);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   360
    
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   361
    reason.sfx.start();
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   362
    return false;
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   363
  }
696
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   364
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   365
  if ( !confirm.checked )
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   366
  {
696
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   367
    // flash the background of the confirm checkbox
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   368
    if ( !confirm.sfx )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   369
      confirm.sfx = new Spry.Effect.Highlight(confirm.parentNode);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   370
    
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   371
    confirm.sfx.start();
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   372
    return false;
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   373
  }
696
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   374
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   375
  prompt_obj.innerHTML = '<img alt="loading" style="display: block; margin: 0 auto;" src="' + cdnPath + '/images/loading-big.gif" />';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   376
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   377
  // tenemos la confirmación y la razón - borre la página.
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   378
  setAjaxLoading();
696
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   379
  ajaxPost(stdAjaxPrefix + '&_mode=deletepage', 'reason=' + ajaxEscape(trim(reason.value)), function()
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   380
    {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   381
      if ( ajax.readyState == 4 && ajax.status == 200 )
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   382
      {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   383
        unsetAjaxLoading();
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   384
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   385
        // show the response in the same prompt window
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   386
        prompt_obj.style.textAlign = 'center';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   387
        prompt_obj.innerHTML = '';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   388
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   389
        var p1 = document.createElement('div');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   390
        p1.style.marginBottom = '15px';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   391
        p1.appendChild(document.createTextNode(ajax.responseText));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   392
        prompt_obj.appendChild(p1);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   393
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   394
        var p2 = document.createElement('p');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   395
        var a = document.createElement('a');
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   396
        a.className = 'abutton';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   397
        a.href = '#';
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   398
        a.appendChild(document.createTextNode($lang.get('etc_close')));
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   399
        a.onclick = function()
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   400
        {
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   401
          miniPromptDestroy(this);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   402
          window.location.reload();
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   403
          return false;
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   404
        }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   405
        p2.appendChild(a);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   406
        prompt_obj.appendChild(a);
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   407
        
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   408
        a.focus();
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   409
      }
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   410
    });
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   411
  
bd5069e1f19a Revamped page deletion interface; fixed bug where page_meta cache was not being cleared upon restoration of deleted page.
Dan
parents: 672
diff changeset
   412
  return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   413
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   414
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   415
window.ajaxDelVote = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   416
{
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   417
  load_component('l10n');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   418
  load_component('messagebox');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   419
  
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   420
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   421
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   422
    return true;
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   423
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   424
      title: $lang.get('ajax_delvote_confirm_title'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   425
      message: $lang.get('ajax_delvote_confirm_body'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   426
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   427
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   428
          text: $lang.get('ajax_delvote_btn_submit'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   429
          color: 'red',
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   430
          style: {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   431
            fontWeight: 'bold'
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   432
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   433
          onclick: function(e)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   434
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   435
            miniPromptDestroy(this);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   436
            setAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   437
            ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   438
              if ( ajax.readyState == 4 && ajax.status == 200 ) {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   439
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   440
                alert(ajax.responseText);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   441
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   442
            }, true);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   443
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   444
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   445
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   446
          text: $lang.get('etc_cancel'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   447
          onclick: function(e)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   448
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   449
            miniPromptDestroy(this);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   450
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   451
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   452
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   453
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   454
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   455
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   456
window.ajaxResetDelVotes = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   457
{
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   458
  load_component('l10n');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   459
  load_component('messagebox');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   460
  
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   461
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   462
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   463
    return true;
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   464
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   465
      title: $lang.get('ajax_delvote_reset_confirm_title'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   466
      message: $lang.get('ajax_delvote_reset_confirm_body'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   467
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   468
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   469
          text: $lang.get('ajax_delvote_reset_btn_submit'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   470
          color: 'red',
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   471
          style: {
555
ac4c6a7f01d8 Added user preference for disabling visual effects in Javascript applets; added re-import button to installed plugins
Dan
parents: 550
diff changeset
   472
            fontWeight: 'bold'
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   473
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   474
          onclick: function(e)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   475
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   476
            miniPromptDestroy(this);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   477
            setAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   478
            ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   479
              if ( ajax.readyState == 4 && ajax.status == 200 ) {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   480
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   481
                alert(ajax.responseText);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   482
                item = document.getElementById('mdgDeleteVoteNoticeBox');
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   483
                if(item)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   484
                {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   485
                  opacity('mdgDeleteVoteNoticeBox', 100, 0, 1000);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   486
                  setTimeout("document.getElementById('mdgDeleteVoteNoticeBox').style.display = 'none';", 1000);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   487
                }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   488
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   489
            }, true);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   490
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   491
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   492
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   493
          text: $lang.get('etc_cancel'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   494
          onclick: function(e)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   495
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   496
            miniPromptDestroy(this);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   497
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   498
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   499
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   500
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   501
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   502
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   503
// Editing/saving category information
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   504
// This was not easy to write, I hope enjoy it, and dang I swear I'm gonna
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   505
// find someone to work on just the Javascript part of Enano...
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   506
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   507
window.ajaxCatEdit = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   508
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   509
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   510
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   511
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   512
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   513
  ajaxGet(stdAjaxPrefix+'&_mode=catedit', function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   514
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   515
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   516
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   517
      eval(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   518
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   519
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   520
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   521
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   522
window.ajaxCatSave = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   523
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   524
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   525
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   526
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   527
  if(!catlist)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   528
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   529
    alert('Var catlist has no properties');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   530
    return;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   531
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   532
  query='';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   533
  for(i=0;i<catlist.length;i++)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   534
  {
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   535
    var s = ( document.forms.mdgCatForm['mdgCat_' + catlist[i]]['checked'] ) ? true : false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   536
    if(s) query = query + '&' + catlist[i] + '=true';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   537
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   538
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   539
  query = query.substring(1, query.length);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   540
  ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   541
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   542
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   543
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   544
      if(ajax.responseText != 'GOOD') alert(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   545
      ajaxReset();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   546
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   547
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   548
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   549
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   550
// History stuff
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   551
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   552
window.ajaxHistory = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   553
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   554
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   555
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   556
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   557
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   558
  ajaxGet(stdAjaxPrefix+'&_mode=histlist', function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   559
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   560
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   561
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   562
      selectButtonMajor('article');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   563
      selectButtonMinor('history');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   564
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   565
      buildDiffList();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   566
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   567
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   568
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   569
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   570
window.ajaxHistView = function(oldid, ttl) {
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   571
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   572
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   573
    return true;
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   574
  if(!ttl) ttl=title;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   575
  setAjaxLoading();
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   576
  ajaxGet(append_sid(scriptPath+'/ajax.php?title='+ttl+'&_mode=getpage&oldid='+oldid), function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   577
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   578
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   579
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   580
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   581
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   582
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   583
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   584
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   585
window.ajaxRollback = function(id) {
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   586
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   587
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   588
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   589
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   590
  ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   591
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   592
      unsetAjaxLoading();
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   593
      
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   594
      var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
   595
      if ( !check_json_response(response) )
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   596
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   597
        handle_invalid_json(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   598
        return false;
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   599
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   600
      
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   601
      response = parseJSON(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   602
      if ( response.success )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   603
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   604
        alert( $lang.get('page_msg_rb_success_' + response.action, { dateline: response.dateline }) )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   605
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   606
      else
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   607
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   608
        if ( response.action )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   609
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   610
          alert( $lang.get('page_err_' + response.error, { action: response.action }) );
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   611
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   612
        else
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   613
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   614
          alert( $lang.get('page_err_' + response.error) );
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   615
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   616
      }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   617
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   618
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   619
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   620
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   621
window.ajaxClearLogs = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   622
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   623
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   624
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   625
    return true;
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   626
  
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   627
  load_component('l10n');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   628
  load_component('messagebox');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   629
  
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   630
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   631
      title: $lang.get('ajax_clearlogs_confirm_title'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   632
      message: $lang.get('ajax_clearlogs_confirm_body'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   633
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   634
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   635
          text: $lang.get('ajax_clearlogs_btn_submit'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   636
          color: 'red',
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   637
          style: {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   638
            fontWeight: 'bold'
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   639
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   640
          onclick: function(e)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   641
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   642
            miniPromptDestroy(this);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   643
            setAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   644
            ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   645
              if ( ajax.readyState == 4 && ajax.status == 200 ) {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   646
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   647
                alert(ajax.responseText);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   648
                window.location.reload();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   649
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   650
            });
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   651
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   652
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   653
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   654
          text: $lang.get('etc_cancel'),
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   655
          onclick: function(e)
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   656
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   657
            miniPromptDestroy(this);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   658
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   659
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   660
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   661
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   662
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   663
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   664
window.buildDiffList = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   665
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   666
  arrDiff1Buttons = getElementsByClassName(document, 'input', 'clsDiff1Radio');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   667
  arrDiff2Buttons = getElementsByClassName(document, 'input', 'clsDiff2Radio');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   668
  var len = arrDiff1Buttons.length;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   669
  if ( len < 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   670
    return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   671
  timelist = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   672
  for ( var i = 0; i < len; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   673
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   674
    timelist.push( arrDiff2Buttons[i].id.substr(6) );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   675
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   676
  timelist.push( arrDiff1Buttons[len-1].id.substr(6) );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   677
  delete(timelist.toJSONString);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   678
  for ( var i = 1; i < timelist.length-1; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   679
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   680
    if ( i >= timelist.length ) break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   681
    arrDiff2Buttons[i].style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   682
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   683
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   684
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   685
window.selectDiff1Button = function(obj)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   686
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   687
  var this_time = obj.id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   688
  var index = parseInt(in_array(this_time, timelist));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   689
  for ( var i = 0; i < timelist.length - 1; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   690
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   691
    if ( i < timelist.length - 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   692
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   693
      var state = ( i < index ) ? 'inline' : 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   694
      var id = 'diff2_' + timelist[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   695
      document.getElementById(id).style.display = state;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   696
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   697
      // alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   698
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   699
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   700
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   701
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   702
window.selectDiff2Button = function(obj)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   703
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   704
  var this_time = obj.id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   705
  var index = parseInt(in_array(this_time, timelist));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   706
  for ( var i = 1; i < timelist.length; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   707
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   708
    if ( i < timelist.length - 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   709
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   710
      var state = ( i > index ) ? 'inline' : 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   711
      var id = 'diff1_' + timelist[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   712
      document.getElementById(id).style.display = state;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   713
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   714
      // alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   715
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   716
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   717
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   718
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   719
window.ajaxHistDiff = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   720
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   721
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   722
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   723
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   724
  var id1=false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   725
  var id2=false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   726
  for ( i = 0; i < arrDiff1Buttons.length; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   727
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   728
    k = i + '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   729
    kpp = i + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   730
    kpp = kpp + '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   731
    if(arrDiff1Buttons[k].checked) id1 = arrDiff1Buttons[k].id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   732
    if(arrDiff2Buttons[k].checked) id2 = arrDiff2Buttons[k].id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   733
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   734
  if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   735
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   736
  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   737
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   738
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   739
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   740
        unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   741
        document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   742
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   743
    });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   744
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   745
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   746
// Change the user's preferred style/theme
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   747
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   748
window.ajaxChangeStyle = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   749
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   750
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   751
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   752
    return true;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   753
  load_component('l10n');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   754
  load_component('messagebox');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   755
  
15
ad5986a53197 Fixed complicated SQL injection vulnerability in URL handler, updated license info for Tigra Tree Menu, and killed one XSS vulnerability
Dan
parents: 11
diff changeset
   756
  var inner_html = '';
215
94db56b8124f Localized the sidebar
Dan
parents: 214
diff changeset
   757
  inner_html += '<p><label>' + $lang.get('ajax_changestyle_lbl_theme') + ' ';
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   758
  inner_html += '  <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   759
  inner_html += '    <option value="_blank" selected="selected">' + $lang.get('ajax_changestyle_select') + '</option>';
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   760
  inner_html +=      ENANO_THEME_LIST;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   761
  inner_html += '  </select>';
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   762
  inner_html += '</label></p>';
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: 539
diff changeset
   763
  var chtheme_mb = new MessageBox(MB_OKCANCEL|MB_ICONQUESTION, $lang.get('ajax_changestyle_title'), inner_html);
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   764
  chtheme_mb.onbeforeclick['OK'] = ajaxChangeStyleComplete;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   765
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   766
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   767
window.ajaxGetStyles = function(id)
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   768
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   769
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   770
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   771
    return true;
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   772
  var thediv = document.getElementById('chtheme_sel_style_parent');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   773
  if ( thediv )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   774
  {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   775
    thediv.parentNode.removeChild(thediv);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   776
  }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   777
  if ( id == '_blank' )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   778
  {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   779
    return null;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   780
  }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   781
  ajaxGet(stdAjaxPrefix + '&_mode=getstyles&id=' + id, function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   782
      if ( ajax.readyState == 4 && ajax.status == 200 )
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   783
      {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   784
        // IE doesn't like substr() on ajax.responseText
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   785
        var response = String(ajax.responseText + ' ');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   786
        response = response.substr(0, response.length - 1);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   787
        if ( response.substr(0,1) != '[' )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   788
        {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   789
          alert('Invalid or unexpected JSON response from server:\n' + response);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   790
          return null;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   791
        }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   792
        
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   793
        // Build a selector and matching label
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   794
        var data = parseJSON(response);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   795
        var options = new Array();
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   796
        for( var i in data )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   797
        {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   798
          var item = data[i];
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   799
          var title = themeid_to_title(item);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   800
          var option = document.createElement('option');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   801
          option.value = item;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   802
          option.appendChild(document.createTextNode(title));
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   803
          options.push(option);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   804
        }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   805
        var p_parent = document.createElement('p');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   806
        var label  = document.createElement('label');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   807
        p_parent.id = 'chtheme_sel_style_parent';
215
94db56b8124f Localized the sidebar
Dan
parents: 214
diff changeset
   808
        label.appendChild(document.createTextNode($lang.get('ajax_changestyle_lbl_style') + ' '));
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   809
        var select = document.createElement('select');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   810
        select.id = 'chtheme_sel_style';
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   811
        for ( var i in options )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   812
        {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   813
          select.appendChild(options[i]);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   814
        }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   815
        label.appendChild(select);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   816
        p_parent.appendChild(label);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   817
        
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   818
        // Stick it onto the messagebox
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   819
        var div = document.getElementById('messageBox');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   820
        var kid = div.firstChild.nextSibling;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   821
        
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   822
        kid.appendChild(p_parent);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   823
        
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   824
      }
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: 329
diff changeset
   825
    }, true);
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   826
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   827
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   828
window.ajaxChangeStyleComplete = function()
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   829
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   830
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   831
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   832
    return true;
420
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 413
diff changeset
   833
  var theme = $dynano('chtheme_sel_theme');
301f546688d1 Re-enabled, debugged, and optimized Javascript compression code
Dan
parents: 413
diff changeset
   834
  var style = $dynano('chtheme_sel_style');
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   835
  if ( !theme.object || !style.object )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   836
  {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   837
    alert($lang.get('ajax_changestyle_pleaseselect_theme'));
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   838
    return true;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   839
  }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   840
  var theme_id = theme.object.value;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   841
  var style_id = style.object.value;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   842
  
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   843
  if ( typeof(theme_id) != 'string' || typeof(style_id) != 'string' )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   844
  {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   845
    alert('Couldn\'t get theme or style ID');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   846
    return true;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   847
  }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   848
  
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   849
  if ( theme_id.length < 1 || style_id.length < 1 )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   850
  {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   851
    alert('Theme or style ID is zero length');
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   852
    return true;
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   853
  }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   854
  
298
39c132e69781 Hopefully now all calls to escape() are replaced with ajaxEscape() in response to Tomasz's forum post; remove deprecated version of show_category_info() from functions.php
Dan
parents: 175
diff changeset
   855
  ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + ajaxEscape(theme_id) + '&style_id=' + ajaxEscape(style_id), function()
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   856
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   857
      if ( ajax.readyState == 4 && ajax.status == 200 )
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   858
      {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   859
        if ( ajax.responseText == 'GOOD' )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   860
        {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   861
          var c = confirm($lang.get('ajax_changestyle_success'));
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   862
          if ( c )
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   863
            window.location.reload();
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   864
        }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   865
        else
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   866
        {
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   867
          alert('Error occurred during attempt to change theme:\n' + ajax.responseText);
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   868
        }
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   869
      }
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: 329
diff changeset
   870
    }, true);
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   871
  
30
7e8fd44b36b0 COPPA support added
Dan
parents: 29
diff changeset
   872
  return false;
29
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   873
  
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   874
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   875
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   876
window.ajaxSwapCSS = function()
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   877
{
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   878
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   879
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   880
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   881
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   882
  if(_css) {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   883
    document.getElementById('mdgCss').href = main_css;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   884
    _css = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   885
  } else {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   886
    document.getElementById('mdgCss').href = print_css;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   887
    _css = true;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   888
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   889
  unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   890
  menuOff();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   891
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   892
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   893
window.ajaxSetPassword = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   894
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   895
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   896
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   897
    return true;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   898
  load_component('crypto');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   899
  pass = hex_sha1(document.getElementById('mdgPassSetField').value);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   900
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   901
  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   902
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   903
      unsetAjaxLoading();
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   904
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   905
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   906
        alert(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   907
      }
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: 329
diff changeset
   908
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   909
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   910
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   911
window.ajaxDisableEmbeddedPHP = function()
11
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   912
{
57
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   913
  // IE <6 pseudo-compatibility
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   914
  if ( KILL_SWITCH )
b354deeaa4c4 Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
parents: 40
diff changeset
   915
    return true;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   916
  if ( !confirm($lang.get('ajax_killphp_confirm')) )
11
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   917
    return false;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   918
  var $killdiv = $dynano('php_killer');
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   919
  if ( !$killdiv.object )
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   920
  {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   921
    alert('Can\'t get kill div object');
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   922
    return false;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   923
  }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   924
  $killdiv.object.innerHTML = '<img alt="Loading..." src="' + scriptPath + '/images/loading-big.gif" /><br />Making request...';
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   925
  var url = makeUrlNS('Admin', 'Home', 'src=ajax');
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   926
  ajaxPost(url, 'act=kill_php', function() {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   927
      if ( ajax.readyState == 4 && ajax.status == 200 )
11
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   928
      {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   929
        if ( ajax.responseText == '1' )
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   930
        {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   931
          var $killdiv = $dynano('php_killer');
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   932
          //$killdiv.object.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />Embedded PHP in pages has been disabled.';
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   933
          $killdiv.object.parentNode.removeChild($killdiv.object);
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   934
          var newdiv = document.createElement('div');
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   935
          // newdiv.style = $killdiv.object.style;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   936
          newdiv.className = $killdiv.object.className;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   937
          newdiv.innerHTML = '<img alt="Success" src="' + scriptPath + '/images/error.png" /><br />' + $lang.get('ajax_killphp_success');
11
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   938
          $killdiv.object.parentNode.appendChild(newdiv);
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   939
          $killdiv.object.parentNode.removeChild($killdiv.object);
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   940
        }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   941
        else
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   942
        {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   943
          var $killdiv = $dynano('php_killer');
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   944
          $killdiv.object.innerHTML = ajax.responseText;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   945
        }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   946
      }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   947
    });
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   948
}
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   949
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   950
var catHTMLBuf = false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   951
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   952
window.ajaxCatToTag = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   953
{
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   954
  if ( KILL_SWITCH )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   955
    return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   956
  setAjaxLoading();
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   957
  ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function()
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   958
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   959
      if ( ajax.readyState == 4 && ajax.status == 200 )
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   960
      {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   961
        unsetAjaxLoading();
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   962
        var resptext = String(ajax.responseText + ' ');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   963
        resptext = resptext.substr(0, resptext.length-1);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   964
        if ( resptext.substr(0, 1) != '{' )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   965
        {
320
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 298
diff changeset
   966
          handle_invalid_json(resptext);
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   967
          return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   968
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   969
        var json = parseJSON(resptext);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   970
        var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   971
        if ( !catbox )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   972
          return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   973
        var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   974
        linkbox.firstChild.nodeValue = $lang.get('catedit_catbox_link_showcategorization');
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   975
        linkbox.onclick = function() { ajaxTagToCat(); return false; };
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   976
        catHTMLBuf = catbox.innerHTML;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   977
        catbox.innerHTML = '';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   978
        catbox.appendChild(document.createTextNode($lang.get('tags_lbl_page_tags')+' '));
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   979
        if ( json.tags.length < 1 )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   980
        {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   981
          catbox.appendChild(document.createTextNode($lang.get('tags_lbl_no_tags')));
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   982
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   983
        for ( var i = 0; i < json.tags.length; i++ )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   984
        {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   985
          catbox.appendChild(document.createTextNode(json.tags[i].name));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   986
          if ( json.tags[i].can_del )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   987
          {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   988
            catbox.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   989
            var a = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   990
            a.appendChild(document.createTextNode('[X]'));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   991
            a.href = '#';
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
   992
            a._js_tag_id = json.tags[i].id;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
   993
            a.onclick = function() { ajaxDeleteTag(this, this._js_tag_id); return false; }
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   994
            catbox.appendChild(a);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   995
          }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   996
          if ( ( i + 1 ) < json.tags.length )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   997
            catbox.appendChild(document.createTextNode(', '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   998
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   999
        if ( json.can_add )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1000
        {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1001
          catbox.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1002
          var addlink = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1003
          addlink.href = '#';
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1004
          addlink.onclick = function() { try { ajaxAddTagStage1(); } catch(e) { }; return false; };
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1005
          addlink.appendChild(document.createTextNode($lang.get('tags_btn_add_tag')));
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1006
          catbox.appendChild(addlink);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1007
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1008
      }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1009
    });
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1010
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1011
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1012
var addtag_open = false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1013
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1014
window.ajaxAddTagStage1 = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1015
{
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1016
  if ( addtag_open )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1017
    return false;
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1018
  var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1019
  var adddiv = document.createElement('div');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1020
  var text = document.createElement('input');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1021
  var addlink = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1022
  addlink.href = '#';
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1023
  addlink.onclick = function() { ajaxAddTagStage2(this.parentNode.firstChild.nextSibling.value, this.parentNode); return false; };
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1024
  addlink.appendChild(document.createTextNode($lang.get('tags_btn_add')));
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1025
  text.type = 'text';
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1026
  text.size = '15';
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1027
  text.onkeyup = function(e)
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1028
  {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1029
    if ( e.keyCode == 13 )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1030
    {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1031
      ajaxAddTagStage2(this.value, this.parentNode);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1032
    }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1033
  }
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1034
  
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1035
  adddiv.style.margin = '5px 0 0 0';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1036
  adddiv.appendChild(document.createTextNode($lang.get('tags_lbl_add_tag')+' '));
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1037
  adddiv.appendChild(text);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1038
  adddiv.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1039
  adddiv.appendChild(addlink);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1040
  catbox.appendChild(adddiv);
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1041
  addtag_open = true;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1042
}
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1043
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1044
var addtag_nukeme = false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1045
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1046
window.ajaxAddTagStage2 = function(tag, nukeme)
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1047
{
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1048
  if ( !addtag_open )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1049
    return false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1050
  if ( addtag_nukeme )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1051
    return false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1052
  addtag_nukeme = nukeme;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1053
  tag = ajaxEscape(tag);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1054
  setAjaxLoading();
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1055
  ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function()
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1056
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1057
      if ( ajax.readyState == 4 && ajax.status == 200 )
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1058
      {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1059
        unsetAjaxLoading();
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1060
        var nukeme = addtag_nukeme;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1061
        addtag_nukeme = false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1062
        var resptext = String(ajax.responseText + ' ');
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1063
        resptext = resptext.substr(0, resptext.length-1);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1064
        if ( resptext.substr(0, 1) != '{' )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1065
        {
320
112debff64bd SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents: 298
diff changeset
  1066
          handle_invalid_json(resptext);
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1067
          return false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1068
        }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1069
        var json = parseJSON(resptext);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1070
        var parent = nukeme.parentNode;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1071
        parent.removeChild(nukeme);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1072
        addtag_open = false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1073
        if ( json.success )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1074
        {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1075
          var node = parent.childNodes[1];
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1076
          var insertafter = false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1077
          var nukeafter = false;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1078
          if ( node.nodeValue == $lang.get('tags_lbl_no_tags') )
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1079
          {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1080
            nukeafter = true;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1081
          }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1082
          insertafter = parent.childNodes[ parent.childNodes.length - 3 ];
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1083
          // these need to be inserted in reverse order
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1084
          if ( json.can_del )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1085
          {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1086
            var a = document.createElement('a');
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1087
            a.appendChild(document.createTextNode('[X]'));
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1088
            a.href = '#';
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1089
            a._js_tag_id = json.tag_id;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1090
            a.onclick = function() { ajaxDeleteTag(this, this._js_tag_id); return false; }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1091
            insertAfter(parent, a, insertafter);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1092
            insertAfter(parent, document.createTextNode(' '), insertafter);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1093
          }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1094
          insertAfter(parent, document.createTextNode(json.tag), insertafter);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1095
          if ( !nukeafter )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1096
          {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1097
            insertAfter(parent, document.createTextNode(', '), insertafter);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1098
          }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1099
          if ( nukeafter )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1100
          {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1101
            parent.removeChild(insertafter);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1102
          }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1103
        }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1104
        else
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1105
        {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1106
          alert(json.error);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1107
        }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1108
      }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1109
    });
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1110
}
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1111
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1112
window.ajaxDeleteTag = function(parentobj, tag_id)
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1113
{
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1114
  var arrDelete = [ parentobj, parentobj.previousSibling, parentobj.previousSibling.previousSibling ];
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1115
  var parent = parentobj.parentNode;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1116
  var writeNoTags = false;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1117
  if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == ', ' )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1118
    arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling);
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1119
  else if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' )
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1120
    arrDelete.push(parentobj.nextSibling);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1121
  
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1122
  if ( parentobj.previousSibling.previousSibling.previousSibling.nodeValue == $lang.get('tags_lbl_page_tags') + ' ' &&
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1123
       parentobj.nextSibling.nextSibling.firstChild )
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1124
    if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag'))
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1125
      writeNoTags = true;
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1126
    
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1127
  ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function()
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1128
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1129
      if ( ajax.readyState == 4 && ajax.status == 200 )
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1130
      {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1131
        if ( ajax.responseText == 'success' )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1132
        {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1133
          for ( var i = 0; i < arrDelete.length; i++ )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1134
          {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1135
            try
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1136
            {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1137
              parent.removeChild(arrDelete[i]);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1138
            } catch(e) {}
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1139
          }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1140
          if ( writeNoTags )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1141
          {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1142
            var node1 = document.createTextNode($lang.get('tags_lbl_no_tags'));
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1143
            var node2 = document.createTextNode(' ');
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1144
            insertAfter(parent, node1, parent.firstChild);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1145
            insertAfter(parent, node2, node1);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1146
          }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1147
        }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1148
        else
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1149
        {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1150
          alert(ajax.responseText);
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1151
        }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1152
      }
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 78
diff changeset
  1153
    });
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1154
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1155
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1156
window.ajaxTagToCat = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1157
{
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1158
  if ( !catHTMLBuf )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1159
    return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1160
  var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1161
  if ( !catbox )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1162
    return false;
87
570f68c3fe36 Redid stupid fading button code and fixed several RC2 bugs in the upgrade schema; 1.0.1 release candidate
Dan
parents: 80
diff changeset
  1163
  addtag_open = false;
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1164
  var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1165
  linkbox.firstChild.nodeValue = $lang.get('tags_catbox_link');
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1166
  linkbox.onclick = function() { ajaxCatToTag(); return false; };
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1167
  catbox.innerHTML = catHTMLBuf;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1168
  catHTMLBuf = false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1169
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1170
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1171
var keepalive_interval = false;
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1172
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1173
window.ajaxPingServer = function()
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1174
{
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1175
  ajaxGet(stdAjaxPrefix + '&_mode=ping', function()
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1176
    {
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1177
    });
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1178
}
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1179
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1180
window.ajaxToggleKeepalive = function()
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1181
{
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1182
  if ( readCookie('admin_keepalive') == '1' )
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1183
  {
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1184
    createCookie('admin_keepalive', '0', 3650);
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1185
    if ( keepalive_interval )
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1186
      clearInterval(keepalive_interval);
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1187
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1188
    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1189
  }
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1190
  else
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1191
  {
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1192
    createCookie('admin_keepalive', '1', 3650);
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1193
    if ( !keepalive_interval )
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1194
      keepalive_interval = setInterval('ajaxPingServer();', 600000);
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1195
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1196
    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1197
    ajaxPingServer();
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1198
  }
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1199
}
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1200
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1201
var keepalive_onload = function()
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1202
{
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1203
  if ( readCookie('admin_keepalive') == '1' )
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1204
  {
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1205
    if ( !keepalive_interval )
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1206
      keepalive_interval = setInterval('ajaxPingServer();', 600000);
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1207
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1208
    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1209
  }
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1210
  else
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1211
  {
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1212
    if ( keepalive_interval )
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1213
      clearInterval(keepalive_interval);
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1214
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1215
    span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1216
  }
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1217
};
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1218
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1219
window.aboutKeepAlive = function()
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1220
{
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
  1221
  load_component('messagebox');
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: 539
diff changeset
  1222
  new MessageBox(MB_OK|MB_ICONINFORMATION, $lang.get('user_keepalive_info_title'), $lang.get('user_keepalive_info_body'));
118
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1223
}
0c5efda996bf Added keep-alive function to admin panel (had been planned for some time) and a new hook, template_var_init_end
Dan
parents: 103
diff changeset
  1224
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1225
window.ajaxUpdateCheck = function(targetelement)
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1226
{
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1227
  if ( !document.getElementById(targetelement) )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1228
  {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1229
    return false;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1230
  }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1231
  var target = document.getElementById(targetelement);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1232
  target.innerHTML = '';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1233
  var img = document.createElement('img');
650
e45183014778 Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
parents: 592
diff changeset
  1234
  img.src = cdnPath + '/images/loading.gif';
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1235
  img.alt = 'Loading...';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1236
  target.appendChild(img);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1237
  ajaxGet(makeUrlNS('Admin', 'Home/updates.xml'), function()
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1238
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1239
      if ( ajax.readyState == 4 && ajax.status == 200 )
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1240
      {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1241
        var releases = new Array();
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1242
        var update_available = false;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1243
        if ( ajax.responseXML == null )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1244
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1245
          alert("Error fetching updates list:\n" + ajax.responseText);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1246
          return false;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1247
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1248
        if ( ajax.responseXML.firstChild.tagName == 'enano' )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1249
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1250
          var enanotag = ajax.responseXML.firstChild;
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: 329
diff changeset
  1251
          for ( var i = 0; i < enanotag.childNodes.length; i++ )
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1252
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1253
            if ( enanotag.childNodes[i].tagName == 'error' )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1254
            {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1255
              alert(enanotag.childNodes[i].firstChild.nodeValue);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1256
            }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1257
            else if ( enanotag.childNodes[i].tagName == 'latest' )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1258
            {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1259
              // got <latest>
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1260
              var latesttag = enanotag.childNodes[i];
343
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1261
              for ( var j = 0; j < latesttag.childNodes.length; j++ )
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1262
              {
343
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1263
                var node = latesttag.childNodes[j];
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1264
                if ( node.tagName == 'release' )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1265
                {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1266
                  var releasedata = new Object();
343
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1267
                  for ( var k = 0; k < node.attributes.length; k++ )
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1268
                  {
343
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1269
                    releasedata[node.attributes[k].nodeName] = node.attributes[k].nodeValue;
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1270
                  }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1271
                  releases.push(releasedata);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1272
                }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1273
                else if ( node.tagName == 'haveupdates' )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1274
                {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1275
                  update_available = true;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1276
                }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1277
              }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1278
              break;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1279
            }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1280
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1281
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1282
        else
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1283
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1284
          return false;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1285
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1286
        var thediv = document.getElementById(targetelement);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1287
        thediv.innerHTML = '';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1288
        if ( !thediv )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1289
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1290
          return false;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1291
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1292
        if ( releases.length > 0 )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1293
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1294
          thediv.className = 'tblholder';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1295
          if ( update_available )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1296
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1297
            var infobox = document.createElement('div');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1298
            infobox.className = 'info-box-mini';
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: 329
diff changeset
  1299
            infobox.appendChild(document.createTextNode('An update for Enano is available. The newest release is highlighted below.'));
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1300
            infobox.style.borderWidth = '0';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1301
            infobox.style.margin = '0 0 0 0';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1302
            thediv.appendChild(infobox);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1303
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1304
          else
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1305
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1306
            var infobox = document.createElement('div');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1307
            infobox.className = 'info-box-mini';
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: 329
diff changeset
  1308
            infobox.appendChild(document.createTextNode('No new updates are available. The latest available releases are shown below.'));
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1309
            infobox.style.borderWidth = '0';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1310
            infobox.style.margin = '0 0 0 0';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1311
            thediv.appendChild(infobox);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1312
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1313
          var table = document.createElement('table');
343
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1314
          table.setAttribute('border', '0');
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1315
          table.setAttribute('cellspacing', '1');
eefe9ab7fe7c Localized the first parts of the admin panel. As a consequence, also wrote a brand new Admin:PageManager that doesn't suck like the old one did.
Dan
parents: 335
diff changeset
  1316
          table.setAttribute('cellpadding', '4');
329
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1317
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1318
          var tr = document.createElement('tr');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1319
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1320
          var td1 = document.createElement('th');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1321
          var td2 = document.createElement('th');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1322
          var td3 = document.createElement('th');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1323
          var td4 = document.createElement('th');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1324
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1325
          td1.appendChild( document.createTextNode('Release type') );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1326
          td2.appendChild( document.createTextNode('Version') );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1327
          td3.appendChild( document.createTextNode('Code name') );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1328
          td4.appendChild( document.createTextNode('Release notes') );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1329
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1330
          tr.appendChild(td1);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1331
          tr.appendChild(td2);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1332
          tr.appendChild(td3);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1333
          tr.appendChild(td4);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1334
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1335
          table.appendChild(tr);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1336
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1337
          var cls = 'row2';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1338
          
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1339
          var j = 0;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1340
          for ( var i in releases )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1341
          {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1342
            j++;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1343
            if ( j > 5 )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1344
              break;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1345
            if ( update_available && j == 1 )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1346
              cls = 'row1_green';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1347
            else
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1348
              cls = ( cls == 'row1' ) ? 'row2' : 'row1';
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1349
            var release = releases[i];
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1350
            var tr = document.createElement('tr');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1351
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1352
            var td1 = document.createElement('td');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1353
            var td2 = document.createElement('td');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1354
            var td3 = document.createElement('td');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1355
            var td4 = document.createElement('td');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1356
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1357
            td1.className = cls;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1358
            td2.className = cls;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1359
            td3.className = cls;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1360
            td4.className = cls;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1361
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1362
            if ( release.tag )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1363
              td1.appendChild( document.createTextNode(release.tag) );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1364
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1365
            if ( release.version )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1366
              td2.appendChild( document.createTextNode(release.version) );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1367
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1368
            if ( release.codename )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1369
              td3.appendChild( document.createTextNode(release.codename) );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1370
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1371
            if ( release.relnotes )
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1372
            {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1373
              var a = document.createElement('a');
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1374
              a.href = release.relnotes;
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1375
              a.appendChild(document.createTextNode('View'));
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1376
              td4.appendChild( a );
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1377
            }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1378
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1379
            tr.appendChild(td1);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1380
            tr.appendChild(td2);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1381
            tr.appendChild(td3);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1382
            tr.appendChild(td4);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1383
            
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1384
            table.appendChild(tr);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1385
          }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1386
          thediv.appendChild(table);
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1387
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1388
        else
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1389
        {
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1390
          thediv.appendChild(document.createTextNode('No releases available.'));
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1391
        }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1392
      }
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1393
    });
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1394
}
0437a7cf1acc Added update-checking function (still a little rough around the edges); added support into admin user CP for changing avatars
Dan
parents: 326
diff changeset
  1395
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1396
window.ajaxPluginAction = function(action, plugin_filename, btnobj)
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1397
{
560
8981dcf7d485 Added re-import function to plugin manager
Dan
parents: 555
diff changeset
  1398
  // if installing, uninstalling, or re-importing, confirm
8981dcf7d485 Added re-import function to plugin manager
Dan
parents: 555
diff changeset
  1399
  if ( action == 'install' || action == 'uninstall' || action == 'reimport' )
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1400
  {
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1401
    var prompt = miniPrompt(function(div)
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1402
      {
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1403
        var txtholder = document.createElement('div');
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1404
        txtholder.style.textAlign = 'center';
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1405
        txtholder.appendChild(document.createTextNode($lang.get('acppl_msg_confirm_' + action)));
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1406
        txtholder.appendChild(document.createElement('br'));
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1407
        txtholder.appendChild(document.createElement('br'));
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1408
        
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1409
        // create buttons
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1410
        var btn_go = document.createElement('a');
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1411
        btn_go.className = 'abutton abutton_red';
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1412
        btn_go.href = '#';
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1413
        btn_go._action = action;
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1414
        btn_go._filename = plugin_filename;
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1415
        btn_go._button = btnobj;
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1416
        btn_go.appendChild(document.createTextNode($lang.get('acppl_btn_' + action)));
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1417
        btn_go.style.fontWeight = 'bold';
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1418
        txtholder.appendChild(btn_go);
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1419
        
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1420
        // space
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1421
        txtholder.appendChild(document.createTextNode(' '));
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1422
        
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1423
        // cancel
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1424
        var btn_cancel = document.createElement('a');
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1425
        btn_cancel.className = 'abutton abutton_blue';
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1426
        btn_cancel.href = '#';
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1427
        btn_cancel.appendChild(document.createTextNode($lang.get('etc_cancel')));
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1428
        
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1429
        txtholder.appendChild(btn_cancel);
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1430
        div.appendChild(txtholder);
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1431
        
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1432
        btn_go.onclick = function()
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1433
        {
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1434
          ajaxPluginAction(this._action + '_confirm', this._filename, this._button);
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1435
          miniPromptDestroy(this);
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1436
          return false;
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1437
        }
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1438
        btn_cancel.onclick = function()
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1439
        {
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1440
          miniPromptDestroy(this);
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1441
          return false;
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1442
        }
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1443
      });
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1444
    return true;
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1445
  }
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1446
  action = action.replace(/_confirm$/, '');
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1447
  // white-out the plugin info box
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1448
  if ( btnobj )
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1449
  {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1450
    var td = btnobj.parentNode.parentNode.parentNode.parentNode;
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1451
    var blackbox = whiteOutElement(td);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1452
  }
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1453
  var request = toJSONString({
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1454
      mode: action,
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1455
      plugin: plugin_filename
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1456
    });
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1457
  ajaxPost(makeUrlNS('Admin', 'PluginManager/action.json'), 'r=' + ajaxEscape(request), function()
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1458
    {
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1459
      if ( ajax.readyState == 4 && ajax.status == 200 )
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1460
      {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1461
        var response = String(ajax.responseText + '');
651
ce9d78d7251d Improved JSON validation and error interface when validation fails; made rank manager support custom CSS
Dan
parents: 650
diff changeset
  1462
        if ( !check_json_response(response) )
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1463
        {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1464
          handle_invalid_json(response);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1465
          return false;
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1466
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1467
        response = parseJSON(response);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1468
        if ( response.success )
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1469
        {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1470
          if ( blackbox )
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1471
          {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1472
            blackbox.parentNode.removeChild(blackbox);
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1473
          }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1474
          ajaxPage( namespace_list['Admin'] + 'PluginManager' );
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1475
          return true;
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1476
        } 
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1477
        // wait for fade effect to finish its run
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1478
        setTimeout(function()
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1479
          {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1480
            miniPrompt(function(div)
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1481
              {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1482
                if ( blackbox )
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1483
                {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1484
                  blackbox.parentNode.removeChild(blackbox);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1485
                }
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1486
                var txtholder = document.createElement('div');
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1487
                txtholder.style.textAlign = 'center';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1488
                txtholder.appendChild(document.createTextNode(response.error));
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1489
                txtholder.appendChild(document.createElement('br'));
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1490
                txtholder.appendChild(document.createElement('br'));
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1491
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1492
                // close button
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1493
                var btn_cancel = document.createElement('a');
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1494
                btn_cancel.className = 'abutton abutton_red';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1495
                btn_cancel.href = '#';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1496
                btn_cancel.appendChild(document.createTextNode($lang.get('etc_ok')));
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1497
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1498
                txtholder.appendChild(btn_cancel);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1499
                div.appendChild(txtholder);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1500
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1501
                btn_cancel.onclick = function()
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1502
                {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1503
                  miniPromptDestroy(this);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1504
                  return false;
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1505
                }
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1506
              });
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1507
          }, 750);
526
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1508
      }
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1509
    });
b2fb50d572c7 New plugin manager half-implemented. Most of the UI/frontend code is done. Moved sql_parse.php to /includes/ to allow use after installation - TODO: check installer, etc. for breakage
Dan
parents: 522
diff changeset
  1510
}
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1511
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1512
window.ajaxReverseDNS = function(o, text)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1513
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1514
  if(text) var ipaddr = text;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1515
  else var ipaddr = o.innerHTML;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1516
  rDnsObj = o;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1517
  rDnsBannerObj = bannerOn('Retrieving reverse DNS info...');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1518
  ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function() {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1519
      if ( ajax.readyState == 4 && ajax.status == 200 )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1520
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1521
        off = fetch_offset(rDnsObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1522
        dim = fetch_dimensions(rDnsObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1523
        right = off['left'] + dim['w'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1524
        top = off['top'] + dim['h'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1525
        var thediv = document.createElement('div');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1526
        thediv.className = 'info-box';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1527
        thediv.style.margin = '0';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1528
        thediv.style.position = 'absolute';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1529
        thediv.style.top  = top  + 'px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1530
        thediv.style.display = 'none';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1531
        thediv.style.zIndex = getHighestZ() + 2;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1532
        thediv.id = 'mdgDynamic_rDnsInfoDiv_'+Math.floor(Math.random() * 1000000);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1533
        thediv.innerHTML = '<b>Reverse DNS:</b><br />'+ajax.responseText+' <a href="#" onclick="elem = document.getElementById(\''+thediv.id+'\'); elem.innerHTML = \'\'; elem.style.display = \'none\';return false;">Close</a>';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1534
        var body = document.getElementsByTagName('body');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1535
        body = body[0];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1536
        bannerOff(rDnsBannerObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1537
        body.appendChild(thediv);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1538
        thediv.style.display = 'block';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1539
        left = fetch_dimensions(thediv);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1540
        thediv.style.display = 'none';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1541
        left = right - left['w'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1542
        thediv.style.left = left + 'px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1543
        thediv.style.display = 'block';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1544
        fadeInfoBoxes();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1545
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1546
    });
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1547
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1548
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1549
function themeid_to_title(id)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1550
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1551
  if ( typeof(id) != 'string' )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1552
    return false;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1553
  id = id.substr(0, 1).toUpperCase() + id.substr(1);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1554
  id = id.replace(/_/g, ' ');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1555
  id = id.replace(/-/g, ' ');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1556
  return id;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1557
}