includes/clientside/static/ajax.js
author Dan
Mon, 13 Apr 2009 12:05:46 -0400
changeset 903 b8db9a7946fc
parent 889 7e933a5c860b
child 906 c949e82b8f49
permissions -rw-r--r--
Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
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' : '';
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
    16
  ajaxGet(append_sid(scriptPath + '/ajax.php?title=' + physical_title +'&_mode=getpage&noheaders' + redir), function(ajax) {
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';
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
    53
  ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function(ajax) {
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
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 699
diff changeset
    81
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
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
    82
  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
    83
}
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
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
    86
{
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
  // 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
    88
  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
    89
  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
    90
  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
    91
  
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
  // 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
    93
  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
    94
  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
    95
  
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
  // 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
    97
  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
    98
  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
    99
  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
   100
  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
   101
  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
   102
  
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
  // 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
   104
  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
   105
  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
   106
  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
   107
  
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
  // 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
   109
  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
   110
  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
   111
  
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
  // 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
   113
  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
   114
  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
   115
  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
   116
  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
   117
  
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
  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
   119
  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
   120
  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
   121
  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
   122
  
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
  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
   124
  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
   125
  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
   126
  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
   127
  
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
  // 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
   129
  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
   130
  {
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
    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
   132
    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
   133
  }
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
  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
   135
  {
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
    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
   137
    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
   138
  }
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
  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
   140
  {
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
    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
   142
    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
   143
  }
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
  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
   146
    {
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
      box.focus();
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   148
    }, ( aclDisableTransitionFX ? 200 : 750 ));
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
   149
}
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   151
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
   152
{
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
  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
   154
  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
   155
    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
   156
  
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   157
  var input = box.getElementsByTagName('input')[0];
592
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   158
  if ( !input )
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   159
    return false;
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   160
    
592
27377179fe58 Another sweep from the optimization monster.
Dan
parents: 585
diff changeset
   161
  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
   162
  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
   163
  
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
  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
   165
  {
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
    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
   167
    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
   168
  }
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
  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
   171
  {
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
    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
   173
  }
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
  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
   176
  var whiteout = whiteOutElement(innerBox);
699
c7d737202d59 Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents: 696
diff changeset
   177
  whiteout.style.width = ( $dynano(whiteout).Width() - 78 ) + 'px';
c7d737202d59 Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents: 696
diff changeset
   178
  whiteout.style.left = ( $dynano(whiteout).Left() + 44 ) + 'px';
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
   179
  
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   180
  ajaxPost(stdAjaxPrefix + '&_mode=rename', 'newtitle=' + ajaxEscape(newname), function(ajax)
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
   181
    {
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
      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
   183
      {
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
        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
   185
        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
   186
        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
   187
        {
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
          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
   189
          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
   190
        }
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
        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
   192
        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
   193
        {
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
          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
   195
          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
   196
          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
   197
          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
   198
        }
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
        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
   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
   201
          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
   202
          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
   203
        }
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
    }, 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
   206
}
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   208
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
   209
{
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
  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
   211
  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
   212
  {
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
    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
   214
  }
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
  document.title = newname;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   216
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   217
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   218
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
   219
{
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
  // 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
   221
  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
   222
    return true;
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 699
diff changeset
   223
  load_component(['l10n', 'messagebox', 'jquery', 'jquery-ui', 'fadefilter', 'flyin']);
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
   224
  
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
  // 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
   226
  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
   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
      // 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
   229
      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
   230
      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
   231
      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
   232
      
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
      // "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
   234
      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
   235
      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
   236
      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
   237
      
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
      // 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
   239
      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
   240
      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
   241
      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
   242
      
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
      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
   244
      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
   245
      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
   246
      {
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
        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
   248
        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
   249
        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
   250
        {
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 ( 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
   252
          {
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
            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
   254
          }
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
        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
   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
          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
   259
        }
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
      
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
      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
   263
      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
   264
      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
   265
      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
   266
      
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
      // 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
   268
      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
   269
      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
   270
      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
   271
      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
   272
      
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
      // 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
   274
      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
   275
      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
   276
      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
   277
      
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
      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
   279
      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
   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
      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
   282
      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
   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
      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
   285
      
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
      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
   287
      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
   288
      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
   289
      
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
      // 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
   291
      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
   292
      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
   293
      
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
      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
   295
      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
   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
      // 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
   298
      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
   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
        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
   301
        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
   302
        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
   303
          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
   304
      }
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
      
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
      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
   307
      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
   308
      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
   309
      
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
      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
   311
      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
   312
      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
   313
      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
   314
      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
   315
      {
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
        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
   317
        {
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
          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
   319
        }
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
        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
   321
      }
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
      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
   324
      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
   325
      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
   326
      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
   327
      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
   328
      {
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
        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
   330
        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
   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
      
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
      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
   334
      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
   335
      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
   336
      
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
      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
   338
      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
   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
          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
   341
        }, 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
   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
}
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
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
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
   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
  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
   348
  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
   349
  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
   350
  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
   351
  
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
  if ( trim(reason.value) == '' )
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   353
  {
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
   354
    // flash the background of the reason entry
699
c7d737202d59 Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents: 696
diff changeset
   355
    $(reason.parentNode).effect("highlight", {}, 1000);
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   356
    return false;
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   357
  }
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
   358
  
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
  if ( !confirm.checked )
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   360
  {
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
   361
    // flash the background of the confirm checkbox
699
c7d737202d59 Removed Adobe Spry and replaced with jQuery. Please report any new bugs on the forums or via IRC. In a related note, auto-completion should work now at least for usernames. Still hacking away at page name completion...
Dan
parents: 696
diff changeset
   362
    $(confirm.parentNode).effect("highlight", {}, 1000);
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
   363
    return false;
28
dd2edcdc6c03 Deleting pages now requires a reason
Dan
parents: 15
diff changeset
   364
  }
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
   365
  
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
   366
  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
   367
  
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
  // 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
   369
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   370
  ajaxPost(stdAjaxPrefix + '&_mode=deletepage', 'reason=' + ajaxEscape(trim(reason.value)), function(ajax)
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
   371
    {
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
      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
   373
      {
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
        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
   375
        
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
        // 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
   377
        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
   378
        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
   379
        
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
        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
   381
        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
   382
        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
   383
        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
   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
        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
   386
        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
   387
        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
   388
        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
   389
        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
   390
        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
   391
        {
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
          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
   393
          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
   394
          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
   395
        }
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
        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
   397
        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
   398
        
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.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
   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
    });
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
  
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 true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   404
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   405
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   406
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
   407
{
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 699
diff changeset
   408
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   409
  
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
   410
  // 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
   411
  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
   412
    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
   413
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   414
      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
   415
      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
   416
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   417
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   418
          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
   419
          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
   420
          style: {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   421
            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
   422
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   423
          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
   424
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   425
            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
   426
            setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   427
            ajaxGet(stdAjaxPrefix+'&_mode=delvote', function(ajax) {
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   428
              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
   429
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   430
                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
   431
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   432
            }, true);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   433
          }
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
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   436
          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
   437
          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
   438
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   439
            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
   440
          }
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
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   443
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   444
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   445
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   446
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
   447
{
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 699
diff changeset
   448
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   449
  
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
   450
  // 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
   451
  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
   452
    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
   453
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   454
      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
   455
      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
   456
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   457
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   458
          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
   459
          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
   460
          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
   461
            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
   462
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   463
          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
   464
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   465
            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
   466
            setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   467
            ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function(ajax) {
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   468
              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
   469
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   470
                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
   471
                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
   472
                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
   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
                  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
   475
                  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
   476
                }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   477
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   478
            }, true);
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   479
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   480
        },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   481
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   482
          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
   483
          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
   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
            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
   486
          }
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
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   490
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   491
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   492
// Editing/saving category information
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   493
// 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
   494
// find someone to work on just the Javascript part of Enano...
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   495
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   496
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
   497
{
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
   498
  // 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
   499
  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
   500
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   501
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   502
  ajaxGet(stdAjaxPrefix+'&_mode=catedit', function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   503
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   504
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   505
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   506
      eval(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   507
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   508
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   509
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   510
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   511
window.ajaxCatSave = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   512
{
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
   513
  // 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
   514
  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
   515
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   516
  if(!catlist)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   517
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   518
    alert('Var catlist has no properties');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   519
    return;
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
  query='';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   522
  for(i=0;i<catlist.length;i++)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   523
  {
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   524
    var s = ( document.forms.mdgCatForm['mdgCat_' + catlist[i]]['checked'] ) ? true : false;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   525
    if(s) query = query + '&' + catlist[i] + '=true';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   526
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   527
  setAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   528
  query = query.substring(1, query.length);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   529
  ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   530
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   531
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   532
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   533
      if(ajax.responseText != 'GOOD') alert(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   534
      ajaxReset();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   535
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   536
  });
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
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   539
// History stuff
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   540
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   541
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
   542
{
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
   543
  // 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
   544
  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
   545
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   546
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   547
  ajaxGet(stdAjaxPrefix+'&_mode=histlist', function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   548
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   549
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   550
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   551
      selectButtonMajor('article');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   552
      selectButtonMinor('history');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   553
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   554
      buildDiffList();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   555
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   556
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   557
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   558
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   559
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
   560
  // 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
   561
  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
   562
    return true;
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   563
  if(!ttl) ttl=title;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   564
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   565
  ajaxGet(append_sid(scriptPath+'/ajax.php?title='+ttl+'&_mode=getpage&oldid='+oldid), function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   566
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   567
      unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   568
      edit_open = false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   569
      document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   570
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   571
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   572
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   573
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   574
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
   575
  // 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
   576
  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
   577
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   578
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   579
  ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   580
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   581
      unsetAjaxLoading();
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   582
      
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   583
      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
   584
      if ( !check_json_response(response) )
481
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   585
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   586
        handle_invalid_json(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   587
        return false;
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   588
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   589
      
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   590
      response = parseJSON(response);
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   591
      if ( response.success )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   592
      {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   593
        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
   594
      }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   595
      else
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
        if ( response.action )
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   598
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   599
          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
   600
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   601
        else
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   602
        {
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   603
          alert( $lang.get('page_err_' + response.error) );
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   604
        }
07bf15b066bc Hopefully completed rewrite and localization of rollback backend and interface
Dan
parents: 436
diff changeset
   605
      }
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   606
    }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   607
  });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   608
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   609
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   610
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
   611
{
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
   612
  // 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
   613
  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
   614
    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
   615
  
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 699
diff changeset
   616
  load_component(['l10n', 'messagebox', 'flyin', 'fadefilter']);
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   617
  
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   618
  miniPromptMessage({
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   619
      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
   620
      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
   621
      buttons: [
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   622
        {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   623
          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
   624
          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
   625
          style: {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   626
            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
   627
          },
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   628
          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
   629
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   630
            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
   631
            setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   632
            ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function(ajax) {
539
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   633
              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
   634
                unsetAjaxLoading();
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   635
                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
   636
                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
   637
              }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   638
            });
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
        },
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
          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
   643
          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
   644
          {
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   645
            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
   646
          }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   647
        }
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   648
      ]
1beddd693f2d Replaced some confirmation boxes with miniPromptMessage versions. This commit will require a re-langimport and shift-reload.
Dan
parents: 537
diff changeset
   649
    });
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   650
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   651
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   652
window.buildDiffList = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   653
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   654
  arrDiff1Buttons = getElementsByClassName(document, 'input', 'clsDiff1Radio');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   655
  arrDiff2Buttons = getElementsByClassName(document, 'input', 'clsDiff2Radio');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   656
  var len = arrDiff1Buttons.length;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   657
  if ( len < 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   658
    return false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   659
  timelist = new Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   660
  for ( var i = 0; i < len; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   661
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   662
    timelist.push( arrDiff2Buttons[i].id.substr(6) );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   663
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   664
  timelist.push( arrDiff1Buttons[len-1].id.substr(6) );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   665
  delete(timelist.toJSONString);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   666
  for ( var i = 1; i < timelist.length-1; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   667
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   668
    if ( i >= timelist.length ) break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   669
    arrDiff2Buttons[i].style.display = 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   670
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   671
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   672
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   673
window.selectDiff1Button = function(obj)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   674
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   675
  var this_time = obj.id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   676
  var index = parseInt(in_array(this_time, timelist));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   677
  for ( var i = 0; i < timelist.length - 1; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   678
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   679
    if ( i < timelist.length - 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   680
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   681
      var state = ( i < index ) ? 'inline' : 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   682
      var id = 'diff2_' + timelist[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   683
      document.getElementById(id).style.display = state;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   684
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   685
      // alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i);
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
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   688
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   689
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   690
window.selectDiff2Button = function(obj)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   691
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   692
  var this_time = obj.id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   693
  var index = parseInt(in_array(this_time, timelist));
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   694
  for ( var i = 1; i < timelist.length; i++ )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   695
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   696
    if ( i < timelist.length - 1 )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   697
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   698
      var state = ( i > index ) ? 'inline' : 'none';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   699
      var id = 'diff1_' + timelist[i];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   700
      document.getElementById(id).style.display = state;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   701
      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   702
      // alert("Debug:\nIndex: "+index+"\nState: "+state+"\ni: "+i);
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
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   705
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   706
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   707
window.ajaxHistDiff = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   708
{
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
   709
  // 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
   710
  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
   711
    return true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   712
  var id1=false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   713
  var id2=false;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   714
  for ( i = 0; i < arrDiff1Buttons.length; 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
    k = i + '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   717
    kpp = i + 1;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   718
    kpp = kpp + '';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   719
    if(arrDiff1Buttons[k].checked) id1 = arrDiff1Buttons[k].id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   720
    if(arrDiff2Buttons[k].checked) id2 = arrDiff2Buttons[k].id.substr(6);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   721
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   722
  if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   723
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   724
  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function(ajax)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   725
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   726
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
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
        unsetAjaxLoading();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   729
        document.getElementById('ajaxEditContainer').innerHTML = ajax.responseText;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   730
      }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   731
    });
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   732
}
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
// Change the user's preferred style/theme
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   735
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   736
window.ajaxChangeStyle = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   737
{
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
   738
  // 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
   739
  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
   740
    return true;
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   741
  load_component(['l10n', 'fadefilter', 'jquery', 'jquery-ui']);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   742
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   743
  // force string fetch
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   744
  $lang.get('etc_cancel');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   745
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   746
  // preload some images
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   747
  var i1 = new Image();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   748
  i1.src = cdnPath + '/images/loading-big.gif';
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   749
  var i2 = new Image();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   750
  i2.src = cdnPath + '/images/check-large.png';
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   751
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   752
  darken(true, 70, 'theme-selector-shade');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   753
  
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   754
  $('body').append('<div id="theme-selector-wrapper"><div id="theme-selector-body"><div id="theme-selector-inner"><div class="theme-selector-spinner"></div></div></div></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   755
  $('#theme-selector-wrapper')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   756
    .css('top', String(getScrollOffset()) + 'px')
881
01810d32a0d6 AJAX: theme selector: explicitly set wrapper div to 0 to prevent sidescrolling
Dan
parents: 870
diff changeset
   757
    .css('left', 0)
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   758
    .css('z-index', String( getHighestZ() + 20 ));
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   759
  
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   760
  $.get(stdAjaxPrefix + '&_mode=theme_list', {}, function(data, status)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   761
    {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   762
      $('#theme-selector-inner .theme-selector-spinner').fadeOut(650);
903
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   763
      $('#theme-selector-body').animate({ width: 728 }, 600, function()
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   764
        {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   765
          // avoiding jQuery's fade functions because they insist on toggling display as well
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   766
          if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   767
            changeOpac(0, 'theme-selector-inner');
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   768
          $('#theme-selector-inner').html('<h3></h3>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   769
          $('#theme-selector-inner > h3').text($lang.get('ajax_thmsel_lbl_choosetheme'));
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   770
          $('#theme-selector-inner').append('<ul></ul>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   771
          for ( var i = 0; i < data.length; i++ )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   772
          {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   773
            var bgi = data[i].have_thumb ? cdnPath + '/themes/' + data[i].theme_id + '/preview.png' : cdnPath + '/images/themepreview.png';
903
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   774
            var maxheight = getHeight() - 325;
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   775
            $('#theme-selector-inner > ul')
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   776
              .css('clip', 'rect(0px, auto, auto, 0px)')
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   777
              .css('overflow', 'auto')
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   778
              .css('max-height', maxheight)
b8db9a7946fc Theme selector: controls height now (limits box to height of screen minus a few px of padding) if there are lots of themes
Dan
parents: 889
diff changeset
   779
              .append('<li id="theme_' + i + '"><a href="#"><span></span></a></li>');
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   780
            $('#theme-selector-inner li#theme_' + i + ' > a')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   781
              .css('background-image', 'url(' + bgi + ')')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   782
              .attr('enano:theme_id', data[i].theme_id);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   783
            $('#theme-selector-inner li#theme_' + i + ' > a > span')
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   784
              .text(data[i].theme_name);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   785
          }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   786
          $('#theme-selector-inner').append('<span class="menuclear"></span>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   787
          $('#theme-selector-inner').append('<div style="padding-top: 40px;"><a class="abutton abutton_green" style="font-size: larger;" href="#" onclick="ajaxChangeStyleClose(); return false;">' + $lang.get('etc_cancel') + '</a></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   788
          
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   789
          $('#theme-selector-body').animate({ height: $('#theme-selector-inner').height() + 30 }, 600, function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   790
            {
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   791
              if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   792
                opacity('theme-selector-inner', 0, 100, 750);
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   793
            });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   794
          
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   795
          $('#theme-selector-inner li a').click(function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   796
            {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   797
              var theme_id = $(this).attr('enano:theme_id');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   798
              $('span', this).html('&nbsp;').addClass('loading').fadeTo('fast', 0.6)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   799
              $.get(stdAjaxPrefix + '&_mode=get_styles', { theme_id: theme_id }, function(data, status)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   800
                {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   801
                  if ( data.length > 1 )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   802
                  {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   803
                    $('#theme-selector-inner').css('height', $('#theme-selector-inner').height()).fadeOut(600, function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   804
                    {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   805
                      var div = document.createElement('div');
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   806
                      if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   807
                        domObjChangeOpac(0, div);
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   808
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   809
                      $(div).attr('id', 'theme-selector-style-list').append('<h3></h3>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   810
                      $('h3', div).text($lang.get('ajax_thmsel_lbl_choosestyle'));
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   811
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   812
                      for ( var i = 0; i < data.length; i++ )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   813
                      {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   814
                        $(div).append('<a class="abutton block stylebtn" id="stylebtn_' + i + '" enano:style_id="' + data[i] + '">' + themeid_to_title(data[i]) + '</a>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   815
                      }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   816
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   817
                      $(div).append('<div style="padding-top: 40px;"><a class="abutton abutton_green" style="font-size: larger;" href="#" onclick="ajaxChangeStyleClose(); return false;">' + $lang.get('etc_cancel') + '</a></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   818
                      
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   819
                      if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   820
                        changeOpac(0, 'theme-selector-style-list');
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   821
                      $(this).html(div).show();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   822
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   823
                      $('#theme-selector-body').animate({width: 300, height: $('#theme-selector-style-list').height() + 30}, 300, function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   824
                        {
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   825
                          if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   826
                            opacity('theme-selector-style-list', 0, 100, 500);
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   827
                        });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   828
                      
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   829
                      $('.stylebtn').click(function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   830
                        {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   831
                          ajaxChangeThemeSetLoading();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   832
                          $.post(stdAjaxPrefix + '&_mode=change_theme', { theme_id: theme_id, style_id: $(this).attr('enano:style_id') }, function(data, status)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   833
                            {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   834
                              if ( data.error )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   835
                              {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   836
                                alert(data.error);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   837
                                ajaxChangeStyleClose();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   838
                                return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   839
                              }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   840
                              ajaxChangeThemeShowSuccess();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   841
                            }, 2000);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   842
                          
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   843
                          return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   844
                        });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   845
                    });
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   846
                  }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   847
                  else
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   848
                  {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   849
                    if ( !data[0] )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   850
                    {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   851
                      alert('Didn\'t find any CSS files. :-/');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   852
                      ajaxChangeStyleClose();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   853
                    }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   854
                    
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   855
                    $.post(stdAjaxPrefix + '&_mode=change_theme', { theme_id: theme_id, style_id: data[0] }, function(data, status)
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   856
                      {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   857
                        if ( data.error )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   858
                        {
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   859
                          alert(data.error);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   860
                          ajaxChangeStyleClose();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   861
                          return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   862
                        }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   863
                        ajaxChangeThemeShowSuccess();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   864
                      }, 'json');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   865
                  }
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   866
                }, 'json');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   867
              return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   868
            }); // click function
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   869
        }); // animate
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   870
    }, 'json'); // get
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
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   872
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   873
window.ajaxChangeThemeSetLoading = 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
   874
{
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   875
  $('#theme-selector-body').animate({width: 130, height: 130});
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   876
  $('#theme-selector-inner').empty().html('<div class="theme-selector-spinner"></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   877
}
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   878
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   879
window.ajaxChangeThemeShowSuccess = function()
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   880
{
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   881
  if ( aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   882
  {
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   883
    $('#theme-selector-inner').empty();
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   884
  }
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   885
  else
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   886
  {
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   887
    setTimeout(function()
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   888
      {
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   889
        $('#theme-selector-inner').empty();
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   890
      }, 10);
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   891
  }
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   892
  
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   893
  $('#theme-selector-body').animate({width: 400, height: 300 }, 600, 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
   894
      {
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   895
        $('#theme-selector-inner').append('<img src="' + cdnPath + '/images/check-large.png" alt=" " style="display: block; margin: 15px auto;" />');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   896
        $('#theme-selector-inner').append('<h3>' + $lang.get('ajax_thmsel_msg_success') + '</h3>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   897
        $('#theme-selector-inner').append('<div style="padding-top: 20px;"><a class="abutton abutton_green" style="font-size: larger;" href="#" onclick="window.location.reload(); return false;">' + $lang.get('ajax_thmsel_btn_reload') + '</a></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   898
        $('#theme-selector-inner').append('<div style="padding-top: 25px;"><a href="#" style="font-size: smaller;" onclick="ajaxChangeStyleClose(); return false;">' + $lang.get('ajax_thmsel_btn_close') + '</a><br /><small>' + $lang.get('ajax_thmsel_btn_close_hint') + '</small></div>');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   899
        $('#theme-selector-inner').fadeIn();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   900
      });
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
   901
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   902
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   903
window.ajaxChangeStyleClose = 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
   904
{
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   905
  setTimeout(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
   906
    {
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   907
      enlighten(false, 'theme-selector-shade');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   908
      $('#theme-selector-wrapper').fadeOut(500, 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
   909
        {
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   910
          $(this).remove();
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   911
        });
889
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   912
    }, ( aclDisableTransitionFX ? 0 : 300));
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   913
  if ( !aclDisableTransitionFX )
7e933a5c860b Made aclDisableTransitionFX also switch on jQuery.fx.off; made theme switcher work with said jQuery switch
Dan
parents: 881
diff changeset
   914
    opacity('theme-selector-inner', 100, 0, 250);
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
   915
}
e5484a9e0818 Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents: 28
diff changeset
   916
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   917
function themeid_to_title(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
   918
{
870
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   919
  if ( typeof(id) != 'string' )
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   920
    return false;
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   921
  id = id.substr(0, 1).toUpperCase() + id.substr(1);
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   922
  id = id.replace(/_/g, ' ');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   923
  id = id.replace(/-/g, ' ');
82bbfe3dc8a0 Swapped in a new theme selector.
Dan
parents: 869
diff changeset
   924
  return id;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   925
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   926
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   927
window.ajaxSetPassword = function()
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   928
{
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
   929
  // 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
   930
  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
   931
    return true;
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   932
  load_component('crypto');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   933
  pass = hex_sha1(document.getElementById('mdgPassSetField').value);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   934
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   935
  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function(ajax)
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   936
    {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   937
      unsetAjaxLoading();
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   938
      if ( ajax.readyState == 4 && ajax.status == 200 )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   939
      {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   940
        alert(ajax.responseText);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   941
      }
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
   942
    }, true);
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   943
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   944
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   945
window.ajaxDisableEmbeddedPHP = function()
11
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   946
{
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
   947
  // 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
   948
  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
   949
    return true;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   950
  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
   951
    return false;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   952
  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
   953
  if ( !$killdiv.object )
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   954
  {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   955
    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
   956
    return false;
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   957
  }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   958
  $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
   959
  var url = makeUrlNS('Admin', 'Home', 'src=ajax');
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   960
  ajaxPost(url, 'act=kill_php', function(ajax) {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   961
      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
   962
      {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   963
        if ( ajax.responseText == '1' )
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   964
        {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   965
          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
   966
          //$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
   967
          $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
   968
          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
   969
          // 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
   970
          newdiv.className = $killdiv.object.className;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
   971
          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
   972
          $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
   973
          $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
   974
        }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   975
        else
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   976
        {
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   977
          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
   978
          $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
   979
        }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   980
      }
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   981
    });
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   982
}
ccad6026a168 Finalized permissions on files and directories; adding PHP shutoff button (actual shutoff not implemented)
Dan
parents: 1
diff changeset
   983
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   984
var catHTMLBuf = false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   985
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
   986
window.ajaxCatToTag = function()
76
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
  if ( KILL_SWITCH )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   989
    return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   990
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
   991
  ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function(ajax)
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   992
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
   993
      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
   994
      {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   995
        unsetAjaxLoading();
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   996
        var resptext = String(ajax.responseText + ' ');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   997
        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
   998
        if ( resptext.substr(0, 1) != '{' )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
   999
        {
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
  1000
          handle_invalid_json(resptext);
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1001
          return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1002
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1003
        var json = parseJSON(resptext);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1004
        var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1005
        if ( !catbox )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1006
          return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1007
        var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1008
        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
  1009
        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
  1010
        catHTMLBuf = catbox.innerHTML;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1011
        catbox.innerHTML = '';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1012
        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
  1013
        if ( json.tags.length < 1 )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1014
        {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1015
          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
  1016
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1017
        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
  1018
        {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1019
          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
  1020
          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
  1021
          {
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1022
            catbox.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1023
            var a = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1024
            a.appendChild(document.createTextNode('[X]'));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1025
            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
  1026
            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
  1027
            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
  1028
            catbox.appendChild(a);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1029
          }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1030
          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
  1031
            catbox.appendChild(document.createTextNode(', '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1032
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1033
        if ( json.can_add )
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
          catbox.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1036
          var addlink = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1037
          addlink.href = '#';
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1038
          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
  1039
          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
  1040
          catbox.appendChild(addlink);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1041
        }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1042
      }
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1043
    });
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1044
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1045
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
  1046
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
  1047
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1048
window.ajaxAddTagStage1 = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1049
{
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
  1050
  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
  1051
    return false;
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1052
  var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1053
  var adddiv = document.createElement('div');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1054
  var text = document.createElement('input');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1055
  var addlink = document.createElement('a');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1056
  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
  1057
  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
  1058
  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
  1059
  text.type = 'text';
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1060
  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
  1061
  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
  1062
  {
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
    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
  1064
    {
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
      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
  1066
    }
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
  }
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1068
  
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1069
  adddiv.style.margin = '5px 0 0 0';
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1070
  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
  1071
  adddiv.appendChild(text);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1072
  adddiv.appendChild(document.createTextNode(' '));
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1073
  adddiv.appendChild(addlink);
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1074
  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
  1075
  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
  1076
}
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
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
  1078
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
  1079
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1080
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
  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
  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
  1083
    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
  1084
  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
  1085
    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
  1086
  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
  1087
  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
  1088
  setAjaxLoading();
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
  1089
  ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function(ajax)
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
  1090
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1091
      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
  1092
      {
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
        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
  1094
        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
  1095
        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
  1096
        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
  1097
        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
  1098
        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
  1099
        {
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
  1100
          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
  1101
          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
  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
        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
  1104
        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
  1105
        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
  1106
        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
  1107
        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
  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
          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
  1110
          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
  1111
          var nukeafter = false;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1112
          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
  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
            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
  1115
          }
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
          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
  1117
          // 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
  1118
          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
  1119
          {
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
            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
  1121
            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
  1122
            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
  1123
            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
  1124
            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
  1125
            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
  1126
            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
  1127
          }
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
          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
  1129
          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
  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
            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
  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
          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
  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
            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
  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
        }
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
        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
  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
          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
  1141
        }
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
  1142
      }
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
    });
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
}
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1146
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
  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
  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
  1149
  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
  1150
  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
  1151
  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
  1152
    arrDelete.push(parentobj.previousSibling.previousSibling.previousSibling);
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1153
  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
  1154
    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
  1155
  
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1156
  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
  1157
       parentobj.nextSibling.nextSibling.firstChild )
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1158
    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
  1159
      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
  1160
    
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
  1161
  ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function(ajax)
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
  1162
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1163
      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
  1164
      {
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
  1165
        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
  1166
        {
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
  1167
          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
  1168
          {
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
  1169
            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
  1170
            {
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
  1171
              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
  1172
            } 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
  1173
          }
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
  1174
          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
  1175
          {
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1176
            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
  1177
            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
  1178
            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
  1179
            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
  1180
          }
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
  1181
        }
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
  1182
        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
  1183
        {
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
  1184
          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
  1185
        }
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
  1186
      }
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
  1187
    });
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1188
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1189
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1190
window.ajaxTagToCat = function()
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1191
{
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1192
  if ( !catHTMLBuf )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1193
    return false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1194
  var catbox = document.getElementById('mdgCatBox');
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1195
  if ( !catbox )
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1196
    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
  1197
  addtag_open = false;
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1198
  var linkbox = catbox.parentNode.firstChild.firstChild.nextSibling;
214
a6ed8b6cdbe1 All on-page AJAX applets should be localized now
Dan
parents: 213
diff changeset
  1199
  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
  1200
  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
  1201
  catbox.innerHTML = catHTMLBuf;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1202
  catHTMLBuf = false;
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1203
}
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 60
diff changeset
  1204
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
  1205
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
  1206
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1207
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
  1208
{
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
  1209
  ajaxGet(stdAjaxPrefix + '&_mode=ping', function(ajax)
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
  1210
    {
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
}
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
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1214
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
  1215
{
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
  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
  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
    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
  1219
    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
  1220
      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
  1221
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1222
    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
  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
  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
  1225
  {
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
  1226
    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
  1227
    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
  1228
      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
  1229
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1230
    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
  1231
    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
  1232
  }
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
  1233
}
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
  1234
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
  1235
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
  1236
{
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
  1237
  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
  1238
  {
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
  1239
    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
  1240
      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
  1241
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1242
    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
  1243
  }
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
  1244
  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
  1245
  {
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
  1246
    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
  1247
      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
  1248
    var span = document.getElementById('keepalivestat');
211
753dabeca1ee Completely localized admin tree menu and page toolbar
Dan
parents: 209
diff changeset
  1249
    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
  1250
  }
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
  1251
};
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
  1252
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1253
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
  1254
{
779
609e35845ec3 load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents: 699
diff changeset
  1255
  load_component(['messagebox', 'flyin', 'fadefilter']);
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
  1256
  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
  1257
}
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
  1258
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1259
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
  1260
{
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
  1261
  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
  1262
  {
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
  1263
    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
  1264
  }
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
  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
  1266
  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
  1267
  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
  1268
  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
  1269
  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
  1270
  target.appendChild(img);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
  1271
  ajaxGet(makeUrlNS('Admin', 'Home/updates.xml'), function(ajax)
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
  1272
    {
407
35d94240a197 Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents: 343
diff changeset
  1273
      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
  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
        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
  1276
        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
  1277
        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
  1278
        {
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
          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
  1280
          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
  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
        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
  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
          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
  1285
          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
  1286
          {
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
            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
  1288
            {
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
              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
  1290
            }
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
            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
  1292
            {
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
              // 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
  1294
              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
  1295
              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
  1296
              {
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
  1297
                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
  1298
                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
  1299
                {
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
                  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
  1301
                  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
  1302
                  {
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
  1303
                    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
  1304
                  }
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
                  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
  1306
                }
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
                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
  1308
                {
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
                  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
  1310
                }
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
              }
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
              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
  1313
            }
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
  1314
          }
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
  1315
        }
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
  1316
        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
  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
          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
  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 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
  1321
        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
  1322
        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
  1323
        {
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
          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
  1325
        }
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
        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
  1327
        {
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
          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
  1329
          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
  1330
          {
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
            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
  1332
            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
  1333
            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
  1334
            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
  1335
            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
  1336
            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
  1337
          }
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
          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
  1339
          {
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
            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
  1341
            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
  1342
            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
  1343
            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
  1344
            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
  1345
            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
  1346
          }
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
          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
  1348
          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
  1349
          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
  1350
          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
  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 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
  1353
          
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 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
  1355
          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
  1356
          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
  1357
          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
  1358
          
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
          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
  1360
          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
  1361
          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
  1362
          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
  1363
          
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
          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
  1365
          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
  1366
          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
  1367
          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
  1368
            
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
          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
  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
          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
  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 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
  1374
          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
  1375
          {
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
            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
  1377
            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
  1378
              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
  1379
            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
  1380
              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
  1381
            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
  1382
              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
  1383
            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
  1384
            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
  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
            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
  1387
            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
  1388
            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
  1389
            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
  1390
            
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
            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
  1392
            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
  1393
            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
  1394
            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
  1395
            
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
  1396
            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
  1397
              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
  1398
            
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
  1399
            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
  1400
              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
  1401
            
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
  1402
            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
  1403
              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
  1404
            
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
  1405
            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
  1406
            {
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
  1407
              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
  1408
              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
  1409
              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
  1410
              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
  1411
            }
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
  1412
            
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
  1413
            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
  1414
            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
  1415
            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
  1416
            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
  1417
            
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
  1418
            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
  1419
          }
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
  1420
          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
  1421
        }
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
  1422
        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
  1423
        {
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
  1424
          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
  1425
        }
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
  1426
      }
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
  1427
    });
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
  1428
}
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
  1429
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1430
window.ajaxPluginAction = function(action, plugin_filename, btnobj, send_confirm)
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
  1431
{
560
8981dcf7d485 Added re-import function to plugin manager
Dan
parents: 555
diff changeset
  1432
  // if installing, uninstalling, or re-importing, confirm
8981dcf7d485 Added re-import function to plugin manager
Dan
parents: 555
diff changeset
  1433
  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
  1434
  {
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
    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
  1436
      {
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
        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
  1438
        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
  1439
        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
  1440
        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
  1441
        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
  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
        // 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
  1444
        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
  1445
        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
  1446
        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
  1447
        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
  1448
        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
  1449
        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
  1450
        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
  1451
        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
  1452
        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
  1453
        
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
        // 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
  1455
        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
  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
        // 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
  1458
        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
  1459
        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
  1460
        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
  1461
        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
  1462
        
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
        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
  1464
        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
  1465
        
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
        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
  1467
        {
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
  1468
          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
  1469
          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
  1470
          return false;
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1471
        };
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
  1472
        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
  1473
        {
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
  1474
          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
  1475
          return false;
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1476
        };
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
  1477
      });
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
  1478
    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
  1479
  }
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
  1480
  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
  1481
  // 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
  1482
  if ( btnobj )
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1483
  {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1484
    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
  1485
    var blackbox = whiteOutElement(td);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1486
  }
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1487
  var request = {
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
  1488
      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
  1489
      plugin: plugin_filename
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1490
    };
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1491
  if ( send_confirm )
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1492
  {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1493
    request.install_confirmed = true;
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1494
  }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1495
  request = toJSONString(request);
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
  1496
  ajaxPost(makeUrlNS('Admin', 'PluginManager/action.json'), 'r=' + ajaxEscape(request), function(ajax)
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
  1497
    {
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
  1498
      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
  1499
      {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1500
        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
  1501
        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
  1502
        {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1503
          handle_invalid_json(response);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1504
          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
  1505
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1506
        response = parseJSON(response);
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1507
        if ( blackbox )
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1508
        {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1509
          blackbox.parentNode.removeChild(blackbox);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1510
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1511
        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
  1512
        {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1513
          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
  1514
          return true;
869
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1515
        }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1516
        if ( response.need_confirm )
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1517
        {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1518
          miniPromptMessage({
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1519
              title: $lang.get(response.confirm_title),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1520
              message: $lang.get(response.confirm_body),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1521
              buttons: [
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1522
                {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1523
                  text: $lang.get('acppl_btn_install'),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1524
                  color: 'red',
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1525
                  style: {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1526
                    fontWeight: 'bold',
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1527
                  },
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1528
                  onclick: function() {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1529
                    ajaxPluginAction(action + '_confirm', plugin_filename, btnobj, true);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1530
                    miniPromptDestroy(this);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1531
                  }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1532
                },
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1533
                {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1534
                  text: $lang.get('etc_cancel'),
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1535
                  color: 'blue',
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1536
                  onclick: function() {
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1537
                    miniPromptDestroy(this);
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1538
                  }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1539
                }
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1540
              ]
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1541
            });
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1542
          return true;
58bc29c14a4d Plugins: Added checks and additional warning for authentication plugins.
Dan
parents: 823
diff changeset
  1543
        }
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1544
        // 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
  1545
        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
  1546
          {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1547
            miniPrompt(function(div)
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1548
              {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1549
                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
  1550
                {
527
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1551
                  blackbox.parentNode.removeChild(blackbox);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1552
                }
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1553
                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
  1554
                txtholder.style.textAlign = 'center';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1555
                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
  1556
                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
  1557
                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
  1558
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1559
                // close button
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1560
                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
  1561
                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
  1562
                btn_cancel.href = '#';
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1563
                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
  1564
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1565
                txtholder.appendChild(btn_cancel);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1566
                div.appendChild(txtholder);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1567
                
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1568
                btn_cancel.onclick = function()
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1569
                {
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1570
                  miniPromptDestroy(this);
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1571
                  return false;
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1572
                }
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1573
              });
21e11f564463 (Hopefully) finished new plugin manager and implemented the utilization of it. Still HIGHLY experimental.
Dan
parents: 526
diff changeset
  1574
          }, 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
  1575
      }
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
  1576
    });
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
  1577
}
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1578
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1579
window.ajaxReverseDNS = function(o, text)
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1580
{
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1581
  if(text) var ipaddr = text;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1582
  else var ipaddr = o.innerHTML;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1583
  rDnsObj = o;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1584
  rDnsBannerObj = bannerOn('Retrieving reverse DNS info...');
823
4596c40aaa94 AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
Dan
parents: 800
diff changeset
  1585
  ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function(ajax) {
582
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1586
      if ( ajax.readyState == 4 && ajax.status == 200 )
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1587
      {
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1588
        off = fetch_offset(rDnsObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1589
        dim = fetch_dimensions(rDnsObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1590
        right = off['left'] + dim['w'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1591
        top = off['top'] + dim['h'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1592
        var thediv = document.createElement('div');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1593
        thediv.className = 'info-box';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1594
        thediv.style.margin = '0';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1595
        thediv.style.position = 'absolute';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1596
        thediv.style.top  = top  + 'px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1597
        thediv.style.display = 'none';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1598
        thediv.style.zIndex = getHighestZ() + 2;
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1599
        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
  1600
        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
  1601
        var body = document.getElementsByTagName('body');
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1602
        body = body[0];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1603
        bannerOff(rDnsBannerObj);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1604
        body.appendChild(thediv);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1605
        thediv.style.display = 'block';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1606
        left = fetch_dimensions(thediv);
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1607
        thediv.style.display = 'none';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1608
        left = right - left['w'];
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1609
        thediv.style.left = left + 'px';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1610
        thediv.style.display = 'block';
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1611
        fadeInfoBoxes();
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1612
      }
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1613
    });
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1614
}
a38876c0793c Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents: 581
diff changeset
  1615